create-interview-cockpit 0.26.1 → 0.28.0

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.
@@ -3,6 +3,7 @@ import { useStore } from "../store";
3
3
  import type { CodeContextRoot } from "../types";
4
4
  import FileViewerModal from "./FileViewerModal";
5
5
  import NotesModal, { notesKey } from "./NotesModal";
6
+ import DiagramsModal, { diagramsKey } from "./DiagramsModal";
6
7
  import GitDiffPanel from "./GitDiffPanel";
7
8
  import {
8
9
  File,
@@ -25,6 +26,7 @@ import {
25
26
  Trash2,
26
27
  Pencil,
27
28
  NotebookPen,
29
+ Workflow,
28
30
  } from "lucide-react";
29
31
 
30
32
  // ─── Tree data structure ─────────────────────────────────
@@ -150,7 +152,7 @@ function FolderNode({
150
152
  selectedFiles.includes(codeContextFileId(rootId, f)),
151
153
  ).length;
152
154
  const folderKey = codeContextFileId(rootId, node.path);
153
- const isExpanded = expandedFolders.has(folderKey);
155
+ const isExpanded = Boolean(filter) || expandedFolders.has(folderKey);
154
156
 
155
157
  // Filter: if searching, only show nodes that have matching files
156
158
  const matchingFiles = filter
@@ -310,7 +312,8 @@ function CodeContextRootNode({
310
312
  : true;
311
313
  if (filter && !hasMatchingDescendants) return null;
312
314
 
313
- const isExpanded = rootMatches || expandedFolders.has(rootKey);
315
+ const isExpanded =
316
+ Boolean(filter) || rootMatches || expandedFolders.has(rootKey);
314
317
  const checkState: "none" | "some" | "all" =
315
318
  selectedCount === 0 || rootFileIds.length === 0
316
319
  ? "none"
@@ -452,6 +455,7 @@ export default function CodeContextPanel() {
452
455
  );
453
456
  const [viewingFile, setViewingFile] = useState<string | null>(null);
454
457
  const [notesOpen, setNotesOpen] = useState(false);
458
+ const [diagramsOpen, setDiagramsOpen] = useState(false);
455
459
 
456
460
  // Show a dot in the Notes button when there are saved notes for this context
457
461
  const hasNotes = (() => {
@@ -465,6 +469,18 @@ export default function CodeContextPanel() {
465
469
  }
466
470
  })();
467
471
 
472
+ // Same indicator for diagrams attached to this question.
473
+ const hasDiagrams = (() => {
474
+ try {
475
+ const raw = localStorage.getItem(diagramsKey(currentQuestion?.id));
476
+ if (!raw) return false;
477
+ const parsed = JSON.parse(raw);
478
+ return Array.isArray(parsed) && parsed.length > 0;
479
+ } catch {
480
+ return false;
481
+ }
482
+ })();
483
+
468
484
  useEffect(() => {
469
485
  fetchAvailableFiles();
470
486
  }, []);
@@ -865,6 +881,28 @@ export default function CodeContextPanel() {
865
881
  </span>
866
882
  </button>
867
883
  </div>
884
+
885
+ {/* ── Diagrams section ────────────────────────────────── */}
886
+ <div className="border-t border-slate-800 px-3 py-2">
887
+ <button
888
+ onClick={() => setDiagramsOpen((v) => !v)}
889
+ className="w-full flex items-center gap-2 group"
890
+ >
891
+ <Workflow className="w-3 h-3 text-sky-400/70 shrink-0" />
892
+ <span className="text-[10px] uppercase tracking-wider text-slate-600 flex-1 text-left">
893
+ Diagrams
894
+ </span>
895
+ {hasDiagrams && (
896
+ <span
897
+ className="w-1.5 h-1.5 rounded-full bg-sky-400/70 shrink-0"
898
+ title="Has diagrams"
899
+ />
900
+ )}
901
+ <span className="text-[10px] text-slate-700 group-hover:text-slate-500 transition-colors">
902
+ {diagramsOpen ? "close" : "open"}
903
+ </span>
904
+ </button>
905
+ </div>
868
906
  </div>
869
907
 
870
908
  {viewingFile && (
@@ -880,6 +918,13 @@ export default function CodeContextPanel() {
880
918
  onClose={() => setNotesOpen(false)}
881
919
  />
882
920
  )}
921
+
922
+ {diagramsOpen && (
923
+ <DiagramsModal
924
+ questionId={currentQuestion?.id}
925
+ onClose={() => setDiagramsOpen(false)}
926
+ />
927
+ )}
883
928
  </div>
884
929
  );
885
930
  }