This commit is contained in:
@@ -87,10 +87,12 @@ Dynamic routes use string concat: `Pages.customer.update + ":id"`.
|
||||
|
||||
## Sidebar & submenu
|
||||
|
||||
- Main items: `SideBarItem` in `SideBar.tsx` with `link`, `isActive`, `activeName`
|
||||
- Features with sub-nav: add segment to `SideBarItemHasSubMenu` in `src/config/SideBarSubMenu.ts`, create `{Feature}SubMenu.tsx` in `src/shared/components/`, render it in the `subMenuName === "..."` block at bottom of `SideBar.tsx`
|
||||
- Submenu items use `SubMenuItem` with `Pages.*` links
|
||||
- `subMenuName` is derived from first URL segment (`location.pathname.split("/")[1]`)
|
||||
- Main sidebar shows **group** items (`menu`, `financial`, `other`, `content`, …) via `SideBarItem` with `name` matching the group key
|
||||
- Each group opens a side panel: `{Group}SubMenu.tsx` in `src/shared/components/` (e.g. `MenuSubMenu.tsx`)
|
||||
- Map URL → group in `getSubMenuNameFromPath` (`src/config/SideBarSubMenu.ts`)
|
||||
- Flat links inside a group: `SubMenuItem`
|
||||
- Nested feature menus inside a group: `SubMenuAccordion` (arrow open/close) wrapping `SubMenuItem` children
|
||||
- `subMenuName` comes from the group key, not the feature path segment
|
||||
|
||||
## Conventions
|
||||
|
||||
|
||||
@@ -58,10 +58,10 @@ import CouponsList from "../pages/coupons/List";
|
||||
|
||||
**Multi-page feature** — also:
|
||||
|
||||
1. Add `"coupons"` to `SideBarItemHasSubMenu` in `src/config/SideBarSubMenu.ts`
|
||||
2. Create `src/shared/components/CouponsSubMenu.tsx` (copy `CustomerSubMenu.tsx`)
|
||||
3. Import and add branch in `SideBar.tsx`: `subMenuName === "coupons" ? <CouponsSubMenu /> : ...`
|
||||
4. Point main sidebar link to list path; first URL segment must match `activeName` / submenu key
|
||||
1. Add the feature’s URL segment → group mapping in `getSubMenuNameFromPath` / `pathSegmentToSubMenu` (`src/config/SideBarSubMenu.ts`)
|
||||
2. Add links under the matching group SubMenu (e.g. `MenuSubMenu.tsx`) using `SubMenuItem`
|
||||
3. If the feature has nested pages, wrap them in `SubMenuAccordion` (arrow open/close) inside that group SubMenu
|
||||
4. Do not add a new top-level sidebar group unless the feature is a new section (reseller/dmenu-style)
|
||||
|
||||
## 5. Translations
|
||||
|
||||
|
||||
Reference in New Issue
Block a user