diff options
| author | Joe Carstairs <me@joeac.net> | 2024-10-22 07:46:43 +0100 |
|---|---|---|
| committer | Joe Carstairs <me@joeac.net> | 2024-10-22 07:46:43 +0100 |
| commit | 5824c353f978a5b9ab9696451ee3014c6a614ffc (patch) | |
| tree | bc39754ca417e84eb00b0aa9a1ae2330da0bf282 /gui/src/views/histogram/HistogramView.tsx | |
| parent | 7adaace61a4fe983eba5ded3aaaf624ce6fb9014 (diff) | |
Refactors importer to use core stuff
Diffstat (limited to 'gui/src/views/histogram/HistogramView.tsx')
| -rw-r--r-- | gui/src/views/histogram/HistogramView.tsx | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/gui/src/views/histogram/HistogramView.tsx b/gui/src/views/histogram/HistogramView.tsx new file mode 100644 index 0000000..30e64ca --- /dev/null +++ b/gui/src/views/histogram/HistogramView.tsx @@ -0,0 +1,31 @@ +import { Match, Resource, Switch } from 'solid-js'; +import Histogram from '../../components/histogram/Histogram' +import { Category } from '../../types/category'; + +export function HistogramView({ categories }: Props) { + return ( + <Switch> + <Match when={categories.state === 'ready'}> + <Histogram categories={(categories as Extract<Resource<Category[]>, { state: 'ready' }>)()} /> + </Match> + <Match when={categories.state === 'pending'}> + <p>Loading...</p> + </Match> + <Match when={categories.state === 'unresolved'}> + <p>Unresolved!</p> + </Match> + <Match when={categories.state === 'errored'}> + <p>Error!</p> + <p>{JSON.stringify(categories.error, null, 2)}</p> + <p>{JSON.stringify(categories(), null, 2)}</p> + </Match> + <Match when={categories.state === 'refreshing'}> + <p>Refreshing!</p> + </Match> + </Switch> + ); +} + +type Props = { + categories: Resource<Category[] | null>; +} |
