diff --git a/barkmanui/public/barklogo.png b/barkmanui/public/barklogo.png new file mode 100644 index 0000000..f093bcd Binary files /dev/null and b/barkmanui/public/barklogo.png differ 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 3baf441..0e1f4b5 100644 --- a/barkmanui/src/common/components/BarkHeader.tsx +++ b/barkmanui/src/common/components/BarkHeader.tsx @@ -1,8 +1,9 @@ -import { Burger, Container, Group } from '@mantine/core'; +import {Burger, Container, Group, Image} from '@mantine/core'; import { useDisclosure } from '@mantine/hooks'; import classes from './BarkHeader.module.css'; import {NavLink} from "react-router"; + const links = [ { link: '/', label: 'Home' }, { link: '/inventory', label: 'Inventory' }, @@ -20,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 e16309b..97fb7e7 100644 --- a/barkmanui/src/features/inventory/EditItem.tsx +++ b/barkmanui/src/features/inventory/EditItem.tsx @@ -1,5 +1,5 @@ -import {Button, Group, TextInput, Text, Textarea, NumberInput} from '@mantine/core'; -import { useForm } from '@mantine/form'; +import {Button, Group, TextInput, Text, Textarea, NumberInput, Container, Title, Flex} from '@mantine/core'; +import {useForm} from '@mantine/form'; import {useParams} from "react-router"; import {useMutation, useQuery, useQueryClient} from "@tanstack/react-query"; import {InventoryItem} from "./types.ts"; @@ -10,7 +10,7 @@ type EditableInventoryItem = Omit; function EditItem() { const params = useParams(); - const form = useForm({ + const editItemForm = useForm({ mode: 'uncontrolled', initialValues: { name: "", @@ -22,11 +22,10 @@ function EditItem() { notes: "", }, - validate: { - }, + validate: {}, }); - const { isPending, error, data, isFetching } = useQuery({ + const {isPending, error, data, isFetching} = useQuery({ queryKey: ['inventory', params.itemId], queryFn: async (): Promise => { const response = await fetch( @@ -68,8 +67,9 @@ function EditItem() { useEffect(() => { if (data) { // Even if query.data changes, form will be initialized only once - form.initialize(data); + editItemForm.initialize(data); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [data]); if (isPending) return 'Loading...' @@ -77,27 +77,39 @@ function EditItem() { if (error) return 'An error has occurred: ' + error.message return ( -
await + await updateItem.mutateAsync(values))}> -
{isFetching ? 'Updating...' : ''}
- ID: {data.id} - - - - - - -