mirror of
https://github.com/NotAShelf/nix-evaluator-stats.git
synced 2026-04-12 22:37:42 +00:00
analysis: allow re-opening saved analyses
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I0c7074f1c44dcef27662e99eed875e3d6a6a6964
This commit is contained in:
parent
1850ac135f
commit
a37be62288
3 changed files with 78 additions and 4 deletions
|
|
@ -1,12 +1,14 @@
|
|||
import { createSignal, Show } from 'solid-js';
|
||||
import { StatsData } from '../utils/types';
|
||||
import { BarChart2 } from 'lucide-solid';
|
||||
import { createSignal, Show, For } from 'solid-js';
|
||||
import { StatsData, ComparisonEntry } from '../utils/types';
|
||||
import { BarChart2, Clock } from 'lucide-solid';
|
||||
|
||||
interface FileUploadProps {
|
||||
onFileLoad: (data: StatsData, raw: Record<string, unknown>) => void;
|
||||
onTextLoad: (text: string) => void;
|
||||
showHelp: boolean;
|
||||
onToggleHelp: () => void;
|
||||
snapshots?: ComparisonEntry[];
|
||||
onLoadSnapshot?: (entry: ComparisonEntry) => void;
|
||||
}
|
||||
|
||||
export default function FileUpload(props: FileUploadProps) {
|
||||
|
|
@ -91,6 +93,27 @@ export default function FileUpload(props: FileUploadProps) {
|
|||
<Show when={error()}>
|
||||
<div class="error">{error()}</div>
|
||||
</Show>
|
||||
|
||||
<Show when={props.snapshots && props.snapshots.length > 0}>
|
||||
<div class="recent-analyses">
|
||||
<h3>
|
||||
<Clock size={16} />
|
||||
Recent Analyses
|
||||
</h3>
|
||||
<div class="snapshot-list">
|
||||
<For each={props.snapshots}>
|
||||
{entry => (
|
||||
<div class="snapshot-item" onClick={() => props.onLoadSnapshot?.(entry)}>
|
||||
<span class="snapshot-name">{entry.name}</span>
|
||||
<span class="snapshot-date">
|
||||
{new Date(entry.timestamp).toLocaleDateString()}
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
</For>
|
||||
</div>
|
||||
</div>
|
||||
</Show>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue