feat(blocks): add Localized type support to full-guide blocks

Widens prose props on FleetDiagram, HandoffTable, PhasePanel, RouteTable, SkillPackage, and WorktreeMap to accept {en, pt} as well as string, and conditionally renders language spans. Non-prose props (id, code, etc) were left as strings.
This commit is contained in:
Marcos Paulo
2026-09-05 21:59:29 +00:00
parent a5d9630dd8
commit cac1115035
6 changed files with 311 additions and 39 deletions
+28 -4
View File
@@ -6,15 +6,17 @@
// the `data-tree` hook asserted by `scripts/verify.mjs`. The `root` node and
// the `initial` branch are marked selected.
type Localized = { en: string; pt: string };
interface Branch {
/** The `data-tree` hook, e.g. "ui", "tests", "docs". */
id: string;
/** Uppercase label, e.g. "UI AGENT". */
label: string;
label: string | Localized;
/** Strong line, e.g. "agent/ui". */
strong: string;
/** Status small, e.g. "3 files · working". */
small: string;
small: string | Localized;
/** CSS modifier so each branch picks up its tone. */
tone: 'ui' | 'tests' | 'docs' | string;
}
@@ -50,9 +52,31 @@ const { branches, initial = 'main' } = Astro.props;
aria-selected={branch.id === initial}
>
<>
<span>{branch.label}</span>
<span>
{typeof branch.label === 'string' ? (
branch.label
) : (
<>
<span data-language-content="en">{branch.label.en}</span>
<span data-language-content="pt" hidden>
{branch.label.pt}
</span>
</>
)}
</span>
<strong>{branch.strong}</strong>
<small>{branch.small}</small>
<small>
{typeof branch.small === 'string' ? (
branch.small
) : (
<>
<span data-language-content="en">{branch.small.en}</span>
<span data-language-content="pt" hidden>
{branch.small.pt}
</span>
</>
)}
</small>
</>
</button>
))