mirror of
https://github.com/BarkProductions/barkman.git
synced 2026-06-13 06:11:55 +00:00
Add item detail view and link from inventory list
Introduces a new `ItemDetail` component to display detailed information for an inventory item. Updates the `InventoryList` to include a link directing users to the detail view for each item. Also adds the necessary route for the `ItemDetail` component in the app configuration.
This commit is contained in:
@@ -4,6 +4,7 @@ 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 {createTheme, MantineProvider} from '@mantine/core';
|
||||||
import '@mantine/core/styles.css';
|
import '@mantine/core/styles.css';
|
||||||
|
import ItemDetail from "./features/inventory/ItemDetail.tsx";
|
||||||
|
|
||||||
// Create a client
|
// Create a client
|
||||||
const queryClient = new QueryClient()
|
const queryClient = new QueryClient()
|
||||||
@@ -34,6 +35,7 @@ function App() {
|
|||||||
<Routes>
|
<Routes>
|
||||||
<Route index element={<Home />} />
|
<Route index element={<Home />} />
|
||||||
<Route path="inventory" element={<InventoryList />} />
|
<Route path="inventory" element={<InventoryList />} />
|
||||||
|
<Route path="itemDetail/:itemId" element={<ItemDetail />} />
|
||||||
</Routes>
|
</Routes>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import {InventoryItem} from "./types";
|
|||||||
import {BarkHeader} from "../../common/components/BarkHeader.tsx";
|
import {BarkHeader} from "../../common/components/BarkHeader.tsx";
|
||||||
import {Flex, Table} from '@mantine/core';
|
import {Flex, Table} from '@mantine/core';
|
||||||
import BarkButton from "../../common/components/BarkButton.tsx";
|
import BarkButton from "../../common/components/BarkButton.tsx";
|
||||||
|
import {Link} from "react-router";
|
||||||
|
|
||||||
function InventoryList() {
|
function InventoryList() {
|
||||||
|
|
||||||
@@ -53,6 +53,7 @@ function InventoryList() {
|
|||||||
<Table.Th c="red">Brand</Table.Th>
|
<Table.Th c="red">Brand</Table.Th>
|
||||||
<Table.Th c="red">Item</Table.Th>
|
<Table.Th c="red">Item</Table.Th>
|
||||||
<Table.Th c="red">Status</Table.Th>
|
<Table.Th c="red">Status</Table.Th>
|
||||||
|
<Table.Th c="red">Details</Table.Th>
|
||||||
</Table.Tr>
|
</Table.Tr>
|
||||||
</Table.Thead>
|
</Table.Thead>
|
||||||
<Table.Tbody>
|
<Table.Tbody>
|
||||||
@@ -62,6 +63,9 @@ function InventoryList() {
|
|||||||
<Table.Td>{data.brand}</Table.Td>
|
<Table.Td>{data.brand}</Table.Td>
|
||||||
<Table.Td>{data.name}</Table.Td>
|
<Table.Td>{data.name}</Table.Td>
|
||||||
<Table.Td>{data.status}</Table.Td>
|
<Table.Td>{data.status}</Table.Td>
|
||||||
|
<Table.Td>
|
||||||
|
<Link to={`/itemDetail/${data.id}`}>Details</Link>
|
||||||
|
</Table.Td>
|
||||||
</Table.Tr>
|
</Table.Tr>
|
||||||
))}
|
))}
|
||||||
</Table.Tbody>
|
</Table.Tbody>
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
import {Text} from "@mantine/core";
|
||||||
|
import {BarkHeader} from "../../common/components/BarkHeader.tsx";
|
||||||
|
import {useParams} from "react-router";
|
||||||
|
|
||||||
|
|
||||||
|
function ItemDetail() {
|
||||||
|
let params = useParams();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<BarkHeader></BarkHeader>
|
||||||
|
<Text c="red">Item Detail</Text>
|
||||||
|
<Text>ID: {params.itemId}</Text>
|
||||||
|
|
||||||
|
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ItemDetail
|
||||||
Reference in New Issue
Block a user