40 lines
1.9 KiB
Markdown
40 lines
1.9 KiB
Markdown
# F-084 — Architect: Parent categories list does not show emoji in front of the name
|
|
|
|
## Root cause
|
|
|
|
`apps/admin/src/app/(dashboard)/categories/page.tsx`, in `CategoryRow`, the cell is rendered as:
|
|
|
|
```tsx
|
|
{cat.children && cat.children.length > 0 && <span className="text-gray-300">{cat.emoji ?? '📁'}</span>}
|
|
```
|
|
|
|
The emoji is gated on `cat.children.length > 0`. As soon as a parent has no children yet (e.g. immediately after creation, or when children get re-parented / archived) the emoji disappears. Editing the emoji later does not bring it back because the condition is structural, not value-driven.
|
|
|
|
Child categories never matched this branch, which the bug report cites as the "already-renders-correctly" baseline.
|
|
|
|
## Design
|
|
|
|
Drop the `cat.children.length > 0` gate. Render the emoji whenever it exists; show a neutral placeholder (greyed "·") when not. Apply to every category (parent or child) so behaviour is uniform.
|
|
|
|
```tsx
|
|
{cat.emoji ? (
|
|
<span className="text-xl">{cat.emoji}</span>
|
|
) : (
|
|
<span className="text-gray-300 text-xl select-none" aria-hidden="true">·</span>
|
|
)}
|
|
```
|
|
|
|
No backend change: emoji was already stored and returned by the categories API.
|
|
|
|
Re-editing the emoji from the form already calls `load()` after `handleSave`, so a refresh of the row is automatic. No stale state remains.
|
|
|
|
## Risk
|
|
|
|
Low. Render-only change; no schema, no API contract.
|
|
|
|
## Acceptance mapping
|
|
- "Every parent category row shows its emoji immediately before the name" → render is now unconditional.
|
|
- "Editing the emoji reflects on next refresh" → existing `load()` after save handles it.
|
|
- "Child categories keep their current rendering (no regression)" → children also get emoji + neutral placeholder; consistent.
|
|
- "Categories without emoji show a neutral placeholder instead of an empty space" → greyed `·` placeholder.
|
|
- "Emoji is stored and returned correctly by the API (sanitized, valid UTF-8)" → unchanged from before; no backend touch. |