From cd269b3540fb5e3a988c1b59d3763db360b1fb34 Mon Sep 17 00:00:00 2001 From: Joe Carstairs Date: Tue, 17 Sep 2024 13:20:04 +0100 Subject: many, many changes --- gui/src/components/app/App.tsx | 70 +++++++++++++++--------------------------- 1 file changed, 25 insertions(+), 45 deletions(-) (limited to 'gui/src/components/app') diff --git a/gui/src/components/app/App.tsx b/gui/src/components/app/App.tsx index cd9f9ee..e9ef742 100644 --- a/gui/src/components/app/App.tsx +++ b/gui/src/components/app/App.tsx @@ -1,53 +1,33 @@ -import Category from '../../types/category'; -import Gbp from '../../types/currency/gbp'; +import { createResource, Match, Resource, Switch } from 'solid-js'; import Histogram from '../histogram/Histogram' import './App.css' +import { getAllCategories } from '../../ajax/backend'; +import { Category } from '../../types/category'; function App() { + const [categories] = createResource(getAllCategories); + return ( - <> - - - ) + + + , { state: 'ready' }>)()} /> + + +

Loading...

+
+ +

Unresolved!

+
+ +

Error!

+

{JSON.stringify(categories.error, null, 2)}

+

{JSON.stringify(categories(), null, 2)}

+
+ +

Refreshing!

+
+
+ ); } -const categories: Category[] = [ - { - id: 0, - name: 'Groceries', - currentBalance: new Gbp(71, 37, 1), - currentBudget: { - quantity: new Gbp(65, 0, 1), - period: 7, - }, - }, - { - id: 1, - name: 'Stationery', - currentBalance: new Gbp(10, 12, -1), - currentBudget: { - quantity: new Gbp(12, 0, 1), - period: 30, - }, - }, - { - id: 2, - name: 'Holidays', - currentBalance: new Gbp(325, 0, 1), - currentBudget: { - quantity: new Gbp(1000, 0, 1), - period: 365, - }, - }, - { - id: 3, - name: 'Wages', - currentBalance: new Gbp(1025, 60, -1), - currentBudget: { - quantity: new Gbp(2167, 7, -1), - period: 30.25, - }, - }, -].map(c => ({ ...c, balanceToBudgetRatio: c.currentBalance.valueOf() / c.currentBudget.quantity.valueOf() })); - export default App -- cgit v1.2.3