import React from 'react'; import Box from '@mui/material/Box'; import List from '@mui/material/List'; import ListItem from '@mui/material/ListItem'; import ListItemButton from '@mui/material/ListItemButton'; import ListItemIcon from '@mui/material/ListItemIcon'; import ListItemText from '@mui/material/ListItemText'; import Avatar from '@mui/material/Avatar'; import Badge from '@mui/material/Badge'; import { useChat } from '../../contexts/ChatContext'; const ChatRoomList: React.FC = () => { const { rooms, selectedRoomToken, selectRoom } = useChat(); return ( {rooms.map((room) => { const isSelected = room.token === selectedRoomToken; return ( selectRoom(room.token)} sx={{ py: 1, px: 1.5, '&.Mui-selected': { backgroundColor: 'primary.light', color: 'primary.contrastText', '&:hover': { backgroundColor: 'primary.main', }, '& .MuiListItemIcon-root': { color: 'primary.contrastText', }, '& .MuiListItemText-secondary': { color: 'primary.contrastText', opacity: 0.7, }, }, }} > {room.displayName.substring(0, 2).toUpperCase()} ); })} ); }; export default ChatRoomList;