feat(app): editor Annotations tab, core-decided placement, repair rules
This commit is contained in:
1 parent
92c595caa1
commit
26097852ff
37 files changed
+5001
-6
No files matched your search
@@ -0,0 +1,39 @@
|
||||
import Button from '@/components/ui/Button'
|
||||
import type { NewKind } from '@/editor/annotations/creation'
|
||||
import { useT } from '@/i18n/useT'
|
||||
|
||||
const KINDS: readonly NewKind[] = ['point', 'zone', 'detail_trigger']
|
||||
|
||||
/**
|
||||
* The keyboard creation path (C7): each button holds a pending element at the centre of
|
||||
* the frame and opens the creation panel; every coordinate is then typed in the fields.
|
||||
*/
|
||||
export default function KeyboardAdd({
|
||||
disabled,
|
||||
linkDisabled,
|
||||
onAdd,
|
||||
}: {
|
||||
/** No measured frame, or no category: nothing can be placed. */
|
||||
disabled: boolean
|
||||
/** No detail view directly under this view: no link can be placed. */
|
||||
linkDisabled: boolean
|
||||
onAdd: (kind: NewKind) => void
|
||||
}) {
|
||||
const t = useT()
|
||||
return (
|
||||
<div className="flex flex-wrap gap-2">
|
||||
{KINDS.map((kind) => (
|
||||
<Button
|
||||
key={kind}
|
||||
type="button"
|
||||
variant="secondary"
|
||||
size="sm"
|
||||
disabled={disabled || (kind === 'detail_trigger' && linkDisabled)}
|
||||
onClick={() => onAdd(kind)}
|
||||
>
|
||||
{t(`editor.annotations.add.${kind}`)}
|
||||
</Button>
|
||||
))}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user