63 lines
1.7 KiB
TypeScript
63 lines
1.7 KiB
TypeScript
import Dialog from '@/components/ui/Dialog'
|
|
import Button from '@/components/ui/Button'
|
|
import type { LateralSide } from '@faunosteo/domain'
|
|
import { useT } from '@/i18n/useT'
|
|
|
|
export interface LateralityPickerProps {
|
|
open: boolean
|
|
onClose: () => void
|
|
onSelect: (sides: LateralSide[]) => void
|
|
title: string
|
|
existingSides: LateralSide[]
|
|
}
|
|
|
|
export default function LateralityPicker({
|
|
open,
|
|
onClose,
|
|
onSelect,
|
|
title,
|
|
existingSides,
|
|
}: LateralityPickerProps) {
|
|
const t = useT()
|
|
const hasLeft = existingSides.includes('left')
|
|
const hasRight = existingSides.includes('right')
|
|
|
|
return (
|
|
<Dialog open={open} onClose={onClose} title={title} size="sm">
|
|
<div className="space-y-4">
|
|
<p className="text-sm text-[var(--color-ink-muted)]">
|
|
{t('lateral.which_side')}
|
|
</p>
|
|
<div className="flex gap-3 justify-center">
|
|
<Button
|
|
variant={hasLeft ? 'ghost' : 'primary'}
|
|
disabled={hasLeft}
|
|
onClick={() => onSelect(['left'])}
|
|
>
|
|
{t('lateral.left')}
|
|
</Button>
|
|
<Button
|
|
variant={hasRight ? 'ghost' : 'primary'}
|
|
disabled={hasRight}
|
|
onClick={() => onSelect(['right'])}
|
|
>
|
|
{t('lateral.right')}
|
|
</Button>
|
|
<Button
|
|
variant={hasLeft && hasRight ? 'ghost' : 'primary'}
|
|
disabled={hasLeft && hasRight}
|
|
onClick={() => {
|
|
const sides: LateralSide[] = []
|
|
if (!hasLeft) sides.push('left')
|
|
if (!hasRight) sides.push('right')
|
|
onSelect(sides)
|
|
}}
|
|
>
|
|
{t('lateral.both')}
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
</Dialog>
|
|
)
|
|
}
|