diff --git a/src/frontend/src/features/rooms/livekit/components/controls/ChatToggle.tsx b/src/frontend/src/features/rooms/livekit/components/controls/ChatToggle.tsx index 3b56a141..83f249f1 100644 --- a/src/frontend/src/features/rooms/livekit/components/controls/ChatToggle.tsx +++ b/src/frontend/src/features/rooms/livekit/components/controls/ChatToggle.tsx @@ -2,18 +2,13 @@ import { useTranslation } from 'react-i18next' import { RiChat1Line } from '@remixicon/react' import { ToggleButton } from '@/primitives' import { css } from '@/styled-system/css' -import { useLayoutContext } from '@livekit/components-react' -import { useSnapshot } from 'valtio' -import { participantsStore } from '@/stores/participants' +import { useWidgetInteraction } from '../../hooks/useWidgetInteraction' export const ChatToggle = () => { const { t } = useTranslation('rooms') - const { dispatch, state } = useLayoutContext().widget - const tooltipLabel = state?.showChat ? 'open' : 'closed' - - const participantsSnap = useSnapshot(participantsStore) - const showParticipants = participantsSnap.showParticipants + const { isChatOpen, unreadMessages, toggleChat } = useWidgetInteraction() + const tooltipLabel = isChatOpen ? 'open' : 'closed' return (