);
}
export default BillingOverview;
```
**Step 2: Verify**
Run: `pnpm type-check`
Expected: PASS
**Step 3: Commit**
```bash
git add apps/portal/src/features/billing/views/BillingOverview.tsx
git commit -m "feat: create combined BillingOverview view"
```
---
### Task 3: Add /account/billing route and make sidebar flat
**Files:**
- Create: `apps/portal/src/app/account/billing/page.tsx`
- Modify: `apps/portal/src/components/organisms/AppShell/navigation.ts:29-36`
- Modify: `apps/portal/src/components/organisms/AppShell/AppShell.tsx:111`
**Step 1: Create the billing page**
```tsx
import { BillingOverview } from "@/features/billing/views/BillingOverview";
export default function AccountBillingPage() {
return ;
}
```
**Step 2: Update navigation config**
Change Billing from expandable to flat:
```ts
// Before (lines 29-36):
{
name: "Billing",
icon: CreditCardIcon,
children: [
{ name: "Invoices", href: "/account/billing/invoices" },
{ name: "Payment Methods", href: "/account/billing/payments" },
],
},
// After:
{ name: "Billing", href: "/account/billing", icon: CreditCardIcon },
```
**Step 3: Remove auto-expand logic for Billing in AppShell**
File: `apps/portal/src/components/organisms/AppShell/AppShell.tsx`
Remove the line:
```ts
if (pathname.startsWith("/account/billing")) next.add("Billing");
```
**Step 4: Verify**
Run: `pnpm type-check`
Expected: PASS
**Step 5: Commit**
```bash
git add apps/portal/src/app/account/billing/page.tsx apps/portal/src/components/organisms/AppShell/navigation.ts apps/portal/src/components/organisms/AppShell/AppShell.tsx
git commit -m "refactor: make Billing a flat sidebar link with combined page"
```
---
### Task 4: Update Sidebar active-state matching for flat Billing and Support
**Files:**
- Modify: `apps/portal/src/components/organisms/AppShell/Sidebar.tsx:327`
The current `SimpleNavItem` uses exact match (`pathname === item.href`) which won't highlight Billing when on `/account/billing/invoices/123`. Change to `startsWith` for path-based matching:
```ts
// Before (line 327):
const isActive = item.href ? pathname === item.href : false;
// After:
const isActive = item.href
? item.href === "/account"
? pathname === item.href
: pathname.startsWith(item.href)
: false;
```
This ensures:
- Dashboard (`/account`) still uses exact match (doesn't highlight for every `/account/*` page)
- Billing (`/account/billing`) highlights on `/account/billing`, `/account/billing/invoices/123`, etc.
- Support (`/account/support`) highlights on `/account/support`, `/account/support/new`, `/account/support/123`, etc.
**Step 1: Update Sidebar active matching**
Apply the change above.
**Step 2: Verify**
Run: `pnpm type-check`
Expected: PASS
**Step 3: Commit**
```bash
git add apps/portal/src/components/organisms/AppShell/Sidebar.tsx
git commit -m "fix: use startsWith for sidebar active state on nested routes"
```
---
### Task 5: Update backLink references in InvoiceDetail
**Files:**
- Modify: `apps/portal/src/features/billing/views/InvoiceDetail.tsx:84,99`
Update the "Back to Invoices" links to point to the combined billing page:
```ts
// Before:
backLink={{ label: "Back to Invoices", href: "/account/billing/invoices" }}
// After:
backLink={{ label: "Back to Billing", href: "/account/billing" }}
```
Apply this on both lines 84 and 99.
**Step 1: Apply changes**
**Step 2: Verify**
Run: `pnpm type-check`
Expected: PASS
**Step 3: Commit**
```bash
git add apps/portal/src/features/billing/views/InvoiceDetail.tsx
git commit -m "fix: update InvoiceDetail backLink to point to combined billing page"
```
---
### Task 6: Update remaining billing route references
**Files:**
- Modify: `apps/portal/src/features/dashboard/utils/dashboard.utils.ts:43` — change `/account/billing/invoices/${activity.relatedId}` to keep as-is (invoice detail pages still live at `/account/billing/invoices/[id]`)
- Modify: `apps/portal/src/features/dashboard/components/TaskList.tsx:66` — change `href="/account/billing/invoices"` to `href="/account/billing"`
- Modify: `apps/portal/src/features/subscriptions/views/SubscriptionDetail.tsx:208` — change `href="/account/billing/invoices"` to `href="/account/billing"`
- Modify: `apps/portal/src/features/billing/components/BillingSummary/BillingSummary.tsx:160,187` — change `href="/account/billing/invoices"` to `href="/account/billing"`
Note: Keep `dashboard.utils.ts:43` unchanged — it links to a specific invoice detail page which still exists at `/account/billing/invoices/[id]`.
Note: Keep `InvoiceTable.tsx:276` unchanged — it navigates to individual invoice detail pages.
**Step 1: Apply changes to the 3 files listed above**
**Step 2: Verify**
Run: `pnpm type-check`
Expected: PASS
**Step 3: Commit**
```bash
git add apps/portal/src/features/dashboard/components/TaskList.tsx apps/portal/src/features/subscriptions/views/SubscriptionDetail.tsx apps/portal/src/features/billing/components/BillingSummary/BillingSummary.tsx
git commit -m "fix: update billing route references to use combined billing page"
```
---
### Task 7: Clean up unused imports in navigation.ts
**Files:**
- Modify: `apps/portal/src/components/organisms/AppShell/navigation.ts`
After removing children from both Billing and Support, the `NavigationChild` type and children-related interfaces may still be needed by other code (the Sidebar still supports expandable items generically). Check if `NavigationChild` is still used — if Subscriptions or any other item still has children, keep it. If no items have children anymore, remove unused types.
**Step 1: Check if any navigation item still uses children**
After our changes, review `baseNavigation` — none will have children. But `NavigationChild` and `children` field on `NavigationItem` are still referenced by `Sidebar.tsx` (the `ExpandableNavItem` component). These can stay for now since they're part of the generic nav system — removing the component is a larger cleanup.
**Step 2: Verify full build**
Run: `pnpm type-check && pnpm lint`
Expected: PASS
**Step 3: Final commit if any cleanup was needed**
```bash
git add -A
git commit -m "chore: sidebar consolidation cleanup"
```