@burdenoff/microfe-planmagnet 2026.930.13 → 2026.930.14
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/dist/planmagnet/PlanMagnetRoot.d.ts.map +1 -1
- package/dist/planmagnet/PlanMagnetRoot.js +133 -126
- package/dist/planmagnet/PlanMagnetRoot.js.map +1 -1
- package/dist/planmagnet/PlanMagnetRoutes.d.ts.map +1 -1
- package/dist/planmagnet/PlanMagnetRoutes.js +9 -5
- package/dist/planmagnet/PlanMagnetRoutes.js.map +1 -1
- package/dist/planmagnet/activity/activityDescribe.d.ts +38 -0
- package/dist/planmagnet/activity/activityDescribe.d.ts.map +1 -0
- package/dist/planmagnet/activity/activityDescribe.js +123 -0
- package/dist/planmagnet/activity/activityDescribe.js.map +1 -0
- package/dist/planmagnet/activity/relativeTime.d.ts +8 -0
- package/dist/planmagnet/activity/relativeTime.d.ts.map +1 -0
- package/dist/planmagnet/activity/relativeTime.js +38 -0
- package/dist/planmagnet/activity/relativeTime.js.map +1 -0
- package/dist/planmagnet/comments/WorkItemActivity.d.ts.map +1 -1
- package/dist/planmagnet/comments/WorkItemActivity.js +35 -38
- package/dist/planmagnet/comments/WorkItemActivity.js.map +1 -1
- package/dist/planmagnet/controls/FeatureControls.js +25 -25
- package/dist/planmagnet/controls/ProjectControls.d.ts.map +1 -1
- package/dist/planmagnet/controls/ProjectControls.js +53 -46
- package/dist/planmagnet/controls/ProjectControls.js.map +1 -1
- package/dist/planmagnet/pages/ActivityActivityPagePage.d.ts +2 -0
- package/dist/planmagnet/pages/ActivityActivityPagePage.d.ts.map +1 -0
- package/dist/planmagnet/pages/ActivityActivityPagePage.js +291 -0
- package/dist/planmagnet/pages/ActivityActivityPagePage.js.map +1 -0
- package/dist/planmagnet/pages/AutomationAutomationRulesPagePage.js +15 -15
- package/dist/planmagnet/pages/AutomationCreateAutomationRulePagePage.js +9 -9
- package/dist/planmagnet/pages/ProductsEditProductPagePage.js +4 -4
- package/dist/planmagnet/pages/ProductsEditRoadmapPagePage.js +4 -4
- package/dist/planmagnet/pages/ProductsProductDetailPagePage.js +4 -4
- package/dist/planmagnet/pages/ProductsRoadmapDetailPagePage.d.ts.map +1 -1
- package/dist/planmagnet/pages/ProductsRoadmapDetailPagePage.js +118 -109
- package/dist/planmagnet/pages/ProductsRoadmapDetailPagePage.js.map +1 -1
- package/dist/planmagnet/pages/ProgramsEditProgramPagePage.js +4 -4
- package/dist/planmagnet/pages/ProjectsEditProjectPagePage.js +6 -6
- package/dist/planmagnet/pages/ProjectsMilestoneDetailPagePage.js +4 -4
- package/dist/planmagnet/pages/ProjectsPlanningDetailPagePage.js +4 -4
- package/dist/planmagnet/pages/ProjectsPlanningEditPagePage.js +6 -6
- package/dist/planmagnet/pages/ProjectsProjectDetailPagePage.js +13 -13
- package/dist/planmagnet/pages/RisksRiskDetailPagePage.js +4 -4
- package/dist/planmagnet/pages/TeamCreateTeamPagePage.js +4 -4
- package/dist/planmagnet/pages/TeamTeamDetailPagePage.js +6 -6
- package/dist/planmagnet/pages/TeamTeamEditPagePage.js +6 -6
- package/dist/planmagnet/roadmaps/RoadmapControls.js +21 -21
- package/dist/planmagnet/roadmaps/RoadmapNowNextLater.d.ts +29 -0
- package/dist/planmagnet/roadmaps/RoadmapNowNextLater.d.ts.map +1 -1
- package/dist/planmagnet/roadmaps/RoadmapNowNextLater.js +1 -1
- package/dist/planmagnet/roadmaps/RoadmapNowNextLater.js.map +1 -1
- package/dist/planmagnet/roadmaps/RoadmapPresentation.d.ts +37 -0
- package/dist/planmagnet/roadmaps/RoadmapPresentation.d.ts.map +1 -0
- package/dist/planmagnet/roadmaps/RoadmapPresentation.js +210 -0
- package/dist/planmagnet/roadmaps/RoadmapPresentation.js.map +1 -0
- package/dist/planmagnet/team/TeamControls.d.ts.map +1 -1
- package/dist/planmagnet/team/TeamControls.js +134 -124
- package/dist/planmagnet/team/TeamControls.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RoadmapNowNextLater.js","names":[],"sources":["../../../src/planmagnet/roadmaps/RoadmapNowNextLater.tsx"],"sourcesContent":["import { useEffect, useMemo, useState, type DragEvent } from 'react';\nimport { gql } from '@apollo/client';\nimport { useMutation, useQuery } from '@apollo/client/react';\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@burdenoff/fe-libs/ui';\nimport {\n AlertTriangle,\n Calendar,\n Gauge,\n Inbox,\n Loader2,\n ShieldAlert,\n ShieldCheck,\n} from 'lucide-react';\nimport { usePlanMagnet } from '../providers/PlanMagnetProvider';\nimport { throwOnError } from '../utils/mutationResult';\nimport { isForbidden, mutationErrorMessage } from '../utils/graphqlErrors';\nimport { enumLabel } from '../controls/WorkItemControls';\n\n/**\n * Now/Next/Later (PRM-06, PRM-09, PRM-10): a VIEW of a roadmap's items grouped by `horizon`, alongside the\n * existing Timeline view (`ProductsRoadmapDetailPagePage.tsx`) — not a separate roadmap type. Placement is\n * changed by dragging a card, or by the keyboard \"Move…\" select every card also carries (the same mutation\n * either way: `planmagnetMoveRoadmapItem`), never optimistically: the list shown is always what\n * `planmagnetRoadmapItems` last returned, so a refused move has nothing local to \"undo\" — the card simply never\n * left its column.\n *\n * `planmagnetMoveRoadmapItem`'s `index` is scoped to the (roadmap, horizon, **swimlane**) group, not to the\n * column as a whole — the same lane-scoping the Timeline view treats as first-class (`swimlaneGroups` there).\n * Each column therefore renders its cards **grouped by lane** (one sub-list per lane, in the same order in\n * every column), exactly like the Timeline view's per-lane cards. A drag/drop within a lane's sub-list, or a\n * \"Move…\" menu action, only ever computes an index against that same sub-list — so \"the end of this section\"\n * (what the user sees) and \"the end of this lane's server-side group\" (what the index means) are always the\n * same place, with no cross-lane ambiguity. Dropping a card onto a *different* lane's section is rejected (the\n * move never changes `swimlane`); the lane header is only shown once a roadmap actually uses more than one\n * lane, so a single-lane (the common case) or lane-less roadmap renders exactly one unlabelled section per\n * column — visually identical to a flat list.\n */\n\nconst ITEM_FIELDS = `\n id\n title\n status\n startDate\n endDate\n horizon\n swimlane\n sortOrder\n confidence\n riskLevel\n riskNote\n featureRequestDemand {\n requests\n votes\n }\n`;\n\nconst NNL_ITEMS = gql`\n query RoadmapNowNextLaterItems(\n $workspaceId: ID!\n $filter: PlanmagnetRoadmapItemFilter\n $pagination: PlanmagnetPaginationInput\n ) {\n planmagnetRoadmapItems(workspaceId: $workspaceId, filter: $filter, pagination: $pagination) {\n items {\n ${ITEM_FIELDS}\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n totalCount\n }\n }\n`;\n\nconst MOVE_ITEM = gql`\n mutation RoadmapNowNextLaterMove($id: ID!, $input: PlanmagnetMoveRoadmapItemInput!) {\n planmagnetMoveRoadmapItem(id: $id, input: $input) {\n ${ITEM_FIELDS}\n }\n }\n`;\n\ninterface NnlItem {\n id: string;\n title: string;\n status: string;\n startDate: string | null;\n endDate: string | null;\n horizon: 'NOW' | 'NEXT' | 'LATER' | null;\n swimlane: string | null;\n sortOrder: number;\n confidence: number | null;\n riskLevel: 'LOW' | 'MEDIUM' | 'HIGH' | null;\n riskNote: string | null;\n featureRequestDemand: { requests: number; votes: number } | null;\n}\n\ntype ColumnKey = 'UNPLACED' | 'NOW' | 'NEXT' | 'LATER';\ntype Horizon = 'NOW' | 'NEXT' | 'LATER' | null;\n\nconst COLUMNS: { key: ColumnKey; label: string; horizon: Horizon }[] = [\n { key: 'UNPLACED', label: 'Not placed', horizon: null },\n { key: 'NOW', label: 'Now', horizon: 'NOW' },\n { key: 'NEXT', label: 'Next', horizon: 'NEXT' },\n { key: 'LATER', label: 'Later', horizon: 'LATER' },\n];\nconst columnOf = (horizon: Horizon): ColumnKey => horizon ?? 'UNPLACED';\n\nconst PAGE_SIZE = 200;\n/** Items beyond this many are not loaded. Stated rather than silently dropped: a banner below the board says so\n * when the cap is actually hit, the same \"never silently stop\" convention as `controls/Pickers.tsx`. */\nconst MAX_ITEMS = 2000;\n\n/** Every item on the roadmap, paged through in full (never just the first page) up to `MAX_ITEMS`, ordered by\n * sortOrder then id — same pattern as `ProjectSelect` in `controls/Pickers.tsx`, generalized to a full board\n * rather than a picker list. */\nfunction useAllRoadmapItems(workspaceId: string | undefined, roadmapId: string) {\n const { data, loading, error, fetchMore } = useQuery<{\n planmagnetRoadmapItems: {\n items: NnlItem[];\n pageInfo: { hasNextPage: boolean; endCursor: string | null };\n totalCount: number;\n };\n }>(NNL_ITEMS, {\n variables: {\n workspaceId: workspaceId ?? '',\n filter: { roadmapId },\n pagination: { first: PAGE_SIZE },\n },\n skip: !workspaceId || !roadmapId,\n });\n const loaded = data?.planmagnetRoadmapItems.items ?? [];\n const hasNextPage = data?.planmagnetRoadmapItems.pageInfo.hasNextPage ?? false;\n const endCursor = data?.planmagnetRoadmapItems.pageInfo.endCursor ?? null;\n const totalCount = data?.planmagnetRoadmapItems.totalCount ?? 0;\n\n useEffect(() => {\n if (!hasNextPage || !endCursor || loaded.length >= MAX_ITEMS) return;\n fetchMore({\n variables: { pagination: { first: PAGE_SIZE, after: endCursor } },\n updateQuery: (prev, { fetchMoreResult }) => ({\n planmagnetRoadmapItems: {\n ...fetchMoreResult.planmagnetRoadmapItems,\n items: [\n ...prev.planmagnetRoadmapItems.items,\n ...fetchMoreResult.planmagnetRoadmapItems.items,\n ],\n },\n }),\n }).catch(() => {\n // A failed extra page leaves the items already loaded usable; `truncated` below still reports the gap.\n });\n }, [hasNextPage, endCursor, loaded.length, fetchMore]);\n\n return {\n items: loaded,\n loading: loading && !data,\n error,\n totalCount,\n truncated: hasNextPage && loaded.length >= MAX_ITEMS,\n };\n}\n\n/** An item's lane key for grouping — `null`/unset normalizes to `''` so it compares equal to itself. */\nconst laneKey = (item: NnlItem) => item.swimlane ?? '';\n/** Display label for a lane key, matching the Timeline view's own term for the unassigned bucket\n * (`ProductsRoadmapDetailPagePage.tsx`'s `swimlaneGroups`). */\nconst laneLabel = (key: string) => key || 'Uncategorized';\n\n/**\n * The 0-based index to send `planmagnetMoveRoadmapItem` so `movedItem` lands where the drop indicates.\n * `laneItems` MUST already be scoped to a single lane's section (the same list the card was dropped in/onto —\n * see the module docstring), so there is no cross-lane ambiguity left to resolve here: `beforeId` is the id of\n * the card the drop should land in front of within that section, or `null` for the end of it, which is exactly\n * the end of the (roadmap, horizon, lane) group the server indexes into.\n */\nfunction destinationIndex(\n laneItems: NnlItem[],\n movedItemId: string,\n beforeId: string | null\n): number {\n const others = laneItems.filter((it) => it.id !== movedItemId);\n if (beforeId === null) return others.length;\n const cut = others.findIndex((it) => it.id === beforeId);\n return cut === -1 ? others.length : cut;\n}\n\nconst RISK_META: Record<\n 'LOW' | 'MEDIUM' | 'HIGH',\n { Icon: typeof ShieldCheck; label: string; className: string }\n> = {\n LOW: { Icon: ShieldCheck, label: 'Low risk', className: 'text-muted-foreground' },\n MEDIUM: { Icon: AlertTriangle, label: 'Medium risk', className: 'text-status-warning-text' },\n HIGH: { Icon: ShieldAlert, label: 'High risk', className: 'text-status-error-text' },\n};\n\n/** Icon + text label (never colour alone) for a risk level; the note (if any) shows on hover/focus via a\n * tooltip, which is keyboard-reachable because the trigger is a real, focusable button. */\nfunction RiskIndicator({ level, note }: { level: NnlItem['riskLevel']; note: string | null }) {\n if (!level) return null;\n const meta = RISK_META[level];\n const badge = (\n <span\n data-testid=\"nnl-risk\"\n className={`inline-flex items-center gap-1 text-xs ${meta.className}`}\n >\n <meta.Icon className=\"h-3.5 w-3.5\" aria-hidden=\"true\" />\n {meta.label}\n </span>\n );\n if (!note) return badge;\n return (\n <TooltipProvider>\n <Tooltip>\n <TooltipTrigger asChild>\n <button\n type=\"button\"\n className=\"rounded focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n {badge}\n </button>\n </TooltipTrigger>\n <TooltipContent className=\"max-w-xs\">{note}</TooltipContent>\n </Tooltip>\n </TooltipProvider>\n );\n}\n\nfunction ConfidenceBadge({ confidence }: { confidence: number | null }) {\n if (confidence === null) return null;\n return (\n <span\n data-testid=\"nnl-confidence\"\n className=\"inline-flex items-center gap-1 text-xs text-muted-foreground\"\n >\n <Gauge className=\"h-3.5 w-3.5\" aria-hidden=\"true\" />\n {confidence}% confident\n </span>\n );\n}\n\n/** The keyboard/menu equivalent of dragging: every horizon this card isn't already in, plus reorder-in-place.\n * A native `<select>` with a constant `value=\"\"` — the same \"Move…\" pattern `board/ProjectBoard.tsx` uses — so\n * it always shows the placeholder after an action instead of needing to be reset by hand. */\nfunction CardMoveMenu({\n item,\n columnKey,\n laneItems,\n disabled,\n onMoveTo,\n onShift,\n}: {\n item: NnlItem;\n columnKey: ColumnKey;\n laneItems: NnlItem[];\n disabled: boolean;\n onMoveTo: (target: ColumnKey) => void;\n onShift: (delta: -1 | 1) => void;\n}) {\n const pos = laneItems.findIndex((it) => it.id === item.id);\n const canUp = pos > 0;\n const canDown = pos !== -1 && pos < laneItems.length - 1;\n return (\n <select\n id={`nnl-move-${item.id}`}\n aria-label={`Move ${item.title}`}\n data-testid=\"nnl-card-move\"\n className=\"rounded border border-input bg-background px-1 py-0.5 text-[11px] disabled:opacity-60\"\n value=\"\"\n disabled={disabled}\n onChange={(e) => {\n const v = e.target.value;\n if (v === 'up') onShift(-1);\n else if (v === 'down') onShift(1);\n // Every other <option> value below is a literal ColumnKey from COLUMNS itself, so this is safe.\n else if (v) onMoveTo(v as ColumnKey);\n }}\n >\n <option value=\"\">Move…</option>\n {COLUMNS.filter((c) => c.key !== columnKey).map((c) => (\n <option key={c.key} value={c.key}>\n Move to {c.label}\n </option>\n ))}\n <option value=\"up\" disabled={!canUp}>\n Move up\n </option>\n <option value=\"down\" disabled={!canDown}>\n Move down\n </option>\n </select>\n );\n}\n\nfunction NnlCard({\n item,\n columnKey,\n laneItems,\n draggable,\n dragging,\n dropIndicator,\n moveDisabled,\n onDragStart,\n onDragEnd,\n onDragOverCard,\n onDropOnCard,\n onMoveTo,\n onShift,\n}: {\n item: NnlItem;\n columnKey: ColumnKey;\n laneItems: NnlItem[];\n draggable: boolean;\n dragging: boolean;\n dropIndicator: 'before' | 'after' | null;\n moveDisabled: boolean;\n onDragStart: (id: string) => void;\n onDragEnd: () => void;\n onDragOverCard: (e: DragEvent<HTMLLIElement>) => void;\n onDropOnCard: (e: DragEvent<HTMLLIElement>) => void;\n onMoveTo: (target: ColumnKey) => void;\n onShift: (delta: -1 | 1) => void;\n}) {\n const demand = item.featureRequestDemand;\n return (\n <li\n draggable={draggable}\n onDragStart={(e) => {\n e.dataTransfer.setData('text/plain', item.id);\n e.dataTransfer.effectAllowed = 'move';\n onDragStart(item.id);\n }}\n onDragEnd={onDragEnd}\n onDragOver={onDragOverCard}\n onDrop={onDropOnCard}\n data-testid=\"nnl-card\"\n className={[\n 'space-y-1.5 rounded-md border bg-background p-2 text-sm',\n draggable ? 'cursor-grab' : '',\n dragging ? 'opacity-50' : '',\n dropIndicator === 'before' ? 'border-t-2 border-t-primary' : '',\n dropIndicator === 'after' ? 'border-b-2 border-b-primary' : '',\n ]\n .filter(Boolean)\n .join(' ')}\n >\n <p className=\"font-medium leading-tight\">{item.title}</p>\n <div className=\"flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted-foreground\">\n <span>{enumLabel(item.status)}</span>\n {(item.startDate || item.endDate) && (\n <span className=\"flex items-center gap-1\">\n <Calendar className=\"h-3 w-3\" aria-hidden=\"true\" />\n {item.startDate ? new Date(item.startDate).toLocaleDateString() : '?'}\n {' - '}\n {item.endDate ? new Date(item.endDate).toLocaleDateString() : '?'}\n </span>\n )}\n </div>\n {demand && demand.requests > 0 && (\n <p className=\"text-xs text-muted-foreground\" data-testid=\"roadmap-item-demand\">\n {demand.requests} feature request{demand.requests === 1 ? '' : 's'} · {demand.votes} vote\n {demand.votes === 1 ? '' : 's'}\n </p>\n )}\n <div className=\"flex flex-wrap items-center gap-x-3 gap-y-1\">\n <ConfidenceBadge confidence={item.confidence} />\n <RiskIndicator level={item.riskLevel} note={item.riskNote} />\n </div>\n <div className=\"flex justify-end pt-0.5\">\n <CardMoveMenu\n item={item}\n columnKey={columnKey}\n laneItems={laneItems}\n disabled={moveDisabled}\n onMoveTo={onMoveTo}\n onShift={onShift}\n />\n </div>\n </li>\n );\n}\n\n/** Drop-target state: `laneKey` pins the drop to one column's one lane section, so hovering a different lane's\n * (rendered) section in the same column never gets confused with this one — see the module docstring. */\ninterface DropTarget {\n columnKey: ColumnKey;\n laneKey: string;\n beforeId: string | null;\n}\n\nexport function RoadmapNowNextLater({ roadmapId }: { roadmapId: string }) {\n const { workspaceId } = usePlanMagnet();\n const { items, loading, error, totalCount, truncated } = useAllRoadmapItems(\n workspaceId,\n roadmapId\n );\n const [move, moveState] = useMutation(MOVE_ITEM, {\n refetchQueries: [\n 'GetRoadmapDetailPage',\n 'GetRoadmapDetail',\n 'GetRoadmapAnalytics',\n 'RoadmapNowNextLaterItems',\n ],\n awaitRefetchQueries: true,\n });\n const [actionError, setActionError] = useState<string | null>(null);\n const [forbidden, setForbidden] = useState(false);\n const [announcement, setAnnouncement] = useState('');\n const [draggingId, setDraggingId] = useState<string | null>(null);\n const [dropTarget, setDropTarget] = useState<DropTarget | null>(null);\n const [pendingFocusId, setPendingFocusId] = useState<string | null>(null);\n\n // Lane keys in first-appearance order across the WHOLE roadmap (not per column), so every column groups its\n // cards into the same lane sections in the same order — same convention as the Timeline view's\n // `swimlaneGroups`, generalized so it stays consistent across all four columns.\n const laneOrder = useMemo(() => {\n const seen = new Set<string>();\n const order: string[] = [];\n for (const item of items) {\n const key = laneKey(item);\n if (!seen.has(key)) {\n seen.add(key);\n order.push(key);\n }\n }\n return order;\n }, [items]);\n // Only disambiguate visually when there's something to disambiguate: a roadmap that never uses more than one\n // lane renders exactly one unlabelled section per column, identical to a flat list.\n const hasMultipleLanes = laneOrder.length > 1;\n\n const byColumn = useMemo(() => {\n const groups: Record<ColumnKey, NnlItem[]> = { UNPLACED: [], NOW: [], NEXT: [], LATER: [] };\n for (const item of items) groups[columnOf(item.horizon)].push(item);\n return groups;\n }, [items]);\n\n // Every (column, lane) pair's items, in sortOrder — the unit both rendering and move math operate on.\n const byColumnLane = useMemo(() => {\n const groups: Record<ColumnKey, Record<string, NnlItem[]>> = {\n UNPLACED: {},\n NOW: {},\n NEXT: {},\n LATER: {},\n };\n for (const key of laneOrder) {\n groups.UNPLACED[key] = [];\n groups.NOW[key] = [];\n groups.NEXT[key] = [];\n groups.LATER[key] = [];\n }\n for (const item of items) {\n const col = columnOf(item.horizon);\n const lane = laneKey(item);\n (groups[col][lane] ??= []).push(item);\n }\n return groups;\n }, [items, laneOrder]);\n\n // Focus the moved card's own \"Move…\" control once the board has re-rendered in its new position — a\n // horizon-changing move remounts the control in a different column's DOM subtree, which would otherwise drop\n // focus back to the document body with no notice to a keyboard/screen-reader user.\n useEffect(() => {\n if (!pendingFocusId) return;\n const id = pendingFocusId;\n const raf = requestAnimationFrame(() => {\n document.getElementById(`nnl-move-${id}`)?.focus();\n setPendingFocusId(null);\n });\n return () => cancelAnimationFrame(raf);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [items]);\n\n const busy = moveState.loading;\n const movesAllowed = !forbidden;\n const draggingItem = draggingId ? (items.find((it) => it.id === draggingId) ?? null) : null;\n\n const runMove = async (\n item: NnlItem,\n horizon: Horizon,\n index: number,\n resultLabel: string,\n focusAfter: boolean\n ) => {\n setActionError(null);\n if (focusAfter) setPendingFocusId(item.id);\n try {\n await throwOnError(move({ variables: { id: item.id, input: { horizon, index } } }));\n setAnnouncement(`Moved \"${item.title}\" to ${resultLabel}.`);\n } catch (e) {\n if (isForbidden(e)) {\n setForbidden(true);\n setActionError('Your role cannot reorder this roadmap.');\n setAnnouncement(`Move refused: your role cannot reorder this roadmap.`);\n } else {\n const msg = mutationErrorMessage(e, 'The item could not be moved.');\n setActionError(msg);\n setAnnouncement(`Move failed: ${msg}`);\n }\n }\n };\n\n /** `laneItems` is one (column, lane) section's own list — see the module docstring on why the move never\n * needs to consider any other lane's items. */\n const dropOnLane = (\n columnKey: ColumnKey,\n lane: string,\n laneItems: NnlItem[],\n draggedId: string,\n beforeId: string | null\n ) => {\n if (!movesAllowed || busy) return;\n const movedItem = items.find((it) => it.id === draggedId);\n if (!movedItem) return;\n // Defensive: the section's own onDragOver already refuses to arm a drop target for a foreign lane (and a\n // dragover that never calls preventDefault never gets a drop event at all), but a drop is rejected here too\n // in case that ever changes — the move must never silently reassign `swimlane`.\n if (laneKey(movedItem) !== lane) return;\n const column = COLUMNS.find((c) => c.key === columnKey);\n if (!column) return;\n const index = destinationIndex(laneItems, movedItem.id, beforeId);\n // No-op guard: `destinationIndex` already excludes the moved item from its own count, so \"drop just before\n // itself\" and \"drop just after itself\" both resolve to its current lane-relative index — a single equality\n // check catches both without needing to special-case direction.\n if (columnOf(movedItem.horizon) === columnKey) {\n const currentIndex = laneItems.findIndex((it) => it.id === movedItem.id);\n if (currentIndex === index) return;\n }\n void runMove(movedItem, column.horizon, index, column.label, false);\n };\n\n const laneCardDragOver =\n (columnKey: ColumnKey, lane: string, laneItems: NnlItem[]) =>\n (e: DragEvent<HTMLLIElement>, item: NnlItem, index: number) => {\n if (!movesAllowed || busy || !draggingItem || laneKey(draggingItem) !== lane) return;\n e.preventDefault();\n // Stop this from also bubbling to the lane section's own onDragOver, which would otherwise overwrite the\n // precise before/after target computed here with \"append at the end\" on every mousemove over a card.\n e.stopPropagation();\n e.dataTransfer.dropEffect = 'move';\n const rect = e.currentTarget.getBoundingClientRect();\n const before = e.clientY < rect.top + rect.height / 2;\n const beforeId = before ? item.id : (laneItems[index + 1]?.id ?? null);\n setDropTarget({ columnKey, laneKey: lane, beforeId });\n };\n\n const laneDrop =\n (columnKey: ColumnKey, lane: string, laneItems: NnlItem[]) => (e: DragEvent<HTMLElement>) => {\n e.preventDefault();\n // Stop this from also bubbling to the section's own onDrop, which would otherwise run the same drop a\n // second time with the section-level (already-cleared) target.\n e.stopPropagation();\n const draggedId = e.dataTransfer.getData('text/plain');\n const beforeId =\n dropTarget?.columnKey === columnKey && dropTarget.laneKey === lane\n ? dropTarget.beforeId\n : null;\n setDropTarget(null);\n setDraggingId(null);\n if (draggedId) dropOnLane(columnKey, lane, laneItems, draggedId, beforeId);\n };\n\n if (loading) {\n return (\n <div className=\"flex items-center justify-center p-12\" data-testid=\"nnl-board\">\n <Loader2 className=\"h-8 w-8 animate-spin text-muted-foreground\" aria-hidden=\"true\" />\n </div>\n );\n }\n\n if (error) {\n return (\n <div className=\"p-6 text-destructive\" data-testid=\"nnl-board\">\n Failed to load roadmap items: {error.message}\n </div>\n );\n }\n\n return (\n <div className=\"space-y-3\" data-testid=\"nnl-board\">\n <p className=\"sr-only\" role=\"status\" aria-live=\"polite\">\n {announcement}\n </p>\n {forbidden && (\n <p\n role=\"alert\"\n className=\"rounded-md border border-destructive/40 p-2 text-sm text-destructive\"\n >\n Your role can view this roadmap but not reorder it. Moves are disabled below.\n </p>\n )}\n {!forbidden && actionError && (\n <p\n role=\"alert\"\n className=\"rounded-md border border-destructive/40 p-2 text-sm text-destructive\"\n >\n {actionError}\n </p>\n )}\n {truncated && (\n <p className=\"text-xs text-muted-foreground\">\n Showing the first {MAX_ITEMS} of {totalCount} items.\n </p>\n )}\n <div className=\"grid grid-cols-1 gap-3 md:grid-cols-4\">\n {COLUMNS.map((column) => {\n const columnItems = byColumn[column.key];\n // Every lane's own list for this column, plus whether it should render at all: a roadmap using only\n // one lane always shows its (possibly empty) single section, exactly like the old flat list; once a\n // roadmap uses more than one lane, an EMPTY lane's section only appears while something from that\n // exact lane is being dragged (so it can serve as a drop target), keeping the common, non-dragging\n // view free of empty \"Lane — no items\" clutter.\n const laneSections = laneOrder\n .map((lane) => ({ lane, laneItems: byColumnLane[column.key][lane] ?? [] }))\n .filter(\n ({ lane, laneItems }) =>\n !hasMultipleLanes ||\n laneItems.length > 0 ||\n (draggingItem && laneKey(draggingItem) === lane)\n );\n return (\n <section\n key={column.key}\n aria-label={`${column.label} column`}\n data-testid={`nnl-column-${column.key}`}\n className=\"min-h-[120px] rounded-md border bg-muted/30 p-2\"\n // The whole column accepts a drop, not just its lane lists: a card dropped on the column's empty\n // space (below a short list, or on its header) goes to the END of its own lane in this column — the\n // lane never changes on a drop (see dropOnLane). The lists and cards handle their own, more precise\n // drops and stop them here.\n onDragOver={(e) => {\n if (!movesAllowed || busy || !draggingItem) return;\n e.preventDefault();\n e.dataTransfer.dropEffect = 'move';\n setDropTarget({\n columnKey: column.key,\n laneKey: laneKey(draggingItem),\n beforeId: null,\n });\n }}\n onDrop={(e) => {\n if (!draggingItem) return;\n const lane = laneKey(draggingItem);\n laneDrop(column.key, lane, byColumnLane[column.key][lane] ?? [])(e);\n }}\n >\n <h3 className=\"mb-2 flex items-center gap-1.5 text-sm font-medium\">\n {column.key === 'UNPLACED' && (\n <Inbox className=\"h-3.5 w-3.5 text-muted-foreground\" aria-hidden=\"true\" />\n )}\n {column.label}\n <span className=\"text-xs text-muted-foreground\">({columnItems.length})</span>\n </h3>\n {laneSections.length === 0 && (\n <p className=\"py-4 text-center text-xs text-muted-foreground\">No items</p>\n )}\n <div className=\"space-y-3\">\n {laneSections.map(({ lane, laneItems }) => {\n const isLaneDropTarget =\n dropTarget?.columnKey === column.key && dropTarget.laneKey === lane;\n return (\n <div key={lane || '(none)'} className=\"space-y-1\">\n {hasMultipleLanes && (\n <p\n data-testid=\"nnl-lane-label\"\n className=\"text-[11px] font-medium text-muted-foreground\"\n >\n {laneLabel(lane)}{' '}\n <span className=\"text-muted-foreground/70\">({laneItems.length})</span>\n </p>\n )}\n <ul\n className={`min-h-[48px] space-y-2 rounded-sm p-1 ${\n isLaneDropTarget && !dropTarget.beforeId ? 'ring-2 ring-primary' : ''\n }`}\n onDragOver={(e) => {\n if (\n !movesAllowed ||\n busy ||\n !draggingItem ||\n laneKey(draggingItem) !== lane\n )\n return;\n e.preventDefault();\n e.dataTransfer.dropEffect = 'move';\n setDropTarget({ columnKey: column.key, laneKey: lane, beforeId: null });\n }}\n onDrop={laneDrop(column.key, lane, laneItems)}\n >\n {laneItems.length === 0 && (\n <li\n className=\"py-2 text-center text-[11px] text-muted-foreground\"\n aria-hidden=\"true\"\n >\n Drop here\n </li>\n )}\n {laneItems.map((item, index) => {\n // 'before': the drop would land this card right in front of `item`. 'after': the drop\n // targets \"end of this lane's section\" (beforeId null) and `item` is that section's\n // last card, so the line belongs below it.\n const dropIndicator: 'before' | 'after' | null = !isLaneDropTarget\n ? null\n : dropTarget.beforeId === item.id\n ? 'before'\n : dropTarget.beforeId === null && index === laneItems.length - 1\n ? 'after'\n : null;\n return (\n <NnlCard\n key={item.id}\n item={item}\n columnKey={column.key}\n laneItems={laneItems}\n draggable={movesAllowed && !busy}\n dragging={draggingId === item.id}\n dropIndicator={dropIndicator}\n moveDisabled={!movesAllowed || busy}\n onDragStart={setDraggingId}\n onDragEnd={() => {\n setDraggingId(null);\n setDropTarget(null);\n }}\n onDragOverCard={(e) =>\n laneCardDragOver(column.key, lane, laneItems)(e, item, index)\n }\n onDropOnCard={laneDrop(column.key, lane, laneItems)}\n onMoveTo={(target) => {\n const targetColumn = COLUMNS.find((c) => c.key === target);\n if (!targetColumn) return;\n const targetLaneItems = byColumnLane[target][laneKey(item)] ?? [];\n const index2 = destinationIndex(targetLaneItems, item.id, null);\n void runMove(\n item,\n targetColumn.horizon,\n index2,\n targetColumn.label,\n true\n );\n }}\n onShift={(delta) => {\n const pos = laneItems.findIndex((it) => it.id === item.id);\n const target = pos + delta;\n if (pos === -1 || target < 0 || target >= laneItems.length) return;\n void runMove(item, item.horizon, target, column.label, true);\n }}\n />\n );\n })}\n </ul>\n </div>\n );\n })}\n </div>\n </section>\n );\n })}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;AAsCA,IAAM,IAAc,0LAkBd,IAAY,CAAG;;;;;;;;UAQX,EAAY;;;;;;;;;GAWhB,IAAY,CAAG;;;QAGb,EAAY;;;GAuBd,IAAiE;CACrE;EAAE,KAAK;EAAY,OAAO;EAAc,SAAS;EAAM;CACvD;EAAE,KAAK;EAAO,OAAO;E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AAU;YAI9B,IAAM,IAA4C,IAE9C,EAAW,aAAa,EAAK,KAC3B,WACA,EAAW,aAAa,QAAQ,MAAU,EAAU,SAAS,IAC3D,UACA,OALJ;AAMJ,mBACE,kBAAC,GAAD;aAEQ;aACN,WAAW,EAAO;aACP;aACX,WAAW,KAAgB,CAAC;aAC5B,UAAU,MAAe,EAAK;aACf;aACf,cAAc,CAAC,KAAgB;aAC/B,aAAa;aACb,iBAAiB;AAEf,cADA,EAAc,KAAK,EACnB,EAAc,KAAK;;aAErB,iBAAiB,MACf,EAAiB,EAAO,KAAK,GAAM,EAAU,CAAC,GAAG,GAAM,EAAM;aAE/D,cAAc,EAAS,EAAO,KAAK,GAAM,EAAU;aACnD,WAAW,MAAW;cACpB,IAAM,IAAe,EAAQ,MAAM,MAAM,EAAE,QAAQ,EAAO;AAC1D,kBAAI,CAAC,EAAc;cAEnB,IAAM,IAAS,EADS,EAAa,GAAQ,EAAQ,EAAK,KAAK,EAAE,EAChB,EAAK,IAAI,KAAK;AAC1D,gBACH,GACA,EAAa,SACb,GACA,EAAa,OACb,GACD;;aAEH,UAAU,MAAU;cAClB,IAAM,IAAM,EAAU,WAAW,MAAO,EAAG,OAAO,EAAK,GAAG,EACpD,IAAS,IAAM;AACjB,oBAAQ,MAAM,IAAS,KAAK,KAAU,EAAU,UAC/C,EAAQ,GAAM,EAAK,SAAS,GAAQ,EAAO,OAAO,GAAK;;aAE9D,EApCK,EAAK,GAoCV;aAEJ,CACC;aACD;YAzFI,KAAQ,SAyFZ;UAER;QACE,CAAA;OACE;QApIH,EAAO,IAoIJ;MAEZ;IACE,CAAA;GACF"}
|
|
1
|
+
{"version":3,"file":"RoadmapNowNextLater.js","names":[],"sources":["../../../src/planmagnet/roadmaps/RoadmapNowNextLater.tsx"],"sourcesContent":["import { useEffect, useMemo, useState, type DragEvent } from 'react';\nimport { gql } from '@apollo/client';\nimport { useMutation, useQuery } from '@apollo/client/react';\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@burdenoff/fe-libs/ui';\nimport {\n AlertTriangle,\n Calendar,\n Gauge,\n Inbox,\n Loader2,\n ShieldAlert,\n ShieldCheck,\n} from 'lucide-react';\nimport { usePlanMagnet } from '../providers/PlanMagnetProvider';\nimport { throwOnError } from '../utils/mutationResult';\nimport { isForbidden, mutationErrorMessage } from '../utils/graphqlErrors';\nimport { enumLabel } from '../controls/WorkItemControls';\n\n/**\n * Now/Next/Later (PRM-06, PRM-09, PRM-10): a VIEW of a roadmap's items grouped by `horizon`, alongside the\n * existing Timeline view (`ProductsRoadmapDetailPagePage.tsx`) — not a separate roadmap type. Placement is\n * changed by dragging a card, or by the keyboard \"Move…\" select every card also carries (the same mutation\n * either way: `planmagnetMoveRoadmapItem`), never optimistically: the list shown is always what\n * `planmagnetRoadmapItems` last returned, so a refused move has nothing local to \"undo\" — the card simply never\n * left its column.\n *\n * `planmagnetMoveRoadmapItem`'s `index` is scoped to the (roadmap, horizon, **swimlane**) group, not to the\n * column as a whole — the same lane-scoping the Timeline view treats as first-class (`swimlaneGroups` there).\n * Each column therefore renders its cards **grouped by lane** (one sub-list per lane, in the same order in\n * every column), exactly like the Timeline view's per-lane cards. A drag/drop within a lane's sub-list, or a\n * \"Move…\" menu action, only ever computes an index against that same sub-list — so \"the end of this section\"\n * (what the user sees) and \"the end of this lane's server-side group\" (what the index means) are always the\n * same place, with no cross-lane ambiguity. Dropping a card onto a *different* lane's section is rejected (the\n * move never changes `swimlane`); the lane header is only shown once a roadmap actually uses more than one\n * lane, so a single-lane (the common case) or lane-less roadmap renders exactly one unlabelled section per\n * column — visually identical to a flat list.\n */\n\nconst ITEM_FIELDS = `\n id\n title\n status\n startDate\n endDate\n horizon\n swimlane\n sortOrder\n confidence\n riskLevel\n riskNote\n featureRequestDemand {\n requests\n votes\n }\n`;\n\nconst NNL_ITEMS = gql`\n query RoadmapNowNextLaterItems(\n $workspaceId: ID!\n $filter: PlanmagnetRoadmapItemFilter\n $pagination: PlanmagnetPaginationInput\n ) {\n planmagnetRoadmapItems(workspaceId: $workspaceId, filter: $filter, pagination: $pagination) {\n items {\n ${ITEM_FIELDS}\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n totalCount\n }\n }\n`;\n\nconst MOVE_ITEM = gql`\n mutation RoadmapNowNextLaterMove($id: ID!, $input: PlanmagnetMoveRoadmapItemInput!) {\n planmagnetMoveRoadmapItem(id: $id, input: $input) {\n ${ITEM_FIELDS}\n }\n }\n`;\n\ninterface NnlItem {\n id: string;\n title: string;\n status: string;\n startDate: string | null;\n endDate: string | null;\n horizon: 'NOW' | 'NEXT' | 'LATER' | null;\n swimlane: string | null;\n sortOrder: number;\n confidence: number | null;\n riskLevel: 'LOW' | 'MEDIUM' | 'HIGH' | null;\n riskNote: string | null;\n featureRequestDemand: { requests: number; votes: number } | null;\n}\n\ntype ColumnKey = 'UNPLACED' | 'NOW' | 'NEXT' | 'LATER';\ntype Horizon = 'NOW' | 'NEXT' | 'LATER' | null;\n\nconst COLUMNS: { key: ColumnKey; label: string; horizon: Horizon }[] = [\n { key: 'UNPLACED', label: 'Not placed', horizon: null },\n { key: 'NOW', label: 'Now', horizon: 'NOW' },\n { key: 'NEXT', label: 'Next', horizon: 'NEXT' },\n { key: 'LATER', label: 'Later', horizon: 'LATER' },\n];\nconst columnOf = (horizon: Horizon): ColumnKey => horizon ?? 'UNPLACED';\n\nconst PAGE_SIZE = 200;\n/** Items beyond this many are not loaded. Stated rather than silently dropped: a banner below the board says so\n * when the cap is actually hit, the same \"never silently stop\" convention as `controls/Pickers.tsx`. */\nconst MAX_ITEMS = 2000;\n\n/** Every item on the roadmap, paged through in full (never just the first page) up to `MAX_ITEMS`, ordered by\n * sortOrder then id — same pattern as `ProjectSelect` in `controls/Pickers.tsx`, generalized to a full board\n * rather than a picker list. */\nfunction useAllRoadmapItems(workspaceId: string | undefined, roadmapId: string) {\n const { data, loading, error, fetchMore } = useQuery<{\n planmagnetRoadmapItems: {\n items: NnlItem[];\n pageInfo: { hasNextPage: boolean; endCursor: string | null };\n totalCount: number;\n };\n }>(NNL_ITEMS, {\n variables: {\n workspaceId: workspaceId ?? '',\n filter: { roadmapId },\n pagination: { first: PAGE_SIZE },\n },\n skip: !workspaceId || !roadmapId,\n });\n const loaded = data?.planmagnetRoadmapItems.items ?? [];\n const hasNextPage = data?.planmagnetRoadmapItems.pageInfo.hasNextPage ?? false;\n const endCursor = data?.planmagnetRoadmapItems.pageInfo.endCursor ?? null;\n const totalCount = data?.planmagnetRoadmapItems.totalCount ?? 0;\n\n useEffect(() => {\n if (!hasNextPage || !endCursor || loaded.length >= MAX_ITEMS) return;\n fetchMore({\n variables: { pagination: { first: PAGE_SIZE, after: endCursor } },\n updateQuery: (prev, { fetchMoreResult }) => ({\n planmagnetRoadmapItems: {\n ...fetchMoreResult.planmagnetRoadmapItems,\n items: [\n ...prev.planmagnetRoadmapItems.items,\n ...fetchMoreResult.planmagnetRoadmapItems.items,\n ],\n },\n }),\n }).catch(() => {\n // A failed extra page leaves the items already loaded usable; `truncated` below still reports the gap.\n });\n }, [hasNextPage, endCursor, loaded.length, fetchMore]);\n\n return {\n items: loaded,\n loading: loading && !data,\n error,\n totalCount,\n truncated: hasNextPage && loaded.length >= MAX_ITEMS,\n };\n}\n\n/** An item's lane key for grouping — `null`/unset normalizes to `''` so it compares equal to itself. */\nconst laneKey = (item: NnlItem) => item.swimlane ?? '';\n/** Display label for a lane key, matching the Timeline view's own term for the unassigned bucket\n * (`ProductsRoadmapDetailPagePage.tsx`'s `swimlaneGroups`). */\nconst laneLabel = (key: string) => key || 'Uncategorized';\n\n/**\n * The 0-based index to send `planmagnetMoveRoadmapItem` so `movedItem` lands where the drop indicates.\n * `laneItems` MUST already be scoped to a single lane's section (the same list the card was dropped in/onto —\n * see the module docstring), so there is no cross-lane ambiguity left to resolve here: `beforeId` is the id of\n * the card the drop should land in front of within that section, or `null` for the end of it, which is exactly\n * the end of the (roadmap, horizon, lane) group the server indexes into.\n */\nfunction destinationIndex(\n laneItems: NnlItem[],\n movedItemId: string,\n beforeId: string | null\n): number {\n const others = laneItems.filter((it) => it.id !== movedItemId);\n if (beforeId === null) return others.length;\n const cut = others.findIndex((it) => it.id === beforeId);\n return cut === -1 ? others.length : cut;\n}\n\nconst RISK_META: Record<\n 'LOW' | 'MEDIUM' | 'HIGH',\n { Icon: typeof ShieldCheck; label: string; className: string }\n> = {\n LOW: { Icon: ShieldCheck, label: 'Low risk', className: 'text-muted-foreground' },\n MEDIUM: { Icon: AlertTriangle, label: 'Medium risk', className: 'text-status-warning-text' },\n HIGH: { Icon: ShieldAlert, label: 'High risk', className: 'text-status-error-text' },\n};\n\n/** Icon + text label (never colour alone) for a risk level; the note (if any) shows on hover/focus via a\n * tooltip, which is keyboard-reachable because the trigger is a real, focusable button. Exported for\n * `roadmaps/RoadmapPresentation.tsx` (PRM-11), which reuses this exact chip rather than re-deriving risk styling. */\nexport function RiskIndicator({\n level,\n note,\n}: {\n level: NnlItem['riskLevel'];\n note: string | null;\n}) {\n if (!level) return null;\n const meta = RISK_META[level];\n const badge = (\n <span\n data-testid=\"nnl-risk\"\n className={`inline-flex items-center gap-1 text-xs ${meta.className}`}\n >\n <meta.Icon className=\"h-3.5 w-3.5\" aria-hidden=\"true\" />\n {meta.label}\n </span>\n );\n if (!note) return badge;\n return (\n <TooltipProvider>\n <Tooltip>\n <TooltipTrigger asChild>\n <button\n type=\"button\"\n className=\"rounded focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n {badge}\n </button>\n </TooltipTrigger>\n <TooltipContent className=\"max-w-xs\">{note}</TooltipContent>\n </Tooltip>\n </TooltipProvider>\n );\n}\n\n/** Exported for `roadmaps/RoadmapPresentation.tsx` (PRM-11) — see `RiskIndicator` above. */\nexport function ConfidenceBadge({ confidence }: { confidence: number | null }) {\n if (confidence === null) return null;\n return (\n <span\n data-testid=\"nnl-confidence\"\n className=\"inline-flex items-center gap-1 text-xs text-muted-foreground\"\n >\n <Gauge className=\"h-3.5 w-3.5\" aria-hidden=\"true\" />\n {confidence}% confident\n </span>\n );\n}\n\n/** The keyboard/menu equivalent of dragging: every horizon this card isn't already in, plus reorder-in-place.\n * A native `<select>` with a constant `value=\"\"` — the same \"Move…\" pattern `board/ProjectBoard.tsx` uses — so\n * it always shows the placeholder after an action instead of needing to be reset by hand. */\nfunction CardMoveMenu({\n item,\n columnKey,\n laneItems,\n disabled,\n onMoveTo,\n onShift,\n}: {\n item: NnlItem;\n columnKey: ColumnKey;\n laneItems: NnlItem[];\n disabled: boolean;\n onMoveTo: (target: ColumnKey) => void;\n onShift: (delta: -1 | 1) => void;\n}) {\n const pos = laneItems.findIndex((it) => it.id === item.id);\n const canUp = pos > 0;\n const canDown = pos !== -1 && pos < laneItems.length - 1;\n return (\n <select\n id={`nnl-move-${item.id}`}\n aria-label={`Move ${item.title}`}\n data-testid=\"nnl-card-move\"\n className=\"rounded border border-input bg-background px-1 py-0.5 text-[11px] disabled:opacity-60\"\n value=\"\"\n disabled={disabled}\n onChange={(e) => {\n const v = e.target.value;\n if (v === 'up') onShift(-1);\n else if (v === 'down') onShift(1);\n // Every other <option> value below is a literal ColumnKey from COLUMNS itself, so this is safe.\n else if (v) onMoveTo(v as ColumnKey);\n }}\n >\n <option value=\"\">Move…</option>\n {COLUMNS.filter((c) => c.key !== columnKey).map((c) => (\n <option key={c.key} value={c.key}>\n Move to {c.label}\n </option>\n ))}\n <option value=\"up\" disabled={!canUp}>\n Move up\n </option>\n <option value=\"down\" disabled={!canDown}>\n Move down\n </option>\n </select>\n );\n}\n\nfunction NnlCard({\n item,\n columnKey,\n laneItems,\n draggable,\n dragging,\n dropIndicator,\n moveDisabled,\n onDragStart,\n onDragEnd,\n onDragOverCard,\n onDropOnCard,\n onMoveTo,\n onShift,\n}: {\n item: NnlItem;\n columnKey: ColumnKey;\n laneItems: NnlItem[];\n draggable: boolean;\n dragging: boolean;\n dropIndicator: 'before' | 'after' | null;\n moveDisabled: boolean;\n onDragStart: (id: string) => void;\n onDragEnd: () => void;\n onDragOverCard: (e: DragEvent<HTMLLIElement>) => void;\n onDropOnCard: (e: DragEvent<HTMLLIElement>) => void;\n onMoveTo: (target: ColumnKey) => void;\n onShift: (delta: -1 | 1) => void;\n}) {\n const demand = item.featureRequestDemand;\n return (\n <li\n draggable={draggable}\n onDragStart={(e) => {\n e.dataTransfer.setData('text/plain', item.id);\n e.dataTransfer.effectAllowed = 'move';\n onDragStart(item.id);\n }}\n onDragEnd={onDragEnd}\n onDragOver={onDragOverCard}\n onDrop={onDropOnCard}\n data-testid=\"nnl-card\"\n className={[\n 'space-y-1.5 rounded-md border bg-background p-2 text-sm',\n draggable ? 'cursor-grab' : '',\n dragging ? 'opacity-50' : '',\n dropIndicator === 'before' ? 'border-t-2 border-t-primary' : '',\n dropIndicator === 'after' ? 'border-b-2 border-b-primary' : '',\n ]\n .filter(Boolean)\n .join(' ')}\n >\n <p className=\"font-medium leading-tight\">{item.title}</p>\n <div className=\"flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted-foreground\">\n <span>{enumLabel(item.status)}</span>\n {(item.startDate || item.endDate) && (\n <span className=\"flex items-center gap-1\">\n <Calendar className=\"h-3 w-3\" aria-hidden=\"true\" />\n {item.startDate ? new Date(item.startDate).toLocaleDateString() : '?'}\n {' - '}\n {item.endDate ? new Date(item.endDate).toLocaleDateString() : '?'}\n </span>\n )}\n </div>\n {demand && demand.requests > 0 && (\n <p className=\"text-xs text-muted-foreground\" data-testid=\"roadmap-item-demand\">\n {demand.requests} feature request{demand.requests === 1 ? '' : 's'} · {demand.votes} vote\n {demand.votes === 1 ? '' : 's'}\n </p>\n )}\n <div className=\"flex flex-wrap items-center gap-x-3 gap-y-1\">\n <ConfidenceBadge confidence={item.confidence} />\n <RiskIndicator level={item.riskLevel} note={item.riskNote} />\n </div>\n <div className=\"flex justify-end pt-0.5\">\n <CardMoveMenu\n item={item}\n columnKey={columnKey}\n laneItems={laneItems}\n disabled={moveDisabled}\n onMoveTo={onMoveTo}\n onShift={onShift}\n />\n </div>\n </li>\n );\n}\n\n/** Drop-target state: `laneKey` pins the drop to one column's one lane section, so hovering a different lane's\n * (rendered) section in the same column never gets confused with this one — see the module docstring. */\ninterface DropTarget {\n columnKey: ColumnKey;\n laneKey: string;\n beforeId: string | null;\n}\n\nexport function RoadmapNowNextLater({ roadmapId }: { roadmapId: string }) {\n const { workspaceId } = usePlanMagnet();\n const { items, loading, error, totalCount, truncated } = useAllRoadmapItems(\n workspaceId,\n roadmapId\n );\n const [move, moveState] = useMutation(MOVE_ITEM, {\n refetchQueries: [\n 'GetRoadmapDetailPage',\n 'GetRoadmapDetail',\n 'GetRoadmapAnalytics',\n 'RoadmapNowNextLaterItems',\n ],\n awaitRefetchQueries: true,\n });\n const [actionError, setActionError] = useState<string | null>(null);\n const [forbidden, setForbidden] = useState(false);\n const [announcement, setAnnouncement] = useState('');\n const [draggingId, setDraggingId] = useState<string | null>(null);\n const [dropTarget, setDropTarget] = useState<DropTarget | null>(null);\n const [pendingFocusId, setPendingFocusId] = useState<string | null>(null);\n\n // Lane keys in first-appearance order across the WHOLE roadmap (not per column), so every column groups its\n // cards into the same lane sections in the same order — same convention as the Timeline view's\n // `swimlaneGroups`, generalized so it stays consistent across all four columns.\n const laneOrder = useMemo(() => {\n const seen = new Set<string>();\n const order: string[] = [];\n for (const item of items) {\n const key = laneKey(item);\n if (!seen.has(key)) {\n seen.add(key);\n order.push(key);\n }\n }\n return order;\n }, [items]);\n // Only disambiguate visually when there's something to disambiguate: a roadmap that never uses more than one\n // lane renders exactly one unlabelled section per column, identical to a flat list.\n const hasMultipleLanes = laneOrder.length > 1;\n\n const byColumn = useMemo(() => {\n const groups: Record<ColumnKey, NnlItem[]> = { UNPLACED: [], NOW: [], NEXT: [], LATER: [] };\n for (const item of items) groups[columnOf(item.horizon)].push(item);\n return groups;\n }, [items]);\n\n // Every (column, lane) pair's items, in sortOrder — the unit both rendering and move math operate on.\n const byColumnLane = useMemo(() => {\n const groups: Record<ColumnKey, Record<string, NnlItem[]>> = {\n UNPLACED: {},\n NOW: {},\n NEXT: {},\n LATER: {},\n };\n for (const key of laneOrder) {\n groups.UNPLACED[key] = [];\n groups.NOW[key] = [];\n groups.NEXT[key] = [];\n groups.LATER[key] = [];\n }\n for (const item of items) {\n const col = columnOf(item.horizon);\n const lane = laneKey(item);\n (groups[col][lane] ??= []).push(item);\n }\n return groups;\n }, [items, laneOrder]);\n\n // Focus the moved card's own \"Move…\" control once the board has re-rendered in its new position — a\n // horizon-changing move remounts the control in a different column's DOM subtree, which would otherwise drop\n // focus back to the document body with no notice to a keyboard/screen-reader user.\n useEffect(() => {\n if (!pendingFocusId) return;\n const id = pendingFocusId;\n const raf = requestAnimationFrame(() => {\n document.getElementById(`nnl-move-${id}`)?.focus();\n setPendingFocusId(null);\n });\n return () => cancelAnimationFrame(raf);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [items]);\n\n const busy = moveState.loading;\n const movesAllowed = !forbidden;\n const draggingItem = draggingId ? (items.find((it) => it.id === draggingId) ?? null) : null;\n\n const runMove = async (\n item: NnlItem,\n horizon: Horizon,\n index: number,\n resultLabel: string,\n focusAfter: boolean\n ) => {\n setActionError(null);\n if (focusAfter) setPendingFocusId(item.id);\n try {\n await throwOnError(move({ variables: { id: item.id, input: { horizon, index } } }));\n setAnnouncement(`Moved \"${item.title}\" to ${resultLabel}.`);\n } catch (e) {\n if (isForbidden(e)) {\n setForbidden(true);\n setActionError('Your role cannot reorder this roadmap.');\n setAnnouncement(`Move refused: your role cannot reorder this roadmap.`);\n } else {\n const msg = mutationErrorMessage(e, 'The item could not be moved.');\n setActionError(msg);\n setAnnouncement(`Move failed: ${msg}`);\n }\n }\n };\n\n /** `laneItems` is one (column, lane) section's own list — see the module docstring on why the move never\n * needs to consider any other lane's items. */\n const dropOnLane = (\n columnKey: ColumnKey,\n lane: string,\n laneItems: NnlItem[],\n draggedId: string,\n beforeId: string | null\n ) => {\n if (!movesAllowed || busy) return;\n const movedItem = items.find((it) => it.id === draggedId);\n if (!movedItem) return;\n // Defensive: the section's own onDragOver already refuses to arm a drop target for a foreign lane (and a\n // dragover that never calls preventDefault never gets a drop event at all), but a drop is rejected here too\n // in case that ever changes — the move must never silently reassign `swimlane`.\n if (laneKey(movedItem) !== lane) return;\n const column = COLUMNS.find((c) => c.key === columnKey);\n if (!column) return;\n const index = destinationIndex(laneItems, movedItem.id, beforeId);\n // No-op guard: `destinationIndex` already excludes the moved item from its own count, so \"drop just before\n // itself\" and \"drop just after itself\" both resolve to its current lane-relative index — a single equality\n // check catches both without needing to special-case direction.\n if (columnOf(movedItem.horizon) === columnKey) {\n const currentIndex = laneItems.findIndex((it) => it.id === movedItem.id);\n if (currentIndex === index) return;\n }\n void runMove(movedItem, column.horizon, index, column.label, false);\n };\n\n const laneCardDragOver =\n (columnKey: ColumnKey, lane: string, laneItems: NnlItem[]) =>\n (e: DragEvent<HTMLLIElement>, item: NnlItem, index: number) => {\n if (!movesAllowed || busy || !draggingItem || laneKey(draggingItem) !== lane) return;\n e.preventDefault();\n // Stop this from also bubbling to the lane section's own onDragOver, which would otherwise overwrite the\n // precise before/after target computed here with \"append at the end\" on every mousemove over a card.\n e.stopPropagation();\n e.dataTransfer.dropEffect = 'move';\n const rect = e.currentTarget.getBoundingClientRect();\n const before = e.clientY < rect.top + rect.height / 2;\n const beforeId = before ? item.id : (laneItems[index + 1]?.id ?? null);\n setDropTarget({ columnKey, laneKey: lane, beforeId });\n };\n\n const laneDrop =\n (columnKey: ColumnKey, lane: string, laneItems: NnlItem[]) => (e: DragEvent<HTMLElement>) => {\n e.preventDefault();\n // Stop this from also bubbling to the section's own onDrop, which would otherwise run the same drop a\n // second time with the section-level (already-cleared) target.\n e.stopPropagation();\n const draggedId = e.dataTransfer.getData('text/plain');\n const beforeId =\n dropTarget?.columnKey === columnKey && dropTarget.laneKey === lane\n ? dropTarget.beforeId\n : null;\n setDropTarget(null);\n setDraggingId(null);\n if (draggedId) dropOnLane(columnKey, lane, laneItems, draggedId, beforeId);\n };\n\n if (loading) {\n return (\n <div className=\"flex items-center justify-center p-12\" data-testid=\"nnl-board\">\n <Loader2 className=\"h-8 w-8 animate-spin text-muted-foreground\" aria-hidden=\"true\" />\n </div>\n );\n }\n\n if (error) {\n return (\n <div className=\"p-6 text-destructive\" data-testid=\"nnl-board\">\n Failed to load roadmap items: {error.message}\n </div>\n );\n }\n\n return (\n <div className=\"space-y-3\" data-testid=\"nnl-board\">\n <p className=\"sr-only\" role=\"status\" aria-live=\"polite\">\n {announcement}\n </p>\n {forbidden && (\n <p\n role=\"alert\"\n className=\"rounded-md border border-destructive/40 p-2 text-sm text-destructive\"\n >\n Your role can view this roadmap but not reorder it. Moves are disabled below.\n </p>\n )}\n {!forbidden && actionError && (\n <p\n role=\"alert\"\n className=\"rounded-md border border-destructive/40 p-2 text-sm text-destructive\"\n >\n {actionError}\n </p>\n )}\n {truncated && (\n <p className=\"text-xs text-muted-foreground\">\n Showing the first {MAX_ITEMS} of {totalCount} items.\n </p>\n )}\n <div className=\"grid grid-cols-1 gap-3 md:grid-cols-4\">\n {COLUMNS.map((column) => {\n const columnItems = byColumn[column.key];\n // Every lane's own list for this column, plus whether it should render at all: a roadmap using only\n // one lane always shows its (possibly empty) single section, exactly like the old flat list; once a\n // roadmap uses more than one lane, an EMPTY lane's section only appears while something from that\n // exact lane is being dragged (so it can serve as a drop target), keeping the common, non-dragging\n // view free of empty \"Lane — no items\" clutter.\n const laneSections = laneOrder\n .map((lane) => ({ lane, laneItems: byColumnLane[column.key][lane] ?? [] }))\n .filter(\n ({ lane, laneItems }) =>\n !hasMultipleLanes ||\n laneItems.length > 0 ||\n (draggingItem && laneKey(draggingItem) === lane)\n );\n return (\n <section\n key={column.key}\n aria-label={`${column.label} column`}\n data-testid={`nnl-column-${column.key}`}\n className=\"min-h-[120px] rounded-md border bg-muted/30 p-2\"\n // The whole column accepts a drop, not just its lane lists: a card dropped on the column's empty\n // space (below a short list, or on its header) goes to the END of its own lane in this column — the\n // lane never changes on a drop (see dropOnLane). The lists and cards handle their own, more precise\n // drops and stop them here.\n onDragOver={(e) => {\n if (!movesAllowed || busy || !draggingItem) return;\n e.preventDefault();\n e.dataTransfer.dropEffect = 'move';\n setDropTarget({\n columnKey: column.key,\n laneKey: laneKey(draggingItem),\n beforeId: null,\n });\n }}\n onDrop={(e) => {\n if (!draggingItem) return;\n const lane = laneKey(draggingItem);\n laneDrop(column.key, lane, byColumnLane[column.key][lane] ?? [])(e);\n }}\n >\n <h3 className=\"mb-2 flex items-center gap-1.5 text-sm font-medium\">\n {column.key === 'UNPLACED' && (\n <Inbox className=\"h-3.5 w-3.5 text-muted-foreground\" aria-hidden=\"true\" />\n )}\n {column.label}\n <span className=\"text-xs text-muted-foreground\">({columnItems.length})</span>\n </h3>\n {laneSections.length === 0 && (\n <p className=\"py-4 text-center text-xs text-muted-foreground\">No items</p>\n )}\n <div className=\"space-y-3\">\n {laneSections.map(({ lane, laneItems }) => {\n const isLaneDropTarget =\n dropTarget?.columnKey === column.key && dropTarget.laneKey === lane;\n return (\n <div key={lane || '(none)'} className=\"space-y-1\">\n {hasMultipleLanes && (\n <p\n data-testid=\"nnl-lane-label\"\n className=\"text-[11px] font-medium text-muted-foreground\"\n >\n {laneLabel(lane)}{' '}\n <span className=\"text-muted-foreground/70\">({laneItems.length})</span>\n </p>\n )}\n <ul\n className={`min-h-[48px] space-y-2 rounded-sm p-1 ${\n isLaneDropTarget && !dropTarget.beforeId ? 'ring-2 ring-primary' : ''\n }`}\n onDragOver={(e) => {\n if (\n !movesAllowed ||\n busy ||\n !draggingItem ||\n laneKey(draggingItem) !== lane\n )\n return;\n e.preventDefault();\n e.dataTransfer.dropEffect = 'move';\n setDropTarget({ columnKey: column.key, laneKey: lane, beforeId: null });\n }}\n onDrop={laneDrop(column.key, lane, laneItems)}\n >\n {laneItems.length === 0 && (\n <li\n className=\"py-2 text-center text-[11px] text-muted-foreground\"\n aria-hidden=\"true\"\n >\n Drop here\n </li>\n )}\n {laneItems.map((item, index) => {\n // 'before': the drop would land this card right in front of `item`. 'after': the drop\n // targets \"end of this lane's section\" (beforeId null) and `item` is that section's\n // last card, so the line belongs below it.\n const dropIndicator: 'before' | 'after' | null = !isLaneDropTarget\n ? null\n : dropTarget.beforeId === item.id\n ? 'before'\n : dropTarget.beforeId === null && index === laneItems.length - 1\n ? 'after'\n : null;\n return (\n <NnlCard\n key={item.id}\n item={item}\n columnKey={column.key}\n laneItems={laneItems}\n draggable={movesAllowed && !busy}\n dragging={draggingId === item.id}\n dropIndicator={dropIndicator}\n moveDisabled={!movesAllowed || busy}\n onDragStart={setDraggingId}\n onDragEnd={() => {\n setDraggingId(null);\n setDropTarget(null);\n }}\n onDragOverCard={(e) =>\n laneCardDragOver(column.key, lane, laneItems)(e, item, index)\n }\n onDropOnCard={laneDrop(column.key, lane, laneItems)}\n onMoveTo={(target) => {\n const targetColumn = COLUMNS.find((c) => c.key === target);\n if (!targetColumn) return;\n const targetLaneItems = byColumnLane[target][laneKey(item)] ?? [];\n const index2 = destinationIndex(targetLaneItems, item.id, null);\n void runMove(\n item,\n targetColumn.horizon,\n index2,\n targetColumn.label,\n true\n );\n }}\n onShift={(delta) => {\n const pos = laneItems.findIndex((it) => it.id === item.id);\n const target = pos + delta;\n if (pos === -1 || target < 0 || target >= laneItems.length) return;\n void runMove(item, item.horizon, target, column.label, true);\n }}\n />\n );\n })}\n </ul>\n </div>\n );\n })}\n </div>\n </section>\n );\n })}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;AAsCA,IAAM,IAAc,0LAkBd,IAAY,CAAG;;;;;;;;UAQX,EAAY;;;;;;;;;GAWhB,IAAY,CAAG;;;QAGb,EAAY;;;GAuBd,IAAiE;CACrE;EAAE,KAAK;EAAY,OAAO;EAAc,SAAS;EAAM;CACvD;EAAE,KAAK;EAAO,OAAO;EAAO,SAAS;EAAO;CAC5C;EAAE,KAAK;EAAQ,OAAO;EAAQ,SAAS;EAAQ;CAC/C;EAAE,KAAK;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AAU,SAAS,IAC3D,UACA,OALJ;AAMJ,mBACE,kBAAC,GAAD;aAEQ;aACN,WAAW,EAAO;aACP;aACX,WAAW,KAAgB,CAAC;aAC5B,UAAU,MAAe,EAAK;aACf;aACf,cAAc,CAAC,KAAgB;aAC/B,aAAa;aACb,iBAAiB;AAEf,cADA,EAAc,KAAK,EACnB,EAAc,KAAK;;aAErB,iBAAiB,MACf,EAAiB,EAAO,KAAK,GAAM,EAAU,CAAC,GAAG,GAAM,EAAM;aAE/D,cAAc,EAAS,EAAO,KAAK,GAAM,EAAU;aACnD,WAAW,MAAW;cACpB,IAAM,IAAe,EAAQ,MAAM,MAAM,EAAE,QAAQ,EAAO;AAC1D,kBAAI,CAAC,EAAc;cAEnB,IAAM,IAAS,EADS,EAAa,GAAQ,EAAQ,EAAK,KAAK,EAAE,EAChB,EAAK,IAAI,KAAK;AAC1D,gBACH,GACA,EAAa,SACb,GACA,EAAa,OACb,GACD;;aAEH,UAAU,MAAU;cAClB,IAAM,IAAM,EAAU,WAAW,MAAO,EAAG,OAAO,EAAK,GAAG,EACpD,IAAS,IAAM;AACjB,oBAAQ,MAAM,IAAS,KAAK,KAAU,EAAU,UAC/C,EAAQ,GAAM,EAAK,SAAS,GAAQ,EAAO,OAAO,GAAK;;aAE9D,EApCK,EAAK,GAoCV;aAEJ,CACC;aACD;YAzFI,KAAQ,SAyFZ;UAER;QACE,CAAA;OACE;QApIH,EAAO,IAoIJ;MAEZ;IACE,CAAA;GACF"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Roadmap presentation mode (PRM-11): a full-screen, read-only walk-through of a roadmap, opened from its detail
|
|
3
|
+
* page. Deliberately takes the SAME items the detail page already loaded (`ProductsRoadmapDetailPagePage`'s
|
|
4
|
+
* `GET_ROADMAP` query) rather than firing one of its own — those items already carry `horizon`/`confidence`/
|
|
5
|
+
* `riskLevel`/`riskNote`/dates, and `RoadmapNowNextLater`'s own move mutation refetches that same query, so it
|
|
6
|
+
* never goes stale relative to the Now/Next/Later board.
|
|
7
|
+
*
|
|
8
|
+
* Grouping follows the detail page's OWN view toggle, not a fixed choice: Now/Next/Later when that view is
|
|
9
|
+
* active, one slide per calendar quarter (by `startDate`, falling back to `endDate`) when the Timeline view is
|
|
10
|
+
* active — matching "one slide per horizon … or per timeline quarter" from the ticket. An item that fits neither
|
|
11
|
+
* bucket (no horizon in nnl mode, no date in timeline mode) still gets its own slide rather than being silently
|
|
12
|
+
* left out.
|
|
13
|
+
*
|
|
14
|
+
* Built on `ResponsiveDialog*` (centred full-screen dialog on desktop, a bottom sheet below `md` — the design
|
|
15
|
+
* system's own convention, `no-restricted-imports` refuses the plain `Dialog*` primitives). Focus trap, initial
|
|
16
|
+
* focus, Escape-to-close and focus restored to the "Present" button on exit are Radix Dialog's own default
|
|
17
|
+
* behaviour either way — nothing here re-implements them. Only the left/right slide navigation is this
|
|
18
|
+
* component's own.
|
|
19
|
+
*/
|
|
20
|
+
export interface RoadmapPresentationItem {
|
|
21
|
+
id: string;
|
|
22
|
+
title: string;
|
|
23
|
+
status: string;
|
|
24
|
+
startDate: string | null;
|
|
25
|
+
endDate: string | null;
|
|
26
|
+
horizon: 'NOW' | 'NEXT' | 'LATER' | null;
|
|
27
|
+
confidence: number | null;
|
|
28
|
+
riskLevel: 'LOW' | 'MEDIUM' | 'HIGH' | null;
|
|
29
|
+
riskNote: string | null;
|
|
30
|
+
}
|
|
31
|
+
export declare function RoadmapPresentation({ roadmapName, roadmapDescription, view, items, }: {
|
|
32
|
+
roadmapName: string;
|
|
33
|
+
roadmapDescription: string | null;
|
|
34
|
+
view: 'timeline' | 'nnl';
|
|
35
|
+
items: RoadmapPresentationItem[];
|
|
36
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
37
|
+
//# sourceMappingURL=RoadmapPresentation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RoadmapPresentation.d.ts","sourceRoot":"","sources":["../../../src/planmagnet/roadmaps/RoadmapPresentation.tsx"],"names":[],"mappings":"AAcA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,MAAM,WAAW,uBAAuB;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,OAAO,EAAE,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;IACzC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,SAAS,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,IAAI,CAAC;IAC5C,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAuFD,wBAAgB,mBAAmB,CAAC,EAClC,WAAW,EACX,kBAAkB,EAClB,IAAI,EACJ,KAAK,GACN,EAAE;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,IAAI,EAAE,UAAU,GAAG,KAAK,CAAC;IACzB,KAAK,EAAE,uBAAuB,EAAE,CAAC;CAClC,2CAgHA"}
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import { enumLabel as e } from "../controls/WorkItemControls.js";
|
|
2
|
+
import { ConfidenceBadge as t, RiskIndicator as n } from "./RoadmapNowNextLater.js";
|
|
3
|
+
import { useMemo as r, useState as i } from "react";
|
|
4
|
+
import { ChevronLeft as a, ChevronRight as o, Presentation as s, X as c } from "lucide-react";
|
|
5
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
6
|
+
import { Button as d, ResponsiveDialog as f, ResponsiveDialogClose as p, ResponsiveDialogContent as m, ResponsiveDialogDescription as h, ResponsiveDialogTitle as g, ResponsiveDialogTrigger as _ } from "@burdenoff/fe-libs/ui";
|
|
7
|
+
//#region src/planmagnet/roadmaps/RoadmapPresentation.tsx
|
|
8
|
+
var v = [
|
|
9
|
+
{
|
|
10
|
+
key: "NOW",
|
|
11
|
+
label: "Now"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
key: "NEXT",
|
|
15
|
+
label: "Next"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
key: "LATER",
|
|
19
|
+
label: "Later"
|
|
20
|
+
}
|
|
21
|
+
];
|
|
22
|
+
function y(e) {
|
|
23
|
+
let t = v.map((t) => ({
|
|
24
|
+
key: t.key,
|
|
25
|
+
label: t.label,
|
|
26
|
+
items: e.filter((e) => e.horizon === t.key)
|
|
27
|
+
})), n = e.filter((e) => e.horizon === null);
|
|
28
|
+
return n.length > 0 && t.push({
|
|
29
|
+
key: "UNPLACED",
|
|
30
|
+
label: "Not yet placed",
|
|
31
|
+
items: n
|
|
32
|
+
}), t;
|
|
33
|
+
}
|
|
34
|
+
function b(e) {
|
|
35
|
+
let t = new Date(e);
|
|
36
|
+
return Number.isNaN(t.getTime()) ? null : {
|
|
37
|
+
year: t.getUTCFullYear(),
|
|
38
|
+
quarter: Math.floor(t.getUTCMonth() / 3) + 1
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function x(e) {
|
|
42
|
+
let t = /* @__PURE__ */ new Map(), n = [];
|
|
43
|
+
for (let r of e) {
|
|
44
|
+
let e = b(r.startDate ?? r.endDate ?? "");
|
|
45
|
+
if (!e) {
|
|
46
|
+
n.push(r);
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
let i = `${e.year}-Q${e.quarter}`, a = t.get(i);
|
|
50
|
+
a ? a.items.push(r) : t.set(i, {
|
|
51
|
+
...e,
|
|
52
|
+
items: [r]
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
let r = [...t.entries()].sort(([, e], [, t]) => e.year - t.year || e.quarter - t.quarter).map(([e, t]) => ({
|
|
56
|
+
key: e,
|
|
57
|
+
label: `Q${t.quarter} ${t.year}`,
|
|
58
|
+
items: t.items
|
|
59
|
+
}));
|
|
60
|
+
return n.length > 0 && r.push({
|
|
61
|
+
key: "UNSCHEDULED",
|
|
62
|
+
label: "Unscheduled",
|
|
63
|
+
items: n
|
|
64
|
+
}), r;
|
|
65
|
+
}
|
|
66
|
+
function S({ item: r }) {
|
|
67
|
+
return /* @__PURE__ */ u("li", {
|
|
68
|
+
className: "rounded-md border p-3",
|
|
69
|
+
"data-testid": "roadmap-presentation-item",
|
|
70
|
+
children: [/* @__PURE__ */ l("p", {
|
|
71
|
+
className: "font-medium leading-tight",
|
|
72
|
+
children: r.title
|
|
73
|
+
}), /* @__PURE__ */ u("div", {
|
|
74
|
+
className: "mt-1.5 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground",
|
|
75
|
+
children: [
|
|
76
|
+
/* @__PURE__ */ l("span", { children: e(r.status) }),
|
|
77
|
+
/* @__PURE__ */ l(t, { confidence: r.confidence }),
|
|
78
|
+
/* @__PURE__ */ l(n, {
|
|
79
|
+
level: r.riskLevel,
|
|
80
|
+
note: r.riskNote
|
|
81
|
+
})
|
|
82
|
+
]
|
|
83
|
+
})]
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
function C({ slide: e }) {
|
|
87
|
+
return /* @__PURE__ */ u("div", {
|
|
88
|
+
className: "w-full max-w-2xl space-y-4",
|
|
89
|
+
children: [/* @__PURE__ */ l("h2", {
|
|
90
|
+
className: "text-center text-2xl font-semibold",
|
|
91
|
+
children: e.label
|
|
92
|
+
}), e.items.length === 0 ? /* @__PURE__ */ l("p", {
|
|
93
|
+
className: "text-center text-sm text-muted-foreground",
|
|
94
|
+
children: "No items in this slide."
|
|
95
|
+
}) : /* @__PURE__ */ l("ul", {
|
|
96
|
+
className: "space-y-2",
|
|
97
|
+
children: e.items.map((e) => /* @__PURE__ */ l(S, { item: e }, e.id))
|
|
98
|
+
})]
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
function w({ roadmapName: e, roadmapDescription: t, view: n, items: v }) {
|
|
102
|
+
let [b, S] = i(!1), [w, T] = i(0), E = r(() => n === "nnl" ? y(v) : x(v), [n, v]), D = E.length + 1, O = (e) => {
|
|
103
|
+
S(e), e && T(0);
|
|
104
|
+
}, k = () => T((e) => Math.min(e + 1, D - 1)), A = () => T((e) => Math.max(e - 1, 0));
|
|
105
|
+
return /* @__PURE__ */ u(f, {
|
|
106
|
+
open: b,
|
|
107
|
+
onOpenChange: O,
|
|
108
|
+
children: [/* @__PURE__ */ l(_, {
|
|
109
|
+
asChild: !0,
|
|
110
|
+
children: /* @__PURE__ */ u(d, {
|
|
111
|
+
size: "sm",
|
|
112
|
+
variant: "outline",
|
|
113
|
+
"data-testid": "roadmap-present",
|
|
114
|
+
children: [/* @__PURE__ */ l(s, {
|
|
115
|
+
className: "mr-1 h-4 w-4",
|
|
116
|
+
"aria-hidden": "true"
|
|
117
|
+
}), "Present"]
|
|
118
|
+
})
|
|
119
|
+
}), /* @__PURE__ */ u(m, {
|
|
120
|
+
"data-testid": "roadmap-presentation",
|
|
121
|
+
showCloseButton: !1,
|
|
122
|
+
showHandle: !1,
|
|
123
|
+
className: "inset-0 flex h-screen w-screen max-w-none max-h-none translate-x-0 translate-y-0 flex-col gap-0 rounded-none border-0 p-0 sm:max-w-none",
|
|
124
|
+
onKeyDown: (e) => {
|
|
125
|
+
e.key === "ArrowRight" ? (e.preventDefault(), k()) : e.key === "ArrowLeft" && (e.preventDefault(), A());
|
|
126
|
+
},
|
|
127
|
+
children: [
|
|
128
|
+
/* @__PURE__ */ u(g, {
|
|
129
|
+
className: "sr-only",
|
|
130
|
+
children: [e, " — presentation"]
|
|
131
|
+
}),
|
|
132
|
+
/* @__PURE__ */ u(h, {
|
|
133
|
+
className: "sr-only",
|
|
134
|
+
children: [
|
|
135
|
+
"Read-only, full-screen view of the ",
|
|
136
|
+
e,
|
|
137
|
+
" roadmap. Use the left and right arrow keys to move between slides, and Escape to exit."
|
|
138
|
+
]
|
|
139
|
+
}),
|
|
140
|
+
/* @__PURE__ */ u("div", {
|
|
141
|
+
className: "flex items-center justify-between border-b px-6 py-3",
|
|
142
|
+
children: [/* @__PURE__ */ u("p", {
|
|
143
|
+
className: "text-sm text-muted-foreground",
|
|
144
|
+
"data-testid": "roadmap-presentation-counter",
|
|
145
|
+
children: [
|
|
146
|
+
"Slide ",
|
|
147
|
+
w + 1,
|
|
148
|
+
" of ",
|
|
149
|
+
D
|
|
150
|
+
]
|
|
151
|
+
}), /* @__PURE__ */ l(p, {
|
|
152
|
+
asChild: !0,
|
|
153
|
+
children: /* @__PURE__ */ l(d, {
|
|
154
|
+
variant: "ghost",
|
|
155
|
+
size: "sm",
|
|
156
|
+
"aria-label": "Exit presentation",
|
|
157
|
+
children: /* @__PURE__ */ l(c, {
|
|
158
|
+
className: "h-4 w-4",
|
|
159
|
+
"aria-hidden": "true"
|
|
160
|
+
})
|
|
161
|
+
})
|
|
162
|
+
})]
|
|
163
|
+
}),
|
|
164
|
+
/* @__PURE__ */ l("div", {
|
|
165
|
+
className: "flex flex-1 flex-col items-center justify-center overflow-y-auto px-8 py-6",
|
|
166
|
+
children: w === 0 ? /* @__PURE__ */ u("div", {
|
|
167
|
+
className: "max-w-2xl space-y-4 text-center",
|
|
168
|
+
children: [/* @__PURE__ */ l("h2", {
|
|
169
|
+
className: "text-3xl font-semibold",
|
|
170
|
+
children: e
|
|
171
|
+
}), /* @__PURE__ */ l("p", {
|
|
172
|
+
className: "text-muted-foreground",
|
|
173
|
+
children: t ?? "No description"
|
|
174
|
+
})]
|
|
175
|
+
}) : /* @__PURE__ */ l(C, { slide: E[w - 1] })
|
|
176
|
+
}),
|
|
177
|
+
/* @__PURE__ */ u("div", {
|
|
178
|
+
className: "flex items-center justify-center gap-3 border-t px-6 py-3",
|
|
179
|
+
children: [/* @__PURE__ */ l(d, {
|
|
180
|
+
variant: "outline",
|
|
181
|
+
size: "sm",
|
|
182
|
+
onClick: A,
|
|
183
|
+
disabled: w === 0,
|
|
184
|
+
"aria-label": "Previous slide",
|
|
185
|
+
"data-testid": "roadmap-presentation-prev",
|
|
186
|
+
children: /* @__PURE__ */ l(a, {
|
|
187
|
+
className: "h-4 w-4",
|
|
188
|
+
"aria-hidden": "true"
|
|
189
|
+
})
|
|
190
|
+
}), /* @__PURE__ */ l(d, {
|
|
191
|
+
variant: "outline",
|
|
192
|
+
size: "sm",
|
|
193
|
+
onClick: k,
|
|
194
|
+
disabled: w === D - 1,
|
|
195
|
+
"aria-label": "Next slide",
|
|
196
|
+
"data-testid": "roadmap-presentation-next",
|
|
197
|
+
children: /* @__PURE__ */ l(o, {
|
|
198
|
+
className: "h-4 w-4",
|
|
199
|
+
"aria-hidden": "true"
|
|
200
|
+
})
|
|
201
|
+
})]
|
|
202
|
+
})
|
|
203
|
+
]
|
|
204
|
+
})]
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
//#endregion
|
|
208
|
+
export { w as RoadmapPresentation };
|
|
209
|
+
|
|
210
|
+
//# sourceMappingURL=RoadmapPresentation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RoadmapPresentation.js","names":[],"sources":["../../../src/planmagnet/roadmaps/RoadmapPresentation.tsx"],"sourcesContent":["import { useMemo, useState } from 'react';\nimport {\n Button,\n ResponsiveDialog,\n ResponsiveDialogClose,\n ResponsiveDialogContent,\n ResponsiveDialogDescription,\n ResponsiveDialogTitle,\n ResponsiveDialogTrigger,\n} from '@burdenoff/fe-libs/ui';\nimport { ChevronLeft, ChevronRight, Presentation as PresentationIcon, X } from 'lucide-react';\nimport { enumLabel } from '../controls/WorkItemControls';\nimport { ConfidenceBadge, RiskIndicator } from './RoadmapNowNextLater';\n\n/**\n * Roadmap presentation mode (PRM-11): a full-screen, read-only walk-through of a roadmap, opened from its detail\n * page. Deliberately takes the SAME items the detail page already loaded (`ProductsRoadmapDetailPagePage`'s\n * `GET_ROADMAP` query) rather than firing one of its own — those items already carry `horizon`/`confidence`/\n * `riskLevel`/`riskNote`/dates, and `RoadmapNowNextLater`'s own move mutation refetches that same query, so it\n * never goes stale relative to the Now/Next/Later board.\n *\n * Grouping follows the detail page's OWN view toggle, not a fixed choice: Now/Next/Later when that view is\n * active, one slide per calendar quarter (by `startDate`, falling back to `endDate`) when the Timeline view is\n * active — matching \"one slide per horizon … or per timeline quarter\" from the ticket. An item that fits neither\n * bucket (no horizon in nnl mode, no date in timeline mode) still gets its own slide rather than being silently\n * left out.\n *\n * Built on `ResponsiveDialog*` (centred full-screen dialog on desktop, a bottom sheet below `md` — the design\n * system's own convention, `no-restricted-imports` refuses the plain `Dialog*` primitives). Focus trap, initial\n * focus, Escape-to-close and focus restored to the \"Present\" button on exit are Radix Dialog's own default\n * behaviour either way — nothing here re-implements them. Only the left/right slide navigation is this\n * component's own.\n */\n\nexport interface RoadmapPresentationItem {\n id: string;\n title: string;\n status: string;\n startDate: string | null;\n endDate: string | null;\n horizon: 'NOW' | 'NEXT' | 'LATER' | null;\n confidence: number | null;\n riskLevel: 'LOW' | 'MEDIUM' | 'HIGH' | null;\n riskNote: string | null;\n}\n\ninterface Slide {\n key: string;\n label: string;\n items: RoadmapPresentationItem[];\n}\n\nconst HORIZONS: { key: 'NOW' | 'NEXT' | 'LATER'; label: string }[] = [\n { key: 'NOW', label: 'Now' },\n { key: 'NEXT', label: 'Next' },\n { key: 'LATER', label: 'Later' },\n];\n\nfunction buildHorizonSlides(items: RoadmapPresentationItem[]): Slide[] {\n const slides: Slide[] = HORIZONS.map((h) => ({\n key: h.key,\n label: h.label,\n items: items.filter((item) => item.horizon === h.key),\n }));\n const unplaced = items.filter((item) => item.horizon === null);\n // Never silently drop items the board hasn't placed yet — they get their own slide instead.\n if (unplaced.length > 0)\n slides.push({ key: 'UNPLACED', label: 'Not yet placed', items: unplaced });\n return slides;\n}\n\nfunction quarterOf(dateIso: string): { year: number; quarter: number } | null {\n const date = new Date(dateIso);\n if (Number.isNaN(date.getTime())) return null;\n return { year: date.getUTCFullYear(), quarter: Math.floor(date.getUTCMonth() / 3) + 1 };\n}\n\nfunction buildQuarterSlides(items: RoadmapPresentationItem[]): Slide[] {\n const groups = new Map<\n string,\n { year: number; quarter: number; items: RoadmapPresentationItem[] }\n >();\n const undated: RoadmapPresentationItem[] = [];\n for (const item of items) {\n const q = quarterOf(item.startDate ?? item.endDate ?? '');\n if (!q) {\n undated.push(item);\n continue;\n }\n const key = `${q.year}-Q${q.quarter}`;\n const group = groups.get(key);\n if (group) group.items.push(item);\n else groups.set(key, { ...q, items: [item] });\n }\n const slides: Slide[] = [...groups.entries()]\n .sort(([, a], [, b]) => a.year - b.year || a.quarter - b.quarter)\n .map(([key, g]) => ({ key, label: `Q${g.quarter} ${g.year}`, items: g.items }));\n if (undated.length > 0) slides.push({ key: 'UNSCHEDULED', label: 'Unscheduled', items: undated });\n return slides;\n}\n\nfunction ItemCard({ item }: { item: RoadmapPresentationItem }) {\n return (\n <li className=\"rounded-md border p-3\" data-testid=\"roadmap-presentation-item\">\n <p className=\"font-medium leading-tight\">{item.title}</p>\n <div className=\"mt-1.5 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground\">\n <span>{enumLabel(item.status)}</span>\n <ConfidenceBadge confidence={item.confidence} />\n <RiskIndicator level={item.riskLevel} note={item.riskNote} />\n </div>\n </li>\n );\n}\n\nfunction ItemsSlide({ slide }: { slide: Slide }) {\n return (\n <div className=\"w-full max-w-2xl space-y-4\">\n <h2 className=\"text-center text-2xl font-semibold\">{slide.label}</h2>\n {slide.items.length === 0 ? (\n <p className=\"text-center text-sm text-muted-foreground\">No items in this slide.</p>\n ) : (\n <ul className=\"space-y-2\">\n {slide.items.map((item) => (\n <ItemCard key={item.id} item={item} />\n ))}\n </ul>\n )}\n </div>\n );\n}\n\nexport function RoadmapPresentation({\n roadmapName,\n roadmapDescription,\n view,\n items,\n}: {\n roadmapName: string;\n roadmapDescription: string | null;\n view: 'timeline' | 'nnl';\n items: RoadmapPresentationItem[];\n}) {\n const [open, setOpen] = useState(false);\n const [index, setIndex] = useState(0);\n\n const slides = useMemo(\n () => (view === 'nnl' ? buildHorizonSlides(items) : buildQuarterSlides(items)),\n [view, items]\n );\n // Slide 0 is always the title/description overview; one slide per group follows.\n const slideCount = slides.length + 1;\n\n // Reset to the first slide in the SAME handler that opens the dialog (not a `useEffect` keyed on `open`) — an\n // effect that calls setState on mount/update is a cascading-render smell (react-hooks/set-state-in-effect) and\n // is also one render behind: it would still show the previous close's last slide for one frame.\n const onOpenChange = (next: boolean) => {\n setOpen(next);\n if (next) setIndex(0);\n };\n\n const goNext = () => setIndex((i) => Math.min(i + 1, slideCount - 1));\n const goPrev = () => setIndex((i) => Math.max(i - 1, 0));\n\n return (\n <ResponsiveDialog open={open} onOpenChange={onOpenChange}>\n <ResponsiveDialogTrigger asChild>\n <Button size=\"sm\" variant=\"outline\" data-testid=\"roadmap-present\">\n <PresentationIcon className=\"mr-1 h-4 w-4\" aria-hidden=\"true\" />\n Present\n </Button>\n </ResponsiveDialogTrigger>\n <ResponsiveDialogContent\n data-testid=\"roadmap-presentation\"\n showCloseButton={false}\n showHandle={false}\n // `inset-0` (not `top-0 left-0`) plus `max-h-none`: on desktop this still fully overrides\n // DialogContent's centred `top-[50%] left-[50%]` positioning (twMerge treats `inset` as\n // conflicting with the more specific `top`/`left`). On mobile, ResponsiveDialogContent forwards\n // this className unmodified to BottomSheetContent, whose own base className sets\n // `inset-x-0 bottom-0 max-h-[90vh]` — those are in DIFFERENT twMerge groups than `top`/`left` and\n // `h-*`, so a `top-0 left-0` + `h-screen` override used to survive class merging *alongside*\n // `bottom-0` + `max-h-[90vh]` rather than replacing them. With top, bottom and height (clamped to\n // 90vh) all explicitly set on a fixed box, CSS resolves the over-constraint by dropping `bottom`\n // (CSS2.1 10.6.4) and using top+height instead — pinning the sheet to the top of the screen with a\n // ~10vh gap at the bottom. `inset-0` fully replaces `inset-x-0`/`bottom-0` (same conflict group in\n // twMerge) and `max-h-none` fully replaces `max-h-[90vh]`, so nothing is left to over-constrain.\n className=\"inset-0 flex h-screen w-screen max-w-none max-h-none translate-x-0 translate-y-0 flex-col gap-0 rounded-none border-0 p-0 sm:max-w-none\"\n onKeyDown={(e) => {\n if (e.key === 'ArrowRight') {\n e.preventDefault();\n goNext();\n } else if (e.key === 'ArrowLeft') {\n e.preventDefault();\n goPrev();\n }\n // Escape is handled by Radix's own onEscapeKeyDown (closes the dialog) — not duplicated here.\n }}\n >\n <ResponsiveDialogTitle className=\"sr-only\">\n {roadmapName} — presentation\n </ResponsiveDialogTitle>\n <ResponsiveDialogDescription className=\"sr-only\">\n Read-only, full-screen view of the {roadmapName} roadmap. Use the left and right arrow\n keys to move between slides, and Escape to exit.\n </ResponsiveDialogDescription>\n\n <div className=\"flex items-center justify-between border-b px-6 py-3\">\n <p className=\"text-sm text-muted-foreground\" data-testid=\"roadmap-presentation-counter\">\n Slide {index + 1} of {slideCount}\n </p>\n <ResponsiveDialogClose asChild>\n <Button variant=\"ghost\" size=\"sm\" aria-label=\"Exit presentation\">\n <X className=\"h-4 w-4\" aria-hidden=\"true\" />\n </Button>\n </ResponsiveDialogClose>\n </div>\n\n <div className=\"flex flex-1 flex-col items-center justify-center overflow-y-auto px-8 py-6\">\n {index === 0 ? (\n <div className=\"max-w-2xl space-y-4 text-center\">\n <h2 className=\"text-3xl font-semibold\">{roadmapName}</h2>\n <p className=\"text-muted-foreground\">{roadmapDescription ?? 'No description'}</p>\n </div>\n ) : (\n <ItemsSlide slide={slides[index - 1]} />\n )}\n </div>\n\n <div className=\"flex items-center justify-center gap-3 border-t px-6 py-3\">\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={goPrev}\n disabled={index === 0}\n aria-label=\"Previous slide\"\n data-testid=\"roadmap-presentation-prev\"\n >\n <ChevronLeft className=\"h-4 w-4\" aria-hidden=\"true\" />\n </Button>\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={goNext}\n disabled={index === slideCount - 1}\n aria-label=\"Next slide\"\n data-testid=\"roadmap-presentation-next\"\n >\n <ChevronRight className=\"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KAAD;OAAG,WAAU;iBAAyB,KAAsB;OAAqB,CAAA,CAC7E;UAEN,kBAAC,GAAD,EAAY,OAAO,EAAO,IAAQ,IAAM,CAAA;KAEtC,CAAA;IAEN,kBAAC,OAAD;KAAK,WAAU;eAAf,CACE,kBAAC,GAAD;MACE,SAAQ;MACR,MAAK;MACL,SAAS;MACT,UAAU,MAAU;MACpB,cAAW;MACX,eAAY;gBAEZ,kBAAC,GAAD;OAAa,WAAU;OAAU,eAAY;OAAS,CAAA;MAC/C,CAAA,EACT,kBAAC,GAAD;MACE,SAAQ;MACR,MAAK;MACL,SAAS;MACT,UAAU,MAAU,IAAa;MACjC,cAAW;MACX,eAAY;gBAEZ,kBAAC,GAAD;OAAc,WAAU;OAAU,eAAY;OAAS,CAAA;MAChD,CAAA,CACL;;IACkB;KACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TeamControls.d.ts","sourceRoot":"","sources":["../../../src/planmagnet/team/TeamControls.tsx"],"names":[],"mappings":"AAuBA;;;;;;GAMG;AAEH,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACb;AAED,0EAA0E;AAC1E,eAAO,MAAM,YAAY,UAAgC,CAAC;AAU1D,wBAAgB,iBAAiB,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"TeamControls.d.ts","sourceRoot":"","sources":["../../../src/planmagnet/team/TeamControls.tsx"],"names":[],"mappings":"AAuBA;;;;;;GAMG;AAEH,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACb;AAED,0EAA0E;AAC1E,eAAO,MAAM,YAAY,UAAgC,CAAC;AAU1D,wBAAgB,iBAAiB,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,2CAuDnF;AAmBD,wBAAgB,gBAAgB,CAAC,EAC/B,MAAM,EACN,OAAO,GACR,EAAE;IACD,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,aAAa,EAAE,CAAC;CAC1B,2CA8DA;AA+KD,wBAAgB,iBAAiB,CAAC,EAChC,MAAM,EACN,QAAQ,GACT,EAAE;IACD,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,cAAc,EAAE,CAAC;CAC5B,2CAkEA"}
|