fix(editor): plurals, trimmed names, default tab, parent drawing confirmation

This commit is contained in:
bchanot committed 2026-11-04 19:40:43 +01:00
1 parent b42c6ae844
commit be4f468790
35 files changed
+385 -63

No files matched your search

@@ -60,6 +60,7 @@ function NameFields(props: Props) {
value={annotation.name?.[locale] ?? ''}
onCommit={rename(locale)}
readOnly={readOnly}
trim
error={edit.fieldError(locale)}
/>
))}
@@ -12,6 +12,7 @@ import {
type EditableGeometry,
type GroupFields,
} from '@/editor/annotations/geometryEdit'
import { usePlural } from '@/editor/plural'
import { useT } from '@/i18n/useT'
/** What applying the group answers: kept, or the words that say why not. */
@@ -208,7 +209,6 @@ function CircleRows(props: RowsProps<Extract<Fields, { type: 'circle' }>>) {
}
function PolygonRows(props: RowsProps<PolygonFields>) {
const t = useT()
const [selected, setSelected] = useState(0)
const { fields } = props
const change = (index: number, axis: 'x' | 'y', value: string) =>
@@ -218,11 +218,11 @@ function PolygonRows(props: RowsProps<PolygonFields>) {
i === index ? { ...row, [axis]: value } : row,
),
})
const count = String(fields.rows.length)
const plural = usePlural()
return (
<div className="space-y-2">
<p className="text-sm text-[var(--color-ink-muted)]">
{t('editor.annotations.geometry.vertices').replace('{count}', count)}
{plural('editor.annotations.geometry.vertices', fields.rows.length)}
</p>
{fields.rows.map((row, index) => (
<VertexRow
@@ -1,4 +1,5 @@
import Button from '@/components/ui/Button'
import { usePlural } from '@/editor/plural'
import { useT } from '@/i18n/useT'
/** While a zone or link is being traced: close (3 vertices at least) or drop it. */
@@ -12,10 +13,11 @@ export default function TracingBar({
onCancel: () => void
}) {
const t = useT()
const plural = usePlural()
return (
<div className="flex flex-wrap items-center gap-2">
<p className="text-sm text-[var(--color-ink-muted)]">
{t('editor.annotations.tracing').replace('{count}', String(count))}
{plural('editor.annotations.tracing', count)}
</p>
<Button type="button" size="sm" disabled={count < 3} onClick={onClose}>
{t('editor.annotations.trace_close')}