Skip to content

Commit bb0303c

Browse files
authored
Merge pull request #109 from getagentseal/fix/view-persistence-and-compare-period-hints
fix: preserve view on period switch and auto-refresh
2 parents 19b4513 + 95bcd60 commit bb0303c

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/compare.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ function ModelSelector({ models, onSelect, onBack }: ModelSelectorProps) {
121121
<Text>
122122
<Text color={ORANGE} bold>[space]</Text><Text dimColor> select </Text>
123123
<Text color={ORANGE} bold>[enter]</Text><Text dimColor> compare </Text>
124+
<Text color={ORANGE} bold>{'<>'}</Text><Text dimColor> switch period </Text>
124125
<Text color={ORANGE} bold>[esc]</Text><Text dimColor> back </Text>
125126
<Text color={ORANGE} bold>[q]</Text><Text dimColor> quit</Text>
126127
</Text>
@@ -298,6 +299,7 @@ function ComparisonResults({ modelA, modelB, rows, categories, workingStyle, onB
298299
</Box>
299300

300301
<Text>
302+
<Text color={ORANGE} bold>{'<>'}</Text><Text dimColor> switch period </Text>
301303
<Text color={ORANGE} bold>[esc]</Text><Text dimColor> back </Text>
302304
<Text color={ORANGE} bold>[q]</Text><Text dimColor> quit</Text>
303305
</Text>

src/dashboard.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ function StatusBar({ width, showProvider, view, findingCount, optimizeAvailable,
544544
{!isOptimize && optimizeAvailable && findingCount != null && findingCount > 0 && (
545545
<><Text dimColor> </Text><Text color={ORANGE} bold>o</Text><Text dimColor> optimize</Text><Text color="#F55B5B"> ({findingCount})</Text></>
546546
)}
547-
{!isOptimize && view !== 'compare' && compareAvailable && (
547+
{!isOptimize && compareAvailable && (
548548
<><Text dimColor> </Text><Text color={ORANGE} bold>c</Text><Text dimColor> compare</Text></>
549549
)}
550550
{showProvider && (<><Text dimColor> </Text><Text color={ORANGE} bold>p</Text><Text dimColor> provider</Text></>)}
@@ -664,15 +664,13 @@ function InteractiveDashboard({ initialProjects, initialPeriod, initialProvider,
664664
const switchPeriod = useCallback((np: Period) => {
665665
if (np === period) return
666666
setPeriod(np)
667-
setView(v => v === 'compare' ? v : 'dashboard')
668667
if (debounceRef.current) clearTimeout(debounceRef.current)
669668
debounceRef.current = setTimeout(() => { reloadData(np, activeProvider) }, 600)
670669
}, [period, activeProvider, reloadData])
671670

672671
const switchPeriodImmediate = useCallback(async (np: Period) => {
673672
if (np === period) return
674673
setPeriod(np)
675-
setView(v => v === 'compare' ? v : 'dashboard')
676674
if (debounceRef.current) clearTimeout(debounceRef.current)
677675
await reloadData(np, activeProvider)
678676
}, [period, activeProvider, reloadData])
@@ -689,8 +687,8 @@ function InteractiveDashboard({ initialProjects, initialPeriod, initialProvider,
689687
reloadData(period, next); return
690688
}
691689
const idx = PERIODS.indexOf(period)
692-
if (key.leftArrow && view !== 'optimize') switchPeriod(PERIODS[(idx - 1 + PERIODS.length) % PERIODS.length]!)
693-
else if ((key.rightArrow || key.tab) && view !== 'optimize') switchPeriod(PERIODS[(idx + 1) % PERIODS.length]!)
690+
if (key.leftArrow) switchPeriod(PERIODS[(idx - 1 + PERIODS.length) % PERIODS.length]!)
691+
else if (key.rightArrow || key.tab) switchPeriod(PERIODS[(idx + 1) % PERIODS.length]!)
694692
else if (input === '1') switchPeriodImmediate('today')
695693
else if (input === '2') switchPeriodImmediate('week')
696694
else if (input === '3') switchPeriodImmediate('30days')
@@ -711,7 +709,7 @@ function InteractiveDashboard({ initialProjects, initialPeriod, initialProvider,
711709
</Box>
712710
</Box>
713711
: <Panel title="CodeBurn" color={ORANGE} width={dashWidth}><Text dimColor>Loading {PERIOD_LABELS[period]}...</Text></Panel>}
714-
{view !== 'compare' && <StatusBar width={dashWidth} showProvider={multipleProviders} view="dashboard" findingCount={0} optimizeAvailable={false} compareAvailable={false} />}
712+
{view !== 'compare' && <StatusBar width={dashWidth} showProvider={multipleProviders} view={view} findingCount={0} optimizeAvailable={false} compareAvailable={false} />}
715713
</Box>
716714
)
717715
}

0 commit comments

Comments
 (0)