diff --git a/src/frontend/src/features/notifications/components/ToastRegion.tsx b/src/frontend/src/features/notifications/components/ToastRegion.tsx index 8351ab36..09ea4dad 100644 --- a/src/frontend/src/features/notifications/components/ToastRegion.tsx +++ b/src/frontend/src/features/notifications/components/ToastRegion.tsx @@ -1,5 +1,5 @@ import { AriaToastRegionProps, useToastRegion } from '@react-aria/toast' -import type { ToastState } from '@react-stately/toast' +import type { QueuedToast, ToastState } from '@react-stately/toast' import { Toast } from './Toast' import { useRef } from 'react' import { NotificationType } from '../NotificationType' @@ -14,31 +14,39 @@ interface ToastRegionProps extends AriaToastRegionProps { state: ToastState } +const renderToast = ( + toast: QueuedToast, + state: ToastState +) => { + switch (toast.content?.type) { + case NotificationType.ParticipantJoined: + return + + case NotificationType.HandRaised: + return + + case NotificationType.ParticipantMuted: + return + + case NotificationType.MessageReceived: + return ( + + ) + + case NotificationType.LowerHand: + return + + default: + return + } +} + export function ToastRegion({ state, ...props }: ToastRegionProps) { const ref = useRef(null) const { regionProps } = useToastRegion(props, state, ref) return (
- {state.visibleToasts.map((toast) => { - if (toast.content?.type === NotificationType.ParticipantJoined) { - return - } - if (toast.content?.type === NotificationType.HandRaised) { - return - } - if (toast.content?.type === NotificationType.ParticipantMuted) { - return - } - if (toast.content?.type === NotificationType.MessageReceived) { - return ( - - ) - } - if (toast.content?.type === NotificationType.LowerHand) { - return - } - return - })} + {state.visibleToasts.map((toast) => renderToast(toast, state))}
) }