-
Notifications
You must be signed in to change notification settings - Fork 811
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(flat-components): users panel (#1801)
- Loading branch information
Showing
37 changed files
with
1,222 additions
and
158 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 8 additions & 44 deletions
52
packages/flat-components/src/components/ChatPanel/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
packages/flat-components/src/components/UsersPanel/UsersPanel.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import React from "react"; | ||
import { Meta, Story } from "@storybook/react"; | ||
import { UsersPanel, UsersPanelProps } from "./index"; | ||
import { User } from "../../types/user"; | ||
import faker from "faker"; | ||
import Chance from "chance"; | ||
|
||
const storyMeta: Meta = { | ||
title: "ChatPanel/UsersPanel", | ||
component: UsersPanel, | ||
}; | ||
|
||
export default storyMeta; | ||
|
||
const chance = new Chance(); | ||
const makeUser = (): User => ({ | ||
userUUID: faker.datatype.uuid(), | ||
name: faker.name.lastName(), | ||
isSpeak: faker.datatype.boolean(), | ||
wbOperate: faker.datatype.boolean(), | ||
isRaiseHand: faker.datatype.boolean(), | ||
avatar: "http://placekitten.com/64/64", | ||
}); | ||
const currentUser = makeUser(); | ||
const users = (() => { | ||
const users = Array(20).fill(0).map(makeUser); | ||
users.push(currentUser); | ||
return chance.shuffle(users); | ||
})(); | ||
|
||
export const Overview: Story<UsersPanelProps> = args => ( | ||
<div style={{ width: "80vw", height: "400px", overflow: "hidden", border: "1px solid green" }}> | ||
<UsersPanel {...args} /> | ||
</div> | ||
); | ||
const isCreator = chance.bool(); | ||
Overview.args = { | ||
ownerUUID: isCreator ? currentUser.userUUID : chance.pickone(users).userUUID, | ||
userUUID: currentUser.userUUID, | ||
users, | ||
getDeviceState: () => ({ | ||
camera: faker.datatype.boolean(), | ||
mic: faker.datatype.boolean(), | ||
}), | ||
getVolumeLevel: () => faker.datatype.number({ min: 0, max: 1, precision: 0.01 }), | ||
}; |
Oops, something went wrong.