import {
Dialog,
DialogContent,
DialogTitle,
IconButton,
Typography,
} from '@mui/material'
import { widgetStoreActions } from '../../stores/widget-store'
import { useWidgetSelector } from '../../stores/use-widget-selector'
import { Close, FullscreenOutlined } from '@mui/icons-material'
import type {
FullScreenConfig,
FullScreenProps,
FullScreenState,
} from './types'
import { styles } from './styles'
const EMPTY_DIALOG_CONTENT_PROPS: NonNullable<
FullScreenProps['DialogContentProps']
> = {}
/**
* Displays widget content in a fullscreen modal dialog.
*
* Manages fullscreen state via the widget store and renders a MUI Dialog
* with the widget title and a close button.
*
* @example
* ```tsx
*
*
*
* ```
*/
export function FullScreen({
id,
labels,
children,
Icon,
IconButtonProps,
DialogContentProps: {
sx,
...DialogContentProps
} = EMPTY_DIALOG_CONTENT_PROPS,
DialogProps,
}: FullScreenProps) {
const { isFullScreen, title } = useWidgetSelector(id, (w) => ({
isFullScreen: (w as FullScreenState | undefined)?.isFullScreen,
title: (w as FullScreenState | undefined)?.title,
}))
const updateFullScreenConfig = (updates: Partial) => {
widgetStoreActions.setWidget(id, {
isFullScreen: updates.isFullScreen,
})
}
return (
<>
updateFullScreenConfig({ isFullScreen: true })}
>
{Icon ?? }
>
)
}