# Add Feature Checklist

Copy and track when adding a new admin section (e.g. `coupons`):

```
- [ ] Pages.ts paths
- [ ] types/{Feature}Types.ts
- [ ] service/{Feature}Service.ts
- [ ] hooks/use{Feature}Data.ts
- [ ] List.tsx (+ Create/Update if CRUD)
- [ ] components/ (Delete, filters, etc.)
- [ ] Main.tsx routes + imports
- [ ] SideBar.tsx (+ SubMenu if multi-page)
- [ ] fa.json translations
```

## 1. Pages.ts

```typescript
coupons: {
  list: "/coupons/list",
  create: "/coupons/create",
  detail: "/coupons/detail/",
},
```

Use kebab-case URL segments consistent with existing routes.

## 2. Service + hooks + types

Copy structure from `src/pages/customer/` or `src/pages/ads/`. Adjust API paths to match backend.

## 3. Main.tsx

Add import at top, then route(s):

```tsx
import CouponsList from "../pages/coupons/List";
// ...
<Route path={Pages.coupons.list} element={<CouponsList />} />
<Route path={Pages.coupons.create} element={<CreateCoupon />} />
<Route path={Pages.coupons.detail + ":id"} element={<UpdateCoupon />} />
```

## 4. Sidebar (optional)

**Single-page feature** — add `SideBarItem`:

```tsx
<SideBarItem
  icon={<TicketDiscount variant={isActive("coupons") ? "Bold" : "Outline"} color={isActive("coupons") ? "black" : "#8C90A3"} size={iconSizeSideBar} />}
  title={t("sidebar.coupons")}
  isActive={isActive("coupons")}
  link={Pages.coupons.list}
  activeName="coupons"
/>
```

**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

## 5. Translations

Add keys under logical groups in `src/langs/fa.json`:

```json
"sidebar": { "coupons": "کوپن‌ها" },
"submenu": { "coupon_list": "لیست کوپن‌ها" },
"coupon": { "coupon_list": "لیست کوپن‌ها", "add_coupon": "افزودن کوپن" }
```

Use `t('coupon.add_coupon')` in components.

## 6. Verify

- `npm run build` passes
- List loads, create/update navigate correctly
- Sidebar highlights on correct routes
- Mutation invalidates list query cache
