FPSMS-frontend
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

Breadcrumb.tsx 2.9 KiB

pirms 1 gada
pirms 10 mēnešiem
pirms 1 gada
pirms 1 gada
pirms 11 mēnešiem
pirms 8 mēnešiem
pirms 10 mēnešiem
pirms 10 mēnešiem
pirms 20 stundām
pirms 10 mēnešiem
pirms 3 nedēļām
pirms 9 mēnešiem
pirms 7 mēnešiem
pirms 4 mēnešiem
pirms 2 nedēļām
pirms 3 nedēļām
pirms 1 mēnesi
pirms 1 gada
pirms 9 mēnešiem
pirms 1 gada
pirms 10 mēnešiem
pirms 1 gada
pirms 10 mēnešiem
pirms 1 gada
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. "use client";
  2. import Breadcrumbs from "@mui/material/Breadcrumbs";
  3. import Typography from "@mui/material/Typography";
  4. import Link from "next/link";
  5. import MUILink from "@mui/material/Link";
  6. import { usePathname } from "next/navigation";
  7. import { useTranslation } from "react-i18next";
  8. const pathToLabelMap: { [path: string]: string } = {
  9. "": "總覽",
  10. "/chart": "圖表報告",
  11. "/chart/warehouse": "庫存與倉儲",
  12. "/chart/purchase": "採購",
  13. "/chart/delivery": "發貨與配送",
  14. "/chart/joborder": "工單",
  15. "/chart/joborder/board": "工單即時看板",
  16. "/chart/forecast": "預測與計劃",
  17. "/projects": "Projects",
  18. "/projects/create": "Create Project",
  19. "/tasks": "Task Template",
  20. "/tasks/create": "Create Task Template",
  21. "/settings/qcItem": "Qc Item",
  22. "/settings/qcItemAll": "QC Item All",
  23. "/settings/qrCodeHandle": "QR Code Handle",
  24. "/settings/rss": "Demand Forecast Setting",
  25. "/settings/equipment": "Equipment",
  26. "/settings/equipment/MaintenanceEdit": "MaintenanceEdit",
  27. "/settings/shop": "ShopAndTruck",
  28. "/settings/shop/detail": "Shop Detail",
  29. "/settings/shop/truckdetail": "Truck Lane Detail",
  30. "/settings/printer": "Printer",
  31. "/scheduling/rough": "Demand Forecast",
  32. "/scheduling/rough/edit": "FG & Material Demand Forecast Detail",
  33. "/scheduling/detailed": "Detail Scheduling",
  34. "/scheduling/detailed/edit": "FG Production Schedule",
  35. "/inventory": "Inventory",
  36. "/settings/importTesting": "Import Testing",
  37. "/do": "Delivery Order",
  38. //"/doworkbench": "DO Workbench",
  39. // "/doworkbench/pick": "DO Workbench pick",
  40. // "/doworkbench/edit": "DO Workbench detail",
  41. "/pickOrder": "Pick Order",
  42. "/po": "Purchase Order",
  43. "/po/workbench": "PO Workbench",
  44. "/dashboard": "dashboard",
  45. "/jo": "Job Order",
  46. "/jo/edit": "Edit Job Order",
  47. "/jo/testing": "Job order testing",
  48. "/putAway": "Put Away",
  49. "/stockIssue": "Stock Issue",
  50. "/report": "Report",
  51. "/m18Syn": "M18 Sync",
  52. "/bagPrint": "打袋機",
  53. "/laserPrint": "檸檬機(激光機)",
  54. "/settings/itemPrice": "Price Inquiry",
  55. };
  56. const Breadcrumb = () => {
  57. const pathname = usePathname();
  58. const segments = pathname.split("/");
  59. const { t } = useTranslation("common");
  60. return (
  61. <Breadcrumbs>
  62. {segments.map((segment, index) => {
  63. const href = segments.slice(0, index + 1).join("/");
  64. const label = pathToLabelMap[href] || segment;
  65. if (index === segments.length - 1) {
  66. return (
  67. <Typography key={index} color="text.primary">
  68. {t(label)}
  69. </Typography>
  70. );
  71. } else {
  72. return (
  73. <MUILink
  74. underline="hover"
  75. color="inherit"
  76. key={index}
  77. component={Link}
  78. href={href || "/"}
  79. >
  80. {t(label)}
  81. </MUILink>
  82. );
  83. }
  84. })}
  85. </Breadcrumbs>
  86. );
  87. };
  88. export default Breadcrumb;