Skip to content

Commit

Permalink
refactor(Breadcrumbs.tsx): remove unused code and imports
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ktun95 committed Mar 4, 2025
1 parent 6df026f commit 7458692
Showing 1 changed file with 0 additions and 25 deletions.
25 changes: 0 additions & 25 deletions apps/stock-center/src/components/Breadcrumbs.tsx
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 7458692

Please sign in to comment.