* inital migration with a couple lingering concerns
* move is stream ready back
* put htmlRef back in useStore
* final tidy of useStore
* test tweaks
* tweak more
* more test tweaks
* fmt
* test tweaks
* attempts at fixing 'Basic default modeling and sketch hotkeys work'
* more tries
* 😭
* try again
* fmt
59 lines
1.5 KiB
TypeScript
59 lines
1.5 KiB
TypeScript
import styles from './ModelingPane.module.css'
|
|
import { useSettingsAuthContext } from 'hooks/useSettingsAuthContext'
|
|
import { useModelingContext } from 'hooks/useModelingContext'
|
|
|
|
export interface ModelingPaneProps
|
|
extends React.PropsWithChildren,
|
|
React.HTMLAttributes<HTMLDivElement> {
|
|
title: string
|
|
Menu?: React.ReactNode | React.FC
|
|
detailsTestId?: string
|
|
}
|
|
|
|
export const ModelingPaneHeader = ({
|
|
title,
|
|
Menu,
|
|
}: Pick<ModelingPaneProps, 'title' | 'Menu'>) => {
|
|
return (
|
|
<div className={styles.header}>
|
|
<div className="flex gap-2 items-center flex-1">{title}</div>
|
|
{Menu instanceof Function ? <Menu /> : Menu}
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export const ModelingPane = ({
|
|
title,
|
|
id,
|
|
children,
|
|
className,
|
|
Menu,
|
|
detailsTestId,
|
|
...props
|
|
}: ModelingPaneProps) => {
|
|
const { settings } = useSettingsAuthContext()
|
|
const onboardingStatus = settings.context.app.onboardingStatus
|
|
const { context } = useModelingContext()
|
|
const pointerEventsCssClass =
|
|
context.store?.buttonDownInStream || onboardingStatus.current === 'camera'
|
|
? 'pointer-events-none '
|
|
: 'pointer-events-auto '
|
|
return (
|
|
<section
|
|
{...props}
|
|
data-testid={detailsTestId}
|
|
id={id}
|
|
className={
|
|
'group-focus-within:border-primary dark:group-focus-within:border-chalkboard-50 ' +
|
|
pointerEventsCssClass +
|
|
styles.panel +
|
|
' group ' +
|
|
(className || '')
|
|
}
|
|
>
|
|
<ModelingPaneHeader title={title} Menu={Menu} />
|
|
<div className="relative w-full">{children}</div>
|
|
</section>
|
|
)
|
|
}
|