feat: add profile route and sidebar navigation; implement inventory and view product pages

- Added a new profile route under the hidden layout.
- Introduced a Sidebar component for navigation between inventory, add product, and profile pages.
- Created InventoryPage to display a list of products with sorting and pagination.
- Implemented ViewProduct page to show details of a selected product.
- Integrated API calls for fetching products and product details.
- Updated route tree to include new routes and components.
This commit is contained in:
2026-05-26 21:37:30 +02:00
parent 56a31bb614
commit 616058b603
13 changed files with 1091 additions and 12 deletions
+6 -4
View File
@@ -1,5 +1,5 @@
// routes/app/_layout.tsx (oder app.tsx als Parent)
import { Outlet, createFileRoute } from "@tanstack/react-router";
import { Sidebar } from "../../components/Sidebar";
export const Route = createFileRoute("/app/_hiddenLayout")({
component: AppLayout,
@@ -7,9 +7,11 @@ export const Route = createFileRoute("/app/_hiddenLayout")({
function AppLayout() {
return (
<div>
<h1>Layout</h1>
<Outlet />
<div className="flex min-h-screen w-full bg-[#f7f9fc]">
<Sidebar />
<main className="flex-1 px-8 py-6">
<Outlet />
</main>
</div>
);
}
@@ -1,5 +1,6 @@
import { createFileRoute, redirect } from "@tanstack/react-router";
import { isAuthenticated } from "../../../utils/auth";
import { InventoryPage } from "../../../pages/Inventory";
export const Route = createFileRoute("/app/_hiddenLayout/inventory")({
beforeLoad: async () => {
@@ -13,9 +14,5 @@ export const Route = createFileRoute("/app/_hiddenLayout/inventory")({
});
function RouteComponent() {
return (
<>
<p>Inventar</p>
</>
);
return <InventoryPage />;
}
@@ -0,0 +1,9 @@
import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/app/_hiddenLayout/profile')({
component: RouteComponent,
})
function RouteComponent() {
return <div>Hello "/app/_hiddenLayout/profile"!</div>
}
@@ -1,5 +1,7 @@
import { createFileRoute, redirect } from "@tanstack/react-router";
import { z } from "zod";
import { isAuthenticated } from "../../../utils/auth";
import { ViewProduct } from "../../../pages/ViewProduct";
export const Route = createFileRoute("/app/_hiddenLayout/view-product")({
beforeLoad: async () => {
@@ -9,9 +11,13 @@ export const Route = createFileRoute("/app/_hiddenLayout/view-product")({
});
}
},
validateSearch: z.object({
product: z.string(),
}),
component: RouteComponent,
});
function RouteComponent() {
return <div>Hello "/app/view-product"!</div>;
const { product } = Route.useSearch();
return <ViewProduct uuid={product} />;
}