Files
faunosteo/apps/app/src/components/editor/EditorGlyph.tsx
T
bchanot ebcf2723a0 fix(editor): overview rows ask first, no empty save, board 31 icons
U2 Task 6 review by self:

- The overview stays shown during a selection (A3): its rows and view
  rows now go through the drawing guard, so a started move or redraw
  asks before a click there drops it (R-12). Was a regression: the
  column was unreachable while selected before Task 6.
- The edit form compares and merges trimmed names and colour: a space
  typed alone is no change and writes no `update`.
- A layer opened with no opener (reload, Forward) returns the focus
  to its row on close.
- Board 31 A: icons on « Modifier », « Modifier la forme » (the
  shape's glyph), « Marquer comme relu »; « Supprimer » as red text
  with its trash icon.
- Tests: overview row and view row ask during a started move; a row
  asks during a started redraw; whitespace-only save; unnamed link
  read rows; focus back to the row with no opener. Dead helpers
  removed (tests/helpers openProperties, e2e propertiesDialog).

Mapping: the point-edit « Enter on the selected row … asks first »
test (which replaced « Toutes les annotations asks first ») keeps its
place; the overview-row path it did not cover now has its own test.
2026-11-17 22:17:20 +01:00

64 lines
1.6 KiB
TypeScript

export type GlyphName =
| 'select'
| 'point'
| 'zone'
| 'link'
| 'in'
| 'out'
| 'fit'
| 'undo'
| 'redo'
| 'search'
| 'deselect'
| 'move'
| 'properties'
| 'edit'
| 'check'
| 'trash'
/** The editor's one glyph table (24-unit grid strokes); `book` and `close` are in `Icon`. */
const GLYPHS: Record<GlyphName, string> = {
select: 'M5 3l12 7-5 1-3 5z',
point: 'M12 8a4 4 0 1 0 0 8 4 4 0 0 0 0-8zM12 3v3M12 18v3M3 12h3M18 12h3',
zone: 'M12 3l8 6-3 10H7L4 9z',
link: 'M4 4h8v8H4zM12 12h8v8h-8z',
in: 'M11 5v12M5 11h12M20 20l-4-4',
out: 'M5 11h12M20 20l-4-4',
fit: 'M4 9V4h5M20 9V4h-5M4 15v5h5M20 15v5h-5',
undo: 'M9 7L4 12l5 5M4 12h11a5 5 0 0 1 0 10',
redo: 'M15 7l5 5-5 5M20 12H9a5 5 0 0 0 0 10',
search: 'M11 4a7 7 0 1 0 0 14 7 7 0 0 0 0-14zM20 20l-4-4',
move: 'M12 3v18M3 12h18M9 6l3-3 3 3M9 18l3 3 3-3M6 9l-3 3 3 3M18 9l3 3-3 3',
properties: 'M7 3h7l4 4v14H7zM14 3v4h4M10 12h5M10 16h5',
edit: 'M4 20h4L19 9l-4-4L4 16zM14 6l4 4',
check: 'M5 12l5 5L19 7',
trash: 'M5 7h14M10 7V4h4v3M7 7l1 13h8l1-13',
deselect:
'M4 8V5a1 1 0 0 1 1-1h3M16 4h3a1 1 0 0 1 1 1v3M20 16v3a1 1 0 0 1-1 1h-3M8 20H5a1 1 0 0 1-1-1v-3M9 9l6 6M15 9l-6 6',
}
/** A decorative glyph of the editor, drawn in the current text colour. */
export default function EditorGlyph({
name,
size = 20,
}: {
name: GlyphName
size?: number
}) {
return (
<svg
viewBox="0 0 24 24"
width={size}
height={size}
fill="none"
stroke="currentColor"
strokeWidth="1.8"
strokeLinecap="round"
strokeLinejoin="round"
aria-hidden="true"
>
<path d={GLYPHS[name]} />
</svg>
)
}