From e78fc46ead4cb3d077eb5e56ddc8ca559f6b477c Mon Sep 17 00:00:00 2001 From: Robert <> Date: Tue, 1 Oct 2024 13:01:19 +0200 Subject: [PATCH] have the prep status visible in the meeting drawer --- frontend/src/components/AppBar/AppBar.tsx | 2 +- .../MeetingsDrawer/MeetingsDrawer.tsx | 35 +++++++++++++------ .../container/MeetingNotes/MeetingNotes.tsx | 2 +- 3 files changed, 27 insertions(+), 12 deletions(-) diff --git a/frontend/src/components/AppBar/AppBar.tsx b/frontend/src/components/AppBar/AppBar.tsx index f556869..66b39a5 100644 --- a/frontend/src/components/AppBar/AppBar.tsx +++ b/frontend/src/components/AppBar/AppBar.tsx @@ -55,7 +55,7 @@ export const AppBar = ({ handleDrawerToggle, mobileOpen }) => { {mobileOpen ? : } - Meeting App + Prep Me up Before i GO GO
diff --git a/frontend/src/components/MeetingsDrawer/MeetingsDrawer.tsx b/frontend/src/components/MeetingsDrawer/MeetingsDrawer.tsx index b58867c..e708470 100644 --- a/frontend/src/components/MeetingsDrawer/MeetingsDrawer.tsx +++ b/frontend/src/components/MeetingsDrawer/MeetingsDrawer.tsx @@ -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': , + 'in_progress': , + 'todo': , + "unknown": , +} + +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') } @@ -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) @@ -43,6 +55,7 @@ const groupMeetingsByWeek = (meetings) => { grouped[weekNumber][dayName] = [] } grouped[weekNumber][dayName].push(meeting) + }) return grouped } @@ -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) : {} @@ -92,11 +106,12 @@ export const MeetingsDrawer = ({ {dayMeetings.map(meeting => ( - - - - + + + {statusIcon[meeting.status] ?? statusIcon.unknown} + + ))} diff --git a/frontend/src/container/MeetingNotes/MeetingNotes.tsx b/frontend/src/container/MeetingNotes/MeetingNotes.tsx index 4ca5e03..ae80d42 100644 --- a/frontend/src/container/MeetingNotes/MeetingNotes.tsx +++ b/frontend/src/container/MeetingNotes/MeetingNotes.tsx @@ -113,7 +113,7 @@ export default function MeetingNotes() { Agenda for {id} setHideDoneFlag(!hideDoneFlag)} - defaultChecked={!hideDoneFlag} + checked={!hideDoneFlag} >