From 1daa3d23c090ba2c0dbc8f8502af8a2518c13aa7 Mon Sep 17 00:00:00 2001 From: Drew Rautenberg Date: Thu, 23 Jan 2025 11:12:43 -0600 Subject: [PATCH] cleaned up ui and code --- barkmanui/src/App.tsx | 61 +++++++++---------- .../src/common/components/BarkHeader.tsx | 4 +- barkmanui/src/features/inventory/EditItem.tsx | 36 +++++------ .../src/features/inventory/ItemDetail.tsx | 2 +- barkmanui/src/pages/home.tsx | 6 +- 5 files changed, 55 insertions(+), 54 deletions(-) diff --git a/barkmanui/src/App.tsx b/barkmanui/src/App.tsx index 9633399..e3753f9 100644 --- a/barkmanui/src/App.tsx +++ b/barkmanui/src/App.tsx @@ -1,7 +1,7 @@ -import { Routes, Route} from 'react-router'; +import {Routes, Route} from 'react-router'; import Home from './pages/home.tsx'; import InventoryList from "./features/inventory/InventoryList.tsx"; -import { QueryClientProvider, QueryClient } from '@tanstack/react-query'; +import {QueryClientProvider, QueryClient} from '@tanstack/react-query'; import {createTheme, MantineProvider} from '@mantine/core'; import '@mantine/core/styles.css'; import ItemDetail from "./features/inventory/ItemDetail.tsx"; @@ -12,39 +12,38 @@ import {BarkHeader} from "./common/components/BarkHeader.tsx"; const queryClient = new QueryClient() const barkTheme = createTheme({ - primaryColor: 'red', - colors: { - 'red': [ - "#ffe8e8", - "#ffcfd0", - "#fd9d9d", - "#fb6868", - "#fa3c3b", - "#f9211e", - "#fa120f", - "#df0404", - "#c70002", - "#ae0000" - ], - }, + primaryColor: 'red', + colors: { + 'red': [ + "#ffe8e8", + "#ffcfd0", + "#fd9d9d", + "#fb6868", + "#fa3c3b", + "#f9211e", + "#fa120f", + "#df0404", + "#c70002", + "#ae0000" + ], + }, }); function App() { - return { ( - - <> - - - } /> - } /> - } /> - } /> - - - - - ) }; + return {( + + <> + + + }/> + }/> + }/> + }/> + + + + )}; } export default App diff --git a/barkmanui/src/common/components/BarkHeader.tsx b/barkmanui/src/common/components/BarkHeader.tsx index a07d76a..0e1f4b5 100644 --- a/barkmanui/src/common/components/BarkHeader.tsx +++ b/barkmanui/src/common/components/BarkHeader.tsx @@ -21,8 +21,8 @@ export function BarkHeader() { return (
- - + + {items} diff --git a/barkmanui/src/features/inventory/EditItem.tsx b/barkmanui/src/features/inventory/EditItem.tsx index 2b915a3..6bf33b3 100644 --- a/barkmanui/src/features/inventory/EditItem.tsx +++ b/barkmanui/src/features/inventory/EditItem.tsx @@ -10,7 +10,7 @@ type EditableInventoryItem = Omit; function EditItem() { const params = useParams(); - const form = useForm({ + const editItemForm = useForm({ mode: 'uncontrolled', initialValues: { name: "", @@ -67,7 +67,7 @@ function EditItem() { useEffect(() => { if (data) { // Even if query.data changes, form will be initialized only once - form.initialize(data); + editItemForm.initialize(data); } }, [data]); @@ -76,9 +76,9 @@ function EditItem() { if (error) return 'An error has occurred: ' + error.message return ( -
await + await updateItem.mutateAsync(values))}> - + {isFetching ? 'Updating...' : ''} Edit Item ID: {data.id} - - - - - - -