1- import { layoutStore } from '@/stores/layout'
21import { css } from '@/styled-system/css'
32import { Heading } from 'react-aria-components'
43import { text } from '@/primitives/Text'
54import { Button , Div } from '@/primitives'
65import { RiArrowLeftLine , RiCloseLine } from '@remixicon/react'
76import { useTranslation } from 'react-i18next'
87import { ParticipantsList } from './controls/Participants/ParticipantsList'
9- import { useSidePanel } from '../hooks/useSidePanel'
8+ import { type SidePanelStore , useSidePanel } from '../hooks/useSidePanel'
109import { ReactNode } from 'react'
1110import { Chat } from '../prefabs/Chat'
1211import { Effects } from './effects/Effects'
@@ -144,7 +143,7 @@ const Panel = ({ isOpen, keepAlive = false, children }: PanelProps) => (
144143 { keepAlive || isOpen ? children : null }
145144 </ div >
146145)
147- export const SidePanel = ( ) => {
146+ export const SidePanel = ( { store } : { store ?: SidePanelStore } ) => {
148147 const {
149148 activePanelId,
150149 isParticipantsOpen,
@@ -156,7 +155,9 @@ export const SidePanel = () => {
156155 isInfoOpen,
157156 isSubPanelOpen,
158157 activeSubPanelId,
159- } = useSidePanel ( )
158+ closePanel,
159+ goBack,
160+ } = useSidePanel ( store )
160161 const { t } = useTranslation ( 'rooms' , { keyPrefix : 'sidePanel' } )
161162 const title = t ( `heading.${ activeSubPanelId || activePanelId } ` )
162163
@@ -166,18 +167,15 @@ export const SidePanel = () => {
166167 < StyledSidePanel
167168 title = { title }
168169 ariaLabel = { t ( 'ariaLabel' , { title } ) }
169- onClose = { ( ) => {
170- layoutStore . activePanelId = null
171- layoutStore . activeSubPanelId = null
172- } }
170+ onClose = { closePanel }
173171 closeButtonTooltip = { t ( 'closeButton' , {
174172 content : t ( `content.${ activeSubPanelId || activePanelId } ` ) ,
175173 } ) }
176174 isClosed = { ! isSidePanelOpen }
177175 isSubmenu = { isSubPanelOpen }
178176 isReactionToolbarOpen = { isReactionToolbarOpen }
179177 backButtonLabel = { t ( 'backToTools' ) }
180- onBack = { ( ) => ( layoutStore . activeSubPanelId = null ) }
178+ onBack = { goBack }
181179 >
182180 < Panel isOpen = { isParticipantsOpen } >
183181 < ParticipantsList />
0 commit comments