import { useStore } from '@nanostores/react'; import { motion, type Variants } from 'framer-motion'; import { memo } from 'react'; import { IconButton } from '~/components/ui/IconButton'; import { workbenchStore } from '~/lib/stores/workbench'; import { classNames } from '~/utils/classNames'; import { cubicEasingFn } from '~/utils/easings'; import { renderLogger } from '~/utils/logger'; import { Preview } from './Preview'; import useViewport from '~/lib/hooks'; interface WorkspaceProps { chatStarted?: boolean; } const workbenchVariants = { closed: { width: 0, transition: { duration: 0.2, ease: cubicEasingFn, }, }, open: { width: 'var(--workbench-width)', transition: { duration: 0.2, ease: cubicEasingFn, }, }, } satisfies Variants; export const Workbench = memo(({ chatStarted }: WorkspaceProps) => { renderLogger.trace('Workbench'); const showWorkbench = useStore(workbenchStore.showWorkbench); const isSmallViewport = useViewport(1024); return ( chatStarted && (
{ workbenchStore.showWorkbench.set(false); }} />
) ); });