@purview-dev/pm-docs-site 0.0.0-stage → 0.1.0-pre.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/LICENSE.md +9 -0
  2. package/README.md +219 -2
  3. package/dist/cli.d.ts +2 -0
  4. package/dist/cli.js +90 -0
  5. package/dist/index.d.ts +7 -0
  6. package/dist/index.js +118 -0
  7. package/dist/options.d.ts +5 -0
  8. package/dist/options.js +46 -0
  9. package/dist/repo-docs.d.ts +33 -0
  10. package/dist/repo-docs.js +94 -0
  11. package/dist/schema-version.d.ts +10 -0
  12. package/dist/schema-version.js +19 -0
  13. package/dist/sidebar.d.ts +10 -0
  14. package/dist/sidebar.js +30 -0
  15. package/dist/site-options.d.ts +9 -0
  16. package/dist/site-options.js +39 -0
  17. package/dist/types.d.ts +47 -0
  18. package/dist/types.js +4 -0
  19. package/lib/repo-docs.ts +124 -0
  20. package/lib/schema-version.ts +24 -0
  21. package/package.json +68 -5
  22. package/src/components/ExportStamp.astro +29 -0
  23. package/src/components/FeatureSummary.astro +160 -0
  24. package/src/components/FeatureTable.astro +64 -0
  25. package/src/components/ItemDetail.astro +16 -0
  26. package/src/components/ItemDialog.astro +16 -0
  27. package/src/components/LinkedFrom.astro +33 -0
  28. package/src/components/LinkedText.astro +12 -0
  29. package/src/components/PlanInteractions.astro +30 -0
  30. package/src/components/RefLink.astro +18 -0
  31. package/src/components/StateBadge.astro +15 -0
  32. package/src/components/board/Board.tsx +244 -0
  33. package/src/components/board/KanbanItemCard.tsx +129 -0
  34. package/src/components/board/LinkRuns.tsx +21 -0
  35. package/src/components/board/TaskKanbanCard.tsx +81 -0
  36. package/src/components/board/useBoardUrlState.ts +41 -0
  37. package/src/components/lib/KanbanItemCard.astro +264 -0
  38. package/src/components/lib/StatusTimelineFeed.astro +194 -0
  39. package/src/components/lib/TaskKanbanCard.astro +215 -0
  40. package/src/components/timeline/Timeline.tsx +159 -0
  41. package/src/components/timeline/useTimelineLayout.ts +39 -0
  42. package/src/content.config.ts +16 -0
  43. package/src/env.d.ts +7 -0
  44. package/src/lib/board-data.ts +84 -0
  45. package/src/lib/board.ts +209 -0
  46. package/src/lib/planning-types.ts +207 -0
  47. package/src/lib/planning.ts +415 -0
  48. package/src/lib/references.ts +360 -0
  49. package/src/lib/timeline.ts +156 -0
  50. package/src/loaders/repo-docs.ts +69 -0
  51. package/src/pages/index.astro +158 -0
  52. package/src/pages/plan/board.astro +41 -0
  53. package/src/pages/plan/log.astro +83 -0
  54. package/src/pages/plan/risks/[id].astro +72 -0
  55. package/src/pages/plan/risks.astro +263 -0
  56. package/src/pages/plan/roadmap.astro +108 -0
  57. package/src/routes/plan/briefs.astro +66 -0
  58. package/src/routes/plan/features/[id].astro +113 -0
  59. package/src/routes/plan/features/index.astro +29 -0
  60. package/src/routes/plan/inbox.astro +78 -0
  61. package/src/routes/plan/milestones/[milestone].astro +113 -0
  62. package/src/routes/plan/milestones/index.astro +56 -0
  63. package/src/routes/plan/now.astro +135 -0
  64. package/src/routes/plan/strategy.astro +194 -0
  65. package/src/scripts/plan.ts +40 -0
  66. package/src/styles/components.css +491 -0
  67. package/src/styles/kanban.css +277 -0
  68. package/src/styles/timeline.css +210 -0
  69. package/src/styles/width.css +4 -0
