@burdenoff/microfe-planmagnet 2026.930.14 → 2026.930.16
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 +162 -129
- package/dist/planmagnet/PlanMagnetRoot.js.map +1 -1
- package/dist/planmagnet/PlanMagnetRoutes.d.ts.map +1 -1
- package/dist/planmagnet/PlanMagnetRoutes.js +243 -227
- package/dist/planmagnet/PlanMagnetRoutes.js.map +1 -1
- package/dist/planmagnet/comments/RoadmapComments.d.ts +29 -0
- package/dist/planmagnet/comments/RoadmapComments.d.ts.map +1 -0
- package/dist/planmagnet/comments/RoadmapComments.js +310 -0
- package/dist/planmagnet/comments/RoadmapComments.js.map +1 -0
- package/dist/planmagnet/dashboards/DashboardUI.d.ts +79 -0
- package/dist/planmagnet/dashboards/DashboardUI.d.ts.map +1 -0
- package/dist/planmagnet/dashboards/DashboardUI.js +126 -0
- package/dist/planmagnet/dashboards/DashboardUI.js.map +1 -0
- package/dist/planmagnet/dashboards/cards/DeliveryTimelineCard.d.ts +7 -0
- package/dist/planmagnet/dashboards/cards/DeliveryTimelineCard.d.ts.map +1 -0
- package/dist/planmagnet/dashboards/cards/DeliveryTimelineCard.js +92 -0
- package/dist/planmagnet/dashboards/cards/DeliveryTimelineCard.js.map +1 -0
- package/dist/planmagnet/dashboards/cards/ObjectivesProgressCard.d.ts +7 -0
- package/dist/planmagnet/dashboards/cards/ObjectivesProgressCard.d.ts.map +1 -0
- package/dist/planmagnet/dashboards/cards/ObjectivesProgressCard.js +68 -0
- package/dist/planmagnet/dashboards/cards/ObjectivesProgressCard.js.map +1 -0
- package/dist/planmagnet/dashboards/cards/PortfolioHealthCard.d.ts +5 -0
- package/dist/planmagnet/dashboards/cards/PortfolioHealthCard.d.ts.map +1 -0
- package/dist/planmagnet/dashboards/cards/PortfolioHealthCard.js +118 -0
- package/dist/planmagnet/dashboards/cards/PortfolioHealthCard.js.map +1 -0
- package/dist/planmagnet/dashboards/cards/QualityMetricsCard.d.ts +8 -0
- package/dist/planmagnet/dashboards/cards/QualityMetricsCard.d.ts.map +1 -0
- package/dist/planmagnet/dashboards/cards/QualityMetricsCard.js +94 -0
- package/dist/planmagnet/dashboards/cards/QualityMetricsCard.js.map +1 -0
- package/dist/planmagnet/dashboards/cards/RiskSeverityCard.d.ts +6 -0
- package/dist/planmagnet/dashboards/cards/RiskSeverityCard.d.ts.map +1 -0
- package/dist/planmagnet/dashboards/cards/RiskSeverityCard.js +90 -0
- package/dist/planmagnet/dashboards/cards/RiskSeverityCard.js.map +1 -0
- package/dist/planmagnet/dashboards/cards/RoadmapHorizonCard.d.ts +5 -0
- package/dist/planmagnet/dashboards/cards/RoadmapHorizonCard.d.ts.map +1 -0
- package/dist/planmagnet/dashboards/cards/RoadmapHorizonCard.js +242 -0
- package/dist/planmagnet/dashboards/cards/RoadmapHorizonCard.js.map +1 -0
- package/dist/planmagnet/dashboards/cards/SprintCapacityCard.d.ts +5 -0
- package/dist/planmagnet/dashboards/cards/SprintCapacityCard.d.ts.map +1 -0
- package/dist/planmagnet/dashboards/cards/SprintCapacityCard.js +125 -0
- package/dist/planmagnet/dashboards/cards/SprintCapacityCard.js.map +1 -0
- package/dist/planmagnet/dashboards/cards/TaskCompletionCard.d.ts +6 -0
- package/dist/planmagnet/dashboards/cards/TaskCompletionCard.d.ts.map +1 -0
- package/dist/planmagnet/dashboards/cards/TaskCompletionCard.js +85 -0
- package/dist/planmagnet/dashboards/cards/TaskCompletionCard.js.map +1 -0
- package/dist/planmagnet/dashboards/cards/TeamCapacityCard.d.ts +10 -0
- package/dist/planmagnet/dashboards/cards/TeamCapacityCard.d.ts.map +1 -0
- package/dist/planmagnet/dashboards/cards/TeamCapacityCard.js +115 -0
- package/dist/planmagnet/dashboards/cards/TeamCapacityCard.js.map +1 -0
- package/dist/planmagnet/dashboards/cards/TeamOverviewCard.d.ts +5 -0
- package/dist/planmagnet/dashboards/cards/TeamOverviewCard.d.ts.map +1 -0
- package/dist/planmagnet/dashboards/cards/TeamOverviewCard.js +70 -0
- package/dist/planmagnet/dashboards/cards/TeamOverviewCard.js.map +1 -0
- package/dist/planmagnet/dashboards/cards/TeamWorkloadCard.d.ts +9 -0
- package/dist/planmagnet/dashboards/cards/TeamWorkloadCard.d.ts.map +1 -0
- package/dist/planmagnet/dashboards/cards/TeamWorkloadCard.js +373 -0
- package/dist/planmagnet/dashboards/cards/TeamWorkloadCard.js.map +1 -0
- package/dist/planmagnet/dashboards/cards/TimeLoggedCard.d.ts +8 -0
- package/dist/planmagnet/dashboards/cards/TimeLoggedCard.d.ts.map +1 -0
- package/dist/planmagnet/dashboards/cards/TimeLoggedCard.js +247 -0
- package/dist/planmagnet/dashboards/cards/TimeLoggedCard.js.map +1 -0
- package/dist/planmagnet/pages/DashboardsExecutivePagePage.d.ts +8 -0
- package/dist/planmagnet/pages/DashboardsExecutivePagePage.d.ts.map +1 -0
- package/dist/planmagnet/pages/DashboardsExecutivePagePage.js +61 -0
- package/dist/planmagnet/pages/DashboardsExecutivePagePage.js.map +1 -0
- package/dist/planmagnet/pages/DashboardsLeadershipPagePage.d.ts +8 -0
- package/dist/planmagnet/pages/DashboardsLeadershipPagePage.d.ts.map +1 -0
- package/dist/planmagnet/pages/DashboardsLeadershipPagePage.js +62 -0
- package/dist/planmagnet/pages/DashboardsLeadershipPagePage.js.map +1 -0
- package/dist/planmagnet/pages/DashboardsProjectManagerPagePage.d.ts +7 -0
- package/dist/planmagnet/pages/DashboardsProjectManagerPagePage.d.ts.map +1 -0
- package/dist/planmagnet/pages/DashboardsProjectManagerPagePage.js +117 -0
- package/dist/planmagnet/pages/DashboardsProjectManagerPagePage.js.map +1 -0
- package/dist/planmagnet/pages/DashboardsTeamUtilizationPagePage.d.ts +6 -0
- package/dist/planmagnet/pages/DashboardsTeamUtilizationPagePage.d.ts.map +1 -0
- package/dist/planmagnet/pages/DashboardsTeamUtilizationPagePage.js +84 -0
- package/dist/planmagnet/pages/DashboardsTeamUtilizationPagePage.js.map +1 -0
- package/dist/planmagnet/pages/ProductsRoadmapDetailPagePage.d.ts.map +1 -1
- package/dist/planmagnet/pages/ProductsRoadmapDetailPagePage.js +130 -112
- package/dist/planmagnet/pages/ProductsRoadmapDetailPagePage.js.map +1 -1
- package/dist/planmagnet/pages/analytics/SprintDeliveryCards.d.ts +10 -0
- package/dist/planmagnet/pages/analytics/SprintDeliveryCards.d.ts.map +1 -0
- package/dist/planmagnet/pages/analytics/SprintDeliveryCards.js +219 -0
- package/dist/planmagnet/pages/analytics/SprintDeliveryCards.js.map +1 -0
- package/dist/planmagnet/roadmaps/RoadmapNowNextLater.d.ts.map +1 -1
- package/dist/planmagnet/roadmaps/RoadmapNowNextLater.js +157 -151
- package/dist/planmagnet/roadmaps/RoadmapNowNextLater.js.map +1 -1
- package/dist/planmagnet/roadmaps/RoadmapReviewPanel.d.ts +4 -0
- package/dist/planmagnet/roadmaps/RoadmapReviewPanel.d.ts.map +1 -0
- package/dist/planmagnet/roadmaps/RoadmapReviewPanel.js +370 -0
- package/dist/planmagnet/roadmaps/RoadmapReviewPanel.js.map +1 -0
- package/dist/planmagnet/roadmaps/RoadmapVersionsPanel.d.ts +4 -0
- package/dist/planmagnet/roadmaps/RoadmapVersionsPanel.d.ts.map +1 -0
- package/dist/planmagnet/roadmaps/RoadmapVersionsPanel.js +396 -0
- package/dist/planmagnet/roadmaps/RoadmapVersionsPanel.js.map +1 -0
- 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. 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;EAAS,OAAO;EAAS,SAAS;EAAS;CAC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J,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';\nimport { RoadmapItemCommentsButton } from '../comments/RoadmapComments';\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 roadmapId,\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 roadmapId: string;\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 items-center justify-between gap-1 pt-0.5\">\n <RoadmapItemCommentsButton roadmapId={roadmapId} itemId={item.id} itemTitle={item.title} />\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 roadmapId={roadmapId}\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":";;;;;;;;;;;;AAuCA,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;EA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S,EAAE,MAAM,CAAA;CAAE,2CAgDtE"}
|
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
import { usePlanMagnet as e } from "../providers/PlanMagnetProvider.js";
|
|
2
|
+
import { PersonName as t } from "../people/People.js";
|
|
3
|
+
import { throwOnError as n } from "../utils/mutationResult.js";
|
|
4
|
+
import { ErrorLine as r } from "../controls/ConfirmButton.js";
|
|
5
|
+
import { enumLabel as i } from "../controls/WorkItemControls.js";
|
|
6
|
+
import { isForbidden as a, mutationErrorMessage as o } from "../utils/graphqlErrors.js";
|
|
7
|
+
import { useDeferredValue as s, useEffect as c, useState as l } from "react";
|
|
8
|
+
import { ClipboardCheck as u, Plus as d } from "lucide-react";
|
|
9
|
+
import { gql as f } from "@apollo/client";
|
|
10
|
+
import { useMutation as p, useQuery as m } from "@apollo/client/react";
|
|
11
|
+
import { jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
12
|
+
import { Badge as _, Button as v, Card as y, CardContent as b, CardHeader as x, CardTitle as S, Checkbox as C, Input as w, ResponsiveDialog as T, ResponsiveDialogContent as E, ResponsiveDialogDescription as D, ResponsiveDialogFooter as O, ResponsiveDialogHeader as k, ResponsiveDialogTitle as A, ResponsiveDialogTrigger as j } from "@burdenoff/fe-libs/ui";
|
|
13
|
+
import { useWorkspaceDirectory as M } from "@burdenoff/fe-libs/sharing";
|
|
14
|
+
//#region src/planmagnet/roadmaps/RoadmapReviewPanel.tsx
|
|
15
|
+
var N = {
|
|
16
|
+
refetchQueries: ["RoadmapReviewsPanel"],
|
|
17
|
+
awaitRefetchQueries: !0
|
|
18
|
+
}, P = f`
|
|
19
|
+
query RoadmapReviewsPanel($roadmapId: ID!) {
|
|
20
|
+
planmagnetRoadmapReviews(roadmapId: $roadmapId) {
|
|
21
|
+
id
|
|
22
|
+
status
|
|
23
|
+
note
|
|
24
|
+
requestedBy
|
|
25
|
+
reviewerIds
|
|
26
|
+
createdAt
|
|
27
|
+
decidedAt
|
|
28
|
+
updatedAt
|
|
29
|
+
decisions {
|
|
30
|
+
id
|
|
31
|
+
reviewerId
|
|
32
|
+
decision
|
|
33
|
+
note
|
|
34
|
+
decidedAt
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
`, F = f`
|
|
39
|
+
mutation RoadmapReviewRequest($roadmapId: ID!, $input: PlanmagnetRequestRoadmapReviewInput!) {
|
|
40
|
+
planmagnetRequestRoadmapReview(roadmapId: $roadmapId, input: $input) {
|
|
41
|
+
id
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
`, I = f`
|
|
45
|
+
mutation RoadmapReviewDecide($reviewId: ID!, $input: PlanmagnetDecideRoadmapReviewInput!) {
|
|
46
|
+
planmagnetDecideRoadmapReview(reviewId: $reviewId, input: $input) {
|
|
47
|
+
id
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
`, L = f`
|
|
51
|
+
mutation RoadmapReviewWithdraw($reviewId: ID!) {
|
|
52
|
+
planmagnetWithdrawRoadmapReview(reviewId: $reviewId) {
|
|
53
|
+
id
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
`, R = {
|
|
57
|
+
OPEN: "warning",
|
|
58
|
+
APPROVED: "success",
|
|
59
|
+
CHANGES_REQUESTED: "destructive",
|
|
60
|
+
WITHDRAWN: "secondary"
|
|
61
|
+
}, z = (e) => new Date(e).toLocaleString();
|
|
62
|
+
function B({ roadmapId: t }) {
|
|
63
|
+
let { workspaceId: i, authToken: u, apiGatewayUrl: f } = e(), [m, _] = l(!1), [y, b] = l(""), x = s(y.trim()), [S, P] = l(/* @__PURE__ */ new Set()), [I, L] = l(""), [R, z] = l(null), B = M({
|
|
64
|
+
workspaceId: i ?? "",
|
|
65
|
+
authToken: u ?? void 0,
|
|
66
|
+
apiGatewayUrl: f ?? void 0
|
|
67
|
+
}), { search: V } = B;
|
|
68
|
+
c(() => {
|
|
69
|
+
V(x);
|
|
70
|
+
}, [x, V]);
|
|
71
|
+
let [H, U] = p(F, N), W = (e, t) => P((n) => {
|
|
72
|
+
let r = new Set(n);
|
|
73
|
+
return t ? r.add(e) : r.delete(e), r;
|
|
74
|
+
}), G = () => {
|
|
75
|
+
P(/* @__PURE__ */ new Set()), L(""), b(""), z(null);
|
|
76
|
+
}, K = async () => {
|
|
77
|
+
z(null);
|
|
78
|
+
try {
|
|
79
|
+
await n(H({ variables: {
|
|
80
|
+
roadmapId: t,
|
|
81
|
+
input: {
|
|
82
|
+
reviewerIds: [...S],
|
|
83
|
+
note: I.trim() || null
|
|
84
|
+
}
|
|
85
|
+
} })), G(), _(!1);
|
|
86
|
+
} catch (e) {
|
|
87
|
+
z(a(e) ? "Your role cannot request a review on this roadmap." : o(e, "The review could not be requested."));
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
return /* @__PURE__ */ g(T, {
|
|
91
|
+
open: m,
|
|
92
|
+
onOpenChange: (e) => {
|
|
93
|
+
_(e), e || G();
|
|
94
|
+
},
|
|
95
|
+
children: [/* @__PURE__ */ h(j, {
|
|
96
|
+
asChild: !0,
|
|
97
|
+
children: /* @__PURE__ */ g(v, {
|
|
98
|
+
size: "sm",
|
|
99
|
+
"data-testid": "roadmap-review-request",
|
|
100
|
+
children: [/* @__PURE__ */ h(d, {
|
|
101
|
+
className: "mr-1 h-4 w-4",
|
|
102
|
+
"aria-hidden": "true"
|
|
103
|
+
}), "Request review"]
|
|
104
|
+
})
|
|
105
|
+
}), /* @__PURE__ */ g(E, {
|
|
106
|
+
className: "max-w-lg",
|
|
107
|
+
children: [
|
|
108
|
+
/* @__PURE__ */ g(k, { children: [/* @__PURE__ */ h(A, { children: "Request review" }), /* @__PURE__ */ h(D, { children: "Only one review can be open on this roadmap at a time. Pick everyone who should weigh in." })] }),
|
|
109
|
+
/* @__PURE__ */ h(w, {
|
|
110
|
+
value: y,
|
|
111
|
+
onChange: (e) => b(e.target.value),
|
|
112
|
+
placeholder: "Search workspace members",
|
|
113
|
+
"aria-label": "Search workspace members"
|
|
114
|
+
}),
|
|
115
|
+
/* @__PURE__ */ g("div", {
|
|
116
|
+
className: "max-h-64 overflow-y-auto space-y-1",
|
|
117
|
+
children: [
|
|
118
|
+
B.loading && B.members.length === 0 && /* @__PURE__ */ h("p", {
|
|
119
|
+
className: "text-sm text-muted-foreground py-4 text-center",
|
|
120
|
+
children: "Loading…"
|
|
121
|
+
}),
|
|
122
|
+
!B.loading && B.members.length === 0 && /* @__PURE__ */ h("p", {
|
|
123
|
+
className: "text-sm text-muted-foreground py-4 text-center",
|
|
124
|
+
children: "No matching members."
|
|
125
|
+
}),
|
|
126
|
+
B.members.map((e) => {
|
|
127
|
+
let t = `review-reviewer-${e.id}`;
|
|
128
|
+
return /* @__PURE__ */ g("label", {
|
|
129
|
+
htmlFor: t,
|
|
130
|
+
className: "flex items-center gap-3 border rounded-md p-2 text-sm cursor-pointer hover:bg-muted",
|
|
131
|
+
children: [/* @__PURE__ */ h(C, {
|
|
132
|
+
id: t,
|
|
133
|
+
checked: S.has(e.id),
|
|
134
|
+
onCheckedChange: (t) => W(e.id, t === !0)
|
|
135
|
+
}), /* @__PURE__ */ g("span", {
|
|
136
|
+
className: "min-w-0 flex-1 truncate",
|
|
137
|
+
children: [e.name, e.email && /* @__PURE__ */ g("span", {
|
|
138
|
+
className: "text-muted-foreground",
|
|
139
|
+
children: [" · ", e.email]
|
|
140
|
+
})]
|
|
141
|
+
})]
|
|
142
|
+
}, e.id);
|
|
143
|
+
}),
|
|
144
|
+
B.hasMore && /* @__PURE__ */ h("button", {
|
|
145
|
+
type: "button",
|
|
146
|
+
className: "w-full py-1 text-xs text-primary hover:underline",
|
|
147
|
+
onClick: B.fetchMore,
|
|
148
|
+
children: "Show more members"
|
|
149
|
+
})
|
|
150
|
+
]
|
|
151
|
+
}),
|
|
152
|
+
/* @__PURE__ */ g("div", { children: [/* @__PURE__ */ h("label", {
|
|
153
|
+
htmlFor: "review-request-note",
|
|
154
|
+
className: "text-sm font-medium",
|
|
155
|
+
children: "Note (optional)"
|
|
156
|
+
}), /* @__PURE__ */ h("textarea", {
|
|
157
|
+
id: "review-request-note",
|
|
158
|
+
className: "mt-1 w-full min-h-[60px] rounded-md border border-input bg-background px-3 py-2 text-sm",
|
|
159
|
+
value: I,
|
|
160
|
+
onChange: (e) => L(e.target.value)
|
|
161
|
+
})] }),
|
|
162
|
+
R && /* @__PURE__ */ h(r, { message: R }),
|
|
163
|
+
/* @__PURE__ */ h(O, { children: /* @__PURE__ */ h(v, {
|
|
164
|
+
onClick: () => void K(),
|
|
165
|
+
disabled: S.size === 0 || U.loading,
|
|
166
|
+
children: U.loading ? "Requesting…" : `Request review (${S.size})`
|
|
167
|
+
}) })
|
|
168
|
+
]
|
|
169
|
+
})]
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
function V({ reviewerId: e, decision: n }) {
|
|
173
|
+
return /* @__PURE__ */ g("li", {
|
|
174
|
+
className: "space-y-0.5 text-sm",
|
|
175
|
+
children: [/* @__PURE__ */ g("div", {
|
|
176
|
+
className: "flex items-center justify-between gap-2",
|
|
177
|
+
children: [/* @__PURE__ */ h("span", {
|
|
178
|
+
className: "font-medium",
|
|
179
|
+
children: /* @__PURE__ */ h(t, { id: e })
|
|
180
|
+
}), n ? /* @__PURE__ */ g("span", {
|
|
181
|
+
className: "flex items-center gap-2 text-xs text-muted-foreground",
|
|
182
|
+
children: [/* @__PURE__ */ h(_, {
|
|
183
|
+
variant: n.decision === "APPROVED" ? "success" : "destructive",
|
|
184
|
+
className: "text-[11px]",
|
|
185
|
+
children: i(n.decision)
|
|
186
|
+
}), z(n.decidedAt)]
|
|
187
|
+
}) : /* @__PURE__ */ h("span", {
|
|
188
|
+
className: "text-xs text-muted-foreground",
|
|
189
|
+
children: "Pending"
|
|
190
|
+
})]
|
|
191
|
+
}), n?.note && /* @__PURE__ */ h("p", {
|
|
192
|
+
className: "text-xs text-muted-foreground",
|
|
193
|
+
children: n.note
|
|
194
|
+
})]
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
function H({ review: s }) {
|
|
198
|
+
let { currentUser: c } = e(), [u, d] = l(""), [f, m] = l(null), [y, b] = p(I, N), [x, S] = p(L, N), C = c?.id, w = s.decisions.find((e) => e.reviewerId === C), T = !!C && s.reviewerIds.includes(C) && !w, E = !!C && s.requestedBy === C, D = async (e) => {
|
|
199
|
+
m(null);
|
|
200
|
+
try {
|
|
201
|
+
await n(y({ variables: {
|
|
202
|
+
reviewId: s.id,
|
|
203
|
+
input: {
|
|
204
|
+
decision: e,
|
|
205
|
+
note: u.trim() || null
|
|
206
|
+
}
|
|
207
|
+
} })), d("");
|
|
208
|
+
} catch (e) {
|
|
209
|
+
m(a(e) ? "You are not a reviewer on this request." : o(e, "The decision could not be recorded."));
|
|
210
|
+
}
|
|
211
|
+
}, O = async () => {
|
|
212
|
+
m(null);
|
|
213
|
+
try {
|
|
214
|
+
await n(x({ variables: { reviewId: s.id } }));
|
|
215
|
+
} catch (e) {
|
|
216
|
+
m(o(e, "The review could not be withdrawn."));
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
return /* @__PURE__ */ g("div", {
|
|
220
|
+
className: "space-y-3 rounded-md border p-3",
|
|
221
|
+
children: [
|
|
222
|
+
/* @__PURE__ */ g("div", {
|
|
223
|
+
className: "flex items-center justify-between gap-2",
|
|
224
|
+
children: [/* @__PURE__ */ h(_, {
|
|
225
|
+
variant: R[s.status],
|
|
226
|
+
"data-testid": "roadmap-review-status",
|
|
227
|
+
children: i(s.status)
|
|
228
|
+
}), /* @__PURE__ */ g("span", {
|
|
229
|
+
className: "text-xs text-muted-foreground",
|
|
230
|
+
children: ["Requested ", z(s.createdAt)]
|
|
231
|
+
})]
|
|
232
|
+
}),
|
|
233
|
+
/* @__PURE__ */ g("p", {
|
|
234
|
+
className: "text-sm",
|
|
235
|
+
children: ["Requested by ", /* @__PURE__ */ h(t, { id: s.requestedBy })]
|
|
236
|
+
}),
|
|
237
|
+
s.note && /* @__PURE__ */ h("p", {
|
|
238
|
+
className: "text-sm text-muted-foreground",
|
|
239
|
+
children: s.note
|
|
240
|
+
}),
|
|
241
|
+
/* @__PURE__ */ h("ul", {
|
|
242
|
+
className: "space-y-2",
|
|
243
|
+
children: s.reviewerIds.map((e) => /* @__PURE__ */ h(V, {
|
|
244
|
+
reviewerId: e,
|
|
245
|
+
decision: s.decisions.find((t) => t.reviewerId === e)
|
|
246
|
+
}, e))
|
|
247
|
+
}),
|
|
248
|
+
f && /* @__PURE__ */ h(r, { message: f }),
|
|
249
|
+
T && /* @__PURE__ */ g("div", {
|
|
250
|
+
className: "space-y-2 border-t pt-3",
|
|
251
|
+
children: [
|
|
252
|
+
/* @__PURE__ */ h("label", {
|
|
253
|
+
htmlFor: "review-decision-note",
|
|
254
|
+
className: "text-sm font-medium",
|
|
255
|
+
children: "Note (optional)"
|
|
256
|
+
}),
|
|
257
|
+
/* @__PURE__ */ h("textarea", {
|
|
258
|
+
id: "review-decision-note",
|
|
259
|
+
className: "w-full min-h-[56px] rounded-md border border-input bg-background px-3 py-2 text-sm",
|
|
260
|
+
value: u,
|
|
261
|
+
onChange: (e) => d(e.target.value)
|
|
262
|
+
}),
|
|
263
|
+
/* @__PURE__ */ g("div", {
|
|
264
|
+
className: "flex justify-end gap-2",
|
|
265
|
+
children: [/* @__PURE__ */ h(v, {
|
|
266
|
+
size: "sm",
|
|
267
|
+
variant: "outline",
|
|
268
|
+
"data-testid": "roadmap-review-changes",
|
|
269
|
+
disabled: b.loading,
|
|
270
|
+
onClick: () => void D("CHANGES_REQUESTED"),
|
|
271
|
+
children: "Request changes"
|
|
272
|
+
}), /* @__PURE__ */ h(v, {
|
|
273
|
+
size: "sm",
|
|
274
|
+
"data-testid": "roadmap-review-approve",
|
|
275
|
+
disabled: b.loading,
|
|
276
|
+
onClick: () => void D("APPROVED"),
|
|
277
|
+
children: "Approve"
|
|
278
|
+
})]
|
|
279
|
+
})
|
|
280
|
+
]
|
|
281
|
+
}),
|
|
282
|
+
E && /* @__PURE__ */ h("div", {
|
|
283
|
+
className: "flex justify-end border-t pt-3",
|
|
284
|
+
children: /* @__PURE__ */ h(v, {
|
|
285
|
+
size: "sm",
|
|
286
|
+
variant: "outline",
|
|
287
|
+
"data-testid": "roadmap-review-withdraw",
|
|
288
|
+
disabled: S.loading,
|
|
289
|
+
onClick: () => void O(),
|
|
290
|
+
children: S.loading ? "Withdrawing…" : "Withdraw"
|
|
291
|
+
})
|
|
292
|
+
})
|
|
293
|
+
]
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
function U({ review: e }) {
|
|
297
|
+
return /* @__PURE__ */ g("li", {
|
|
298
|
+
className: "space-y-1 rounded-md border p-2 text-sm",
|
|
299
|
+
children: [/* @__PURE__ */ g("div", {
|
|
300
|
+
className: "flex items-center justify-between gap-2",
|
|
301
|
+
children: [/* @__PURE__ */ h(_, {
|
|
302
|
+
variant: R[e.status],
|
|
303
|
+
className: "text-[11px]",
|
|
304
|
+
children: i(e.status)
|
|
305
|
+
}), /* @__PURE__ */ h("span", {
|
|
306
|
+
className: "text-xs text-muted-foreground",
|
|
307
|
+
children: e.decidedAt ? z(e.decidedAt) : z(e.createdAt)
|
|
308
|
+
})]
|
|
309
|
+
}), /* @__PURE__ */ g("p", {
|
|
310
|
+
className: "text-xs text-muted-foreground",
|
|
311
|
+
children: [
|
|
312
|
+
"Requested by ",
|
|
313
|
+
/* @__PURE__ */ h(t, { id: e.requestedBy }),
|
|
314
|
+
" · ",
|
|
315
|
+
e.decisions.length,
|
|
316
|
+
" of",
|
|
317
|
+
" ",
|
|
318
|
+
e.reviewerIds.length,
|
|
319
|
+
" decided"
|
|
320
|
+
]
|
|
321
|
+
})]
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
function W({ roadmapId: e }) {
|
|
325
|
+
let { data: t, loading: n, error: i } = m(P, {
|
|
326
|
+
variables: { roadmapId: e },
|
|
327
|
+
skip: !e
|
|
328
|
+
}), o = t?.planmagnetRoadmapReviews ?? [], s = o.find((e) => e.status === "OPEN") ?? null, c = o.filter((e) => e.id !== s?.id);
|
|
329
|
+
return /* @__PURE__ */ g(y, {
|
|
330
|
+
"data-testid": "roadmap-review-panel",
|
|
331
|
+
children: [/* @__PURE__ */ g(x, {
|
|
332
|
+
className: "flex flex-row items-center justify-between gap-2",
|
|
333
|
+
children: [/* @__PURE__ */ g(S, {
|
|
334
|
+
className: "flex items-center gap-2",
|
|
335
|
+
children: [/* @__PURE__ */ h(u, {
|
|
336
|
+
className: "h-4 w-4",
|
|
337
|
+
"aria-hidden": "true"
|
|
338
|
+
}), "Review"]
|
|
339
|
+
}), !s && /* @__PURE__ */ h(B, { roadmapId: e })]
|
|
340
|
+
}), /* @__PURE__ */ g(b, {
|
|
341
|
+
className: "space-y-4",
|
|
342
|
+
children: [
|
|
343
|
+
n && !t && /* @__PURE__ */ h("p", {
|
|
344
|
+
className: "text-sm text-muted-foreground",
|
|
345
|
+
children: "Loading review status…"
|
|
346
|
+
}),
|
|
347
|
+
i && /* @__PURE__ */ h(r, { message: a(i) ? "Your role cannot see this roadmap’s reviews." : `Reviews could not be loaded: ${i.message}` }),
|
|
348
|
+
s && /* @__PURE__ */ h(H, { review: s }),
|
|
349
|
+
!s && !n && /* @__PURE__ */ h("p", {
|
|
350
|
+
className: "text-sm text-muted-foreground",
|
|
351
|
+
children: "No review in progress."
|
|
352
|
+
}),
|
|
353
|
+
c.length > 0 && /* @__PURE__ */ g("div", {
|
|
354
|
+
className: "space-y-2 border-t pt-3",
|
|
355
|
+
children: [/* @__PURE__ */ h("p", {
|
|
356
|
+
className: "text-xs font-medium text-muted-foreground",
|
|
357
|
+
children: "Past reviews"
|
|
358
|
+
}), /* @__PURE__ */ h("ul", {
|
|
359
|
+
className: "space-y-2",
|
|
360
|
+
children: c.map((e) => /* @__PURE__ */ h(U, { review: e }, e.id))
|
|
361
|
+
})]
|
|
362
|
+
})
|
|
363
|
+
]
|
|
364
|
+
})]
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
//#endregion
|
|
368
|
+
export { W as RoadmapReviewPanel };
|
|
369
|
+
|
|
370
|
+
//# sourceMappingURL=RoadmapReviewPanel.js.map
|