@burdenoff/microfe-planmagnet 2026.930.9 → 2026.930.10
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TasksTasksPagePage.d.ts","sourceRoot":"","sources":["../../../src/planmagnet/pages/TasksTasksPagePage.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TasksTasksPagePage.d.ts","sourceRoot":"","sources":["../../../src/planmagnet/pages/TasksTasksPagePage.tsx"],"names":[],"mappings":"AAoJA,wBAAgB,kBAAkB,4CAgSjC"}
|
|
@@ -2,8 +2,9 @@ import { usePlanMagnet as e, usePlanMagnetNavigate as t } from "../providers/Pla
|
|
|
2
2
|
import { PersonName as n } from "../people/People.js";
|
|
3
3
|
import { countLabel as r } from "../hooks/useCounts.js";
|
|
4
4
|
import { rowLinkProps as i } from "../utils/rowNavigation.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { readViewIdFromUrl as a } from "../board/boardViewConfig.js";
|
|
6
|
+
import { ProjectBoard as o } from "../board/ProjectBoard.js";
|
|
7
|
+
import { ExportWorkItemsButton as ee } from "../export/ExportWorkItemsButton.js";
|
|
7
8
|
import { useState as s } from "react";
|
|
8
9
|
import { Bot as c, FileUp as l, Filter as u } from "lucide-react";
|
|
9
10
|
import { gql as d } from "@apollo/client";
|
|
@@ -85,44 +86,54 @@ var y = d`
|
|
|
85
86
|
TESTING: "border-t-teal-400",
|
|
86
87
|
DONE: "border-t-green-400",
|
|
87
88
|
CANCELLED: "border-t-muted-foreground"
|
|
88
|
-
},
|
|
89
|
+
}, te = {
|
|
89
90
|
LOW: "bg-gray-100 text-gray-700",
|
|
90
91
|
MEDIUM: "bg-blue-100 text-blue-700",
|
|
91
92
|
HIGH: "bg-orange-100 text-orange-700",
|
|
92
93
|
CRITICAL: "bg-red-100 text-red-700"
|
|
93
|
-
},
|
|
94
|
+
}, ne = {
|
|
94
95
|
STORY: "bg-green-100 text-green-700",
|
|
95
96
|
BUG: "bg-red-100 text-red-700",
|
|
96
97
|
TASK: "bg-blue-100 text-blue-700",
|
|
97
98
|
EPIC: "bg-purple-100 text-purple-700",
|
|
98
99
|
SUB_TASK: "bg-gray-100 text-gray-700"
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
}, E = d`
|
|
101
|
+
query TasksLinkedBoardView($id: ID!) {
|
|
102
|
+
planmagnetBoardView(id: $id) {
|
|
103
|
+
id
|
|
104
|
+
projectId
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
`;
|
|
108
|
+
function D() {
|
|
109
|
+
let { workspaceId: d } = e(), D = t(), [O, k] = s("all"), [A, j] = s("all"), [M, N] = s(null), { data: P } = f(S, {
|
|
102
110
|
variables: { workspaceId: d },
|
|
103
111
|
skip: !d
|
|
104
|
-
}),
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
},
|
|
112
|
+
}), F = P?.planmagnetProjects?.items ?? [], [I] = s(a), { data: L, error: R } = f(E, {
|
|
113
|
+
variables: { id: I ?? "" },
|
|
114
|
+
skip: !I || M !== null
|
|
115
|
+
}), z = L?.planmagnetBoardView?.projectId ?? null, B = !!I && M === null && !L && !R, V = M ?? z ?? (B ? "" : F[0]?.id ?? ""), H = F.find((e) => e.id === V)?.name ?? "", U = {
|
|
116
|
+
...O !== "all" && { priority: O.toUpperCase() },
|
|
117
|
+
...A !== "all" && { type: A.toUpperCase() }
|
|
118
|
+
}, [W, G] = s(!1), { data: K, loading: q, error: J, fetchMore: Y } = f(y, {
|
|
108
119
|
variables: {
|
|
109
120
|
workspaceId: d,
|
|
110
|
-
filter:
|
|
121
|
+
filter: U,
|
|
111
122
|
pagination: { first: x }
|
|
112
123
|
},
|
|
113
|
-
skip: !d || !!
|
|
114
|
-
}), { data:
|
|
124
|
+
skip: !d || !!V || B
|
|
125
|
+
}), { data: X } = f(b, {
|
|
115
126
|
variables: {
|
|
116
127
|
workspaceId: d,
|
|
117
|
-
filter:
|
|
128
|
+
filter: V ? { projectId: V } : U
|
|
118
129
|
},
|
|
119
130
|
skip: !d
|
|
120
|
-
}),
|
|
121
|
-
let e =
|
|
131
|
+
}), re = async () => {
|
|
132
|
+
let e = K?.planmagnetWorkItems?.pageInfo?.endCursor;
|
|
122
133
|
if (e) {
|
|
123
|
-
|
|
134
|
+
G(!0);
|
|
124
135
|
try {
|
|
125
|
-
await
|
|
136
|
+
await Y({
|
|
126
137
|
variables: { pagination: {
|
|
127
138
|
first: x,
|
|
128
139
|
after: e
|
|
@@ -133,19 +144,19 @@ function O() {
|
|
|
133
144
|
} })
|
|
134
145
|
});
|
|
135
146
|
} finally {
|
|
136
|
-
|
|
147
|
+
G(!1);
|
|
137
148
|
}
|
|
138
149
|
}
|
|
139
150
|
};
|
|
140
|
-
if (
|
|
151
|
+
if (q && !K) return /* @__PURE__ */ m("div", {
|
|
141
152
|
className: "flex items-center justify-center p-12",
|
|
142
153
|
children: /* @__PURE__ */ m("div", { className: "animate-spin h-8 w-8 border-2 border-primary border-t-transparent rounded-full" })
|
|
143
154
|
});
|
|
144
|
-
if (
|
|
155
|
+
if (J) return /* @__PURE__ */ h("div", {
|
|
145
156
|
className: "p-6 text-red-500",
|
|
146
|
-
children: ["Error: ",
|
|
157
|
+
children: ["Error: ", J.message]
|
|
147
158
|
});
|
|
148
|
-
let
|
|
159
|
+
let Z = K?.planmagnetWorkItems?.items ?? [], Q = X?.planmagnetWorkItemCounts, $ = Q?.total ?? (V ? void 0 : K?.planmagnetWorkItems?.totalCount), ie = (e) => Q ? Q.byStatus.find((t) => t.status === e)?.count ?? 0 : void 0, ae = K?.planmagnetWorkItems?.pageInfo?.hasNextPage ?? !1;
|
|
149
160
|
return /* @__PURE__ */ h("div", {
|
|
150
161
|
className: "space-y-4 p-6",
|
|
151
162
|
children: [/* @__PURE__ */ m("div", {
|
|
@@ -163,9 +174,9 @@ function O() {
|
|
|
163
174
|
/* @__PURE__ */ h("select", {
|
|
164
175
|
id: "task-board-project",
|
|
165
176
|
className: "mt-2 rounded-md border border-input bg-background px-2 py-1 text-sm",
|
|
166
|
-
value:
|
|
167
|
-
onChange: (e) =>
|
|
168
|
-
children: [
|
|
177
|
+
value: V,
|
|
178
|
+
onChange: (e) => N(e.target.value),
|
|
179
|
+
children: [F.map((e) => /* @__PURE__ */ m("option", {
|
|
169
180
|
value: e.id,
|
|
170
181
|
children: e.name
|
|
171
182
|
}, e.id)), /* @__PURE__ */ m("option", {
|
|
@@ -176,19 +187,19 @@ function O() {
|
|
|
176
187
|
/* @__PURE__ */ h("div", {
|
|
177
188
|
className: "mt-2 flex flex-wrap gap-2",
|
|
178
189
|
children: [
|
|
179
|
-
/* @__PURE__ */ m(
|
|
190
|
+
/* @__PURE__ */ m(ee, { projectId: V || void 0 }),
|
|
180
191
|
/* @__PURE__ */ h(g, {
|
|
181
192
|
size: "sm",
|
|
182
193
|
variant: "outline",
|
|
183
194
|
"data-testid": "import-linear",
|
|
184
|
-
onClick: () =>
|
|
195
|
+
onClick: () => D("/tasks/import-page"),
|
|
185
196
|
children: [/* @__PURE__ */ m(l, { className: "mr-1 h-4 w-4" }), "Import from Linear"]
|
|
186
197
|
}),
|
|
187
198
|
/* @__PURE__ */ h(g, {
|
|
188
199
|
size: "sm",
|
|
189
200
|
variant: "outline",
|
|
190
201
|
"data-testid": "task-board-automation",
|
|
191
|
-
onClick: () =>
|
|
202
|
+
onClick: () => D("/automation/automation-rules-page"),
|
|
192
203
|
children: [/* @__PURE__ */ m(c, { className: "mr-1 h-4 w-4" }), "Automation rules"]
|
|
193
204
|
})
|
|
194
205
|
]
|
|
@@ -196,12 +207,16 @@ function O() {
|
|
|
196
207
|
/* @__PURE__ */ m("p", {
|
|
197
208
|
className: "text-sm text-muted-foreground",
|
|
198
209
|
"data-testid": "task-board-total",
|
|
199
|
-
children:
|
|
210
|
+
children: $ === void 0 ? "Counting tasks…" : V ? `${$} ${$ === 1 ? "task" : "tasks"} in ${H}` : `${$} tasks across all projects${Z.length < $ ? ` · showing ${Z.length}` : ""}`
|
|
200
211
|
})
|
|
201
212
|
] })
|
|
202
|
-
}),
|
|
203
|
-
|
|
204
|
-
|
|
213
|
+
}), B ? /* @__PURE__ */ m("p", {
|
|
214
|
+
className: "text-sm text-muted-foreground",
|
|
215
|
+
"data-testid": "task-board-opening-view",
|
|
216
|
+
children: "Opening the shared view…"
|
|
217
|
+
}) : V ? /* @__PURE__ */ m(o, {
|
|
218
|
+
projectId: V,
|
|
219
|
+
projectName: H
|
|
205
220
|
}) : /* @__PURE__ */ h(p, { children: [
|
|
206
221
|
/* @__PURE__ */ h("div", {
|
|
207
222
|
className: "flex gap-4 items-center flex-wrap",
|
|
@@ -217,8 +232,8 @@ function O() {
|
|
|
217
232
|
"high",
|
|
218
233
|
"critical"
|
|
219
234
|
].map((e) => /* @__PURE__ */ m("button", {
|
|
220
|
-
onClick: () =>
|
|
221
|
-
className: `px-2 py-1 text-xs rounded capitalize ${
|
|
235
|
+
onClick: () => k(e),
|
|
236
|
+
className: `px-2 py-1 text-xs rounded capitalize ${O === e ? "bg-primary text-primary-foreground" : "bg-muted text-muted-foreground"}`,
|
|
222
237
|
children: e
|
|
223
238
|
}, e))
|
|
224
239
|
}),
|
|
@@ -232,8 +247,8 @@ function O() {
|
|
|
232
247
|
"epic",
|
|
233
248
|
"sub_task"
|
|
234
249
|
].map((e) => /* @__PURE__ */ m("button", {
|
|
235
|
-
onClick: () =>
|
|
236
|
-
className: `px-2 py-1 text-xs rounded capitalize ${
|
|
250
|
+
onClick: () => j(e),
|
|
251
|
+
className: `px-2 py-1 text-xs rounded capitalize ${A === e ? "bg-primary text-primary-foreground" : "bg-muted text-muted-foreground"}`,
|
|
237
252
|
children: e === "sub_task" ? "sub-task" : e
|
|
238
253
|
}, e))
|
|
239
254
|
})
|
|
@@ -242,7 +257,7 @@ function O() {
|
|
|
242
257
|
/* @__PURE__ */ m("div", {
|
|
243
258
|
className: "grid grid-cols-7 gap-3 overflow-x-auto",
|
|
244
259
|
children: C.map((e) => {
|
|
245
|
-
let t =
|
|
260
|
+
let t = Z.filter((t) => t.status === e);
|
|
246
261
|
return /* @__PURE__ */ h("div", {
|
|
247
262
|
className: "min-w-[200px]",
|
|
248
263
|
children: [/* @__PURE__ */ m("div", {
|
|
@@ -255,13 +270,13 @@ function O() {
|
|
|
255
270
|
}), /* @__PURE__ */ m("span", {
|
|
256
271
|
className: "text-xs bg-muted rounded-full px-1.5",
|
|
257
272
|
"data-testid": `task-col-count-${e}`,
|
|
258
|
-
children: r(
|
|
273
|
+
children: r(ie(e))
|
|
259
274
|
})]
|
|
260
275
|
})
|
|
261
276
|
}), /* @__PURE__ */ m("div", {
|
|
262
277
|
className: "space-y-2 mt-2",
|
|
263
278
|
children: t.map((e) => /* @__PURE__ */ m(_, {
|
|
264
|
-
...i(() =>
|
|
279
|
+
...i(() => D(`/tasks/task-detail-page?taskId=${encodeURIComponent(e.id)}`), e.title),
|
|
265
280
|
children: /* @__PURE__ */ h(v, {
|
|
266
281
|
className: "p-3 space-y-2",
|
|
267
282
|
children: [
|
|
@@ -276,10 +291,10 @@ function O() {
|
|
|
276
291
|
/* @__PURE__ */ h("div", {
|
|
277
292
|
className: "flex gap-1 flex-wrap",
|
|
278
293
|
children: [/* @__PURE__ */ m("span", {
|
|
279
|
-
className: `text-[10px] px-1.5 py-0.5 rounded-full capitalize ${
|
|
294
|
+
className: `text-[10px] px-1.5 py-0.5 rounded-full capitalize ${te[e.priority] ?? ""}`,
|
|
280
295
|
children: e.priority.toLowerCase()
|
|
281
296
|
}), /* @__PURE__ */ m("span", {
|
|
282
|
-
className: `text-[10px] px-1.5 py-0.5 rounded-full capitalize ${
|
|
297
|
+
className: `text-[10px] px-1.5 py-0.5 rounded-full capitalize ${ne[e.type] ?? ""}`,
|
|
283
298
|
children: e.type.toLowerCase()
|
|
284
299
|
})]
|
|
285
300
|
}),
|
|
@@ -310,21 +325,21 @@ function O() {
|
|
|
310
325
|
}, e);
|
|
311
326
|
})
|
|
312
327
|
}),
|
|
313
|
-
|
|
328
|
+
ae && /* @__PURE__ */ m("div", {
|
|
314
329
|
className: "flex justify-center",
|
|
315
330
|
children: /* @__PURE__ */ m("button", {
|
|
316
331
|
type: "button",
|
|
317
|
-
onClick:
|
|
318
|
-
disabled:
|
|
332
|
+
onClick: re,
|
|
333
|
+
disabled: W,
|
|
319
334
|
className: "px-3 py-1.5 text-sm rounded-md bg-muted text-foreground hover:bg-muted/80 disabled:opacity-50",
|
|
320
335
|
"data-testid": "task-board-load-more",
|
|
321
|
-
children:
|
|
336
|
+
children: W ? "Loading…" : `Load more (${Z.length} of ${$})`
|
|
322
337
|
})
|
|
323
338
|
})
|
|
324
339
|
] })]
|
|
325
340
|
});
|
|
326
341
|
}
|
|
327
342
|
//#endregion
|
|
328
|
-
export {
|
|
343
|
+
export { D as TasksTasksPagePage };
|
|
329
344
|
|
|
330
345
|
//# sourceMappingURL=TasksTasksPagePage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TasksTasksPagePage.js","names":[],"sources":["../../../src/planmagnet/pages/TasksTasksPagePage.tsx"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-nocheck\nimport { useState } from 'react';\nimport { gql } from '@apollo/client';\nimport { useQuery } from '@apollo/client/react';\nimport { Button, Card, CardContent } from '@burdenoff/fe-libs/ui';\nimport { Bot, FileUp, Filter } from 'lucide-react';\nimport { usePlanMagnet, usePlanMagnetNavigate } from '../providers/PlanMagnetProvider';\nimport { countLabel } from '../hooks/useCounts';\nimport { rowLinkProps } from '../utils/rowNavigation';\nimport { PersonName } from '../people/People';\nimport { ProjectBoard } from '../board/ProjectBoard';\nimport { ExportWorkItemsButton } from '../export/ExportWorkItemsButton';\n\nconst GET_WORK_ITEMS = gql`\n query GetWorkItems(\n $workspaceId: ID!\n $filter: PlanmagnetWorkItemFilter\n $pagination: PlanmagnetPaginationInput\n ) {\n planmagnetWorkItems(workspaceId: $workspaceId, filter: $filter, pagination: $pagination) {\n items {\n id\n title\n type\n status\n priority\n key\n assigneeId\n reporterId\n sprintId\n storyPoints\n estimateMinutes\n dueDate\n labels\n tags\n createdAt\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n totalCount\n }\n }\n`;\n\n// Server-side counts (QA H2): the list returns at most 100 rows per page, so\n// counting the loaded page undercounted every workspace past 100 items.\nconst GET_WORK_ITEM_COUNTS = gql`\n query GetWorkItemCounts($workspaceId: ID!, $filter: PlanmagnetWorkItemFilter) {\n planmagnetWorkItemCounts(workspaceId: $workspaceId, filter: $filter) {\n total\n byStatus {\n status\n count\n }\n }\n }\n`;\n\nconst PAGE_SIZE = 100;\n\nconst GET_BOARD_PROJECTS = gql`\n query GetBoardProjects($workspaceId: ID!) {\n planmagnetProjects(workspaceId: $workspaceId, pagination: { first: 100 }) {\n items {\n id\n name\n }\n }\n }\n`;\n\ninterface WorkItemNode {\n id: string;\n title: string;\n type: string;\n status: string;\n priority: string;\n key: string;\n assigneeId: string | null;\n reporterId: string | null;\n sprintId: string | null;\n storyPoints: number | null;\n estimateMinutes: number | null;\n dueDate: string | null;\n labels: string[];\n tags: string[];\n createdAt: string;\n}\n\nconst columns = [\n 'BACKLOG',\n 'TODO',\n 'IN_PROGRESS',\n 'IN_REVIEW',\n 'TESTING',\n 'DONE',\n 'CANCELLED',\n] as const;\n\nconst colLabel: Record<string, string> = {\n BACKLOG: 'Backlog',\n TODO: 'To Do',\n IN_PROGRESS: 'In Progress',\n IN_REVIEW: 'In Review',\n TESTING: 'Testing',\n DONE: 'Done',\n CANCELLED: 'Cancelled',\n};\n\nconst colColor: Record<string, string> = {\n BACKLOG: 'border-t-gray-400',\n TODO: 'border-t-blue-400',\n IN_PROGRESS: 'border-t-yellow-400',\n IN_REVIEW: 'border-t-purple-400',\n TESTING: 'border-t-teal-400',\n DONE: 'border-t-green-400',\n CANCELLED: 'border-t-muted-foreground',\n};\n\nconst priorityColor: Record<string, string> = {\n LOW: 'bg-gray-100 text-gray-700',\n MEDIUM: 'bg-blue-100 text-blue-700',\n HIGH: 'bg-orange-100 text-orange-700',\n CRITICAL: 'bg-red-100 text-red-700',\n};\n\nconst typeColor: Record<string, string> = {\n STORY: 'bg-green-100 text-green-700',\n BUG: 'bg-red-100 text-red-700',\n TASK: 'bg-blue-100 text-blue-700',\n EPIC: 'bg-purple-100 text-purple-700',\n // The API serves SUB_TASK (the stored SUBTASK is mapped by the service), so the old SUBTASK key never matched.\n SUB_TASK: 'bg-gray-100 text-gray-700',\n};\n\nexport function TasksTasksPagePage() {\n const { workspaceId } = usePlanMagnet();\n const navigate = usePlanMagnetNavigate();\n const [priorityFilter, setPriorityFilter] = useState<string>('all');\n const [typeFilter, setTypeFilter] = useState<string>('all');\n // P1.2: the Task Board is a project's real board (server-side placement,\n // drag-and-drop, WIP limits). null = not chosen yet -> the first project;\n // '' = the cross-project status overview, which is NOT a board.\n const [boardProject, setBoardProject] = useState<string | null>(null);\n const { data: projectsData } = useQuery(GET_BOARD_PROJECTS, {\n variables: { workspaceId },\n skip: !workspaceId,\n });\n const boardProjects = projectsData?.planmagnetProjects?.items ?? [];\n const selectedProject = boardProject ?? boardProjects[0]?.id ?? '';\n const selectedProjectName = boardProjects.find((p) => p.id === selectedProject)?.name ?? '';\n\n // Filters go to the server so the loaded items AND the counts both reflect\n // every matching item, not just the first page.\n const filter = {\n ...(priorityFilter !== 'all' && { priority: priorityFilter.toUpperCase() }),\n ...(typeFilter !== 'all' && { type: typeFilter.toUpperCase() }),\n };\n const [loadingMore, setLoadingMore] = useState(false);\n\n const { data, loading, error, fetchMore } = useQuery<{\n planmagnetWorkItems: {\n items: WorkItemNode[];\n pageInfo: { hasNextPage: boolean; endCursor: string | null };\n totalCount: number;\n };\n }>(GET_WORK_ITEMS, {\n variables: { workspaceId, filter, pagination: { first: PAGE_SIZE } },\n // The list only feeds the cross-project overview; a board loads its own cards.\n skip: !workspaceId || !!selectedProject,\n });\n const { data: countsData } = useQuery<{\n planmagnetWorkItemCounts: { total: number; byStatus: { status: string; count: number }[] };\n }>(GET_WORK_ITEM_COUNTS, {\n // On a project board the header counts THAT project, without the overview's priority/type filters (their\n // buttons are hidden there, but their state survived and silently narrowed the count). It used to count the\n // whole workspace above a single project's board (BOFF-7943).\n variables: { workspaceId, filter: selectedProject ? { projectId: selectedProject } : filter },\n skip: !workspaceId,\n });\n\n const loadMore = async () => {\n const after = data?.planmagnetWorkItems?.pageInfo?.endCursor;\n if (!after) return;\n setLoadingMore(true);\n try {\n await fetchMore({\n variables: { pagination: { first: PAGE_SIZE, after } },\n updateQuery: (prev, { fetchMoreResult }) => ({\n planmagnetWorkItems: {\n ...fetchMoreResult.planmagnetWorkItems,\n items: [\n ...prev.planmagnetWorkItems.items,\n ...fetchMoreResult.planmagnetWorkItems.items,\n ],\n },\n }),\n });\n } finally {\n setLoadingMore(false);\n }\n };\n\n // Only before the first load: a refetch or a filter change must not blank the board.\n if (loading && !data) {\n return (\n <div className=\"flex items-center justify-center p-12\">\n <div className=\"animate-spin h-8 w-8 border-2 border-primary border-t-transparent rounded-full\" />\n </div>\n );\n }\n\n if (error) {\n return <div className=\"p-6 text-red-500\">Error: {error.message}</div>;\n }\n\n const tasks = data?.planmagnetWorkItems?.items ?? [];\n\n const counts = countsData?.planmagnetWorkItemCounts;\n // Never fall back to the loaded page's length: on a board nothing is loaded here, so that read \"0 tasks\".\n const total: number | undefined =\n counts?.total ?? (selectedProject ? undefined : data?.planmagnetWorkItems?.totalCount);\n // Never fall back to the loaded page (BOFF-7997): counts.byStatus omits statuses with zero items, so an\n // absent entry once `counts` HAS loaded really is 0 — but while the counts query is loading or failed,\n // `counts` itself is undefined and this must show the same unknown state as the header total above,\n // never a number derived from these <=100 loaded rows.\n const countFor = (status: string): number | undefined =>\n counts ? (counts.byStatus.find((c) => c.status === status)?.count ?? 0) : undefined;\n const hasMore = data?.planmagnetWorkItems?.pageInfo?.hasNextPage ?? false;\n\n return (\n <div className=\"space-y-4 p-6\">\n <div className=\"flex items-center justify-between\">\n <div>\n <h1 className=\"text-2xl font-semibold\">Task Board</h1>\n <label className=\"sr-only\" htmlFor=\"task-board-project\">\n Project\n </label>\n <select\n id=\"task-board-project\"\n className=\"mt-2 rounded-md border border-input bg-background px-2 py-1 text-sm\"\n value={selectedProject}\n onChange={(e) => setBoardProject(e.target.value)}\n >\n {boardProjects.map((p) => (\n <option key={p.id} value={p.id}>\n {p.name}\n </option>\n ))}\n <option value=\"\">All projects — status overview</option>\n </select>\n <div className=\"mt-2 flex flex-wrap gap-2\">\n <ExportWorkItemsButton projectId={selectedProject || undefined} />\n {/* BUILD_PLAN P1.4: the Linear importer had no way in. */}\n <Button\n size=\"sm\"\n variant=\"outline\"\n data-testid=\"import-linear\"\n onClick={() => navigate('/tasks/import-page')}\n >\n <FileUp className=\"mr-1 h-4 w-4\" />\n Import from Linear\n </Button>\n {/* BOFF-8047: automation rules act on this board's work items (status/assign/label/priority). */}\n <Button\n size=\"sm\"\n variant=\"outline\"\n data-testid=\"task-board-automation\"\n onClick={() => navigate('/automation/automation-rules-page')}\n >\n <Bot className=\"mr-1 h-4 w-4\" />\n Automation rules\n </Button>\n </div>\n <p className=\"text-sm text-muted-foreground\" data-testid=\"task-board-total\">\n {total === undefined\n ? 'Counting tasks…'\n : selectedProject\n ? `${total} ${total === 1 ? 'task' : 'tasks'} in ${selectedProjectName}`\n : `${total} tasks across all projects${tasks.length < total ? ` · showing ${tasks.length}` : ''}`}\n </p>\n </div>\n </div>\n {selectedProject ? (\n <ProjectBoard projectId={selectedProject} projectName={selectedProjectName} />\n ) : (\n <>\n <div className=\"flex gap-4 items-center flex-wrap\">\n <Filter className=\"h-4 w-4 text-muted-foreground\" />\n <div className=\"flex gap-1\">\n {/* 'none' included: a NONE-priority task matched no chip (BOFF-7985). */}\n {['all', 'none', 'low', 'medium', 'high', 'critical'].map((p) => (\n <button\n key={p}\n onClick={() => setPriorityFilter(p)}\n className={`px-2 py-1 text-xs rounded capitalize ${priorityFilter === p ? 'bg-primary text-primary-foreground' : 'bg-muted text-muted-foreground'}`}\n >\n {p}\n </button>\n ))}\n </div>\n <div className=\"flex gap-1\">\n {/* sub_task → SUB_TASK: filtering by it works since svc 1f4db8e (it was a masked 500). */}\n {['all', 'story', 'bug', 'task', 'epic', 'sub_task'].map((t) => (\n <button\n key={t}\n onClick={() => setTypeFilter(t)}\n className={`px-2 py-1 text-xs rounded capitalize ${typeFilter === t ? 'bg-primary text-primary-foreground' : 'bg-muted text-muted-foreground'}`}\n >\n {t === 'sub_task' ? 'sub-task' : t}\n </button>\n ))}\n </div>\n </div>\n <div className=\"grid grid-cols-7 gap-3 overflow-x-auto\">\n {columns.map((col) => {\n const colTasks = tasks.filter((t) => t.status === col);\n return (\n <div key={col} className=\"min-w-[200px]\">\n <div className={`border-t-2 ${colColor[col]} rounded-t-md p-2 bg-muted/50`}>\n <div className=\"flex justify-between items-center\">\n <span className=\"text-sm font-medium\">{colLabel[col]}</span>\n <span\n className=\"text-xs bg-muted rounded-full px-1.5\"\n data-testid={`task-col-count-${col}`}\n >\n {countLabel(countFor(col))}\n </span>\n </div>\n </div>\n <div className=\"space-y-2 mt-2\">\n {colTasks.map((task) => (\n <Card\n key={task.id}\n {...rowLinkProps(\n () =>\n navigate(\n `/tasks/task-detail-page?taskId=${encodeURIComponent(task.id)}`\n ),\n task.title\n )}\n >\n <CardContent className=\"p-3 space-y-2\">\n <p className=\"text-sm font-medium leading-tight\">{task.title}</p>\n <p className=\"text-xs text-muted-foreground\">{task.key}</p>\n <div className=\"flex gap-1 flex-wrap\">\n <span\n className={`text-[10px] px-1.5 py-0.5 rounded-full capitalize ${priorityColor[task.priority] ?? ''}`}\n >\n {task.priority.toLowerCase()}\n </span>\n <span\n className={`text-[10px] px-1.5 py-0.5 rounded-full capitalize ${typeColor[task.type] ?? ''}`}\n >\n {task.type.toLowerCase()}\n </span>\n </div>\n <div className=\"flex items-center justify-between\">\n <div className=\"flex gap-1\">\n {(task.labels ?? []).slice(0, 2).map((l) => (\n <span key={l} className=\"text-[9px] px-1 py-0.5 rounded bg-muted\">\n {l}\n </span>\n ))}\n </div>\n <div className=\"flex items-center gap-1\">\n <span className=\"text-[10px] font-medium bg-primary/10 text-primary rounded-full h-5 w-5 flex items-center justify-center\">\n {task.storyPoints ?? 0}\n </span>\n </div>\n </div>\n <div className=\"flex justify-between text-[10px] text-muted-foreground\">\n <span>\n {task.assigneeId ? <PersonName id={task.assigneeId} /> : 'Unassigned'}\n </span>\n <span>\n {task.dueDate ? new Date(task.dueDate).toLocaleDateString() : ''}\n </span>\n </div>\n </CardContent>\n </Card>\n ))}\n </div>\n </div>\n );\n })}\n </div>\n {hasMore && (\n <div className=\"flex justify-center\">\n <button\n type=\"button\"\n onClick={loadMore}\n disabled={loadingMore}\n className=\"px-3 py-1.5 text-sm rounded-md bg-muted text-foreground hover:bg-muted/80 disabled:opacity-50\"\n data-testid=\"task-board-load-more\"\n >\n {loadingMore ? 'Loading…' : `Load more (${tasks.length} of ${total})`}\n </button>\n </div>\n )}\n </>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAcA,IAAM,IAAiB,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCpB,IAAuB,CAAG;;;;;;;;;;GAY1B,IAAY,KAEZ,IAAqB,CAAG;;;;;;;;;GA6BxB,IAAU;CACd;CACA;CACA;CACA;CACA;CACA;CACA;CACD,EAEK,IAAmC;CACvC,SAAS;CACT,MAAM;CACN,aAAa;CACb,WAAW;CACX,SAAS;CACT,MAAM;CACN,WAAW;CACZ,EAEK,IAAmC;CACvC,SAAS;CACT,MAAM;CACN,aAAa;CACb,WAAW;CACX,SAAS;CACT,MAAM;CACN,WAAW;CACZ,EAEK,IAAwC;CAC5C,KAAK;CACL,QAAQ;CACR,MAAM;CACN,UAAU;CACX,EAEK,IAAoC;CACxC,OAAO;CACP,KAAK;CACL,MAAM;CACN,MAAM;CAEN,UAAU;CACX;AAED,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D,CAAA,CACH;;UACM;;QACT,EA/CA,EAAK,GA+CL,CACP;OACE,CAAA,CACF;QAjEI,EAiEJ;MAER;IACE,CAAA;GACL,KACC,kBAAC,OAAD;IAAK,WAAU;cACb,kBAAC,UAAD;KACE,MAAK;KACL,SAAS;KACT,UAAU;KACV,WAAU;KACV,eAAY;eAEX,IAAc,aAAa,cAAc,EAAM,OAAO,MAAM,EAAM;KAC5D,CAAA;IACL,CAAA;GAEP,EAAA,CAAA,CAED"}
|
|
1
|
+
{"version":3,"file":"TasksTasksPagePage.js","names":[],"sources":["../../../src/planmagnet/pages/TasksTasksPagePage.tsx"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-nocheck\nimport { useState } from 'react';\nimport { gql } from '@apollo/client';\nimport { useQuery } from '@apollo/client/react';\nimport { Button, Card, CardContent } from '@burdenoff/fe-libs/ui';\nimport { Bot, FileUp, Filter } from 'lucide-react';\nimport { usePlanMagnet, usePlanMagnetNavigate } from '../providers/PlanMagnetProvider';\nimport { countLabel } from '../hooks/useCounts';\nimport { rowLinkProps } from '../utils/rowNavigation';\nimport { PersonName } from '../people/People';\nimport { ProjectBoard } from '../board/ProjectBoard';\nimport { readViewIdFromUrl } from '../board/boardViewConfig';\nimport { ExportWorkItemsButton } from '../export/ExportWorkItemsButton';\n\nconst GET_WORK_ITEMS = gql`\n query GetWorkItems(\n $workspaceId: ID!\n $filter: PlanmagnetWorkItemFilter\n $pagination: PlanmagnetPaginationInput\n ) {\n planmagnetWorkItems(workspaceId: $workspaceId, filter: $filter, pagination: $pagination) {\n items {\n id\n title\n type\n status\n priority\n key\n assigneeId\n reporterId\n sprintId\n storyPoints\n estimateMinutes\n dueDate\n labels\n tags\n createdAt\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n totalCount\n }\n }\n`;\n\n// Server-side counts (QA H2): the list returns at most 100 rows per page, so\n// counting the loaded page undercounted every workspace past 100 items.\nconst GET_WORK_ITEM_COUNTS = gql`\n query GetWorkItemCounts($workspaceId: ID!, $filter: PlanmagnetWorkItemFilter) {\n planmagnetWorkItemCounts(workspaceId: $workspaceId, filter: $filter) {\n total\n byStatus {\n status\n count\n }\n }\n }\n`;\n\nconst PAGE_SIZE = 100;\n\nconst GET_BOARD_PROJECTS = gql`\n query GetBoardProjects($workspaceId: ID!) {\n planmagnetProjects(workspaceId: $workspaceId, pagination: { first: 100 }) {\n items {\n id\n name\n }\n }\n }\n`;\n\ninterface WorkItemNode {\n id: string;\n title: string;\n type: string;\n status: string;\n priority: string;\n key: string;\n assigneeId: string | null;\n reporterId: string | null;\n sprintId: string | null;\n storyPoints: number | null;\n estimateMinutes: number | null;\n dueDate: string | null;\n labels: string[];\n tags: string[];\n createdAt: string;\n}\n\nconst columns = [\n 'BACKLOG',\n 'TODO',\n 'IN_PROGRESS',\n 'IN_REVIEW',\n 'TESTING',\n 'DONE',\n 'CANCELLED',\n] as const;\n\nconst colLabel: Record<string, string> = {\n BACKLOG: 'Backlog',\n TODO: 'To Do',\n IN_PROGRESS: 'In Progress',\n IN_REVIEW: 'In Review',\n TESTING: 'Testing',\n DONE: 'Done',\n CANCELLED: 'Cancelled',\n};\n\nconst colColor: Record<string, string> = {\n BACKLOG: 'border-t-gray-400',\n TODO: 'border-t-blue-400',\n IN_PROGRESS: 'border-t-yellow-400',\n IN_REVIEW: 'border-t-purple-400',\n TESTING: 'border-t-teal-400',\n DONE: 'border-t-green-400',\n CANCELLED: 'border-t-muted-foreground',\n};\n\nconst priorityColor: Record<string, string> = {\n LOW: 'bg-gray-100 text-gray-700',\n MEDIUM: 'bg-blue-100 text-blue-700',\n HIGH: 'bg-orange-100 text-orange-700',\n CRITICAL: 'bg-red-100 text-red-700',\n};\n\nconst typeColor: Record<string, string> = {\n STORY: 'bg-green-100 text-green-700',\n BUG: 'bg-red-100 text-red-700',\n TASK: 'bg-blue-100 text-blue-700',\n EPIC: 'bg-purple-100 text-purple-700',\n // The API serves SUB_TASK (the stored SUBTASK is mapped by the service), so the old SUBTASK key never matched.\n SUB_TASK: 'bg-gray-100 text-gray-700',\n};\n\nconst GET_LINKED_VIEW_PROJECT = gql`\n query TasksLinkedBoardView($id: ID!) {\n planmagnetBoardView(id: $id) {\n id\n projectId\n }\n }\n`;\n\nexport function TasksTasksPagePage() {\n const { workspaceId } = usePlanMagnet();\n const navigate = usePlanMagnetNavigate();\n const [priorityFilter, setPriorityFilter] = useState<string>('all');\n const [typeFilter, setTypeFilter] = useState<string>('all');\n // P1.2: the Task Board is a project's real board (server-side placement,\n // drag-and-drop, WIP limits). null = not chosen yet -> the first project;\n // '' = the cross-project status overview, which is NOT a board.\n const [boardProject, setBoardProject] = useState<string | null>(null);\n const { data: projectsData } = useQuery(GET_BOARD_PROJECTS, {\n variables: { workspaceId },\n skip: !workspaceId,\n });\n const boardProjects = projectsData?.planmagnetProjects?.items ?? [];\n // PDM-N04: a shared `?view=<id>` link opens on the VIEW's project (its board then applies the view), not on\n // whichever project happens to be first — otherwise the link silently shows another project's board. Read\n // once; an explicit project choice (boardProject) always wins afterwards.\n const [linkedViewId] = useState(readViewIdFromUrl);\n const { data: linkedViewData, error: linkedViewError } = useQuery<{\n planmagnetBoardView: { id: string; projectId: string } | null;\n }>(GET_LINKED_VIEW_PROJECT, {\n variables: { id: linkedViewId ?? '' },\n skip: !linkedViewId || boardProject !== null,\n });\n const linkedViewProject = linkedViewData?.planmagnetBoardView?.projectId ?? null;\n // A missing/private view (null) or a failed lookup falls back to the default project rather than waiting forever.\n const waitingForLinkedView =\n !!linkedViewId && boardProject === null && !linkedViewData && !linkedViewError;\n const selectedProject =\n boardProject ?? linkedViewProject ?? (waitingForLinkedView ? '' : (boardProjects[0]?.id ?? ''));\n const selectedProjectName = boardProjects.find((p) => p.id === selectedProject)?.name ?? '';\n\n // Filters go to the server so the loaded items AND the counts both reflect\n // every matching item, not just the first page.\n const filter = {\n ...(priorityFilter !== 'all' && { priority: priorityFilter.toUpperCase() }),\n ...(typeFilter !== 'all' && { type: typeFilter.toUpperCase() }),\n };\n const [loadingMore, setLoadingMore] = useState(false);\n\n const { data, loading, error, fetchMore } = useQuery<{\n planmagnetWorkItems: {\n items: WorkItemNode[];\n pageInfo: { hasNextPage: boolean; endCursor: string | null };\n totalCount: number;\n };\n }>(GET_WORK_ITEMS, {\n variables: { workspaceId, filter, pagination: { first: PAGE_SIZE } },\n // The list only feeds the cross-project overview; a board loads its own cards.\n skip: !workspaceId || !!selectedProject || waitingForLinkedView,\n });\n const { data: countsData } = useQuery<{\n planmagnetWorkItemCounts: { total: number; byStatus: { status: string; count: number }[] };\n }>(GET_WORK_ITEM_COUNTS, {\n // On a project board the header counts THAT project, without the overview's priority/type filters (their\n // buttons are hidden there, but their state survived and silently narrowed the count). It used to count the\n // whole workspace above a single project's board (BOFF-7943).\n variables: { workspaceId, filter: selectedProject ? { projectId: selectedProject } : filter },\n skip: !workspaceId,\n });\n\n const loadMore = async () => {\n const after = data?.planmagnetWorkItems?.pageInfo?.endCursor;\n if (!after) return;\n setLoadingMore(true);\n try {\n await fetchMore({\n variables: { pagination: { first: PAGE_SIZE, after } },\n updateQuery: (prev, { fetchMoreResult }) => ({\n planmagnetWorkItems: {\n ...fetchMoreResult.planmagnetWorkItems,\n items: [\n ...prev.planmagnetWorkItems.items,\n ...fetchMoreResult.planmagnetWorkItems.items,\n ],\n },\n }),\n });\n } finally {\n setLoadingMore(false);\n }\n };\n\n // Only before the first load: a refetch or a filter change must not blank the board.\n if (loading && !data) {\n return (\n <div className=\"flex items-center justify-center p-12\">\n <div className=\"animate-spin h-8 w-8 border-2 border-primary border-t-transparent rounded-full\" />\n </div>\n );\n }\n\n if (error) {\n return <div className=\"p-6 text-red-500\">Error: {error.message}</div>;\n }\n\n const tasks = data?.planmagnetWorkItems?.items ?? [];\n\n const counts = countsData?.planmagnetWorkItemCounts;\n // Never fall back to the loaded page's length: on a board nothing is loaded here, so that read \"0 tasks\".\n const total: number | undefined =\n counts?.total ?? (selectedProject ? undefined : data?.planmagnetWorkItems?.totalCount);\n // Never fall back to the loaded page (BOFF-7997): counts.byStatus omits statuses with zero items, so an\n // absent entry once `counts` HAS loaded really is 0 — but while the counts query is loading or failed,\n // `counts` itself is undefined and this must show the same unknown state as the header total above,\n // never a number derived from these <=100 loaded rows.\n const countFor = (status: string): number | undefined =>\n counts ? (counts.byStatus.find((c) => c.status === status)?.count ?? 0) : undefined;\n const hasMore = data?.planmagnetWorkItems?.pageInfo?.hasNextPage ?? false;\n\n return (\n <div className=\"space-y-4 p-6\">\n <div className=\"flex items-center justify-between\">\n <div>\n <h1 className=\"text-2xl font-semibold\">Task Board</h1>\n <label className=\"sr-only\" htmlFor=\"task-board-project\">\n Project\n </label>\n <select\n id=\"task-board-project\"\n className=\"mt-2 rounded-md border border-input bg-background px-2 py-1 text-sm\"\n value={selectedProject}\n onChange={(e) => setBoardProject(e.target.value)}\n >\n {boardProjects.map((p) => (\n <option key={p.id} value={p.id}>\n {p.name}\n </option>\n ))}\n <option value=\"\">All projects — status overview</option>\n </select>\n <div className=\"mt-2 flex flex-wrap gap-2\">\n <ExportWorkItemsButton projectId={selectedProject || undefined} />\n {/* BUILD_PLAN P1.4: the Linear importer had no way in. */}\n <Button\n size=\"sm\"\n variant=\"outline\"\n data-testid=\"import-linear\"\n onClick={() => navigate('/tasks/import-page')}\n >\n <FileUp className=\"mr-1 h-4 w-4\" />\n Import from Linear\n </Button>\n {/* BOFF-8047: automation rules act on this board's work items (status/assign/label/priority). */}\n <Button\n size=\"sm\"\n variant=\"outline\"\n data-testid=\"task-board-automation\"\n onClick={() => navigate('/automation/automation-rules-page')}\n >\n <Bot className=\"mr-1 h-4 w-4\" />\n Automation rules\n </Button>\n </div>\n <p className=\"text-sm text-muted-foreground\" data-testid=\"task-board-total\">\n {total === undefined\n ? 'Counting tasks…'\n : selectedProject\n ? `${total} ${total === 1 ? 'task' : 'tasks'} in ${selectedProjectName}`\n : `${total} tasks across all projects${tasks.length < total ? ` · showing ${tasks.length}` : ''}`}\n </p>\n </div>\n </div>\n {waitingForLinkedView ? (\n <p className=\"text-sm text-muted-foreground\" data-testid=\"task-board-opening-view\">\n Opening the shared view…\n </p>\n ) : selectedProject ? (\n <ProjectBoard projectId={selectedProject} projectName={selectedProjectName} />\n ) : (\n <>\n <div className=\"flex gap-4 items-center flex-wrap\">\n <Filter className=\"h-4 w-4 text-muted-foreground\" />\n <div className=\"flex gap-1\">\n {/* 'none' included: a NONE-priority task matched no chip (BOFF-7985). */}\n {['all', 'none', 'low', 'medium', 'high', 'critical'].map((p) => (\n <button\n key={p}\n onClick={() => setPriorityFilter(p)}\n className={`px-2 py-1 text-xs rounded capitalize ${priorityFilter === p ? 'bg-primary text-primary-foreground' : 'bg-muted text-muted-foreground'}`}\n >\n {p}\n </button>\n ))}\n </div>\n <div className=\"flex gap-1\">\n {/* sub_task → SUB_TASK: filtering by it works since svc 1f4db8e (it was a masked 500). */}\n {['all', 'story', 'bug', 'task', 'epic', 'sub_task'].map((t) => (\n <button\n key={t}\n onClick={() => setTypeFilter(t)}\n className={`px-2 py-1 text-xs rounded capitalize ${typeFilter === t ? 'bg-primary text-primary-foreground' : 'bg-muted text-muted-foreground'}`}\n >\n {t === 'sub_task' ? 'sub-task' : t}\n </button>\n ))}\n </div>\n </div>\n <div className=\"grid grid-cols-7 gap-3 overflow-x-auto\">\n {columns.map((col) => {\n const colTasks = tasks.filter((t) => t.status === col);\n return (\n <div key={col} className=\"min-w-[200px]\">\n <div className={`border-t-2 ${colColor[col]} rounded-t-md p-2 bg-muted/50`}>\n <div className=\"flex justify-between items-center\">\n <span className=\"text-sm font-medium\">{colLabel[col]}</span>\n <span\n className=\"text-xs bg-muted rounded-full px-1.5\"\n data-testid={`task-col-count-${col}`}\n >\n {countLabel(countFor(col))}\n </span>\n </div>\n </div>\n <div className=\"space-y-2 mt-2\">\n {colTasks.map((task) => (\n <Card\n key={task.id}\n {...rowLinkProps(\n () =>\n navigate(\n `/tasks/task-detail-page?taskId=${encodeURIComponent(task.id)}`\n ),\n task.title\n )}\n >\n <CardContent className=\"p-3 space-y-2\">\n <p className=\"text-sm font-medium leading-tight\">{task.title}</p>\n <p className=\"text-xs text-muted-foreground\">{task.key}</p>\n <div className=\"flex gap-1 flex-wrap\">\n <span\n className={`text-[10px] px-1.5 py-0.5 rounded-full capitalize ${priorityColor[task.priority] ?? ''}`}\n >\n {task.priority.toLowerCase()}\n </span>\n <span\n className={`text-[10px] px-1.5 py-0.5 rounded-full capitalize ${typeColor[task.type] ?? ''}`}\n >\n {task.type.toLowerCase()}\n </span>\n </div>\n <div className=\"flex items-center justify-between\">\n <div className=\"flex gap-1\">\n {(task.labels ?? []).slice(0, 2).map((l) => (\n <span key={l} className=\"text-[9px] px-1 py-0.5 rounded bg-muted\">\n {l}\n </span>\n ))}\n </div>\n <div className=\"flex items-center gap-1\">\n <span className=\"text-[10px] font-medium bg-primary/10 text-primary rounded-full h-5 w-5 flex items-center justify-center\">\n {task.storyPoints ?? 0}\n </span>\n </div>\n </div>\n <div className=\"flex justify-between text-[10px] text-muted-foreground\">\n <span>\n {task.assigneeId ? <PersonName id={task.assigneeId} /> : 'Unassigned'}\n </span>\n <span>\n {task.dueDate ? new Date(task.dueDate).toLocaleDateString() : ''}\n </span>\n </div>\n </CardContent>\n </Card>\n ))}\n </div>\n </div>\n );\n })}\n </div>\n {hasMore && (\n <div className=\"flex justify-center\">\n <button\n type=\"button\"\n onClick={loadMore}\n disabled={loadingMore}\n className=\"px-3 py-1.5 text-sm rounded-md bg-muted text-foreground hover:bg-muted/80 disabled:opacity-50\"\n data-testid=\"task-board-load-more\"\n >\n {loadingMore ? 'Loading…' : `Load more (${tasks.length} of ${total})`}\n </button>\n </div>\n )}\n </>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAeA,IAAM,IAAiB,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCpB,IAAuB,CAAG;;;;;;;;;;GAY1B,IAAY,KAEZ,IAAqB,CAAG;;;;;;;;;GA6BxB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