style: 移除麵包屑首頁項,側邊欄新增儀表板選單並修正選中狀態

This commit is contained in:
2026-01-13 13:37:51 +08:00
parent ecfcbb93ed
commit f0e6c6e4d1
2 changed files with 11 additions and 8 deletions

View File

@@ -1,4 +1,5 @@
import { import {
LayoutDashboard,
ChevronRight, ChevronRight,
Package, Package,
ShoppingCart, ShoppingCart,
@@ -59,6 +60,12 @@ export default function AuthenticatedLayout({
const [isMobileOpen, setIsMobileOpen] = useState(false); const [isMobileOpen, setIsMobileOpen] = useState(false);
const menuItems: MenuItem[] = [ const menuItems: MenuItem[] = [
{
id: "dashboard",
label: "儀表板",
icon: <LayoutDashboard className="h-5 w-5" />,
route: "/",
},
{ {
id: "inventory-management", id: "inventory-management",
label: "商品與庫存管理", label: "商品與庫存管理",
@@ -197,7 +204,9 @@ export default function AuthenticatedLayout({
const renderMenuItem = (item: MenuItem, level: number = 0) => { const renderMenuItem = (item: MenuItem, level: number = 0) => {
const hasChildren = item.children && item.children.length > 0; const hasChildren = item.children && item.children.length > 0;
const isExpanded = expandedItems.includes(item.id); const isExpanded = expandedItems.includes(item.id);
const isActive = item.route ? url.startsWith(item.route) : false; const isActive = item.route
? (item.route === '/' ? url === '/' : url.startsWith(item.route))
: false;
return ( return (
<div key={item.id} className="mb-1"> <div key={item.id} className="mb-1">

View File

@@ -5,26 +5,20 @@ import { BreadcrumbItemType } from "@/Components/shared/BreadcrumbNav";
* 根據側邊欄層級結構定義基礎麵包屑 * 根據側邊欄層級結構定義基礎麵包屑
*/ */
export const BREADCRUMB_MAP: Record<string, BreadcrumbItemType[]> = { export const BREADCRUMB_MAP: Record<string, BreadcrumbItemType[]> = {
dashboard: [ dashboard: [],
{ label: "首頁", isPage: true }
],
products: [ products: [
{ label: "首頁", href: "/" },
{ label: "商品與庫存管理" }, { label: "商品與庫存管理" },
{ label: "商品資料管理", href: "/products", isPage: true } { label: "商品資料管理", href: "/products", isPage: true }
], ],
warehouses: [ warehouses: [
{ label: "首頁", href: "/" },
{ label: "商品與庫存管理" }, { label: "商品與庫存管理" },
{ label: "倉庫管理", href: "/warehouses", isPage: true } { label: "倉庫管理", href: "/warehouses", isPage: true }
], ],
vendors: [ vendors: [
{ label: "首頁", href: "/" },
{ label: "廠商管理" }, { label: "廠商管理" },
{ label: "廠商資料管理", href: "/vendors", isPage: true } { label: "廠商資料管理", href: "/vendors", isPage: true }
], ],
purchaseOrders: [ purchaseOrders: [
{ label: "首頁", href: "/" },
{ label: "採購管理" }, { label: "採購管理" },
{ label: "管理採購單", href: "/purchase-orders", isPage: true } { label: "管理採購單", href: "/purchase-orders", isPage: true }
], ],