@@ -0,0 +1,33 @@
1
+ ---
2
+ // The pages that link to one item, milestone or risk, grouped by how they
3
+ // link. Derived from planning.json (references), so search ignores it.
4
+ import { RELATION_LABELS, siteRefs, type Relation } from '../lib/references';
5
+
6
+ interface Props {
7
+ ref: string;
8
+ }
9
+
10
+ const links = siteRefs().back.get(Astro.props.ref) ?? [];
11
+ const groups = (Object.keys(RELATION_LABELS) as Relation[])
12
+ .map((relation) => ({ relation, links: links.filter((link) => link.relation === relation) }))
13
+ .filter((group) => group.links.length > 0);
14
+ ---
15
+
16
+ <section class="linked-from" data-linked-from data-pagefind-ignore>
17
+ <h2>Linked from</h2>
18
+ {groups.length === 0 && <p class="plan-empty">Nothing links here yet.</p>}
19
+ {
20
+ groups.map((group) => (
21
+ <>
22
+ <h3>{RELATION_LABELS[group.relation]}</h3>
23
+ <ul>
24
+ {group.links.map((link) => (
25
+ <li>
26
+ <a href={link.href}>{link.label}</a>
27
+ </li>
28
+ ))}
29
+ </ul>
30
+ </>
31
+ ))
32
+ }
33
+ </section>
@@ -0,0 +1,12 @@
1
+ ---
2
+ // Prose with every known ID and brief path linked to its page.
3
+ import { linkify, siteRefs } from '../lib/references';
4
+
5
+ interface Props {
6
+ text: string | null | undefined;
7
+ }
8
+
9
+ const runs = linkify(Astro.props.text ?? '', siteRefs().known);
10
+ ---
11
+
12
+ {runs.map((run) => (run.target?.href ? <a href={run.target.href} title={run.target.label}>{run.text}</a> : run.text))}
@@ -0,0 +1,30 @@
1
+ ---
2
+ // The Board's and Roadmap's client script (src/scripts/plan.ts, the item
3
+ // popup). The inline part runs as the page is parsed, before the Board's
4
+ // columns paint, so a collapsed column never flashes open and a filtered link
5
+ // never shows the unfiltered board; it must stay in step with STORAGE_KEY in
6
+ // src/components/board/Board.tsx and the URL keys in src/lib/board.ts.
7
+ ---
8
+
9
+ <script is:inline>
10
+ try {
11
+ const names = JSON.parse(localStorage.getItem('pm-docs-site:board:collapsed') ?? '[]');
12
+
13
+ if (Array.isArray(names)) document.documentElement.dataset.boardCollapsed = names.filter((name) => typeof name === 'string').join(' ');
14
+ } catch {
15
+ // Junk or no storage: every column stays open.
16
+ }
17
+
18
+ // A board key in the URL: hide the Board's body until the island has
19
+ // rendered that state and deleted the mark (useBoardUrlState.ts), so a
20
+ // filtered link never shows the unfiltered board first.
21
+ // A block, so the binding stays out of the page's global scope.
22
+ {
23
+ const params = new URLSearchParams(location.search);
24
+
25
+ if (['owner', 'milestone', 'size', 'rag', 'group'].some((key) => params.has(key))) document.documentElement.dataset.boardPending = '';
26
+ }
27
+ </script>
28
+ <script>
29
+ import '../scripts/plan.ts';
30
+ </script>
@@ -0,0 +1,18 @@
1
+ ---
2
+ // One item, milestone, risk or brief as a link to its page, named with its
3
+ // title, or as plain text when that page is not built or the key is unknown.
4
+ import { siteRefs } from '../lib/references';
5
+
6
+ interface Props {
7
+ /** An ID (`R-012`, `M1`, `RK-002`), `none` for the No-milestone page, or a brief path. */
8
+ ref: string | null | undefined;
9
+ /** `full` shows the target's label (`R-012 Invoice export`); `id` the key only. */
10
+ label?: 'full' | 'id';
11
+ }
12
+
13
+ const { ref, label = 'full' } = Astro.props;
14
+ const target = ref ? siteRefs().known.get(ref) : undefined;
15
+ const text = target && label === 'full' ? target.label : (ref ?? '');
16
+ ---
17
+
18
+ {target?.href ? <a href={target.href} title={target.label}>{text}</a> : text}
@@ -0,0 +1,15 @@
1
+ ---
2
+ // An item's state (In progress, Next, Later, Done, Dropped) or its roadmap
3
+ // label (blocked, waiting) as a badge that always prints the word.
4
+ import { FEATURE_STATES, type FeatureState } from '../lib/planning';
5
+
6
+ interface Props {
7
+ state?: FeatureState;
8
+ label?: 'blocked' | 'waiting';
9
+ }
10
+
11
+ const { state, label } = Astro.props;
12
+ ---
13
+
14
+ {state && <span class={`state state--${state}`}>{FEATURE_STATES[state]}</span>}
15
+ {label && <span class={`state state--${label}`}>{label}</span>}
@@ -0,0 +1,244 @@
1
+ // The Board island: the filter bar, the five column headers with their
2
+ // collapse toggles, and the cards in lanes, in one CSS grid (.plan-columns in
3
+ // board.astro, components.css). It is server-rendered, so without JavaScript
4
+ // every card shows and the filter bar stays hidden. The item popup is not
5
+ // here: a card's title keeps `a.plan-item-link[data-item]`, which
6
+ // src/scripts/plan.ts opens from the page's ItemDetail templates. The filter
7
+ // and group state lives in the URL (useBoardUrlState.ts); `.plan-board__body`
8
+ // (the header row and the lanes) is hidden while <html> has the pending mark.
9
+ import { useEffect, useState } from 'react';
10
+
11
+ import { COLUMNS, DEFAULT_STATE, isFiltered, lanes, matches } from '../../lib/board';
12
+ import type { BoardCard, BoardFilters, ColumnName, GroupBy } from '../../lib/board';
13
+ import KanbanItemCard from './KanbanItemCard';
14
+ import TaskKanbanCard from './TaskKanbanCard';
15
+ import { useBoardUrlState } from './useBoardUrlState';
16
+
17
+ interface Props {
18
+ cards: BoardCard[];
19
+ milestones: { id: string; name: string }[];
20
+ }
21
+
22
+ /** Collapsed columns: the key the inline pre-paint script in PlanInteractions.astro also reads. */
23
+ const STORAGE_KEY = 'pm-docs-site:board:collapsed';
24
+
25
+ /** The collapsed column names in storage; junk or no storage is none. */
26
+ function readCollapsed(): Set<string> {
27
+ try {
28
+ const value: unknown = JSON.parse(localStorage.getItem(STORAGE_KEY) ?? '[]');
29
+
30
+ return new Set(Array.isArray(value) ? value.filter((name): name is string => typeof name === 'string') : []);
31
+ } catch {
32
+ return new Set();
33
+ }
34
+ }
35
+
36
+ function writeCollapsed(names: ReadonlySet<string>): void {
37
+ try {
38
+ localStorage.setItem(STORAGE_KEY, JSON.stringify([...names]));
39
+ } catch {
40
+ // No storage (private mode, a blocked origin): the state lasts until the page closes.
41
+ }
42
+ }
43
+
44
+ /** The root attribute the collapse CSS reads (components.css). */
45
+ function applyCollapsed(names: ReadonlySet<string>): void {
46
+ document.documentElement.dataset.boardCollapsed = [...names].join(' ');
47
+ }
48
+
49
+ /** The id of a column's cell in a lane: `col-x-cards` in the ungrouped lane, `col-x-cards-<lane>` otherwise. */
50
+ function cellId(column: ColumnName, lane: string): string {
51
+ return lane === 'all' ? `col-${column}-cards` : `col-${column}-cards-${lane}`;
52
+ }
53
+
54
+ function Card({ card }: { card: BoardCard }) {
55
+ return (
56
+ <div data-card={card.key} data-owner={card.owner ?? 'none'} data-milestone={card.milestone ?? 'none'} data-size={card.size ?? 'none'} data-rag={card.rag}>
57
+ {card.column === 'now' ? (
58
+ <TaskKanbanCard
59
+ task={card.title}
60
+ taskRuns={card.titleRuns}
61
+ date={card.started ?? ''}
62
+ assigneeInitials={card.initials}
63
+ size={card.size}
64
+ rag={card.rag}
65
+ progress={card.progress ?? 0}
66
+ href={card.href}
67
+ itemId={card.id}
68
+ />
69
+ ) : (
70
+ <KanbanItemCard
71
+ title={card.title}
72
+ titleRuns={card.titleRuns}
73
+ size={card.size}
74
+ rag={card.rag}
75
+ tag={card.tag}
76
+ tagHref={card.tagHref}
77
+ assignee={card.initials}
78
+ detail={card.detail}
79
+ href={card.href}
80
+ itemId={card.id}
81
+ />
82
+ )}
83
+ </div>
84
+ );
85
+ }
86
+
87
+ interface FilterProps {
88
+ id: string;
89
+ label: string;
90
+ value: string | null;
91
+ options: { value: string; label: string }[];
92
+ onChange: (value: string | null) => void;
93
+ }
94
+
95
+ function Filter({ id, label, value, options, onChange }: FilterProps) {
96
+ return (
97
+ <div className="plan-board__filter">
98
+ <label htmlFor={id}>{label}</label>
99
+ <select id={id} value={value ?? ''} onChange={(event) => onChange(event.target.value === '' ? null : event.target.value)}>
100
+ <option value="">All</option>
101
+ {options.map((option) => (
102
+ <option key={option.value} value={option.value}>
103
+ {option.label}
104
+ </option>
105
+ ))}
106
+ </select>
107
+ </div>
108
+ );
109
+ }
110
+
111
+ const GROUPS: { value: GroupBy; label: string }[] = [
112
+ { value: 'none', label: 'None' },
113
+ { value: 'milestone', label: 'Milestone' },
114
+ { value: 'owner', label: 'Owner' },
115
+ ];
116
+
117
+ export default function Board({ cards, milestones }: Props) {
118
+ const [state, setState, hydrated] = useBoardUrlState(milestones.map((milestone) => milestone.id));
119
+ const [collapsed, setCollapsed] = useState<ReadonlySet<string>>(() => new Set());
120
+
121
+ useEffect(() => {
122
+ const stored = readCollapsed();
123
+
124
+ applyCollapsed(stored);
125
+ setCollapsed(stored);
126
+ }, []);
127
+
128
+ const toggle = (name: ColumnName) => {
129
+ const next = new Set(collapsed);
130
+
131
+ if (next.has(name)) next.delete(name);
132
+ else next.add(name);
133
+ writeCollapsed(next);
134
+ applyCollapsed(next);
135
+ setCollapsed(next);
136
+ };
137
+
138
+ const setFilter = (key: keyof BoardFilters) => (value: string | null) => setState((current) => ({ ...current, filters: { ...current.filters, [key]: value } }));
139
+
140
+ const visible = cards.filter((card) => matches(card, state.filters));
141
+ const filtered = isFiltered(state);
142
+ const grouped = state.group !== 'none';
143
+ // Clear resets every filter and the grouping, so it is live while either is set.
144
+ const rows = lanes(visible, state.group, milestones);
145
+
146
+ return (
147
+ <>
148
+ <div className="plan-board__filters" hidden={!hydrated}>
149
+ <Filter
150
+ id="board-owner"
151
+ label="Owner"
152
+ value={state.filters.owner}
153
+ options={[
154
+ { value: 'agent', label: 'agent' },
155
+ { value: 'user', label: 'user' },
156
+ { value: 'both', label: 'both' },
157
+ ]}
158
+ onChange={setFilter('owner')}
159
+ />
160
+ <Filter
161
+ id="board-milestone"
162
+ label="Milestone"
163
+ value={state.filters.milestone}
164
+ options={[...milestones.map((milestone) => ({ value: milestone.id, label: `${milestone.id} ${milestone.name}` })), { value: 'none', label: 'No milestone' }]}
165
+ onChange={setFilter('milestone')}
166
+ />
167
+ <Filter
168
+ id="board-size"
169
+ label="Size"
170
+ value={state.filters.size}
171
+ options={[
172
+ { value: 'S', label: 'S' },
173
+ { value: 'M', label: 'M' },
174
+ { value: 'L', label: 'L' },
175
+ ]}
176
+ onChange={setFilter('size')}
177
+ />
178
+ <Filter
179
+ id="board-rag"
180
+ label="RAG"
181
+ value={state.filters.rag}
182
+ options={[
183
+ { value: 'red', label: 'red' },
184
+ { value: 'amber', label: 'amber' },
185
+ { value: 'green', label: 'green' },
186
+ { value: 'none', label: 'No risk' },
187
+ ]}
188
+ onChange={setFilter('rag')}
189
+ />
190
+ <div className="plan-board__filter">
191
+ <label htmlFor="board-group">Group by</label>
192
+ <select id="board-group" value={state.group} onChange={(event) => setState((current) => ({ ...current, group: event.target.value as GroupBy }))}>
193
+ {GROUPS.map((group) => (
194
+ <option key={group.value} value={group.value}>
195
+ {group.label}
196
+ </option>
197
+ ))}
198
+ </select>
199
+ </div>
200
+ <button type="button" id="board-clear" className="plan-board__clear" disabled={!filtered && !grouped} onClick={() => setState(DEFAULT_STATE)}>
201
+ Clear
202
+ </button>
203
+ </div>
204
+
205
+ <div className="plan-board__body">
206
+ {COLUMNS.map(({ name, title }) => {
207
+ const shut = collapsed.has(name);
208
+
209
+ return (
210
+ <section key={name} className={grouped ? 'plan-column' : 'plan-column plan-column--joined'} data-column={name} data-collapsed={shut ? '' : undefined} aria-labelledby={`col-${name}`}>
211
+ <h2 id={`col-${name}`}>
212
+ <button type="button" className="plan-column__toggle" aria-expanded={!shut} aria-controls={rows.map((lane) => cellId(name, lane.key)).join(' ')} onClick={() => toggle(name)}>
213
+ <span className="plan-column__name">{title}</span> <span className="plan-column__count">{visible.filter((card) => card.column === name).length}</span>
214
+ </button>
215
+ </h2>
216
+ </section>
217
+ );
218
+ })}
219
+
220
+ {rows.map((lane) => (
221
+ <div key={lane.key} className="plan-lane" data-lane={lane.key}>
222
+ {grouped && (
223
+ <div className="plan-lane__header">
224
+ <span className="plan-lane__name">{lane.label}</span> <span className="plan-lane__count">{lane.cards.length}</span>
225
+ </div>
226
+ )}
227
+ {COLUMNS.map(({ name }) => {
228
+ const inCell = lane.cards.filter((card) => card.column === name);
229
+
230
+ return (
231
+ <div key={name} className="plan-column__cards" data-lane-column={name} id={cellId(name, lane.key)}>
232
+ {!grouped && inCell.length === 0 && <p className="plan-empty">{filtered ? 'Nothing matches' : 'Nothing here'}</p>}
233
+ {inCell.map((card) => (
234
+ <Card key={card.key} card={card} />
235
+ ))}
236
+ </div>
237
+ );
238
+ })}
239
+ </div>
240
+ ))}
241
+ </div>
242
+ </>
243
+ );
244
+ }
@@ -0,0 +1,129 @@
1
+ /**
2
+ * KanbanItemCard — Polished agile kanban ticket with priority pill, assignee avatar, attachment count, and comment indicators.
3
+ *
4
+ * From the Astro Components Kit by Konstantin (https://astrocomponents.dev/docs/kanban-item-card/,
5
+ * https://github.com/konstantinWDK/astro-components), MIT License. Ported to React from its
6
+ * manual-install source (via ../lib/KanbanItemCard.astro); the changes are that hard-coded
7
+ * dark-theme colours use Starlight theme variables, so the card reads in light and dark themes;
8
+ * the title (and tag) can be a link, for the site's item popup and backlinks (href, itemId,
9
+ * tagHref), and the due-date line (and a title that is not a link) links known IDs; the pill
10
+ * shows the item's size (S, M, L in the kit's low, medium, high colours) and is omitted without
11
+ * one; a RAG dot sits beside it; the assignee chip is omitted for a card with no owner; and the
12
+ * card is not focusable and has no role. Its styles are in src/styles/kanban.css.
13
+ */
14
+ import type { CardRag, LinkRun } from '../../lib/board';
15
+ import type { Size } from '../../lib/planning-types';
16
+ import LinkRuns from './LinkRuns';
17
+
18
+ interface Props {
19
+ title: string;
20
+ titleRuns: LinkRun[];
21
+ size: Size | null;
22
+ rag: CardRag;
23
+ tag: string;
24
+ tagHref: string | null;
25
+ /** Null with no owner: no chip, as the owner filter hides the card. */
26
+ assignee: string | null;
27
+ detail: LinkRun[];
28
+ commentsCount?: number;
29
+ attachmentsCount?: number;
30
+ href: string | null;
31
+ itemId: string | null;
32
+ }
33
+
34
+ /** The kit's low, medium, and high pill colours, by size. */
35
+ const sizeMap: Record<Size, { color: string; bg: string }> = {
36
+ S: { color: '#059669', bg: 'rgba(16, 185, 129, 0.12)' },
37
+ M: { color: '#d97706', bg: 'rgba(245, 158, 11, 0.12)' },
38
+ L: { color: '#dc2626', bg: 'rgba(239, 68, 68, 0.12)' },
39
+ };
40
+
41
+ const iconProps = {
42
+ className: 'k-item__icon',
43
+ width: 13,
44
+ height: 13,
45
+ viewBox: '0 0 24 24',
46
+ fill: 'none',
47
+ stroke: 'currentColor',
48
+ strokeWidth: 2,
49
+ strokeLinecap: 'round',
50
+ strokeLinejoin: 'round',
51
+ 'aria-hidden': true,
52
+ } as const;
53
+
54
+ export default function KanbanItemCard({ title, titleRuns, size, rag, tag, tagHref, assignee, detail, commentsCount = 0, attachmentsCount = 0, href, itemId }: Props) {
55
+ const pill = size ? sizeMap[size] : null;
56
+
57
+ return (
58
+ <div className="k-item">
59
+ <div className="k-item__head">
60
+ {tagHref ? (
61
+ <a className="k-item__tag" href={tagHref}>
62
+ {tag}
63
+ </a>
64
+ ) : (
65
+ <span className="k-item__tag">{tag}</span>
66
+ )}
67
+ {(pill || rag !== 'none') && (
68
+ <span className="k-item__badges">
69
+ {pill && (
70
+ <span className="k-item__priority" title={`Size ${size}`} style={{ color: pill.color, background: pill.bg, borderColor: `${pill.color}33` }}>
71
+ <span className="k-item__priority-dot" style={{ background: pill.color }}></span>
72
+ {size}
73
+ </span>
74
+ )}
75
+ {rag !== 'none' && <span className="k-item__rag" data-rag={rag} role="img" aria-label={`RAG ${rag}`}></span>}
76
+ </span>
77
+ )}
78
+ </div>
79
+
80
+ <h4 className="k-item__title">
81
+ {href ? (
82
+ <a className="plan-item-link" href={href} data-item={itemId ?? undefined}>
83
+ {title}
84
+ </a>
85
+ ) : (
86
+ <LinkRuns runs={titleRuns} />
87
+ )}
88
+ </h4>
89
+
90
+ <div className="k-item__footer">
91
+ <div className="k-item__meta">
92
+ <div className="k-item__meta-item" title="Due Date">
93
+ <svg {...iconProps}>
94
+ <circle cx="12" cy="12" r="10"></circle>
95
+ <polyline points="12 6 12 12 16 14"></polyline>
96
+ </svg>
97
+ <span>
98
+ <LinkRuns runs={detail} />
99
+ </span>
100
+ </div>
101
+
102
+ {commentsCount > 0 && (
103
+ <div className="k-item__meta-item" title={`${commentsCount} comments`}>
104
+ <svg {...iconProps}>
105
+ <path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" />
106
+ </svg>
107
+ <span>{commentsCount}</span>
108
+ </div>
109
+ )}
110
+
111
+ {attachmentsCount > 0 && (
112
+ <div className="k-item__meta-item" title={`${attachmentsCount} attachments`}>
113
+ <svg {...iconProps}>
114
+ <path d="M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48" />
115
+ </svg>
116
+ <span>{attachmentsCount}</span>
117
+ </div>
118
+ )}
119
+ </div>
120
+
121
+ {assignee && (
122
+ <div className="k-item__assignee" title={`Assigned to ${assignee}`}>
123
+ {assignee}
124
+ </div>
125
+ )}
126
+ </div>
127
+ </div>
128
+ );
129
+ }
@@ -0,0 +1,21 @@
1
+ // Prose with every known ID and brief path linked to its page: the island's
2
+ // LinkedText.astro. The runs are built at build time (board-data.ts).
3
+ import { Fragment } from 'react';
4
+
5
+ import type { LinkRun } from '../../lib/board';
6
+
7
+ export default function LinkRuns({ runs }: { runs: LinkRun[] }) {
8
+ return (
9
+ <>
10
+ {runs.map((run, index) =>
11
+ run.href ? (
12
+ <a key={index} href={run.href} title={run.label ?? undefined}>
13
+ {run.text}
14
+ </a>
15
+ ) : (
16
+ <Fragment key={index}>{run.text}</Fragment>
17
+ ),
18
+ )}
19
+ </>
20
+ );
21
+ }
@@ -0,0 +1,81 @@
1
+ /**
2
+ * TaskKanbanCard — Agile task card with priority labels, progress completion bar, and due date.
3
+ *
4
+ * From the Astro Components Kit by Konstantin (https://astrocomponents.dev/docs/task-kanban-card/,
5
+ * https://github.com/konstantinWDK/astro-components), MIT License. Ported to React from its
6
+ * manual-install source (via ../lib/TaskKanbanCard.astro); the changes are that hard-coded
7
+ * dark-theme colours use Starlight theme variables, so the card reads in light and dark themes;
8
+ * the task can be a link, for the site's item popup and backlinks (href, itemId), and a task that
9
+ * is not a link links known IDs; the tag shows the item's size (S, M, L as the kit's low, med,
10
+ * high) and is omitted without one; a RAG dot sits beside it; the assignee chip is omitted for a card with no
11
+ * owner; and the card has no role. Its styles are in src/styles/kanban.css.
12
+ */
13
+ import type { CardRag, LinkRun } from '../../lib/board';
14
+ import type { Size } from '../../lib/planning-types';
15
+ import LinkRuns from './LinkRuns';
16
+
17
+ interface Props {
18
+ task: string;
19
+ taskRuns: LinkRun[];
20
+ date: string;
21
+ /** Null with no owner: no chip, as the owner filter hides the card. */
22
+ assigneeInitials: string | null;
23
+ size: Size | null;
24
+ rag: CardRag;
25
+ progress: number;
26
+ href: string | null;
27
+ itemId: string | null;
28
+ }
29
+
30
+ const sizeVariant: Record<Size, 'low' | 'med' | 'high'> = { S: 'low', M: 'med', L: 'high' };
31
+
32
+ export default function TaskKanbanCard({ task, taskRuns, date, assigneeInitials, size, rag, progress, href, itemId }: Props) {
33
+ return (
34
+ <div className="task-card">
35
+ <div className="task-card__tags">
36
+ <span className="k-item__badges">
37
+ {size && (
38
+ <span className={`task-card__tag task-card__tag--${sizeVariant[size]}`} title={`Size ${size}`}>
39
+ <span className="task-card__tag-dot" aria-hidden="true"></span>
40
+ {size}
41
+ </span>
42
+ )}
43
+ {rag !== 'none' && <span className="k-item__rag" data-rag={rag} role="img" aria-label={`RAG ${rag}`}></span>}
44
+ </span>
45
+ <span className="task-card__pct">{progress}%</span>
46
+ </div>
47
+
48
+ <p className="task-card__desc">
49
+ {href ? (
50
+ <a className="plan-item-link" href={href} data-item={itemId ?? undefined}>
51
+ {task}
52
+ </a>
53
+ ) : (
54
+ <LinkRuns runs={taskRuns} />
55
+ )}
56
+ </p>
57
+
58
+ <div className="task-card__progress-wrap" role="progressbar" aria-valuenow={progress} aria-valuemin={0} aria-valuemax={100} aria-label="Task progress">
59
+ <div className="task-card__progress-bar" style={{ width: `${progress}%` }}></div>
60
+ </div>
61
+
62
+ <div className="task-card__footer">
63
+ <div className="task-card__date">
64
+ <svg className="task-card__date-icon" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
65
+ <rect x="3" y="4" width="18" height="18" rx="2" ry="2"></rect>
66
+ <line x1="16" y1="2" x2="16" y2="6"></line>
67
+ <line x1="8" y1="2" x2="8" y2="6"></line>
68
+ <line x1="3" y1="10" x2="21" y2="10"></line>
69
+ </svg>
70
+ <span>{date}</span>
71
+ </div>
72
+
73
+ {assigneeInitials && (
74
+ <div className="task-card__assignee" title={`Assigned to ${assigneeInitials}`}>
75
+ {assigneeInitials}
76
+ </div>
77
+ )}
78
+ </div>
79
+ </div>
80
+ );
81
+ }
@@ -0,0 +1,41 @@
1
+ // The Board's filter and group state, kept in the page URL. The server has no
2
+ // location, so the first render is always DEFAULT_STATE (hydration must match
3
+ // it); the query is read in an effect on mount. Every later change is written
4
+ // back with history.replaceState, in boardQuery's fixed key order. The pending
5
+ // mark (`data-board-pending` on <html>, set before paint by the inline script
6
+ // in PlanInteractions.astro when the URL has a board key) keeps the board
7
+ // hidden until the parsed state has rendered, so a filtered link never shows
8
+ // the unfiltered board first.
9
+ import { useEffect, useState } from 'react';
10
+ import type { Dispatch, SetStateAction } from 'react';
11
+
12
+ import { boardQuery, DEFAULT_STATE, parseBoardQuery } from '../../lib/board';
13
+ import type { BoardState } from '../../lib/board';
14
+
15
+ export function useBoardUrlState(milestoneIds: string[]): [BoardState, Dispatch<SetStateAction<BoardState>>, boolean] {
16
+ const [state, setState] = useState<BoardState>(DEFAULT_STATE);
17
+ // True once the URL's state is applied: the render after it shows the parsed state.
18
+ const [applied, setApplied] = useState(false);
19
+
20
+ useEffect(() => {
21
+ setState(parseBoardQuery(location.search, milestoneIds));
22
+ setApplied(true);
23
+ // Mount only: the milestone list is fixed at build time.
24
+ }, []);
25
+
26
+ useEffect(() => {
27
+ if (!applied) {
28
+ return;
29
+ }
30
+
31
+ // This effect runs after the render that committed the parsed state, so the board is already filtered when it shows.
32
+ delete document.documentElement.dataset.boardPending;
33
+ const url = location.pathname + boardQuery(state) + location.hash;
34
+
35
+ if (url !== location.pathname + location.search + location.hash) {
36
+ history.replaceState(null, '', url);
37
+ }
38
+ }, [state, applied]);
39
+
40
+ return [state, setState, applied];
41
+ }