Skip to content

Commit

Permalink
Update yarn.lock
Browse files Browse the repository at this point in the history
  • Loading branch information
aerovulpe committed May 12, 2022
1 parent 9cfb459 commit 150fdff
Show file tree
Hide file tree
Showing 4 changed files with 11,600 additions and 13,188 deletions.
142 changes: 78 additions & 64 deletions src/fragments/MemberList.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import { User } from 'chatkitty';
import { User } from 'chatkitty';
import { ChatAppContext } from 'providers/ChatAppProvider';
import React, { useContext, useEffect, useState } from 'react';
import { Icon, Icons, StyledBox, useMediaQuery } from 'react-chat-ui-kit';
import {
Drawer,
Heading,
HeadingVariants,
} from 'react-chat-ui-kit';
import { Drawer, Heading, HeadingVariants } from 'react-chat-ui-kit';
import { ThemeContext } from 'styled-components';

import UserAvatar from './UserAvatar';
Expand All @@ -23,7 +19,9 @@ const MemberList: React.FC = () => {
if (!channel) {
return;
}
memberListGetter(channel).then(resolved => {setChannelMembers(resolved)});
memberListGetter(channel).then((resolved) => {
setChannelMembers(resolved);
});
});

return channel ? (
Expand All @@ -32,23 +30,29 @@ const MemberList: React.FC = () => {
background={theme.backgrounds.primary}
>
<div>
{channel?.name !== null && <Heading
variant={HeadingVariants.INVERSE}
style={{ fontSize: '25px', marginTop: '30px', marginLeft: '10px' }}
>
{channel?.name}
</Heading>}
{channel?.name !== null && (
<Heading
variant={HeadingVariants.INVERSE}
style={{ fontSize: '25px', marginTop: '30px', marginLeft: '10px' }}
>
{channel?.name}
</Heading>
)}
</div>

<div>
{channel?.creator != null &&
{channel?.creator != null && (
<div>
<Heading
variant={HeadingVariants.INVERSE}
style={{ marginTop: '30px', marginLeft: '10px', marginBottom: '15px' }}
style={{
marginTop: '30px',
marginLeft: '10px',
marginBottom: '15px',
}}
>
Owner
</Heading>
</Heading>
<StyledBox>
<UserAvatar
user={channel?.creator}
Expand All @@ -61,24 +65,30 @@ const MemberList: React.FC = () => {
/>
<Icon
icon={Icons.Presence}
title={channel.creator.presence.online ? 'Connected' : 'Not connected'}
title={
channel.creator.presence.online
? 'Connected'
: 'Not connected'
}
color={channel.creator.presence.online ? 'success' : 'inactive'}
style={{
display: 'inline',
}}
/>
<p style={{
display: 'inline',
marginLeft: '10px',
width: '100px',
color: 'yellow',
verticalAlign: '10px',
}}>
<p
style={{
display: 'inline',
marginLeft: '10px',
width: '100px',
color: 'yellow',
verticalAlign: '10px',
}}
>
{channel.creator.displayName}
</p>
</StyledBox>
</div>
}
)}
</div>

<Heading
Expand All @@ -87,52 +97,56 @@ const MemberList: React.FC = () => {
>
Channel Members
</Heading>
<StyledBox style={{marginTop: '15px'}}>
{channelMembers?.map((user) =>
<StyledBox key={user.id} >
{user.name !== channel?.creator?.name && <div>
<UserAvatar
user={user}
style={{
borderRadius: '50%',
width: '25px',
marginLeft: '10px',
marginTop: '5px',
}}
/>
<Icon
icon={Icons.Presence}
title={user.presence.online ? 'Connected' : 'Not connected'}
color={user.presence.online ? 'success' : 'inactive'}
style={{
display: 'inline',
}}
/>
<p style={{
display: 'inline',
marginLeft: '10px',
width: '100px',
color: 'white',
verticalAlign: '7px',
}}>
{user.displayName}
</p>
</div>}
<StyledBox style={{ marginTop: '15px' }}>
{channelMembers?.map((user) => (
<StyledBox key={user.id}>
{user.name !== channel?.creator?.name && (
<div>
<UserAvatar
user={user}
style={{
borderRadius: '50%',
width: '25px',
marginLeft: '10px',
marginTop: '5px',
}}
/>
<Icon
icon={Icons.Presence}
title={user.presence.online ? 'Connected' : 'Not connected'}
color={user.presence.online ? 'success' : 'inactive'}
style={{
display: 'inline',
}}
/>
<p
style={{
display: 'inline',
marginLeft: '10px',
width: '100px',
color: 'white',
verticalAlign: '7px',
}}
>
{user.displayName}
</p>
</div>
)}
</StyledBox>
)}
))}
</StyledBox>
</Drawer>
):(
) : (
<Drawer
open={layout.menu || isMedium}
background={theme.backgrounds.primary}
>
<Heading
variant={HeadingVariants.INVERSE}
style={{ fontSize: '20px', marginTop: '30px', marginLeft: '10px' }}
>
Please Select a Channel
</Heading>
variant={HeadingVariants.INVERSE}
style={{ fontSize: '20px', marginTop: '30px', marginLeft: '10px' }}
>
Please Select a Channel
</Heading>
</Drawer>
);
};
Expand Down
32 changes: 15 additions & 17 deletions src/fragments/UserAvatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,23 @@ import React from 'react';
import { StyledBox } from 'react-chat-ui-kit';

interface UserAvatarProp {
user: User;
style: React.CSSProperties | undefined;
user: User;
style: React.CSSProperties | undefined;
}

const UserAvatar: React.FC<UserAvatarProp> = ({
user,
style,
user,
style,
}: UserAvatarProp) => {
return (
<StyledBox
style={{
display: 'inline',
}}>
<img
src={user.displayPictureUrl}
style={style}
/>
</StyledBox>
)
}
return (
<StyledBox
style={{
display: 'inline',
}}
>
<img src={user.displayPictureUrl} style={style} />
</StyledBox>
);
};

export default UserAvatar;
export default UserAvatar;
6 changes: 2 additions & 4 deletions src/providers/ChatAppProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ interface ChatAppContext {
messagesPaginator: (
channel: Channel
) => Promise<ChatKittyPaginator<Message> | null>;
memberListGetter: (
Channel: Channel
) => Promise<User[] | null>;
memberListGetter: (Channel: Channel) => Promise<User[] | null>;
startChatSession: (
channel: Channel,
onReceivedMessage: (message: Message) => void,
Expand Down Expand Up @@ -349,7 +347,7 @@ const ChatAppContextProvider: React.FC<ChatAppContextProviderProps> = ({
return null;
};

const memberListGetter = async (channel: Channel) =>{
const memberListGetter = async (channel: Channel) => {
const result = await kitty.getChannelMembers({ channel: channel });

if (succeeded<GetUsersSucceededResult>(result)) {
Expand Down
Loading

0 comments on commit 150fdff

Please sign in to comment.