Skip to content

Commit

Permalink
Merge branch 'ref/omni' of github.com:RocketChat/Rocket.Chat into ref…
Browse files Browse the repository at this point in the history
…/omni-curr-chats
  • Loading branch information
ggazzo committed Aug 21, 2020
2 parents 07f2e89 + ab78f68 commit da8388b
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 7 deletions.
10 changes: 5 additions & 5 deletions client/components/basic/UserCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,16 @@ export const Action = ({ icon, label, ...props }) => (

export const Info = (props) => (
<Box
mb='x4'
mbe='x4'
is='span'
fontSize='p1'
fontScale='p1'
color='hint'
withTruncatedText
{...props}
/>
);

export const Username = ({ name, status = <Status.Offline/> }) => <Box display='flex' flexShrink={0} alignItems='center' fontScale='s2' color='default' withTruncatedText>
export const Username = ({ name, status = <Status.Offline/>, title }) => <Box display='flex' title={title} flexShrink={0} alignItems='center' fontScale='s2' color='default' withTruncatedText>
{status} <Box mis='x8' flexGrow={1} withTruncatedText>{name}</Box>
</Box>;

Expand Down Expand Up @@ -81,8 +80,9 @@ const UserCard = forwardRef(({
</Box>}
</Box>
<Box display='flex' flexDirection='column' flexGrow={1} flexShrink={1} mis='x24' width='1px'>
<Username status={status} name={name}/>
{nickname && <Info title={t('Nickname')}>{nickname}</Info>}
<Box withTruncatedText display='flex'>
<Username status={status} name={name} title={username !== name && username}/>{nickname && <Box title={t('Nickname')} color='hint' mis='x8' fontScale='p1' withTruncatedText>({ nickname })</Box> }
</Box>
{ customStatus && <Info>{customStatus}</Info> }
<Roles>{roles}</Roles>
<Info>{localTime}</Info>
Expand Down
7 changes: 6 additions & 1 deletion client/components/basic/UserCard.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ const user = {
localTime: 'Local Time: 7:44 AM',
};

const nickname = {
...user,
nickname: 'nicknamenickname',
};

const largeName = {
...user,
customStatus:
Expand Down Expand Up @@ -59,8 +64,8 @@ const noBioNoLocalTimeNoRoles = {


export const Basic = () => <UserCard {...user} />;
export const Nickname = () => <UserCard {...nickname} />;
export const LargeName = () => <UserCard {...largeName} />;

export const NoRoles = () => <UserCard {...noRoles} />;
export const NoActions = () => <UserCard {...noActions} />;
export const NoLocalTime = () => <UserCard {...noLocalTime} />;
Expand Down
7 changes: 6 additions & 1 deletion client/components/basic/UserInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const UserInfo = React.memo(function UserInfo({
{actions}

<Margins block='x4'>
<Username name={username} status={status} />
<UserCard.Username name={name || username} status={status} />
<Info>{customStatus}</Info>

{!!roles && <>
Expand All @@ -63,6 +63,11 @@ export const UserInfo = React.memo(function UserInfo({
<Info><UTCClock utcOffset={utcOffset}/></Info>
</>}

{username !== name && <>
<Label>{t('Username')}</Label>
<Info>{username}</Info>
</>}

<Label>{t('Last_login')}</Label>
<Info>{lastLogin ? timeAgo(lastLogin) : t('Never')}</Info>

Expand Down
6 changes: 6 additions & 0 deletions client/components/basic/UserInfo.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,10 @@ const user = {
},
};

const nickname = {
...user,
nickname: 'Nickname',
};

export const Default = () => <VerticalBar><UserInfo { ...user } /></VerticalBar>;
export const Nickname = () => <VerticalBar><UserInfo { ...nickname } /></VerticalBar>;

0 comments on commit da8388b

Please sign in to comment.