@purview-dev/pm-docs-site 0.1.0-pre.1 → 0.1.0-pre.3
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.
- package/README.md +130 -18
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +91 -0
- package/dist/dev-env.d.ts +2 -0
- package/dist/dev-env.js +13 -0
- package/dist/fs-allow.d.ts +2 -0
- package/dist/fs-allow.js +11 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +152 -0
- package/dist/options.d.ts +5 -0
- package/dist/options.js +46 -0
- package/dist/repo-docs.d.ts +33 -0
- package/dist/repo-docs.js +94 -0
- package/dist/schema-version.d.ts +27 -0
- package/dist/schema-version.js +48 -0
- package/dist/sidebar.d.ts +10 -0
- package/dist/sidebar.js +32 -0
- package/dist/site-options.d.ts +9 -0
- package/dist/site-options.js +44 -0
- package/dist/types.d.ts +47 -0
- package/dist/types.js +4 -0
- package/lib/{repo-docs.mjs → repo-docs.ts} +22 -46
- package/lib/schema-version.ts +59 -0
- package/{index.d.ts → lib/types.ts} +5 -6
- package/package.json +19 -9
- package/src/components/FeatureSummary.astro +30 -9
- package/src/components/FeatureTable.astro +1 -1
- package/src/components/ItemDetail.astro +1 -1
- package/src/components/ItemDialog.astro +12 -8
- package/src/components/PlanInteractions.astro +15 -3
- package/src/components/RefLink.astro +7 -4
- package/src/components/board/Board.tsx +252 -0
- package/src/components/board/KanbanItemCard.tsx +131 -0
- package/src/components/board/LinkRuns.tsx +21 -0
- package/src/components/board/TaskKanbanCard.tsx +83 -0
- package/src/components/board/useBoardUrlState.ts +41 -0
- package/src/components/decisions/Decisions.tsx +162 -0
- package/src/components/decisions/useDecisionsUrlState.ts +29 -0
- package/src/components/graph/Graph.tsx +290 -0
- package/src/components/graph/GraphNodes.tsx +120 -0
- package/src/components/graph/useGraphUrlState.ts +58 -0
- package/src/components/lib/KanbanItemCard.astro +7 -11
- package/src/components/lib/StatusTimelineFeed.astro +3 -2
- package/src/components/lib/TaskKanbanCard.astro +2 -1
- package/src/components/timeline/Timeline.tsx +192 -0
- package/src/components/timeline/useTimelineLayout.ts +39 -0
- package/src/content.config.ts +22 -6
- package/src/env.d.ts +2 -2
- package/src/lib/board-data.ts +84 -0
- package/src/lib/board.ts +209 -0
- package/src/lib/decisions.ts +100 -0
- package/src/lib/graph-layout.ts +270 -0
- package/src/lib/graph-state.ts +99 -0
- package/src/lib/graph.ts +194 -0
- package/src/lib/link-html.ts +39 -0
- package/src/lib/planning-types.ts +32 -3
- package/src/lib/planning.ts +94 -52
- package/src/lib/ref-boundary.ts +19 -0
- package/src/lib/references.ts +67 -8
- package/src/lib/timeline-state.ts +119 -0
- package/src/lib/timeline.ts +51 -0
- package/src/loaders/adrs.ts +43 -0
- package/src/loaders/repo-docs.ts +3 -3
- package/src/pages/404.astro +18 -0
- package/src/pages/index.astro +1 -1
- package/src/pages/plan/board.astro +14 -113
- package/src/pages/plan/log.astro +18 -1
- package/src/pages/plan/roadmap.astro +21 -3
- package/src/routes/plan/decisions/[id].astro +93 -0
- package/src/routes/plan/decisions.astro +52 -0
- package/src/routes/plan/graph.astro +80 -0
- package/src/routes/plan/milestones/index.astro +2 -2
- package/src/routes/plan/now.astro +2 -3
- package/src/scripts/plan.ts +32 -46
- package/src/styles/components.css +244 -13
- package/src/styles/graph.css +296 -0
- package/src/styles/kanban.css +277 -0
- package/src/styles/timeline.css +210 -0
- package/cli.mjs +0 -120
- package/index.mjs +0 -97
- package/lib/options.mjs +0 -67
- package/lib/schema-version.mjs +0 -29
- package/lib/sidebar.mjs +0 -47
- package/lib/site-options.mjs +0 -38
|
@@ -1,25 +1,31 @@
|
|
|
1
1
|
---
|
|
2
|
-
// One item's summary: state, milestone, facts, Done when, related items, brief
|
|
3
|
-
// and risks. The feature page shows it, and so does the item popup on the
|
|
2
|
+
// One item's summary: state, milestone, facts, Done when, related items, brief,
|
|
3
|
+
// decisions (the ADRs whose Item is this item) and risks. The feature page shows it, and so does the item popup on the
|
|
4
4
|
// Board and Roadmap, so the two never drift.
|
|
5
|
-
import { briefOf, dependents, features, loadPlanning, planProgress } from '../lib/planning';
|
|
5
|
+
import { adrsOf, briefOf, dependents, features, loadPlanning, planProgress } from '../lib/planning';
|
|
6
6
|
import LinkedText from './LinkedText.astro';
|
|
7
7
|
import RefLink from './RefLink.astro';
|
|
8
8
|
import StateBadge from './StateBadge.astro';
|
|
9
9
|
|
|
10
10
|
interface Props {
|
|
11
11
|
id: string;
|
|
12
|
+
/** h2 on the feature page (default); h3 in the item popup, below its h2 title. */
|
|
13
|
+
headingLevel?: 2 | 3;
|
|
12
14
|
}
|
|
13
15
|
|
|
16
|
+
const { id, headingLevel } = Astro.props;
|
|
17
|
+
const Heading = headingLevel === 3 ? 'h3' : 'h2';
|
|
18
|
+
|
|
14
19
|
const planning = loadPlanning();
|
|
15
20
|
const all = features(planning);
|
|
16
|
-
const feature = all.find((candidate) => candidate.id ===
|
|
21
|
+
const feature = all.find((candidate) => candidate.id === id)!;
|
|
17
22
|
const byId = new Map(all.map((candidate) => [candidate.id, candidate]));
|
|
18
23
|
const brief = briefOf(planning, feature);
|
|
19
24
|
const blocks = dependents(all, feature.id);
|
|
20
25
|
const revisedBy = all.filter((candidate) => candidate.revisits === feature.id);
|
|
21
26
|
const risks = [...planning.risks.open, ...planning.risks.closed].filter((risk) => risk.affects === feature.id);
|
|
22
27
|
const plan = feature.state === 'now' ? planning.plan : null;
|
|
28
|
+
const adrs = adrsOf(planning, feature.id);
|
|
23
29
|
|
|
24
30
|
const facts: { label: string; value: string }[] = [
|
|
25
31
|
{ label: 'Owner', value: feature.owner ?? '–' },
|
|
@@ -46,7 +52,7 @@ const facts: { label: string; value: string }[] = [
|
|
|
46
52
|
)
|
|
47
53
|
}
|
|
48
54
|
{' '}
|
|
49
|
-
<RefLink ref={feature.milestone ?? 'none'} />
|
|
55
|
+
<RefLink ref={feature.milestone ?? 'none'} fallback={feature.milestone ?? 'No milestone'} />
|
|
50
56
|
</p>
|
|
51
57
|
|
|
52
58
|
<dl class="plan-facts">
|
|
@@ -65,7 +71,7 @@ const facts: { label: string; value: string }[] = [
|
|
|
65
71
|
{
|
|
66
72
|
feature.doneWhen.length > 0 && (
|
|
67
73
|
<section>
|
|
68
|
-
<
|
|
74
|
+
<Heading>Done when</Heading>
|
|
69
75
|
<ul>
|
|
70
76
|
{feature.doneWhen.map((check) => (
|
|
71
77
|
<li>
|
|
@@ -80,7 +86,7 @@ const facts: { label: string; value: string }[] = [
|
|
|
80
86
|
{
|
|
81
87
|
(feature.dependsOn.length > 0 || blocks.length > 0 || feature.revisits || revisedBy.length > 0) && (
|
|
82
88
|
<section>
|
|
83
|
-
<
|
|
89
|
+
<Heading>Related items</Heading>
|
|
84
90
|
<ul>
|
|
85
91
|
{feature.dependsOn.map((dep) => (
|
|
86
92
|
<li>
|
|
@@ -110,7 +116,7 @@ const facts: { label: string; value: string }[] = [
|
|
|
110
116
|
{
|
|
111
117
|
(brief || feature.brief) && (
|
|
112
118
|
<section>
|
|
113
|
-
<
|
|
119
|
+
<Heading>Brief</Heading>
|
|
114
120
|
{brief ? (
|
|
115
121
|
<>
|
|
116
122
|
<p>
|
|
@@ -140,10 +146,25 @@ const facts: { label: string; value: string }[] = [
|
|
|
140
146
|
)
|
|
141
147
|
}
|
|
142
148
|
|
|
149
|
+
{
|
|
150
|
+
adrs.length > 0 && (
|
|
151
|
+
<section>
|
|
152
|
+
<Heading>Decisions</Heading>
|
|
153
|
+
<ul>
|
|
154
|
+
{adrs.map((adr) => (
|
|
155
|
+
<li>
|
|
156
|
+
<RefLink ref={adr.id} /> — {adr.status ?? 'unknown'}
|
|
157
|
+
</li>
|
|
158
|
+
))}
|
|
159
|
+
</ul>
|
|
160
|
+
</section>
|
|
161
|
+
)
|
|
162
|
+
}
|
|
163
|
+
|
|
143
164
|
{
|
|
144
165
|
risks.length > 0 && (
|
|
145
166
|
<section>
|
|
146
|
-
<
|
|
167
|
+
<Heading>Risks</Heading>
|
|
147
168
|
<ul>
|
|
148
169
|
{risks.map((risk) => (
|
|
149
170
|
<li>
|
|
@@ -50,7 +50,7 @@ const when = (feature: Feature) => (state === 'done' || state === 'dropped' ? fe
|
|
|
50
50
|
<td class="plan-nowrap">{when(feature) ?? '–'}</td>
|
|
51
51
|
{!hideMilestone && (
|
|
52
52
|
<td>
|
|
53
|
-
<RefLink ref={feature.milestone ?? 'none'} />
|
|
53
|
+
<RefLink ref={feature.milestone ?? 'none'} fallback={feature.milestone ?? 'No milestone'} />
|
|
54
54
|
</td>
|
|
55
55
|
)}
|
|
56
56
|
<td>{feature.owner ?? '–'}</td>
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
---
|
|
2
2
|
// The one item dialog on the Board and Roadmap. src/scripts/plan.ts fills it
|
|
3
3
|
// from a card's <template> and opens it on a plain click; without JavaScript
|
|
4
|
-
// the card link goes to the item's page instead.
|
|
4
|
+
// the card link goes to the item's page instead. The head, body, and foot sit
|
|
5
|
+
// in a `.plan-dialog__frame` so the dialog element's own box is backdrop: a
|
|
6
|
+
// click there (never on the frame) closes the popup.
|
|
5
7
|
---
|
|
6
8
|
|
|
7
9
|
<dialog class="plan-dialog" data-item-dialog aria-labelledby="plan-dialog-title" data-pagefind-ignore>
|
|
8
|
-
<div class="plan-
|
|
9
|
-
<
|
|
10
|
-
|
|
10
|
+
<div class="plan-dialog__frame">
|
|
11
|
+
<div class="plan-dialog__head">
|
|
12
|
+
<h2 id="plan-dialog-title"></h2>
|
|
13
|
+
<button type="button" class="plan-dialog__close" data-item-dialog-close aria-label="Close">×</button>
|
|
14
|
+
</div>
|
|
15
|
+
<div class="plan-dialog__body" data-item-dialog-body></div>
|
|
16
|
+
<p class="plan-dialog__foot">
|
|
17
|
+
<a data-item-dialog-open href="">Open page</a>
|
|
18
|
+
</p>
|
|
11
19
|
</div>
|
|
12
|
-
<div class="plan-dialog__body" data-item-dialog-body></div>
|
|
13
|
-
<p class="plan-dialog__foot">
|
|
14
|
-
<a data-item-dialog-open href="">Open page</a>
|
|
15
|
-
</p>
|
|
16
20
|
</dialog>
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
---
|
|
2
|
-
// The Board's and Roadmap's client script (src/scripts/plan.ts
|
|
3
|
-
// part runs as the page is parsed, before the
|
|
4
|
-
// column never flashes open
|
|
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.
|
|
5
7
|
---
|
|
6
8
|
|
|
7
9
|
<script is:inline>
|
|
@@ -12,6 +14,16 @@
|
|
|
12
14
|
} catch {
|
|
13
15
|
// Junk or no storage: every column stays open.
|
|
14
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
|
+
}
|
|
15
27
|
</script>
|
|
16
28
|
<script>
|
|
17
29
|
import '../scripts/plan.ts';
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
---
|
|
2
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
|
|
4
|
-
|
|
3
|
+
// title, or as plain text when that page is not built. An unknown key prints
|
|
4
|
+
// the fallback the caller gives (an entry title, `No milestone`), else the key.
|
|
5
|
+
import { refText, siteRefs } from '../lib/references';
|
|
5
6
|
|
|
6
7
|
interface Props {
|
|
7
8
|
/** An ID (`R-012`, `M1`, `RK-002`), `none` for the No-milestone page, or a brief path. */
|
|
8
9
|
ref: string | null | undefined;
|
|
9
10
|
/** `full` shows the target's label (`R-012 Invoice export`); `id` the key only. */
|
|
10
11
|
label?: 'full' | 'id';
|
|
12
|
+
/** The text for a key with no target. */
|
|
13
|
+
fallback?: string;
|
|
11
14
|
}
|
|
12
15
|
|
|
13
|
-
const { ref, label = 'full' } = Astro.props;
|
|
16
|
+
const { ref, label = 'full', fallback } = Astro.props;
|
|
14
17
|
const target = ref ? siteRefs().known.get(ref) : undefined;
|
|
15
|
-
const text = target
|
|
18
|
+
const text = refText(target, ref, label, fallback);
|
|
16
19
|
---
|
|
17
20
|
|
|
18
21
|
{target?.href ? <a href={target.href} title={target.label}>{text}</a> : text}
|
|
@@ -0,0 +1,252 @@
|
|
|
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 collapse toggles
|
|
5
|
+
// appear only once the island has hydrated (a static, unclickable span holds
|
|
6
|
+
// their place before then). The item popup is not here: a card's title keeps
|
|
7
|
+
// `a.plan-item-link[data-item]`, which src/scripts/plan.ts opens from the
|
|
8
|
+
// page's ItemDetail templates. The filter and group state lives in the URL
|
|
9
|
+
// (useBoardUrlState.ts); `.plan-board__body` (the header row and the lanes)
|
|
10
|
+
// is hidden while <html> has the pending mark.
|
|
11
|
+
import { useEffect, useState } from 'react';
|
|
12
|
+
|
|
13
|
+
import { COLUMNS, DEFAULT_STATE, isFiltered, lanes, matches } from '../../lib/board';
|
|
14
|
+
import type { BoardCard, BoardFilters, ColumnName, GroupBy } from '../../lib/board';
|
|
15
|
+
import KanbanItemCard from './KanbanItemCard';
|
|
16
|
+
import TaskKanbanCard from './TaskKanbanCard';
|
|
17
|
+
import { useBoardUrlState } from './useBoardUrlState';
|
|
18
|
+
|
|
19
|
+
interface Props {
|
|
20
|
+
cards: BoardCard[];
|
|
21
|
+
milestones: { id: string; name: string }[];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** Collapsed columns: the key the inline pre-paint script in PlanInteractions.astro also reads. */
|
|
25
|
+
const STORAGE_KEY = 'pm-docs-site:board:collapsed';
|
|
26
|
+
|
|
27
|
+
/** The collapsed column names in storage; junk or no storage is none. */
|
|
28
|
+
function readCollapsed(): Set<string> {
|
|
29
|
+
try {
|
|
30
|
+
const value: unknown = JSON.parse(localStorage.getItem(STORAGE_KEY) ?? '[]');
|
|
31
|
+
|
|
32
|
+
return new Set(Array.isArray(value) ? value.filter((name): name is string => typeof name === 'string') : []);
|
|
33
|
+
} catch {
|
|
34
|
+
return new Set();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function writeCollapsed(names: ReadonlySet<string>): void {
|
|
39
|
+
try {
|
|
40
|
+
localStorage.setItem(STORAGE_KEY, JSON.stringify([...names]));
|
|
41
|
+
} catch {
|
|
42
|
+
// No storage (private mode, a blocked origin): the state lasts until the page closes.
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** The root attribute the collapse CSS reads (components.css). */
|
|
47
|
+
function applyCollapsed(names: ReadonlySet<string>): void {
|
|
48
|
+
document.documentElement.dataset.boardCollapsed = [...names].join(' ');
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** The id of a column's cell in a lane: `col-x-cards` in the ungrouped lane, `col-x-cards-<lane>` otherwise. */
|
|
52
|
+
function cellId(column: ColumnName, lane: string): string {
|
|
53
|
+
return lane === 'all' ? `col-${column}-cards` : `col-${column}-cards-${lane}`;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function Card({ card }: { card: BoardCard }) {
|
|
57
|
+
return (
|
|
58
|
+
<div data-card={card.key} data-owner={card.owner ?? 'none'} data-milestone={card.milestone ?? 'none'} data-size={card.size ?? 'none'} data-rag={card.rag}>
|
|
59
|
+
{card.column === 'now' ? (
|
|
60
|
+
<TaskKanbanCard
|
|
61
|
+
task={card.title}
|
|
62
|
+
taskRuns={card.titleRuns}
|
|
63
|
+
date={card.started ?? ''}
|
|
64
|
+
assigneeInitials={card.initials}
|
|
65
|
+
size={card.size}
|
|
66
|
+
rag={card.rag}
|
|
67
|
+
progress={card.progress ?? 0}
|
|
68
|
+
href={card.href}
|
|
69
|
+
itemId={card.id}
|
|
70
|
+
/>
|
|
71
|
+
) : (
|
|
72
|
+
<KanbanItemCard
|
|
73
|
+
title={card.title}
|
|
74
|
+
titleRuns={card.titleRuns}
|
|
75
|
+
size={card.size}
|
|
76
|
+
rag={card.rag}
|
|
77
|
+
tag={card.tag}
|
|
78
|
+
tagHref={card.tagHref}
|
|
79
|
+
assignee={card.initials}
|
|
80
|
+
detail={card.detail}
|
|
81
|
+
href={card.href}
|
|
82
|
+
itemId={card.id}
|
|
83
|
+
/>
|
|
84
|
+
)}
|
|
85
|
+
</div>
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
interface FilterProps {
|
|
90
|
+
id: string;
|
|
91
|
+
label: string;
|
|
92
|
+
value: string | null;
|
|
93
|
+
options: { value: string; label: string }[];
|
|
94
|
+
onChange: (value: string | null) => void;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function Filter({ id, label, value, options, onChange }: FilterProps) {
|
|
98
|
+
return (
|
|
99
|
+
<div className="plan-board__filter">
|
|
100
|
+
<label htmlFor={id}>{label}</label>
|
|
101
|
+
<select id={id} value={value ?? ''} onChange={(event) => onChange(event.target.value === '' ? null : event.target.value)}>
|
|
102
|
+
<option value="">All</option>
|
|
103
|
+
{options.map((option) => (
|
|
104
|
+
<option key={option.value} value={option.value}>
|
|
105
|
+
{option.label}
|
|
106
|
+
</option>
|
|
107
|
+
))}
|
|
108
|
+
</select>
|
|
109
|
+
</div>
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const GROUPS: { value: GroupBy; label: string }[] = [
|
|
114
|
+
{ value: 'none', label: 'None' },
|
|
115
|
+
{ value: 'milestone', label: 'Milestone' },
|
|
116
|
+
{ value: 'owner', label: 'Owner' },
|
|
117
|
+
];
|
|
118
|
+
|
|
119
|
+
export default function Board({ cards, milestones }: Props) {
|
|
120
|
+
const [state, setState, hydrated] = useBoardUrlState(milestones.map((milestone) => milestone.id));
|
|
121
|
+
const [collapsed, setCollapsed] = useState<ReadonlySet<string>>(() => new Set());
|
|
122
|
+
|
|
123
|
+
useEffect(() => {
|
|
124
|
+
const stored = readCollapsed();
|
|
125
|
+
|
|
126
|
+
applyCollapsed(stored);
|
|
127
|
+
setCollapsed(stored);
|
|
128
|
+
}, []);
|
|
129
|
+
|
|
130
|
+
const toggle = (name: ColumnName) => {
|
|
131
|
+
const next = new Set(collapsed);
|
|
132
|
+
|
|
133
|
+
if (next.has(name)) next.delete(name);
|
|
134
|
+
else next.add(name);
|
|
135
|
+
writeCollapsed(next);
|
|
136
|
+
applyCollapsed(next);
|
|
137
|
+
setCollapsed(next);
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
const setFilter = (key: keyof BoardFilters) => (value: string | null) => setState((current) => ({ ...current, filters: { ...current.filters, [key]: value } }));
|
|
141
|
+
|
|
142
|
+
const visible = cards.filter((card) => matches(card, state.filters));
|
|
143
|
+
const filtered = isFiltered(state);
|
|
144
|
+
const grouped = state.group !== 'none';
|
|
145
|
+
// Clear resets every filter and the grouping, so it is live while either is set.
|
|
146
|
+
const rows = lanes(visible, state.group, milestones);
|
|
147
|
+
|
|
148
|
+
return (
|
|
149
|
+
<>
|
|
150
|
+
<div className="plan-board__filters" hidden={!hydrated}>
|
|
151
|
+
<Filter
|
|
152
|
+
id="board-owner"
|
|
153
|
+
label="Owner"
|
|
154
|
+
value={state.filters.owner}
|
|
155
|
+
options={[
|
|
156
|
+
{ value: 'agent', label: 'agent' },
|
|
157
|
+
{ value: 'user', label: 'user' },
|
|
158
|
+
{ value: 'both', label: 'both' },
|
|
159
|
+
]}
|
|
160
|
+
onChange={setFilter('owner')}
|
|
161
|
+
/>
|
|
162
|
+
<Filter
|
|
163
|
+
id="board-milestone"
|
|
164
|
+
label="Milestone"
|
|
165
|
+
value={state.filters.milestone}
|
|
166
|
+
options={[...milestones.map((milestone) => ({ value: milestone.id, label: `${milestone.id} ${milestone.name}` })), { value: 'none', label: 'No milestone' }]}
|
|
167
|
+
onChange={setFilter('milestone')}
|
|
168
|
+
/>
|
|
169
|
+
<Filter
|
|
170
|
+
id="board-size"
|
|
171
|
+
label="Size"
|
|
172
|
+
value={state.filters.size}
|
|
173
|
+
options={[
|
|
174
|
+
{ value: 'S', label: 'S' },
|
|
175
|
+
{ value: 'M', label: 'M' },
|
|
176
|
+
{ value: 'L', label: 'L' },
|
|
177
|
+
]}
|
|
178
|
+
onChange={setFilter('size')}
|
|
179
|
+
/>
|
|
180
|
+
<Filter
|
|
181
|
+
id="board-rag"
|
|
182
|
+
label="RAG"
|
|
183
|
+
value={state.filters.rag}
|
|
184
|
+
options={[
|
|
185
|
+
{ value: 'red', label: 'red' },
|
|
186
|
+
{ value: 'amber', label: 'amber' },
|
|
187
|
+
{ value: 'green', label: 'green' },
|
|
188
|
+
{ value: 'none', label: 'No risk' },
|
|
189
|
+
]}
|
|
190
|
+
onChange={setFilter('rag')}
|
|
191
|
+
/>
|
|
192
|
+
<div className="plan-board__filter">
|
|
193
|
+
<label htmlFor="board-group">Group by</label>
|
|
194
|
+
<select id="board-group" value={state.group} onChange={(event) => setState((current) => ({ ...current, group: event.target.value as GroupBy }))}>
|
|
195
|
+
{GROUPS.map((group) => (
|
|
196
|
+
<option key={group.value} value={group.value}>
|
|
197
|
+
{group.label}
|
|
198
|
+
</option>
|
|
199
|
+
))}
|
|
200
|
+
</select>
|
|
201
|
+
</div>
|
|
202
|
+
<button type="button" id="board-clear" className="plan-board__clear" disabled={!filtered && !grouped} onClick={() => setState(DEFAULT_STATE)}>
|
|
203
|
+
Clear
|
|
204
|
+
</button>
|
|
205
|
+
</div>
|
|
206
|
+
|
|
207
|
+
<div className="plan-board__body">
|
|
208
|
+
{COLUMNS.map(({ name, title }) => {
|
|
209
|
+
const shut = collapsed.has(name);
|
|
210
|
+
|
|
211
|
+
return (
|
|
212
|
+
<section key={name} className={grouped ? 'plan-column' : 'plan-column plan-column--joined'} data-column={name} data-collapsed={shut ? '' : undefined} aria-labelledby={`col-${name}`}>
|
|
213
|
+
<h2 id={`col-${name}`}>
|
|
214
|
+
{hydrated ? (
|
|
215
|
+
<button type="button" className="plan-column__toggle" aria-expanded={!shut} aria-controls={rows.map((lane) => cellId(name, lane.key)).join(' ')} onClick={() => toggle(name)}>
|
|
216
|
+
<span className="plan-column__name">{title}</span> <span className="plan-column__count">{visible.filter((card) => card.column === name).length}</span>
|
|
217
|
+
</button>
|
|
218
|
+
) : (
|
|
219
|
+
<span className="plan-column__toggle plan-column__toggle--static">
|
|
220
|
+
<span className="plan-column__name">{title}</span> <span className="plan-column__count">{visible.filter((card) => card.column === name).length}</span>
|
|
221
|
+
</span>
|
|
222
|
+
)}
|
|
223
|
+
</h2>
|
|
224
|
+
</section>
|
|
225
|
+
);
|
|
226
|
+
})}
|
|
227
|
+
|
|
228
|
+
{rows.map((lane) => (
|
|
229
|
+
<div key={lane.key} className="plan-lane" data-lane={lane.key}>
|
|
230
|
+
{grouped && (
|
|
231
|
+
<div className="plan-lane__header">
|
|
232
|
+
<span className="plan-lane__name">{lane.label}</span> <span className="plan-lane__count">{lane.cards.length}</span>
|
|
233
|
+
</div>
|
|
234
|
+
)}
|
|
235
|
+
{COLUMNS.map(({ name }) => {
|
|
236
|
+
const inCell = lane.cards.filter((card) => card.column === name);
|
|
237
|
+
|
|
238
|
+
return (
|
|
239
|
+
<div key={name} className="plan-column__cards" data-lane-column={name} id={cellId(name, lane.key)}>
|
|
240
|
+
{!grouped && inCell.length === 0 && <p className="plan-empty">{filtered ? 'Nothing matches' : 'Nothing here'}</p>}
|
|
241
|
+
{inCell.map((card) => (
|
|
242
|
+
<Card key={card.key} card={card} />
|
|
243
|
+
))}
|
|
244
|
+
</div>
|
|
245
|
+
);
|
|
246
|
+
})}
|
|
247
|
+
</div>
|
|
248
|
+
))}
|
|
249
|
+
</div>
|
|
250
|
+
</>
|
|
251
|
+
);
|
|
252
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
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. The title link carries
|
|
13
|
+
* `aria-haspopup="dialog"` when it is the popup trigger. Its styles are in
|
|
14
|
+
* src/styles/kanban.css.
|
|
15
|
+
*/
|
|
16
|
+
import type { CardRag, LinkRun } from '../../lib/board';
|
|
17
|
+
import type { Size } from '../../lib/planning-types';
|
|
18
|
+
import LinkRuns from './LinkRuns';
|
|
19
|
+
|
|
20
|
+
interface Props {
|
|
21
|
+
title: string;
|
|
22
|
+
titleRuns: LinkRun[];
|
|
23
|
+
size: Size | null;
|
|
24
|
+
rag: CardRag;
|
|
25
|
+
tag: string;
|
|
26
|
+
tagHref: string | null;
|
|
27
|
+
/** Null with no owner: no chip, as the owner filter hides the card. */
|
|
28
|
+
assignee: string | null;
|
|
29
|
+
detail: LinkRun[];
|
|
30
|
+
commentsCount?: number;
|
|
31
|
+
attachmentsCount?: number;
|
|
32
|
+
href: string | null;
|
|
33
|
+
itemId: string | null;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** The kit's low, medium, and high pill colours, by size. */
|
|
37
|
+
const sizeMap: Record<Size, { color: string; bg: string }> = {
|
|
38
|
+
S: { color: '#059669', bg: 'rgba(16, 185, 129, 0.12)' },
|
|
39
|
+
M: { color: '#d97706', bg: 'rgba(245, 158, 11, 0.12)' },
|
|
40
|
+
L: { color: '#dc2626', bg: 'rgba(239, 68, 68, 0.12)' },
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const iconProps = {
|
|
44
|
+
className: 'k-item__icon',
|
|
45
|
+
width: 13,
|
|
46
|
+
height: 13,
|
|
47
|
+
viewBox: '0 0 24 24',
|
|
48
|
+
fill: 'none',
|
|
49
|
+
stroke: 'currentColor',
|
|
50
|
+
strokeWidth: 2,
|
|
51
|
+
strokeLinecap: 'round',
|
|
52
|
+
strokeLinejoin: 'round',
|
|
53
|
+
'aria-hidden': true,
|
|
54
|
+
} as const;
|
|
55
|
+
|
|
56
|
+
export default function KanbanItemCard({ title, titleRuns, size, rag, tag, tagHref, assignee, detail, commentsCount = 0, attachmentsCount = 0, href, itemId }: Props) {
|
|
57
|
+
const pill = size ? sizeMap[size] : null;
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<div className="k-item">
|
|
61
|
+
<div className="k-item__head">
|
|
62
|
+
{tagHref ? (
|
|
63
|
+
<a className="k-item__tag" href={tagHref}>
|
|
64
|
+
{tag}
|
|
65
|
+
</a>
|
|
66
|
+
) : (
|
|
67
|
+
<span className="k-item__tag">{tag}</span>
|
|
68
|
+
)}
|
|
69
|
+
{(pill || rag !== 'none') && (
|
|
70
|
+
<span className="k-item__badges">
|
|
71
|
+
{pill && (
|
|
72
|
+
<span className="k-item__priority" title={`Size ${size}`} style={{ color: pill.color, background: pill.bg, borderColor: `${pill.color}33` }}>
|
|
73
|
+
<span className="k-item__priority-dot" style={{ background: pill.color }}></span>
|
|
74
|
+
{size}
|
|
75
|
+
</span>
|
|
76
|
+
)}
|
|
77
|
+
{rag !== 'none' && <span className="k-item__rag" data-rag={rag} role="img" aria-label={`RAG ${rag}`}></span>}
|
|
78
|
+
</span>
|
|
79
|
+
)}
|
|
80
|
+
</div>
|
|
81
|
+
|
|
82
|
+
<h4 className="k-item__title">
|
|
83
|
+
{href ? (
|
|
84
|
+
<a className="plan-item-link" href={href} data-item={itemId ?? undefined} aria-haspopup={itemId ? 'dialog' : undefined}>
|
|
85
|
+
{title}
|
|
86
|
+
</a>
|
|
87
|
+
) : (
|
|
88
|
+
<LinkRuns runs={titleRuns} />
|
|
89
|
+
)}
|
|
90
|
+
</h4>
|
|
91
|
+
|
|
92
|
+
<div className="k-item__footer">
|
|
93
|
+
<div className="k-item__meta">
|
|
94
|
+
<div className="k-item__meta-item" title="Due Date">
|
|
95
|
+
<svg {...iconProps}>
|
|
96
|
+
<circle cx="12" cy="12" r="10"></circle>
|
|
97
|
+
<polyline points="12 6 12 12 16 14"></polyline>
|
|
98
|
+
</svg>
|
|
99
|
+
<span>
|
|
100
|
+
<LinkRuns runs={detail} />
|
|
101
|
+
</span>
|
|
102
|
+
</div>
|
|
103
|
+
|
|
104
|
+
{commentsCount > 0 && (
|
|
105
|
+
<div className="k-item__meta-item" title={`${commentsCount} comments`}>
|
|
106
|
+
<svg {...iconProps}>
|
|
107
|
+
<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" />
|
|
108
|
+
</svg>
|
|
109
|
+
<span>{commentsCount}</span>
|
|
110
|
+
</div>
|
|
111
|
+
)}
|
|
112
|
+
|
|
113
|
+
{attachmentsCount > 0 && (
|
|
114
|
+
<div className="k-item__meta-item" title={`${attachmentsCount} attachments`}>
|
|
115
|
+
<svg {...iconProps}>
|
|
116
|
+
<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" />
|
|
117
|
+
</svg>
|
|
118
|
+
<span>{attachmentsCount}</span>
|
|
119
|
+
</div>
|
|
120
|
+
)}
|
|
121
|
+
</div>
|
|
122
|
+
|
|
123
|
+
{assignee && (
|
|
124
|
+
<div className="k-item__assignee" title={`Assigned to ${assignee}`}>
|
|
125
|
+
{assignee}
|
|
126
|
+
</div>
|
|
127
|
+
)}
|
|
128
|
+
</div>
|
|
129
|
+
</div>
|
|
130
|
+
);
|
|
131
|
+
}
|
|
@@ -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
|
+
}
|