(items: NavItem[])
| 96 | type Group = { title?: string; items: NavItem[] } |
| 97 | |
| 98 | const groupsOf = (items: NavItem[]): Group[] => { |
| 99 | const groups: Group[] = [{ items: [] }] |
| 100 | for (const item of items) { |
| 101 | if (item.kind === "separator") groups.push({ title: item.title, items: [] }) |
| 102 | else groups.at(-1)!.items.push(item) |
| 103 | } |
| 104 | return groups.filter(group => group.items.length) |
| 105 | } |
| 106 | |
| 107 | /** where a folder without a page of its own leads: its first page */ |
| 108 | const pageUrlOf = (item: NavItem): string | undefined => |