From 74586927fecda3114fb0fd58394bef023e3383c7 Mon Sep 17 00:00:00 2001 From: Kevin Tun Date: Tue, 4 Mar 2025 10:44:28 -0600 Subject: [PATCH] refactor(Breadcrumbs.tsx): remove unused code and imports This commit removes unused code and imports from the Breadcrumbs component. The removed code includes: - The `match` function from the `ts-pattern` library - The `Rkeys` function from the `fp-ts/Record` library - The `Sreplace` function from the `fp-ts/string` library - The `RAdropLeft` function from the `fp-ts/ReadonlyArray` library - The `RAfindIndex` function from the `fp-ts/ReadonlyArray` library - The `omitSegments` variable - The `dynamicRoutes` variable - The `pages` variable These changes improve the readability and maintainability of the component. --- .../src/components/Breadcrumbs.tsx | 25 ------------------- 1 file changed, 25 deletions(-) diff --git a/apps/stock-center/src/components/Breadcrumbs.tsx b/apps/stock-center/src/components/Breadcrumbs.tsx index 31d27f78c..7089154ee 100644 --- a/apps/stock-center/src/components/Breadcrumbs.tsx +++ b/apps/stock-center/src/components/Breadcrumbs.tsx @@ -1,20 +1,15 @@ -import { match } from "ts-pattern" import { pipe } from "fp-ts/function" -import { keys as Rkeys } from "fp-ts/Record" import { Monoid as SMonoid, split as Ssplit, isEmpty as SisEmpty, - replace as Sreplace, } from "fp-ts/string" import { filter as RAfilter, map as RAmap, init as RAinit, last as RAlast, - dropLeft as RAdropLeft, takeLeft as RAtakeLeft, - findIndex as RAfindIndex, intercalate as RAintercalate, } from "fp-ts/ReadonlyArray" import { @@ -70,26 +65,6 @@ const convertBreadcrumbTitle = (crumb: string) => { } const roleSegments = new Set(["show", "editable", "edit"]) -const omitSegments = new Set(["index"]) -const dynamicRoutes = import.meta.glob("/src/pages/**/**/*.tsx", { - eager: true, -}) -const pages = pipe( - dynamicRoutes, - Rkeys, - RAmap((path) => - pipe( - path, - Ssplit("/"), - RAdropLeft(3), - RAmap(Sreplace(/\.\w+/, "")), - RAmap(Sreplace(/\[\w+]/, "*")), - RAfilter((segment) => !roleSegments.has(segment)), - RAfilter((segment) => !omitSegments.has(segment)), - ), - ), -) - /** * Breadcrumbs displays navigation breadcrumbs for the DSC app. * 1. Get the pathname.