mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 14:38:45 +00:00
initial working version
This commit is contained in:
1 parent
b87baeb12e
commit
956070951a
23 files changed
+260
-107
No files matched your search
@@ -1,32 +1,27 @@
|
||||
import { List, ListItem, ListItemText, ListItemAvatar, Avatar as MuiAvatar } from '@material-ui/core';
|
||||
import React from 'react'
|
||||
import { useConversation } from '../../hooks/useConversation';
|
||||
import { useFilter } from '../../hooks/useFilter';
|
||||
import { useMessageModal } from '../../hooks/useMessageModal';
|
||||
import { List, ListItem, ListItemText, ListItemAvatar, Avatar as MuiAvatar } from '@material-ui/core';
|
||||
|
||||
import { useMessages } from '../../hooks/useMessages';
|
||||
import useStyles from './list.styles';
|
||||
|
||||
const MessagesList = (): any => {
|
||||
const { setMessageModal } = useMessageModal()
|
||||
const { conversation } = useConversation();
|
||||
const { setMessageFilter } = useFilter();
|
||||
|
||||
const handleConversation = (convo) => {
|
||||
setMessageModal(true)
|
||||
setMessageFilter(convo)
|
||||
}
|
||||
|
||||
if (!conversation) return <p>loading</p>
|
||||
const classes = useStyles();
|
||||
const { messages, setActiveMessageGroupId } = useMessages();
|
||||
|
||||
return (
|
||||
<List>
|
||||
{conversation.map((convo) => (
|
||||
<ListItem divider button key={convo.name} onClick={() => handleConversation(convo)}>
|
||||
<List className={classes.root}>
|
||||
{messages.map((messageGroup) => (
|
||||
<ListItem
|
||||
key={messageGroup.channelId}
|
||||
onClick={() => setActiveMessageGroupId(messageGroup.channelId)}
|
||||
divider
|
||||
button
|
||||
>
|
||||
<ListItemAvatar>
|
||||
<MuiAvatar />
|
||||
</ListItemAvatar>
|
||||
<ListItemText>
|
||||
{convo.name}
|
||||
{messageGroup.channelDisplay}
|
||||
</ListItemText>
|
||||
</ListItem>
|
||||
))}
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import { makeStyles, fade } from '@material-ui/core';
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
root: {
|
||||
height: '100%',
|
||||
overflowY: 'auto',
|
||||
},
|
||||
bg: {
|
||||
display: "flex",
|
||||
height: 60,
|
||||
|
||||
Reference in new issue
Block a user