astryx-dracula 0.4.0 → 0.5.1
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/astryx.integration.mjs +1 -1
- package/icons.mjs +17 -17
- package/icons.tsx +61 -62
- package/package.json +120 -116
- package/shared/auth-chrome-config.ts +6 -6
- package/shared/auth-chrome.tsx +168 -19
- package/shared/auth-copy.ts +14 -14
- package/shared/chaptered-doc-config.ts +48 -51
- package/shared/chaptered-doc.tsx +270 -292
- package/shared/chart-hues.ts +10 -15
- package/shared/chart-labels.tsx +31 -30
- package/shared/chart-legend.tsx +55 -57
- package/shared/chart-panel-style.ts +3 -3
- package/shared/data-bar.tsx +97 -102
- package/shared/format-money.ts +3 -0
- package/shared/gallery-image.ts +6 -6
- package/shared/login-demo.ts +1 -1
- package/shared/metric-card.tsx +123 -0
- package/shared/metric-delta.tsx +28 -27
- package/shared/order-desk.tsx +205 -216
- package/shared/revenue-chart.tsx +145 -165
- package/shared/scene-castle.tsx +206 -291
- package/shared/scene-frame.tsx +33 -32
- package/shared/scene-hues.ts +17 -25
- package/shared/scene-tile.tsx +88 -100
- package/shared/settings-data.ts +132 -104
- package/shared/settings-rows.tsx +143 -163
- package/shared/sparkline.tsx +75 -88
- package/shared/sso-icons.tsx +10 -22
- package/shared/stars.tsx +19 -0
- package/templates/ai-chat-landing.template.mjs +4 -4
- package/templates/ai-chat-landing.tsx +468 -447
- package/templates/ai-chat.template.mjs +4 -4
- package/templates/ai-chat.tsx +561 -645
- package/templates/blank.template.mjs +4 -4
- package/templates/blank.tsx +14 -12
- package/templates/centered-hero.template.mjs +4 -4
- package/templates/centered-hero.tsx +52 -67
- package/templates/classic-gallery.template.mjs +4 -4
- package/templates/classic-gallery.tsx +92 -101
- package/templates/contact-form.template.mjs +4 -4
- package/templates/contact-form.tsx +243 -280
- package/templates/dashboard-portfolio.template.mjs +4 -4
- package/templates/dashboard-portfolio.tsx +723 -634
- package/templates/dashboard.template.mjs +4 -4
- package/templates/dashboard.tsx +592 -682
- package/templates/detail-page.template.mjs +4 -4
- package/templates/detail-page.tsx +537 -598
- package/templates/documentation-design.template.mjs +4 -4
- package/templates/documentation-design.tsx +242 -709
- package/templates/documentation-technical.template.mjs +4 -4
- package/templates/documentation-technical.tsx +233 -258
- package/templates/documentation.template.mjs +4 -4
- package/templates/documentation.tsx +263 -277
- package/templates/editor.template.mjs +4 -4
- package/templates/editor.tsx +847 -899
- package/templates/file-explorer.template.mjs +4 -4
- package/templates/file-explorer.tsx +562 -602
- package/templates/form-two-column.template.mjs +4 -4
- package/templates/form-two-column.tsx +187 -208
- package/templates/gallery-hero.template.mjs +4 -4
- package/templates/gallery-hero.tsx +89 -112
- package/templates/ide.template.mjs +4 -4
- package/templates/ide.tsx +405 -462
- package/templates/incident-console.template.mjs +4 -4
- package/templates/incident-console.tsx +559 -581
- package/templates/kanban-board.template.mjs +4 -4
- package/templates/kanban-board.tsx +660 -729
- package/templates/library.template.mjs +4 -4
- package/templates/library.tsx +405 -452
- package/templates/login-card.template.mjs +4 -4
- package/templates/login-card.tsx +59 -163
- package/templates/login-split.template.mjs +4 -4
- package/templates/login-split.tsx +196 -232
- package/templates/login-sso.template.mjs +4 -4
- package/templates/login-sso.tsx +253 -277
- package/templates/login.template.mjs +4 -4
- package/templates/login.tsx +51 -149
- package/templates/messaging-shell.template.mjs +4 -4
- package/templates/messaging-shell.tsx +596 -624
- package/templates/mixed-gallery.template.mjs +4 -4
- package/templates/mixed-gallery.tsx +56 -56
- package/templates/payment-form.template.mjs +4 -4
- package/templates/payment-form.tsx +877 -990
- package/templates/product-detail.template.mjs +4 -4
- package/templates/product-detail.tsx +251 -302
- package/templates/product-gallery.template.mjs +4 -4
- package/templates/product-gallery.tsx +122 -135
- package/templates/product-tour.template.mjs +4 -4
- package/templates/product-tour.tsx +737 -794
- package/templates/settings-dialog.template.mjs +4 -4
- package/templates/settings-dialog.tsx +694 -747
- package/templates/settings-sidebar.template.mjs +4 -4
- package/templates/settings-sidebar.tsx +768 -848
- package/templates/settings.template.mjs +4 -4
- package/templates/settings.tsx +306 -230
- package/templates/shell-nav.template.mjs +4 -4
- package/templates/shell-nav.tsx +217 -277
- package/templates/shell-side-nav.template.mjs +4 -4
- package/templates/shell-side-nav.tsx +130 -231
- package/templates/shell-top-nav.template.mjs +4 -4
- package/templates/shell-top-nav.tsx +192 -248
- package/templates/side-gallery.template.mjs +4 -4
- package/templates/side-gallery.tsx +87 -94
- package/templates/table-grouped.template.mjs +4 -4
- package/templates/table-grouped.tsx +999 -1201
- package/templates/table-page-chart.template.mjs +4 -4
- package/templates/table-page-chart.tsx +398 -397
- package/templates/table-page-heatmap-status.template.mjs +4 -4
- package/templates/table-page-heatmap-status.tsx +479 -527
- package/templates/table-page-shoe-store-heatmap.template.mjs +4 -4
- package/templates/table-page-shoe-store-heatmap.tsx +746 -746
- package/templates/table-page.template.mjs +4 -4
- package/templates/table-page.tsx +393 -431
- package/templates/table.template.mjs +4 -4
- package/templates/table.tsx +93 -99
- package/templates/tech-report.template.mjs +4 -4
- package/templates/tech-report.tsx +1320 -1324
- package/templates/theme-showcase.template.mjs +4 -4
- package/templates/theme-showcase.tsx +869 -1246
- package/tokens.css +340 -343
|
@@ -2,249 +2,234 @@
|
|
|
2
2
|
// XLE (canonical structure, validated with `bunx astryx layout check`):
|
|
3
3
|
// S > L > (LH[divider] > Tbar > (Hd"Sprint Board"[level=1] + Bd.neutral"8") + (H[g=2] > SE + D.strong + IB"Sort" + IB"Filter" + IB"Search" + B.primary"Add task")) + (LC[p=0] > G[c={min:280,max:4} g=4] > (C.muted[p=0] > L > (LH[divider] > H[j=between a=center] > (H[g=2 a=center] > SD + Hd"To-do"[level=2] + IB) + Tx) + (LC[p=3] > V[g=2] > (C[p=3] > V[g=2] > (H[j=between] > (H[g=2] > Tk + Bd) + MM) + (V[g=1] > Hd[level=3] + Tx) + Tx)*2))*4)
|
|
4
4
|
|
|
5
|
+
import { Badge } from "@astryxdesign/core/Badge";
|
|
6
|
+
import { Button } from "@astryxdesign/core/Button";
|
|
7
|
+
import { Card } from "@astryxdesign/core/Card";
|
|
8
|
+
import { Divider } from "@astryxdesign/core/Divider";
|
|
9
|
+
import { EmptyState } from "@astryxdesign/core/EmptyState";
|
|
10
|
+
import { Grid } from "@astryxdesign/core/Grid";
|
|
11
|
+
import { Icon } from "@astryxdesign/core/Icon";
|
|
12
|
+
import { IconButton } from "@astryxdesign/core/IconButton";
|
|
13
|
+
import { HStack, Layout, LayoutContent, LayoutHeader, VStack } from "@astryxdesign/core/Layout";
|
|
14
|
+
import { MoreMenu } from "@astryxdesign/core/MoreMenu";
|
|
15
|
+
import { Popover } from "@astryxdesign/core/Popover";
|
|
16
|
+
import { Section } from "@astryxdesign/core/Section";
|
|
17
|
+
import { Selector } from "@astryxdesign/core/Selector";
|
|
18
|
+
import { StatusDot } from "@astryxdesign/core/StatusDot";
|
|
19
|
+
import { Heading, Text } from "@astryxdesign/core/Text";
|
|
20
|
+
import { Token } from "@astryxdesign/core/Token";
|
|
21
|
+
import { Toolbar } from "@astryxdesign/core/Toolbar";
|
|
5
22
|
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
Layout,
|
|
17
|
-
LayoutHeader,
|
|
18
|
-
LayoutContent,
|
|
19
|
-
HStack,
|
|
20
|
-
VStack,
|
|
21
|
-
} from '@astryxdesign/core/Layout';
|
|
22
|
-
import {Text, Heading} from '@astryxdesign/core/Text';
|
|
23
|
-
import {Card} from '@astryxdesign/core/Card';
|
|
24
|
-
import {Badge} from '@astryxdesign/core/Badge';
|
|
25
|
-
import {Token} from '@astryxdesign/core/Token';
|
|
26
|
-
import {Button} from '@astryxdesign/core/Button';
|
|
27
|
-
import {IconButton} from '@astryxdesign/core/IconButton';
|
|
28
|
-
import {Icon} from '@astryxdesign/core/Icon';
|
|
29
|
-
import {StatusDot} from '@astryxdesign/core/StatusDot';
|
|
30
|
-
import {EmptyState} from '@astryxdesign/core/EmptyState';
|
|
31
|
-
import {MoreMenu} from '@astryxdesign/core/MoreMenu';
|
|
32
|
-
import {Selector} from '@astryxdesign/core/Selector';
|
|
33
|
-
import {Popover} from '@astryxdesign/core/Popover';
|
|
34
|
-
import {Divider} from '@astryxdesign/core/Divider';
|
|
35
|
-
import {Toolbar} from '@astryxdesign/core/Toolbar';
|
|
36
|
-
import {Section} from '@astryxdesign/core/Section';
|
|
37
|
-
import {Grid} from '@astryxdesign/core/Grid';
|
|
38
|
-
|
|
23
|
+
ArrowUpDown,
|
|
24
|
+
CircleCheck,
|
|
25
|
+
ClipboardCheck,
|
|
26
|
+
Filter,
|
|
27
|
+
Inbox,
|
|
28
|
+
Info,
|
|
29
|
+
Plus,
|
|
30
|
+
RotateCw,
|
|
31
|
+
Search,
|
|
32
|
+
} from "lucide-react";
|
|
39
33
|
import {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
Info,
|
|
48
|
-
ClipboardCheck,
|
|
49
|
-
} from 'lucide-react';
|
|
34
|
+
type KeyboardEvent as ReactKeyboardEvent,
|
|
35
|
+
type ReactNode,
|
|
36
|
+
type PointerEvent as ReactPointerEvent,
|
|
37
|
+
useEffect,
|
|
38
|
+
useRef,
|
|
39
|
+
useState,
|
|
40
|
+
} from "react";
|
|
50
41
|
|
|
51
42
|
// ============= TYPES =============
|
|
52
43
|
|
|
53
|
-
type ColumnId =
|
|
54
|
-
type Priority =
|
|
44
|
+
type ColumnId = "todo" | "in-progress" | "in-review" | "done";
|
|
45
|
+
type Priority = "high" | "medium" | "low";
|
|
55
46
|
|
|
56
47
|
interface WorkItem {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
48
|
+
id: string;
|
|
49
|
+
column: ColumnId;
|
|
50
|
+
ref: string;
|
|
51
|
+
priority: Priority;
|
|
52
|
+
title: string;
|
|
53
|
+
description: string;
|
|
54
|
+
lastEdited: string;
|
|
55
|
+
dueDate: string;
|
|
65
56
|
}
|
|
66
57
|
|
|
67
58
|
interface ColumnMeta {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
59
|
+
id: ColumnId;
|
|
60
|
+
title: string;
|
|
61
|
+
variant: "neutral" | "info" | "warning" | "success";
|
|
62
|
+
tooltip: string;
|
|
63
|
+
emptyTitle: string;
|
|
64
|
+
emptyDescription: string;
|
|
65
|
+
emptyIcon: typeof Inbox;
|
|
75
66
|
}
|
|
76
67
|
|
|
77
68
|
// Where a dragged card will land: a column and an insertion index within it
|
|
78
69
|
// (measured against the cards remaining after the dragged card is removed).
|
|
79
70
|
interface DropTarget {
|
|
80
|
-
|
|
81
|
-
|
|
71
|
+
column: ColumnId;
|
|
72
|
+
index: number;
|
|
82
73
|
}
|
|
83
74
|
|
|
84
75
|
// Live state of an in-progress pointer drag. Coordinates are in viewport space.
|
|
85
76
|
interface DragState {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
77
|
+
id: string;
|
|
78
|
+
width: number;
|
|
79
|
+
height: number;
|
|
80
|
+
offsetX: number;
|
|
81
|
+
offsetY: number;
|
|
82
|
+
pointerX: number;
|
|
83
|
+
pointerY: number;
|
|
84
|
+
target: DropTarget | null;
|
|
94
85
|
}
|
|
95
86
|
|
|
96
87
|
// ============= DATA =============
|
|
97
88
|
|
|
98
89
|
const COLUMNS: ColumnMeta[] = [
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
90
|
+
{
|
|
91
|
+
id: "todo",
|
|
92
|
+
title: "To-do",
|
|
93
|
+
variant: "neutral",
|
|
94
|
+
tooltip: "Palette tasks queued for this sprint, waiting to be picked up.",
|
|
95
|
+
emptyTitle: "To-do is empty",
|
|
96
|
+
emptyDescription: "Tasks pulled into this sprint appear here.",
|
|
97
|
+
emptyIcon: Inbox,
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
id: "in-progress",
|
|
101
|
+
title: "In progress",
|
|
102
|
+
variant: "info",
|
|
103
|
+
tooltip: "Theme work currently on the easel.",
|
|
104
|
+
emptyTitle: "Nothing in progress",
|
|
105
|
+
emptyDescription: "Tasks being worked on appear here.",
|
|
106
|
+
emptyIcon: RotateCw,
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
id: "in-review",
|
|
110
|
+
title: "In review",
|
|
111
|
+
variant: "info",
|
|
112
|
+
tooltip: "Shades waiting for your contrast review.",
|
|
113
|
+
emptyTitle: "Nothing in review",
|
|
114
|
+
emptyDescription: "Tasks awaiting your review appear here.",
|
|
115
|
+
emptyIcon: ClipboardCheck,
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
id: "done",
|
|
119
|
+
title: "Done",
|
|
120
|
+
variant: "success",
|
|
121
|
+
tooltip: "Shipped shades, sealed after dark.",
|
|
122
|
+
emptyTitle: "Nothing done yet",
|
|
123
|
+
emptyDescription: "Completed tasks appear here.",
|
|
124
|
+
emptyIcon: CircleCheck,
|
|
125
|
+
},
|
|
135
126
|
];
|
|
136
127
|
|
|
137
|
-
const PRIORITY_META: Record<
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
high: {label: 'High', variant: 'red'},
|
|
142
|
-
medium: {label: 'Medium', variant: 'yellow'},
|
|
143
|
-
low: {label: 'Low', variant: 'neutral'}, // neutral: low priority is not info
|
|
128
|
+
const PRIORITY_META: Record<Priority, { label: string; variant: "red" | "yellow" | "neutral" }> = {
|
|
129
|
+
high: { label: "High", variant: "red" },
|
|
130
|
+
medium: { label: "Medium", variant: "yellow" },
|
|
131
|
+
low: { label: "Low", variant: "neutral" }, // neutral: low priority is not info
|
|
144
132
|
};
|
|
145
133
|
|
|
146
134
|
function groupByColumn(items: WorkItem[]): Record<ColumnId, WorkItem[]> {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
135
|
+
const map: Record<ColumnId, WorkItem[]> = {
|
|
136
|
+
todo: [],
|
|
137
|
+
"in-progress": [],
|
|
138
|
+
"in-review": [],
|
|
139
|
+
done: [],
|
|
140
|
+
};
|
|
141
|
+
for (const item of items) {
|
|
142
|
+
map[item.column].push(item);
|
|
143
|
+
}
|
|
144
|
+
return map;
|
|
157
145
|
}
|
|
158
146
|
|
|
159
147
|
const INITIAL_ITEMS: WorkItem[] = [
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
lastEdited: '4d ago',
|
|
246
|
-
dueDate: 'Jun 28',
|
|
247
|
-
},
|
|
148
|
+
{
|
|
149
|
+
id: "t1",
|
|
150
|
+
column: "todo",
|
|
151
|
+
ref: "Task 4821",
|
|
152
|
+
priority: "low",
|
|
153
|
+
title: "Draft the palette rollout brief",
|
|
154
|
+
description:
|
|
155
|
+
"Write a short brief outlining goals, scope, and contrast criteria for the Dracula rollout.",
|
|
156
|
+
lastEdited: "2h ago",
|
|
157
|
+
dueDate: "Jul 8",
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
id: "t2",
|
|
161
|
+
column: "todo",
|
|
162
|
+
ref: "Task 4842",
|
|
163
|
+
priority: "low",
|
|
164
|
+
title: "Collect feedback from night-shift reviewers",
|
|
165
|
+
description:
|
|
166
|
+
"Gather input from key reviewers and summarize the main themes for the next review.",
|
|
167
|
+
lastEdited: "1d ago",
|
|
168
|
+
dueDate: "Jul 11",
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
id: "p1",
|
|
172
|
+
column: "in-progress",
|
|
173
|
+
ref: "Task 4825",
|
|
174
|
+
priority: "high",
|
|
175
|
+
title: "Design the midnight landing page",
|
|
176
|
+
description:
|
|
177
|
+
"Create a first-pass layout in pure Dracula and share it for early feedback after dark.",
|
|
178
|
+
lastEdited: "18m ago",
|
|
179
|
+
dueDate: "Jul 3",
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
id: "p2",
|
|
183
|
+
column: "in-progress",
|
|
184
|
+
ref: "Task 4833",
|
|
185
|
+
priority: "medium",
|
|
186
|
+
title: "Set up the theme workspace",
|
|
187
|
+
description: "Configure the shared workspace and invite the coven so everyone has access.",
|
|
188
|
+
lastEdited: "5m ago",
|
|
189
|
+
dueDate: "Jul 4",
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
id: "v1",
|
|
193
|
+
column: "in-review",
|
|
194
|
+
ref: "Task 4831",
|
|
195
|
+
priority: "medium",
|
|
196
|
+
title: "Review the moonlight contrast pass",
|
|
197
|
+
description: "Check the new palette against text and border contrast gates before it ships.",
|
|
198
|
+
lastEdited: "2h ago",
|
|
199
|
+
dueDate: "Jul 5",
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
id: "r1",
|
|
203
|
+
column: "done",
|
|
204
|
+
ref: "Task 4788",
|
|
205
|
+
priority: "low",
|
|
206
|
+
title: "Publish the weekly changelog",
|
|
207
|
+
description:
|
|
208
|
+
"Summarize progress, blockers, and next steps in a short update for the night shift.",
|
|
209
|
+
lastEdited: "Yesterday",
|
|
210
|
+
dueDate: "Jul 1",
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
id: "r2",
|
|
214
|
+
column: "done",
|
|
215
|
+
ref: "Task 4789",
|
|
216
|
+
priority: "high",
|
|
217
|
+
title: "Prepare the midnight demo walkthrough",
|
|
218
|
+
description: "Put together a candlelit walkthrough covering the main haunts for the demo.",
|
|
219
|
+
lastEdited: "3d ago",
|
|
220
|
+
dueDate: "Jun 30",
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
id: "r3",
|
|
224
|
+
column: "done",
|
|
225
|
+
ref: "Task 4790",
|
|
226
|
+
priority: "medium",
|
|
227
|
+
title: "Review and merge open pull requests",
|
|
228
|
+
description:
|
|
229
|
+
"Go through the pending bloodlines, leave comments, and merge the ones that are ready.",
|
|
230
|
+
lastEdited: "4d ago",
|
|
231
|
+
dueDate: "Jun 28",
|
|
232
|
+
},
|
|
248
233
|
];
|
|
249
234
|
|
|
250
235
|
// Pointer travel (px) before a press is promoted to a drag, so taps and clicks
|
|
@@ -253,553 +238,499 @@ const DRAG_THRESHOLD = 5;
|
|
|
253
238
|
|
|
254
239
|
// ============= STYLES =============
|
|
255
240
|
|
|
256
|
-
// Responsive board grid: columns collapse to fewer tracks, then a single
|
|
257
|
-
// stack. The board keeps its own internal scroll as the only scroller;
|
|
258
|
-
// grid children get room to shrink so nothing forces page-level scroll.
|
|
259
|
-
const boardColumnsStyle: CSSProperties = {
|
|
260
|
-
overflowX: 'auto',
|
|
261
|
-
overflowY: 'auto',
|
|
262
|
-
height: '100%',
|
|
263
|
-
padding: 'var(--spacing-6)',
|
|
264
|
-
};
|
|
265
|
-
const columnShellStyle: CSSProperties = {
|
|
266
|
-
minWidth: 0,
|
|
267
|
-
height: '100%',
|
|
268
|
-
};
|
|
269
|
-
// Cards stay static per the Dracula brand (no hover lift); the floating drag
|
|
270
|
-
// clone floats above the board with the high shadow token instead.
|
|
271
|
-
const cardStyle: CSSProperties = {
|
|
272
|
-
cursor: 'grab',
|
|
273
|
-
userSelect: 'none',
|
|
274
|
-
touchAction: 'none',
|
|
275
|
-
};
|
|
276
241
|
// The dragged card is lifted out of flow and follows the pointer. It ignores
|
|
277
242
|
// pointer events so hit-testing reads the columns underneath it. The clone
|
|
278
243
|
// rides above shell chrome (layered 0-3) but stays under overlay surfaces
|
|
279
244
|
// (menus, dialogs layer at 500+ plus the top layer), so an open menu wins.
|
|
280
245
|
const DRAG_CLONE_LAYER = 100;
|
|
281
|
-
const floatingStyle: CSSProperties = {
|
|
282
|
-
position: 'fixed',
|
|
283
|
-
insetBlockStart: 0,
|
|
284
|
-
insetInlineStart: 0,
|
|
285
|
-
pointerEvents: 'none',
|
|
286
|
-
cursor: 'grabbing',
|
|
287
|
-
zIndex: DRAG_CLONE_LAYER,
|
|
288
|
-
};
|
|
289
|
-
// Placeholder marking the landing slot; matches the dragged card's height.
|
|
290
|
-
const ghostStyle = (height: number): CSSProperties => ({
|
|
291
|
-
height,
|
|
292
|
-
borderRadius: 'var(--radius-element)',
|
|
293
|
-
backgroundColor: 'var(--color-background-muted)',
|
|
294
|
-
});
|
|
295
|
-
const toolbarDividerStyle: CSSProperties = {
|
|
296
|
-
alignSelf: 'stretch',
|
|
297
|
-
};
|
|
298
|
-
const columnEmptyStateStyle: CSSProperties = {
|
|
299
|
-
// 12px, not 24. This applies to an EmptyState inside a LayoutContent
|
|
300
|
-
// padding={3} (12px), so 24 rendered as 36px of block air on the empty
|
|
301
|
-
// branch against 12px on the populated one -- a 3x difference between two
|
|
302
|
-
// states of the same column, and the only nested inset in the kit that
|
|
303
|
-
// exceeded its container. The block padding is the CONTAINER's job; this
|
|
304
|
-
// one is the placeholder's room to breathe inside it.
|
|
305
|
-
paddingBlock: 'var(--spacing-3)',
|
|
306
|
-
};
|
|
307
|
-
|
|
308
246
|
// ============= CARD BODY =============
|
|
309
247
|
|
|
310
248
|
// Shared card contents, rendered both in the column list and inside the
|
|
311
249
|
// floating drag clone so the two stay pixel-identical.
|
|
312
250
|
function BoardCardBody({
|
|
313
|
-
|
|
314
|
-
|
|
251
|
+
item,
|
|
252
|
+
onMove,
|
|
315
253
|
}: {
|
|
316
|
-
|
|
317
|
-
|
|
254
|
+
item: WorkItem;
|
|
255
|
+
onMove: (id: string, to: ColumnId) => void;
|
|
318
256
|
}) {
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
257
|
+
const priority = PRIORITY_META[item.priority];
|
|
258
|
+
const moveTargets = COLUMNS.filter((c) => c.id !== item.column).map((c) => ({
|
|
259
|
+
label: `Move to ${c.title}`,
|
|
260
|
+
onClick: () => onMove(item.id, c.id),
|
|
261
|
+
}));
|
|
262
|
+
|
|
263
|
+
return (
|
|
264
|
+
<VStack gap={2}>
|
|
265
|
+
<HStack hAlign="between" vAlign="start">
|
|
266
|
+
<HStack gap={2} vAlign="center" wrap="wrap">
|
|
267
|
+
<Token label={item.ref} size="sm" />
|
|
268
|
+
<Badge label={priority.label} variant={priority.variant} />
|
|
269
|
+
</HStack>
|
|
270
|
+
<MoreMenu
|
|
271
|
+
label="Work item actions"
|
|
272
|
+
size="sm"
|
|
273
|
+
items={[
|
|
274
|
+
{ label: "Open" },
|
|
275
|
+
{ label: "Assign to me" },
|
|
276
|
+
{ type: "divider" },
|
|
277
|
+
...moveTargets,
|
|
278
|
+
]}
|
|
279
|
+
/>
|
|
280
|
+
</HStack>
|
|
281
|
+
|
|
282
|
+
<VStack gap={1}>
|
|
283
|
+
<Heading level={3}>{item.title}</Heading>
|
|
284
|
+
<Text type="body" color="secondary" maxLines={2}>
|
|
285
|
+
{item.description}
|
|
286
|
+
</Text>
|
|
287
|
+
</VStack>
|
|
288
|
+
|
|
289
|
+
<Text type="supporting" color="secondary">
|
|
290
|
+
Edited {item.lastEdited} · Due {item.dueDate}
|
|
291
|
+
</Text>
|
|
292
|
+
</VStack>
|
|
293
|
+
);
|
|
356
294
|
}
|
|
357
295
|
|
|
358
296
|
// ============= BOARD CARD =============
|
|
359
297
|
|
|
360
298
|
function BoardCard({
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
299
|
+
item,
|
|
300
|
+
cardRef,
|
|
301
|
+
onPointerDown,
|
|
302
|
+
onMove,
|
|
365
303
|
}: {
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
304
|
+
item: WorkItem;
|
|
305
|
+
cardRef: (el: HTMLDivElement | null) => void;
|
|
306
|
+
onPointerDown: (e: ReactPointerEvent, id: string) => void;
|
|
307
|
+
onMove: (id: string, to: ColumnId) => void;
|
|
370
308
|
}) {
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
309
|
+
// Keyboard-move path for the core drag interaction: arrow keys move the
|
|
310
|
+
// focused card across columns. The pointer DnD below stays quarantined and
|
|
311
|
+
// untouched; this only reuses its moveItem commit.
|
|
312
|
+
const onKeyDown = (e: ReactKeyboardEvent) => {
|
|
313
|
+
const at = COLUMNS.findIndex((c) => c.id === item.column);
|
|
314
|
+
const to =
|
|
315
|
+
e.key === "ArrowRight"
|
|
316
|
+
? COLUMNS[Math.min(COLUMNS.length - 1, at + 1)]
|
|
317
|
+
: e.key === "ArrowLeft"
|
|
318
|
+
? COLUMNS[Math.max(0, at - 1)]
|
|
319
|
+
: undefined;
|
|
320
|
+
if (!to || to.id === item.column) {
|
|
321
|
+
return;
|
|
322
|
+
}
|
|
323
|
+
e.preventDefault();
|
|
324
|
+
onMove(item.id, to.id);
|
|
325
|
+
};
|
|
326
|
+
return (
|
|
327
|
+
<Card
|
|
328
|
+
ref={cardRef}
|
|
329
|
+
padding={3}
|
|
330
|
+
// Cards stay static per the Dracula brand (no hover lift); the floating
|
|
331
|
+
// drag clone floats above the board with the high shadow token instead.
|
|
332
|
+
style={{ cursor: "grab", userSelect: "none", touchAction: "none" }}
|
|
333
|
+
tabIndex={0}
|
|
334
|
+
role="button"
|
|
335
|
+
aria-label={`${item.title}. In ${COLUMNS.find((c) => c.id === item.column)?.title}. Press left or right arrow to move across columns.`}
|
|
336
|
+
onPointerDown={(e) => onPointerDown(e, item.id)}
|
|
337
|
+
onKeyDown={onKeyDown}
|
|
338
|
+
>
|
|
339
|
+
<BoardCardBody item={item} onMove={onMove} />
|
|
340
|
+
</Card>
|
|
341
|
+
);
|
|
401
342
|
}
|
|
402
343
|
|
|
403
344
|
// ============= BOARD COLUMN =============
|
|
404
345
|
|
|
405
346
|
function BoardColumn({
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
347
|
+
meta,
|
|
348
|
+
count,
|
|
349
|
+
contentRef,
|
|
350
|
+
children,
|
|
410
351
|
}: {
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
352
|
+
meta: ColumnMeta;
|
|
353
|
+
count: number;
|
|
354
|
+
contentRef: (el: HTMLDivElement | null) => void;
|
|
355
|
+
children: ReactNode;
|
|
415
356
|
}) {
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
357
|
+
return (
|
|
358
|
+
<Card variant="muted" padding={0} style={{ minWidth: 0, height: "100%" }}>
|
|
359
|
+
<Layout
|
|
360
|
+
height="fill"
|
|
361
|
+
header={
|
|
362
|
+
<LayoutHeader hasDivider padding={3}>
|
|
363
|
+
<HStack hAlign="between" vAlign="center">
|
|
364
|
+
<HStack gap={1} vAlign="center">
|
|
365
|
+
<StatusDot
|
|
366
|
+
variant={meta.variant}
|
|
367
|
+
label={`${meta.title} status`}
|
|
368
|
+
isPulsing={meta.id === "in-progress" || meta.id === "in-review"}
|
|
369
|
+
/>
|
|
370
|
+
<Heading level={2}>{meta.title}</Heading>
|
|
371
|
+
<Popover
|
|
372
|
+
placement="below"
|
|
373
|
+
width="min(20rem, calc(100vw - 2 * var(--space-viewport)))"
|
|
374
|
+
label={`${meta.title} column help`}
|
|
375
|
+
content={
|
|
376
|
+
<Text type="body" color="secondary">
|
|
377
|
+
{meta.tooltip}
|
|
378
|
+
</Text>
|
|
379
|
+
}
|
|
380
|
+
>
|
|
381
|
+
<IconButton
|
|
382
|
+
label={`About the ${meta.title} column`}
|
|
383
|
+
icon={<Icon icon={Info} size="sm" />}
|
|
384
|
+
variant="ghost"
|
|
385
|
+
size="sm"
|
|
386
|
+
/>
|
|
387
|
+
</Popover>
|
|
388
|
+
</HStack>
|
|
389
|
+
<Text type="supporting" color="secondary" hasTabularNumbers>
|
|
390
|
+
{count}
|
|
391
|
+
</Text>
|
|
392
|
+
</HStack>
|
|
393
|
+
</LayoutHeader>
|
|
394
|
+
}
|
|
395
|
+
content={
|
|
396
|
+
<LayoutContent ref={contentRef} padding={3}>
|
|
397
|
+
{children ?? (
|
|
398
|
+
<EmptyState
|
|
399
|
+
isCompact
|
|
400
|
+
// 12px, not 24: this EmptyState sits inside a LayoutContent
|
|
401
|
+
// padding={3} (12px), so 24 would render as 36px of block air
|
|
402
|
+
// on the empty branch against 12px on the populated one.
|
|
403
|
+
style={{ paddingBlock: "var(--spacing-3)" }}
|
|
404
|
+
icon={<Icon icon={meta.emptyIcon} size="lg" color="secondary" />}
|
|
405
|
+
title={meta.emptyTitle}
|
|
406
|
+
description={meta.emptyDescription}
|
|
407
|
+
/>
|
|
408
|
+
)}
|
|
409
|
+
</LayoutContent>
|
|
410
|
+
}
|
|
411
|
+
/>
|
|
412
|
+
</Card>
|
|
413
|
+
);
|
|
471
414
|
}
|
|
472
415
|
|
|
473
416
|
// ============= MAIN =============
|
|
474
417
|
|
|
475
418
|
export default function KanbanBoard() {
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
elevation="none"
|
|
794
|
-
style={{
|
|
795
|
-
...floatingStyle,
|
|
796
|
-
width: drag.width,
|
|
797
|
-
borderColor: 'var(--color-border-emphasized)',
|
|
798
|
-
transform: `translate(${drag.pointerX - drag.offsetX}px, ${drag.pointerY - drag.offsetY}px)`,
|
|
799
|
-
}}>
|
|
800
|
-
<BoardCardBody item={draggedItem} onMove={() => {}} />
|
|
801
|
-
</Card>
|
|
802
|
-
) : null}
|
|
803
|
-
</Section>
|
|
804
|
-
);
|
|
419
|
+
const [items, setItems] = useState<WorkItem[]>(INITIAL_ITEMS);
|
|
420
|
+
const [sprint, setSprint] = useState("003");
|
|
421
|
+
const [drag, setDrag] = useState<DragState | null>(null);
|
|
422
|
+
|
|
423
|
+
// Live element registries for pointer hit-testing (kept out of render state).
|
|
424
|
+
const columnEls = useRef(new Map<ColumnId, HTMLElement>());
|
|
425
|
+
const cardEls = useRef(new Map<string, HTMLElement>());
|
|
426
|
+
const columnRefCbs = useRef(new Map<ColumnId, (el: HTMLDivElement | null) => void>());
|
|
427
|
+
const cardRefCbs = useRef(new Map<string, (el: HTMLDivElement | null) => void>());
|
|
428
|
+
const teardownRef = useRef<(() => void) | null>(null);
|
|
429
|
+
|
|
430
|
+
// One helper for both registries: stable per-key ref callbacks so
|
|
431
|
+
// registering an element never churns across renders.
|
|
432
|
+
function refCallback<K>(
|
|
433
|
+
cbs: Map<K, (el: HTMLDivElement | null) => void>,
|
|
434
|
+
els: Map<K, HTMLElement>,
|
|
435
|
+
key: K,
|
|
436
|
+
) {
|
|
437
|
+
let cb = cbs.get(key);
|
|
438
|
+
if (!cb) {
|
|
439
|
+
cb = (el) => {
|
|
440
|
+
if (el) {
|
|
441
|
+
els.set(key, el);
|
|
442
|
+
} else {
|
|
443
|
+
els.delete(key);
|
|
444
|
+
}
|
|
445
|
+
};
|
|
446
|
+
cbs.set(key, cb);
|
|
447
|
+
}
|
|
448
|
+
return cb;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
const itemsByColumn = groupByColumn(items);
|
|
452
|
+
|
|
453
|
+
const moveItem = (id: string, to: ColumnId) => {
|
|
454
|
+
setItems((prev) => prev.map((item) => (item.id === id ? { ...item, column: to } : item)));
|
|
455
|
+
};
|
|
456
|
+
|
|
457
|
+
// Resolve the pointer position to a column + insertion index, ignoring the
|
|
458
|
+
// card being dragged so the math is against the cards that stay in place.
|
|
459
|
+
const computeTarget = (px: number, py: number, draggedId: string): DropTarget | null => {
|
|
460
|
+
for (const [colId, el] of Array.from(columnEls.current.entries())) {
|
|
461
|
+
const r = el.getBoundingClientRect();
|
|
462
|
+
if (px < r.left || px > r.right || py < r.top || py > r.bottom) {
|
|
463
|
+
continue;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
const ids: string[] = [];
|
|
467
|
+
for (const it of itemsByColumn[colId]) {
|
|
468
|
+
if (it.id !== draggedId) {
|
|
469
|
+
ids.push(it.id);
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
let index = ids.length;
|
|
474
|
+
for (let i = 0; i < ids.length; i++) {
|
|
475
|
+
const cardEl = cardEls.current.get(ids[i]);
|
|
476
|
+
if (!cardEl) {
|
|
477
|
+
continue;
|
|
478
|
+
}
|
|
479
|
+
const cr = cardEl.getBoundingClientRect();
|
|
480
|
+
if (py < cr.top + cr.height / 2) {
|
|
481
|
+
index = i;
|
|
482
|
+
break;
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
return { column: colId, index };
|
|
486
|
+
}
|
|
487
|
+
return null;
|
|
488
|
+
};
|
|
489
|
+
|
|
490
|
+
// Rebuild the flat item list so the dragged card lands at the resolved slot
|
|
491
|
+
// while every other card keeps its relative order.
|
|
492
|
+
const commitDrag = (id: string, target: DropTarget) => {
|
|
493
|
+
setItems((prev) => {
|
|
494
|
+
const moved = prev.find((it) => it.id === id);
|
|
495
|
+
if (!moved) {
|
|
496
|
+
return prev;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
const rest = prev.filter((it) => it.id !== id);
|
|
500
|
+
const updated: WorkItem = { ...moved, column: target.column };
|
|
501
|
+
const colItems = rest.filter((it) => it.column === target.column);
|
|
502
|
+
const anchor = colItems[target.index];
|
|
503
|
+
|
|
504
|
+
if (!anchor) {
|
|
505
|
+
return [...rest, updated];
|
|
506
|
+
}
|
|
507
|
+
const at = rest.indexOf(anchor);
|
|
508
|
+
return [...rest.slice(0, at), updated, ...rest.slice(at)];
|
|
509
|
+
});
|
|
510
|
+
};
|
|
511
|
+
|
|
512
|
+
const onCardPointerDown = (e: ReactPointerEvent, id: string) => {
|
|
513
|
+
if (e.button !== 0) {
|
|
514
|
+
return;
|
|
515
|
+
}
|
|
516
|
+
// Let the card's own controls (the actions menu) handle the press.
|
|
517
|
+
if ((e.target as HTMLElement).closest('button, [role="menuitem"], [role="menu"]')) {
|
|
518
|
+
return;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
const el = cardEls.current.get(id);
|
|
522
|
+
if (!el) {
|
|
523
|
+
return;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
const rect = el.getBoundingClientRect();
|
|
527
|
+
const startX = e.clientX;
|
|
528
|
+
const startY = e.clientY;
|
|
529
|
+
const offsetX = startX - rect.left;
|
|
530
|
+
const offsetY = startY - rect.top;
|
|
531
|
+
const { width, height } = rect;
|
|
532
|
+
|
|
533
|
+
let started = false;
|
|
534
|
+
let target: DropTarget | null = null;
|
|
535
|
+
|
|
536
|
+
const onMove = (ev: PointerEvent) => {
|
|
537
|
+
if (
|
|
538
|
+
!started &&
|
|
539
|
+
Math.abs(ev.clientX - startX) + Math.abs(ev.clientY - startY) < DRAG_THRESHOLD
|
|
540
|
+
) {
|
|
541
|
+
return;
|
|
542
|
+
}
|
|
543
|
+
started = true;
|
|
544
|
+
target = computeTarget(ev.clientX, ev.clientY, id);
|
|
545
|
+
setDrag({
|
|
546
|
+
id,
|
|
547
|
+
width,
|
|
548
|
+
height,
|
|
549
|
+
offsetX,
|
|
550
|
+
offsetY,
|
|
551
|
+
pointerX: ev.clientX,
|
|
552
|
+
pointerY: ev.clientY,
|
|
553
|
+
target,
|
|
554
|
+
});
|
|
555
|
+
};
|
|
556
|
+
|
|
557
|
+
const onUp = () => {
|
|
558
|
+
teardownRef.current?.();
|
|
559
|
+
if (started && target) {
|
|
560
|
+
commitDrag(id, target);
|
|
561
|
+
}
|
|
562
|
+
setDrag(null);
|
|
563
|
+
};
|
|
564
|
+
|
|
565
|
+
const teardown = () => {
|
|
566
|
+
window.removeEventListener("pointermove", onMove);
|
|
567
|
+
window.removeEventListener("pointerup", onUp);
|
|
568
|
+
teardownRef.current = null;
|
|
569
|
+
};
|
|
570
|
+
teardownRef.current = teardown;
|
|
571
|
+
|
|
572
|
+
window.addEventListener("pointermove", onMove);
|
|
573
|
+
window.addEventListener("pointerup", onUp);
|
|
574
|
+
};
|
|
575
|
+
|
|
576
|
+
const draggedItem = drag ? items.find((it) => it.id === drag.id) : undefined;
|
|
577
|
+
const isDragging = drag !== null;
|
|
578
|
+
|
|
579
|
+
// Suppress selection while dragging and detach listeners on unmount.
|
|
580
|
+
useEffect(() => {
|
|
581
|
+
if (!isDragging) {
|
|
582
|
+
return;
|
|
583
|
+
}
|
|
584
|
+
const previous = document.body.style.userSelect;
|
|
585
|
+
document.body.style.userSelect = "none";
|
|
586
|
+
return () => {
|
|
587
|
+
document.body.style.userSelect = previous;
|
|
588
|
+
};
|
|
589
|
+
}, [isDragging]);
|
|
590
|
+
|
|
591
|
+
useEffect(() => () => teardownRef.current?.(), []);
|
|
592
|
+
|
|
593
|
+
// Card nodes for a column, or null when the column should show its empty
|
|
594
|
+
// state. A dashed ghost box marks the landing slot during a drag.
|
|
595
|
+
const renderColumnCards = (colId: ColumnId): ReactNode => {
|
|
596
|
+
const colItems = itemsByColumn[colId];
|
|
597
|
+
const visible = drag ? colItems.filter((it) => it.id !== drag.id) : colItems;
|
|
598
|
+
const ghostTarget = drag && drag.target && drag.target.column === colId ? drag : null;
|
|
599
|
+
|
|
600
|
+
if (visible.length === 0 && !ghostTarget) {
|
|
601
|
+
return null;
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
const nodes: ReactNode[] = visible.map((it) => (
|
|
605
|
+
<BoardCard
|
|
606
|
+
key={it.id}
|
|
607
|
+
item={it}
|
|
608
|
+
cardRef={refCallback(cardRefCbs.current, cardEls.current, it.id)}
|
|
609
|
+
onPointerDown={onCardPointerDown}
|
|
610
|
+
onMove={moveItem}
|
|
611
|
+
/>
|
|
612
|
+
));
|
|
613
|
+
|
|
614
|
+
if (ghostTarget && ghostTarget.target) {
|
|
615
|
+
const index = Math.min(ghostTarget.target.index, nodes.length);
|
|
616
|
+
nodes.splice(
|
|
617
|
+
index,
|
|
618
|
+
0,
|
|
619
|
+
<VStack
|
|
620
|
+
key="drag-ghost"
|
|
621
|
+
// Placeholder marking the landing slot; matches the dragged card's height.
|
|
622
|
+
style={{
|
|
623
|
+
height: ghostTarget.height,
|
|
624
|
+
borderRadius: "var(--radius-element)",
|
|
625
|
+
backgroundColor: "var(--color-background-muted)",
|
|
626
|
+
}}
|
|
627
|
+
/>,
|
|
628
|
+
);
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
return <VStack gap={2}>{nodes}</VStack>;
|
|
632
|
+
};
|
|
633
|
+
|
|
634
|
+
return (
|
|
635
|
+
<Section height="100dvh">
|
|
636
|
+
<Layout
|
|
637
|
+
height="fill"
|
|
638
|
+
header={
|
|
639
|
+
<LayoutHeader hasDivider padding={6}>
|
|
640
|
+
<Toolbar
|
|
641
|
+
label="Board actions"
|
|
642
|
+
gap={2}
|
|
643
|
+
startContent={
|
|
644
|
+
<>
|
|
645
|
+
<Heading level={1} type="display-2">
|
|
646
|
+
Sprint Board
|
|
647
|
+
</Heading>
|
|
648
|
+
<Badge label={items.length} variant="neutral" />
|
|
649
|
+
</>
|
|
650
|
+
}
|
|
651
|
+
endContent={
|
|
652
|
+
<HStack gap={2} wrap="wrap">
|
|
653
|
+
<Selector
|
|
654
|
+
label="Sprint"
|
|
655
|
+
size="lg"
|
|
656
|
+
width={160}
|
|
657
|
+
isLabelHidden
|
|
658
|
+
value={sprint}
|
|
659
|
+
onChange={setSprint}
|
|
660
|
+
options={[
|
|
661
|
+
{ value: "003", label: "Sprint 003" },
|
|
662
|
+
{ value: "002", label: "Sprint 002" },
|
|
663
|
+
{ value: "001", label: "Sprint 001" },
|
|
664
|
+
]}
|
|
665
|
+
/>
|
|
666
|
+
<Divider
|
|
667
|
+
variant="strong"
|
|
668
|
+
orientation="vertical"
|
|
669
|
+
style={{ alignSelf: "stretch" }}
|
|
670
|
+
/>
|
|
671
|
+
<HStack gap={1} vAlign="center" wrap="wrap">
|
|
672
|
+
<IconButton icon={<Icon icon={ArrowUpDown} size="sm" />} label="Sort" />
|
|
673
|
+
<IconButton icon={<Icon icon={Filter} size="sm" />} label="Filter" />
|
|
674
|
+
<IconButton icon={<Icon icon={Search} size="sm" />} label="Search" />
|
|
675
|
+
</HStack>
|
|
676
|
+
<Button
|
|
677
|
+
label="Add task"
|
|
678
|
+
variant="primary"
|
|
679
|
+
icon={<Icon icon={Plus} size="sm" />}
|
|
680
|
+
/>
|
|
681
|
+
</HStack>
|
|
682
|
+
}
|
|
683
|
+
/>
|
|
684
|
+
</LayoutHeader>
|
|
685
|
+
}
|
|
686
|
+
content={
|
|
687
|
+
<LayoutContent padding={0} isScrollable={false}>
|
|
688
|
+
<Grid
|
|
689
|
+
columns={{ minWidth: 280, max: 4 }}
|
|
690
|
+
gap={4}
|
|
691
|
+
style={{
|
|
692
|
+
overflowX: "auto",
|
|
693
|
+
overflowY: "auto",
|
|
694
|
+
height: "100%",
|
|
695
|
+
padding: "var(--spacing-6)",
|
|
696
|
+
}}
|
|
697
|
+
tabIndex={0}
|
|
698
|
+
role="region"
|
|
699
|
+
aria-label="Sprint board columns"
|
|
700
|
+
>
|
|
701
|
+
{COLUMNS.map((meta) => (
|
|
702
|
+
<BoardColumn
|
|
703
|
+
key={meta.id}
|
|
704
|
+
meta={meta}
|
|
705
|
+
count={itemsByColumn[meta.id].length}
|
|
706
|
+
contentRef={refCallback(columnRefCbs.current, columnEls.current, meta.id)}
|
|
707
|
+
>
|
|
708
|
+
{renderColumnCards(meta.id)}
|
|
709
|
+
</BoardColumn>
|
|
710
|
+
))}
|
|
711
|
+
</Grid>
|
|
712
|
+
</LayoutContent>
|
|
713
|
+
}
|
|
714
|
+
/>
|
|
715
|
+
{drag && draggedItem ? (
|
|
716
|
+
<Card
|
|
717
|
+
padding={3}
|
|
718
|
+
elevation="none"
|
|
719
|
+
style={{
|
|
720
|
+
position: "fixed",
|
|
721
|
+
insetBlockStart: 0,
|
|
722
|
+
insetInlineStart: 0,
|
|
723
|
+
pointerEvents: "none",
|
|
724
|
+
cursor: "grabbing",
|
|
725
|
+
zIndex: DRAG_CLONE_LAYER,
|
|
726
|
+
width: drag.width,
|
|
727
|
+
borderColor: "var(--color-border-emphasized)",
|
|
728
|
+
transform: `translate(${drag.pointerX - drag.offsetX}px, ${drag.pointerY - drag.offsetY}px)`,
|
|
729
|
+
}}
|
|
730
|
+
>
|
|
731
|
+
<BoardCardBody item={draggedItem} onMove={() => {}} />
|
|
732
|
+
</Card>
|
|
733
|
+
) : null}
|
|
734
|
+
</Section>
|
|
735
|
+
);
|
|
805
736
|
}
|