From 2f7369c7f56e84d05ca2b5bbd82c201324dbfe4f Mon Sep 17 00:00:00 2001 From: Drew Rautenberg Date: Sun, 19 Jan 2025 20:10:22 -0600 Subject: [PATCH] Move BarkHeader component to App layout Consolidated BarkHeader usage by removing it from individual pages and including it in the main App layout. This improves consistency and reduces redundancy across components. --- barkmanui/src/App.tsx | 3 +- barkmanui/src/features/inventory/EditItem.tsx | 64 ++++++++++--------- .../src/features/inventory/InventoryList.tsx | 3 - .../src/features/inventory/ItemDetail.tsx | 3 - barkmanui/src/pages/home.tsx | 5 -- 5 files changed, 35 insertions(+), 43 deletions(-) diff --git a/barkmanui/src/App.tsx b/barkmanui/src/App.tsx index d901048..9633399 100644 --- a/barkmanui/src/App.tsx +++ b/barkmanui/src/App.tsx @@ -6,6 +6,7 @@ import {createTheme, MantineProvider} from '@mantine/core'; import '@mantine/core/styles.css'; import ItemDetail from "./features/inventory/ItemDetail.tsx"; import EditItem from "./features/inventory/EditItem.tsx"; +import {BarkHeader} from "./common/components/BarkHeader.tsx"; // Create a client const queryClient = new QueryClient() @@ -33,6 +34,7 @@ function App() { return { ( <> + } /> } /> @@ -40,7 +42,6 @@ function App() { } /> - ) }; diff --git a/barkmanui/src/features/inventory/EditItem.tsx b/barkmanui/src/features/inventory/EditItem.tsx index c0c2e23..2755408 100644 --- a/barkmanui/src/features/inventory/EditItem.tsx +++ b/barkmanui/src/features/inventory/EditItem.tsx @@ -1,13 +1,22 @@ -import {NumberInput, Stack, Text, Textarea, TextInput} from "@mantine/core"; -import {BarkHeader} from "../../common/components/BarkHeader.tsx"; +import {Button, Group, TextInput, Text, Textarea, NumberInput} from '@mantine/core'; +import { useForm } from '@mantine/form'; import {useParams} from "react-router"; -import {InventoryItem} from "./types.ts"; import {useQuery} from "@tanstack/react-query"; - - +import {InventoryItem} from "./types.ts"; function EditItem() { - let params = useParams(); + const params = useParams(); + + const form = useForm({ + mode: 'uncontrolled', + initialValues: { + email: '', + termsOfService: false, + }, + + validate: { + }, + }); const { isPending, error, data, isFetching } = useQuery({ queryKey: ['inventory', params.itemId], @@ -26,31 +35,24 @@ function EditItem() { if (error) return 'An error has occurred: ' + error.message - return ( - <> - - - Edit Item -
{isFetching ? 'Updating...' : ''}
- ID: {data.id} - - - - - - - Replacement Cost: ${data.replacementCost} -