From 3ac6ebd87d5347882a2d17e73d873d12c1441a1c Mon Sep 17 00:00:00 2001 From: Z8MB1E Date: Mon, 2 Nov 2026 14:28:55 -0500 Subject: [PATCH] feat(frontend): make the command-chain editor a collapsible panel Wrap the mission command-chain editor content in a Collapsible with an expand/collapse trigger in the header row, next to the Override/Legacy/ Defaults badge. The 'Command chain' title folds into the trigger so the card header holds only the toggle and the status badge. --- .../MissionCommandChainEditor.tsx | 196 ++++++++++-------- 1 file changed, 109 insertions(+), 87 deletions(-) diff --git a/src/components/frontend/intelligence/MissionCommandChainEditor.tsx b/src/components/frontend/intelligence/MissionCommandChainEditor.tsx index c6eca12e..ee21396b 100644 --- a/src/components/frontend/intelligence/MissionCommandChainEditor.tsx +++ b/src/components/frontend/intelligence/MissionCommandChainEditor.tsx @@ -3,10 +3,13 @@ import { useState } from "react"; import { useRouter } from "next/navigation"; import { toast } from "sonner"; +import { ChevronDown } from "lucide-react"; +import { cn } from "@/lib/utils"; import { Button } from "@/components/ui/button"; import { Badge } from "@/components/ui/badge"; import { Label } from "@/components/ui/label"; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; +import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@/components/ui/collapsible"; import { Alert, AlertDescription } from "@/components/ui/alert"; import { Select, @@ -54,6 +57,7 @@ export function MissionCommandChainEditor({ }: MissionCommandChainEditorProps) { const router = useRouter(); const [pending, setPending] = useState(false); + const [contentOpen, setContentOpen] = useState(true); const initialSupervisors = (subordinateId: number) => links.filter((l) => l.subordinateId === subordinateId).map((l) => l.supervisorId); const [draft, setDraft] = useState>(() => @@ -104,95 +108,113 @@ export function MissionCommandChainEditor({ }; return ( - - - - Command chain - - {mode === "stored" ? "Override" : mode === "legacy" ? "Legacy" : "Defaults"} - - - - Who was in command of whom for this operation only. Permanent assignments are not - changed. Supervisors may rate their subordinate as a command review. - - - - {mode === "legacy" && ( - - - This mission was rated before the chain existed, so its command reviews follow the - original assignment rule and cannot be changed here. - - - )} - {!editable && lockReason && ( - - {lockReason} - - )} + + + + +
+ + + + + {mode === "stored" ? "Override" : mode === "legacy" ? "Legacy" : "Defaults"} + +
+
+ + Who was in command of whom for this operation only. Permanent assignments are not + changed. Supervisors may rate their subordinate as a command review. + +
+ + + {mode === "legacy" && ( + + + This mission was rated before the chain existed, so its command reviews follow the + original assignment rule and cannot be changed here. + + + )} + {!editable && lockReason && ( + + {lockReason} + + )} - {mode !== "legacy" && ( -
- {participants.map((sub) => { - const supervisors = draft[sub.id] ?? []; - const options = participants.filter( - (p) => p.id !== sub.id && !supervisors.includes(p.id), - ); - return ( -
- -
- {supervisors.length === 0 && ( - No supervisor - )} - {supervisors.map((supId) => ( - - {nameOf(supId)} - {editable && ( - + {mode !== "legacy" && ( +
+ {participants.map((sub) => { + const supervisors = draft[sub.id] ?? []; + const options = participants.filter( + (p) => p.id !== sub.id && !supervisors.includes(p.id), + ); + return ( +
+ +
+ {supervisors.length === 0 && ( + No supervisor )} - - ))} - {editable && options.length > 0 && ( - - )} -
-
- ); - })} -
- )} + {supervisors.map((supId) => ( + + {nameOf(supId)} + {editable && ( + + )} + + ))} + {editable && options.length > 0 && ( + + )} +
+
+ ); + })} +
+ )} - {editable && mode !== "legacy" && ( -
- - -
- )} -
-
+ {editable && mode !== "legacy" && ( +
+ + +
+ )} +
+ +
+ ); }