Skip to content

Commit 56af7fd

Browse files
committed
fix UI updating while analyzing
1 parent e2f10fc commit 56af7fd

9 files changed

Lines changed: 431 additions & 168 deletions

src/AnalysisProgressList.tsx

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
/**
2+
* Analysis Progress List Component
3+
*
4+
* A reusable component that shows the progress of layer analysis
5+
* with visual indicators for completed, current, and pending steps.
6+
*/
7+
8+
import { For, createMemo } from "solid-js";
9+
import { theme } from "./theme";
10+
import { useStore } from "./store";
11+
import {
12+
ANALYSIS_STEPS,
13+
ANALYSIS_STEP_LABELS,
14+
type AnalysisProgressStep,
15+
} from "./storeTypes";
16+
17+
/**
18+
* Get the status of a step relative to the current progress
19+
*/
20+
function getStepStatus(
21+
step: AnalysisProgressStep,
22+
currentStep: AnalysisProgressStep | null,
23+
): "pending" | "current" | "completed" {
24+
if (!currentStep) return "pending";
25+
26+
const stepIndex = ANALYSIS_STEPS.indexOf(step);
27+
const currentIndex = ANALYSIS_STEPS.indexOf(currentStep);
28+
29+
if (stepIndex < currentIndex) return "completed";
30+
if (stepIndex === currentIndex) return "current";
31+
return "pending";
32+
}
33+
34+
/**
35+
* Get the icon for a step based on its status
36+
*/
37+
function getStepIcon(status: "pending" | "current" | "completed"): string {
38+
switch (status) {
39+
case "completed":
40+
return "✓";
41+
case "current":
42+
return "→";
43+
case "pending":
44+
return "○";
45+
}
46+
}
47+
48+
interface AnalysisProgressListProps {
49+
/** Whether to show in a compact single-line format */
50+
compact?: boolean;
51+
}
52+
53+
/**
54+
* Displays the list of analysis progress steps with visual status indicators.
55+
*
56+
* - Completed steps: ✓ in green
57+
* - Current step: → in orange/warning
58+
* - Pending steps: ○ in muted gray
59+
*/
60+
export function AnalysisProgressList(props: AnalysisProgressListProps) {
61+
const { store } = useStore();
62+
63+
const currentStep = createMemo(() => store.ui.layerAnalysisProgress);
64+
65+
// Compact mode: show only current step on one line
66+
if (props.compact) {
67+
return (
68+
<text style={{ fg: theme.warning }}>
69+
{currentStep()
70+
? `→ ${ANALYSIS_STEP_LABELS[currentStep()!]}...`
71+
: "Analyzing..."}
72+
</text>
73+
);
74+
}
75+
76+
// Full mode: show all steps
77+
return (
78+
<box flexDirection="column">
79+
<For each={ANALYSIS_STEPS}>
80+
{(step) => {
81+
const status = createMemo(() => getStepStatus(step, currentStep()));
82+
const icon = createMemo(() => getStepIcon(status()));
83+
const label = ANALYSIS_STEP_LABELS[step];
84+
85+
return (
86+
<text
87+
style={{
88+
fg:
89+
status() === "completed"
90+
? theme.success
91+
: status() === "current"
92+
? theme.warning
93+
: theme.muted,
94+
}}
95+
marginBottom={1}
96+
>
97+
{icon()} {label}
98+
</text>
99+
);
100+
}}
101+
</For>
102+
</box>
103+
);
104+
}

src/AnalysisStatusView.tsx

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22
* Analysis Status View Component
33
*
44
* Shows different analysis states: idle, analyzing, complete (no results), error.
5+
* During analysis, shows progress steps with muted colors for pending steps
6+
* and unmuted colors for completed steps.
57
*/
68

79
import { Show } from "solid-js";
810
import { theme } from "./theme";
911
import { useStore } from "./store";
10-
12+
import { AnalysisProgressList } from "./AnalysisProgressList";
1113

1214
export function AnalysisStatusView() {
1315
const { store } = useStore();
@@ -33,16 +35,12 @@ export function AnalysisStatusView() {
3335
<text style={{ fg: theme.warning }} marginBottom={2}>
3436
Analyzing project...
3537
</text>
36-
<text style={{ fg: theme.muted }} marginBottom={1}>
37-
- Searching for tsconfig.json
38-
</text>
39-
<text style={{ fg: theme.muted }} marginBottom={1}>
40-
- Scanning TypeScript diagnostics
38+
<text style={{ fg: theme.muted }} marginBottom={2}>
39+
Press [Esc] to cancel
4140
</text>
42-
<text style={{ fg: theme.muted }} marginBottom={1}>
43-
- Finding layer definitions
44-
</text>
45-
<text style={{ fg: theme.muted }}>- Resolving dependencies</text>
41+
42+
{/* Progress steps with reactive coloring */}
43+
<AnalysisProgressList />
4644
</Show>
4745

4846
<Show

src/fixTab.tsx

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { Show, createMemo } from "solid-js";
1010
import { theme } from "./theme";
1111
import { useStore } from "./store";
1212
import { AnalysisStatusView } from "./AnalysisStatusView";
13+
import { AnalysisProgressList } from "./AnalysisProgressList";
1314
import { ServicesListPanel } from "./ServicesListPanel";
1415
import { LayerCandidatesPanel } from "./LayerCandidatesPanel";
1516
import { DependencyGraphPanel } from "./DependencyGraphView";
@@ -42,6 +43,11 @@ export function FixTab() {
4243
// Show results view when we have results (even if re-analyzing)
4344
const showResultsView = createMemo(() => hasPreviousResults());
4445

46+
// Show re-analyzing indicator when we have results AND are analyzing
47+
const isReAnalyzing = createMemo(
48+
() => hasPreviousResults() && store.ui.layerAnalysisStatus === "analyzing",
49+
);
50+
4551
return (
4652
<box
4753
flexDirection="column"
@@ -57,6 +63,25 @@ export function FixTab() {
5763
{/* Results view: graph + service panels */}
5864
<Show when={showResultsView()}>
5965
<box flexGrow={1} flexDirection="column" width="100%">
66+
{/* Re-analyzing indicator - shown above graph when re-analyzing */}
67+
<Show when={isReAnalyzing()}>
68+
<box
69+
flexDirection="row"
70+
width="100%"
71+
paddingLeft={2}
72+
paddingTop={1}
73+
paddingBottom={1}
74+
backgroundColor={theme.bgAlt}
75+
border={["bottom"]}
76+
borderColor={theme.bgSelected}
77+
>
78+
<AnalysisProgressList compact />
79+
<text style={{ fg: theme.muted }} marginLeft={2}>
80+
[Esc] Cancel
81+
</text>
82+
</box>
83+
</Show>
84+
6085
{/* Graph view (toggleable) */}
6186
<Show when={showGraph()}>
6287
<box

src/index.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,15 @@ function AppContent() {
240240
return;
241241
}
242242

243+
// Cancel analysis with ESC
244+
if (
245+
key.name === "escape" &&
246+
store.ui.layerAnalysisStatus === "analyzing"
247+
) {
248+
actions.cancelLayerAnalysis();
249+
return;
250+
}
251+
243252
// Navigation within analysis results
244253
if (
245254
store.ui.layerAnalysisStatus === "complete" &&

0 commit comments

Comments
 (0)