Refactor: Move DashboardFilterProvider to pages directory
- Move DashboardFilterProvider component and tests from providers/ to pages/ - Update DashboardPage imports to reflect new structure - Update documentation with latest task progress Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -179,6 +179,20 @@ The distinction between **`pages/`** and **`components/`** is fundamental to the
|
||||
- **Utils** are pure functions with no side effects and no React dependency.
|
||||
- **Theme** contains exclusively Fluent UI custom token overrides and theme definitions — no component logic.
|
||||
|
||||
### Providers — App-Wide vs Page-Scoped
|
||||
|
||||
The `providers/` directory is reserved for **app-wide context providers** — providers that wrap the entire application or large sections of it and are used by many pages or components.
|
||||
|
||||
**App-wide providers belong in `providers/`:**
|
||||
- `AuthProvider` — authentication state for the whole app
|
||||
- `ThemeProvider` — theme/styling state for the whole app
|
||||
- `TimezoneProvider` — timezone preference for the whole app
|
||||
|
||||
**Page-scoped providers belong co-located with their consumer:**
|
||||
If a React Context provider is used by **only one page** (e.g., `DashboardFilterProvider` is used only by `DashboardPage`), it should live **in the same directory as the page** or in a subdirectory alongside the page's components. This prevents the `providers/` directory from being cluttered with page-specific state and makes the scope of these providers clear to future contributors.
|
||||
|
||||
**Example:** `DashboardFilterProvider` manages dashboard time-range and origin filters. It is instantiated only inside `DashboardPage.tsx` and its sub-components. Therefore, it lives in `pages/DashboardFilterProvider.tsx` (or `pages/dashboard/DashboardFilterProvider.tsx` if the page is split into a subdirectory), not in `providers/`.
|
||||
|
||||
---
|
||||
|
||||
## 5. UI Framework — Fluent UI React (v9)
|
||||
|
||||
Reference in New Issue
Block a user