Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…ckathon

* 'main' of https://github.com/lukas-holzner/codefusion-hackathon:
  have the prep status visible in the meeting drawer
  • Loading branch information
vorasudh committed Oct 1, 2024
2 parents 217907d + 9843170 commit 2afff37
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 12 deletions.
2 changes: 1 addition & 1 deletion frontend/src/components/AppBar/AppBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export const AppBar = ({ handleDrawerToggle, mobileOpen }) => {
{mobileOpen ? <CloseIcon /> : <MenuIcon />}
</IconButton>
<Typography variant="h6" noWrap component="div">
Meeting App
Prep Me up Before i GO GO
</Typography>
<div className='UserSelector'>
<FormControl fullWidth>
Expand Down
35 changes: 25 additions & 10 deletions frontend/src/components/MeetingsDrawer/MeetingsDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,23 @@ import {
Typography,
} from '@mui/material'
import HomeIcon from '@mui/icons-material/Home'
import MeetingRoomIcon from '@mui/icons-material/MeetingRoom'
import CheckCircleOutlineIcon from '@mui/icons-material/CheckCircleOutline'
import PauseCircleOutlineIcon from '@mui/icons-material/PauseCircleOutline'
import PlayCircleOutlineIcon from '@mui/icons-material/PlayCircleOutline'
import HelpOutlineIcon from '@mui/icons-material/HelpOutline'
import { useUser } from '../../utils/userProvider';

import './MeetingsDrawer.css'

const fetchMeetings = async () => {
const response = await fetch('https://codefusion.lholz.de/meetings/?skip=0&limit=100')
const statusIcon = {
'done': <CheckCircleOutlineIcon />,
'in_progress': <PauseCircleOutlineIcon />,
'todo': <PlayCircleOutlineIcon />,
"unknown": <HelpOutlineIcon />,
}

const fetchMeetings = async (userId) => {
const response = await fetch(`https://codefusion.lholz.de/meetings/by_user/${userId}?skip=0&limit=100`)
if (!response.ok) {
throw new Error('Failed to fetch meetings')
}
Expand All @@ -31,7 +42,8 @@ const fetchMeetings = async () => {

const groupMeetingsByWeek = (meetings) => {
const grouped = {}
meetings.forEach(meeting => {
meetings.forEach((item) => {
const meeting = { ...item.meeting, status: item.conversation_status }
const date = new Date(meeting.date)
const weekNumber = getWeekNumber(date)
const dayName = getDayName(date)
Expand All @@ -43,6 +55,7 @@ const groupMeetingsByWeek = (meetings) => {
grouped[weekNumber][dayName] = []
}
grouped[weekNumber][dayName].push(meeting)

})
return grouped
}
Expand All @@ -66,9 +79,10 @@ export const MeetingsDrawer = ({
handleDrawerToggle,
drawerWidth,
}) => {
const activeUser = useUser()
const { data: meetings, isLoading, isError } = useQuery({
queryKey: ['meetings'],
queryFn: fetchMeetings,
queryKey: ['meetings', activeUser.userId],
queryFn: () => fetchMeetings(activeUser.userId),
})

const groupedMeetings = meetings ? groupMeetingsByWeek(meetings) : {}
Expand All @@ -92,11 +106,12 @@ export const MeetingsDrawer = ({
</ListItem>
{dayMeetings.map(meeting => (
<ListItem disablePadding key={meeting.id}>
<ListItemButton component={Link} to={`/meeting/${meeting.id}`} sx={{paddingLeft: '32px'}}>
<ListItemIcon sx={{minWidth: '32px'}}>
<MeetingRoomIcon />
</ListItemIcon>
<ListItemButton component={Link} to={`/meeting/${meeting.id}`} sx={{ paddingLeft: '32px' }}>
<ListItemText primary={meeting.title} />
<ListItemIcon sx={{ minWidth: '32px' }}>
{statusIcon[meeting.status] ?? statusIcon.unknown}
</ListItemIcon>

</ListItemButton>
</ListItem>
))}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/container/MeetingNotes/MeetingNotes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export default function MeetingNotes() {
Agenda for {id}
<Switch
onChange={() => setHideDoneFlag(!hideDoneFlag)}
defaultChecked={!hideDoneFlag}
checked={!hideDoneFlag}
></Switch>
</Typography>

Expand Down

0 comments on commit 2afff37

Please sign in to comment.