xertica-ui 2.3.0 → 2.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/CHANGELOG.md +22 -2
  2. package/README.md +33 -22
  3. package/bin/cli.ts +136 -47
  4. package/bin/language-config.ts +5 -8
  5. package/components/assistant/modern-chat-input/ModernChatInput.tsx +17 -7
  6. package/components/assistant/xertica-assistant/parts/AssistantConversationList.tsx +1 -3
  7. package/components/assistant/xertica-assistant/parts/AssistantFeedbackDialog.tsx +13 -3
  8. package/components/assistant/xertica-assistant/parts/AssistantMessageBubble.tsx +10 -6
  9. package/components/assistant/xertica-assistant/xertica-assistant.tsx +1 -3
  10. package/components/blocks/card-patterns/FeatureCardSkeleton.tsx +1 -6
  11. package/components/blocks/card-patterns/ProfileCard.tsx +1 -3
  12. package/components/blocks/card-patterns/ProjectCardSkeleton.tsx +1 -6
  13. package/components/brand/language-selector/language-selector.stories.tsx +1 -4
  14. package/components/brand/theme-toggle/ThemeToggle.tsx +5 -1
  15. package/components/brand/xertica-provider/XerticaProvider.tsx +1 -4
  16. package/components/index.ts +1 -5
  17. package/components/layout/sidebar/sidebar.tsx +9 -3
  18. package/components/media/audio-player/AudioPlayer.tsx +4 -2
  19. package/components/pages/forgot-password-page/ForgotPasswordPage.tsx +188 -188
  20. package/components/pages/home-content/HomeContent.tsx +55 -55
  21. package/components/pages/home-page/HomePage.tsx +5 -1
  22. package/components/pages/login-page/LoginPage.tsx +4 -2
  23. package/components/pages/reset-password-page/ResetPasswordPage.tsx +7 -3
  24. package/components/pages/template-content/TemplateContent.tsx +268 -149
  25. package/components/pages/verify-email-page/VerifyEmailPage.tsx +9 -9
  26. package/components/shared/error-boundary.stories.tsx +114 -132
  27. package/components/shared/error-boundary.tsx +150 -154
  28. package/components/shared/error-fallbacks.tsx +222 -226
  29. package/components/ui/stats-card/stats-card-skeleton.tsx +1 -3
  30. package/components/ui/stats-card/stats-card.stories.tsx +18 -0
  31. package/components/ui/stats-card/stats-card.tsx +18 -2
  32. package/components.json +512 -892
  33. package/contexts/AuthContext.tsx +121 -118
  34. package/contexts/LanguageContext.tsx +1 -2
  35. package/dist/AssistantChart-BKVtGUKF.js +3383 -0
  36. package/dist/AssistantChart-WeycT5Pd.cjs +3551 -0
  37. package/dist/VerifyEmailPage-Bp1XXl3H.cjs +3305 -0
  38. package/dist/VerifyEmailPage-DGhuIqkb.js +3296 -0
  39. package/dist/XerticaProvider-BErr83Bg.js +42 -0
  40. package/dist/XerticaProvider-CwOkHxiT.cjs +44 -0
  41. package/dist/XerticaXLogo-BX3ueACh.js +255 -0
  42. package/dist/XerticaXLogo-qBPhwK3g.cjs +260 -0
  43. package/dist/assistant.cjs.js +1 -1
  44. package/dist/assistant.es.js +1 -1
  45. package/dist/brand.cjs.js +2 -2
  46. package/dist/brand.es.js +2 -2
  47. package/dist/cli.js +90 -37
  48. package/dist/components/brand/theme-toggle/ThemeToggle.d.ts +1 -1
  49. package/dist/components/index.d.ts +1 -1
  50. package/dist/components/ui/stats-card/stats-card.d.ts +10 -0
  51. package/dist/index.cjs.js +6 -6
  52. package/dist/index.es.js +6 -6
  53. package/dist/layout.cjs.js +1 -1
  54. package/dist/layout.es.js +1 -1
  55. package/dist/pages.cjs.js +1 -1
  56. package/dist/pages.es.js +1 -1
  57. package/dist/sidebar-B4ZWaMrE.js +792 -0
  58. package/dist/sidebar-BS1p2V7t.cjs +795 -0
  59. package/dist/ui.cjs.js +1 -1
  60. package/dist/ui.es.js +1 -1
  61. package/dist/xertica-assistant-B1NaSFFj.js +2173 -0
  62. package/dist/xertica-assistant-CIaUlbIt.cjs +2180 -0
  63. package/dist/xertica-ui.css +1 -1
  64. package/docs/architecture-improvements.md +5 -5
  65. package/docs/architecture.md +16 -10
  66. package/docs/components/card-patterns.md +19 -17
  67. package/docs/components/error-boundary.md +201 -191
  68. package/docs/components/hooks.md +15 -13
  69. package/docs/components/language-selector.md +20 -16
  70. package/docs/components/pages.md +323 -309
  71. package/docs/components/stats-card.md +20 -2
  72. package/docs/doc-audit.md +12 -11
  73. package/docs/getting-started.md +41 -28
  74. package/docs/guidelines.md +14 -12
  75. package/docs/i18n.md +61 -57
  76. package/docs/installation.md +268 -267
  77. package/docs/llms.md +17 -17
  78. package/docs/state-management.md +17 -17
  79. package/guidelines/Guidelines.md +17 -14
  80. package/llms-compact.txt +1 -1
  81. package/llms-full.txt +11553 -7133
  82. package/llms.txt +1 -1
  83. package/package.json +1 -1
  84. package/styles/xertica/base.css +90 -84
  85. package/templates/CLAUDE.md +16 -1
  86. package/templates/guidelines/Guidelines.md +42 -18
  87. package/templates/package.json +3 -3
  88. package/templates/src/app/components/AuthGuard.tsx +131 -82
  89. package/templates/src/features/auth/ui/AuthPageShell.tsx +32 -32
  90. package/templates/src/features/auth/ui/ForgotPasswordContent.tsx +1 -3
  91. package/templates/src/features/auth/ui/ResetPasswordContent.tsx +6 -2
  92. package/templates/src/features/auth/ui/VerifyEmailContent.tsx +2 -6
  93. package/templates/src/features/home/data/mock.ts +41 -35
  94. package/templates/src/features/home/ui/HomeContent.tsx +62 -64
  95. package/templates/src/features/template/ui/CrudTemplate.tsx +1 -4
  96. package/templates/src/features/template/ui/LoginTemplate.tsx +1 -1
  97. package/templates/src/features/template/ui/TemplateContent.tsx +28 -20
  98. package/templates/src/locales/en/pages/templates.json +17 -17
  99. package/templates/src/locales/es/pages/templates.json +17 -17
  100. package/templates/src/locales/pt-BR/pages/templates.json +17 -17
  101. package/templates/src/pages/AssistantPage.tsx +26 -20
  102. package/templates/src/pages/HomePage.tsx +5 -1
  103. package/templates/src/shared/error-boundary.tsx +150 -154
  104. package/templates/src/shared/error-fallbacks.tsx +222 -226
  105. package/templates/vite.config.ts +12 -9
@@ -1,309 +1,323 @@
1
- # Page Templates — Xertica UI
2
-
3
- Xertica UI ships 8 ready-to-use page templates covering authentication flows, the main dashboard shell, and a fully-featured component showcase. All templates are exported from `xertica-ui/pages`.
4
-
5
- ---
6
-
7
- ## Import
8
-
9
- ```tsx
10
- import {
11
- LoginPage,
12
- ForgotPasswordPage,
13
- ResetPasswordPage,
14
- VerifyEmailPage,
15
- HomePage,
16
- HomeContent,
17
- TemplatePage,
18
- TemplateContent,
19
- } from 'xertica-ui/pages';
20
- ```
21
-
22
- ---
23
-
24
- ## Authentication Pages
25
-
26
- ### `LoginPage`
27
-
28
- A complete, responsive login screen with a hero image side-panel (desktop) and a focused authentication form.
29
-
30
- **Features:**
31
-
32
- - Email + password form with validation
33
- - Loading state during submission
34
- - Error message display
35
- - Social/SSO provider placeholders (Google, MT Login, gov.br)
36
- - Language selector (`LanguageSelector`)
37
- - Xertica logo
38
- - Link to forgot-password flow (via `react-router-dom`)
39
-
40
- **Props:**
41
-
42
- | Prop | Type | Description |
43
- | --------- | ---------------------------------------------- | --------------------------------------------------------------------------- |
44
- | `onLogin` | `(email: string, password: string) => boolean` | Authentication handler. Return `true` on success, `false` to show an error. |
45
-
46
- **Usage:**
47
-
48
- ```tsx
49
- import { LoginPage } from 'xertica-ui/pages';
50
- import { useNavigate } from 'react-router-dom';
51
-
52
- function AuthRoute() {
53
- const navigate = useNavigate();
54
-
55
- const handleLogin = (email: string, password: string): boolean => {
56
- if (!email || !password) return false;
57
- // call your auth API here
58
- navigate('/home');
59
- return true;
60
- };
61
-
62
- return <LoginPage onLogin={handleLogin} />;
63
- }
64
- ```
65
-
66
- ---
67
-
68
- ### `ForgotPasswordPage`
69
-
70
- A password recovery form where users enter their email to receive a reset link.
71
-
72
- **Features:**
73
-
74
- - Email input with validation
75
- - Success state (shows confirmation message after submission)
76
- - Back-to-login navigation link
77
- - Xertica logo + hero image
78
-
79
- **Props:**
80
-
81
- | Prop | Type | Description |
82
- | ---------- | ------------------------- | ---------------------------------------------- |
83
- | `onSubmit` | `(email: string) => void` | Called when the user submits the recovery form |
84
-
85
- **Usage:**
86
-
87
- ```tsx
88
- import { ForgotPasswordPage } from 'xertica-ui/pages';
89
-
90
- <ForgotPasswordPage
91
- onSubmit={email => {
92
- // send password reset email
93
- console.log('Reset requested for:', email);
94
- }}
95
- />;
96
- ```
97
-
98
- ---
99
-
100
- ### `ResetPasswordPage`
101
-
102
- A new-password form for users arriving via a password reset link.
103
-
104
- **Features:**
105
-
106
- - New password + confirm password fields
107
- - Password match validation
108
- - Success state after reset
109
-
110
- **Props:**
111
-
112
- | Prop | Type | Description |
113
- | --------- | ---------------------------- | ------------------------------------------------------- |
114
- | `onReset` | `(password: string) => void` | Called with the new password when the form is submitted |
115
-
116
- **Usage:**
117
-
118
- ```tsx
119
- import { ResetPasswordPage } from 'xertica-ui/pages';
120
-
121
- <ResetPasswordPage
122
- onReset={newPassword => {
123
- // call your reset API with the token from the URL
124
- console.log('New password:', newPassword);
125
- }}
126
- />;
127
- ```
128
-
129
- ---
130
-
131
- ### `VerifyEmailPage`
132
-
133
- An email verification confirmation screen shown after registration.
134
-
135
- **Features:**
136
-
137
- - Confirmation message with email address display
138
- - "Resend email" action
139
- - Back-to-login link
140
-
141
- **Props:**
142
-
143
- | Prop | Type | Description |
144
- | ---------- | ------------ | -------------------------------------------------------- |
145
- | `email` | `string` | The email address to display in the confirmation message |
146
- | `onResend` | `() => void` | Called when the user clicks "Resend verification email" |
147
-
148
- **Usage:**
149
-
150
- ```tsx
151
- import { VerifyEmailPage } from 'xertica-ui/pages';
152
-
153
- <VerifyEmailPage
154
- email="user@example.com"
155
- onResend={() => {
156
- // resend verification email
157
- }}
158
- />;
159
- ```
160
-
161
- ---
162
-
163
- ## Dashboard Pages
164
-
165
- ### `HomePage`
166
-
167
- The root dashboard page. Assembles `Sidebar`, `HomeContent`, and `XerticaAssistant` into a full-screen layout.
168
-
169
- **Features:**
170
-
171
- - Full-screen `h-screen` layout with sidebar + main content + assistant
172
- - Integrates `LayoutContext` for synchronized sidebar/assistant state
173
- - Auth state from `useAuth()` — **no `user` or `onLogout` props needed**
174
- - `XerticaAssistant` config (suggestions, feedback options) fetched via `useAssistantConfig()` (React Query)
175
-
176
- **Props:** none — all state consumed from `AuthContext` and React Query.
177
-
178
- **Usage:**
179
-
180
- ```tsx
181
- import { HomePage } from 'xertica-ui/pages';
182
-
183
- // Inside <AuthProvider> and <QueryClientProvider>
184
- <Route path="/home" element={<ProtectedRoute><HomePage /></ProtectedRoute>} />;
185
- ```
186
-
187
- > **Note**: `HomePage` uses `react-router-dom` hooks internally. It must be rendered inside a `<BrowserRouter>` (or equivalent) and inside `<AuthProvider>`.
188
-
189
- ---
190
-
191
- ### `HomeContent`
192
-
193
- The main content area of the dashboard. Feature cards are fetched via `useFeatureCards()` (React Query) — no hardcoded data.
194
-
195
- **Features:**
196
-
197
- - `Header` with breadcrumbs, theme toggle, and language selector
198
- - Feature card grid — data from `features/home/hooks/useFeatureCards.ts`
199
- - Skeleton loading state while query is in-flight
200
-
201
- **Props:** none — layout from `useLayout()`, data from React Query.
202
-
203
- **Usage:**
204
-
205
- ```tsx
206
- import { HomeContent } from 'xertica-ui/pages';
207
-
208
- // Self-containedno props required
209
- <HomeContent />;
210
- ```
211
-
212
- ---
213
-
214
- ### `TemplatePage`
215
-
216
- A complete layout shell identical to `HomePage` but with `TemplateContent` as the main area. Use this as the **primary reference** for building new pages.
217
-
218
- **Features:**
219
-
220
- - Full-screen layout: Sidebar + TemplateContent + XerticaAssistant
221
- - Auth state from `useAuth()` — **no props needed**
222
- - Synchronized layout state via `LayoutContext`
223
-
224
- **Props:** none.
225
-
226
- **Usage:**
227
-
228
- ```tsx
229
- import { TemplatePage } from 'xertica-ui/pages';
230
-
231
- <Route path="/template" element={<ProtectedRoute><TemplatePage /></ProtectedRoute>} />;
232
- ```
233
-
234
- ---
235
-
236
- ### `TemplateContent`
237
-
238
- The main content area of `TemplatePage`. Contains a comprehensive showcase of all Xertica UI components.
239
-
240
- **Features:**
241
-
242
- - `Header` with full breadcrumb, user menu, and action buttons
243
- - All form elements (Input, Select, Checkbox, Switch, Slider, etc.)
244
- - Data display: Table with team members from `useTeamMembers()` (React Query)
245
- - UI toggles (progress, slider, switch) from `useDashboardStore` (Zustand)
246
- - Overlay components (Dialog, Sheet, Drawer, Popover, Tooltip)
247
- - Media components (AudioPlayer, VideoPlayer)
248
- - AI components (XerticaAssistant in full-page mode)
249
-
250
- **Props:** none — all state from React Query hooks and Zustand store.
251
-
252
- ---
253
-
254
- ## Page Architecture Pattern
255
-
256
- All dashboard pages follow the same three-column layout pattern:
257
-
258
- ```
259
- ┌─────────────────────────────────────────────────────┐
260
- │ Sidebar │ Main Content │Assistant
261
- │ (fixed) │ Header + scrollable body │ (fixed)
262
- └─────────────────────────────────────────────────────┘
263
- ```
264
-
265
- ```tsx
266
- // Standard page shell — auth from context, data from React Query
267
- function MyPage() {
268
- const { user, logout } = useAuth(); // ← no prop drilling
269
- const { data: myData } = useMyFeatureQuery(); // ← React Query
270
- const { sidebarExpanded, sidebarWidth, assistenteExpanded,
271
- toggleSidebar, toggleAssistente } = useLayout();
272
- const location = useLocation();
273
- const navigate = useNavigate();
274
-
275
- return (
276
- <div className="h-screen flex bg-muted overflow-hidden relative">
277
- <Sidebar
278
- expanded={sidebarExpanded}
279
- width={sidebarWidth}
280
- onToggle={toggleSidebar}
281
- user={{ ...user, name: 'Display Name', avatar: '...' }}
282
- onLogout={logout}
283
- location={location}
284
- navigate={navigate}
285
- routes={routes}
286
- />
287
- <MyContent data={myData} />
288
- <XerticaAssistant isExpanded={assistenteExpanded} onToggle={toggleAssistente} demoMode />
289
- </div>
290
- );
291
- }
292
- ```
293
-
294
- ---
295
-
296
- ## AI Rules
297
-
298
- > [!IMPORTANT]
299
- >
300
- > - **`user` and `onLogout` are NOT props on `HomePage` or `TemplatePage`**: They are consumed via `useAuth()` from `AuthContext`. Never pass `user` or `onLogout` as props to these components.
301
- > - **Use `TemplatePage` as the reference**: When building a new page, copy the structure from `TemplatePage` — it demonstrates the correct three-column layout with synchronized state.
302
- > - **Router dependency**: All dashboard pages use `useLocation` and `useNavigate` from `react-router-dom`. They must be rendered inside a `<BrowserRouter>`.
303
- > - **`LayoutContext` is optional**: Pages use `useOptionalLayout()` and fall back to local state if the context is not available. This allows standalone usage in Storybook or tests.
304
- > - **Authentication pages are standalone**: `LoginPage`, `ForgotPasswordPage`, `ResetPasswordPage`, and `VerifyEmailPage` do not use `LayoutContext` and can be rendered without `XerticaProvider`.
305
- > - **Data comes from `features/`**: All server data (team members, stats, feature cards, assistant config) is fetched via React Query hooks in `features/*/hooks/`. Never hardcode this data in components.
306
- > - **Do not add business logic to page shells**: Page components (`HomePage`, `TemplatePage`) are thin layout containers. Business logic and data fetching belong in `features/*/hooks/` or content components.
307
- > - **`LoginPage` still accepts `onLogin` prop**: It is a reusable library component decoupled from `AuthContext`. Use a bridge wrapper (e.g., `LoginPageWithAuth`) that reads `useAuth().login` and passes it as `onLogin`.
308
- > - **Wrap route entries in `<PageErrorBoundary>`**: Place `<PageErrorBoundary>` around `<Routes>` / `<AuthGuard>` so that lazy-chunk load failures and page render errors show a recoverable fallback instead of a blank screen.
309
- > - **Wrap data-heavy sections in `<SectionErrorBoundary>`**: Any section that renders server data (tables, charts, the assistant panel) must be wrapped in `<SectionErrorBoundary>`. An error in one section must not crash the entire page.
1
+ # Page Templates — Xertica UI
2
+
3
+ Xertica UI ships 8 ready-to-use page templates covering authentication flows, the main dashboard shell, and a fully-featured component showcase. All templates are exported from `xertica-ui/pages`.
4
+
5
+ ---
6
+
7
+ ## Import
8
+
9
+ ```tsx
10
+ import {
11
+ LoginPage,
12
+ ForgotPasswordPage,
13
+ ResetPasswordPage,
14
+ VerifyEmailPage,
15
+ HomePage,
16
+ HomeContent,
17
+ TemplatePage,
18
+ TemplateContent,
19
+ } from 'xertica-ui/pages';
20
+ ```
21
+
22
+ ---
23
+
24
+ ## Authentication Pages
25
+
26
+ ### `LoginPage`
27
+
28
+ A complete, responsive login screen with a hero image side-panel (desktop) and a focused authentication form.
29
+
30
+ **Features:**
31
+
32
+ - Email + password form with validation
33
+ - Loading state during submission
34
+ - Error message display
35
+ - Social/SSO provider placeholders (Google, MT Login, gov.br)
36
+ - Language selector (`LanguageSelector`)
37
+ - Xertica logo
38
+ - Link to forgot-password flow (via `react-router-dom`)
39
+
40
+ **Props:**
41
+
42
+ | Prop | Type | Description |
43
+ | --------- | ---------------------------------------------- | --------------------------------------------------------------------------- |
44
+ | `onLogin` | `(email: string, password: string) => boolean` | Authentication handler. Return `true` on success, `false` to show an error. |
45
+
46
+ **Usage:**
47
+
48
+ ```tsx
49
+ import { LoginPage } from 'xertica-ui/pages';
50
+ import { useNavigate } from 'react-router-dom';
51
+
52
+ function AuthRoute() {
53
+ const navigate = useNavigate();
54
+
55
+ const handleLogin = (email: string, password: string): boolean => {
56
+ if (!email || !password) return false;
57
+ // call your auth API here
58
+ navigate('/home');
59
+ return true;
60
+ };
61
+
62
+ return <LoginPage onLogin={handleLogin} />;
63
+ }
64
+ ```
65
+
66
+ ---
67
+
68
+ ### `ForgotPasswordPage`
69
+
70
+ A password recovery form where users enter their email to receive a reset link.
71
+
72
+ **Features:**
73
+
74
+ - Email input with validation
75
+ - Success state (shows confirmation message after submission)
76
+ - Back-to-login navigation link
77
+ - Xertica logo + hero image
78
+
79
+ **Props:**
80
+
81
+ | Prop | Type | Description |
82
+ | ---------- | ------------------------- | ---------------------------------------------- |
83
+ | `onSubmit` | `(email: string) => void` | Called when the user submits the recovery form |
84
+
85
+ **Usage:**
86
+
87
+ ```tsx
88
+ import { ForgotPasswordPage } from 'xertica-ui/pages';
89
+
90
+ <ForgotPasswordPage
91
+ onSubmit={email => {
92
+ // send password reset email
93
+ console.log('Reset requested for:', email);
94
+ }}
95
+ />;
96
+ ```
97
+
98
+ ---
99
+
100
+ ### `ResetPasswordPage`
101
+
102
+ A new-password form for users arriving via a password reset link.
103
+
104
+ **Features:**
105
+
106
+ - New password + confirm password fields
107
+ - Password match validation
108
+ - Success state after reset
109
+
110
+ **Props:**
111
+
112
+ | Prop | Type | Description |
113
+ | --------- | ---------------------------- | ------------------------------------------------------- |
114
+ | `onReset` | `(password: string) => void` | Called with the new password when the form is submitted |
115
+
116
+ **Usage:**
117
+
118
+ ```tsx
119
+ import { ResetPasswordPage } from 'xertica-ui/pages';
120
+
121
+ <ResetPasswordPage
122
+ onReset={newPassword => {
123
+ // call your reset API with the token from the URL
124
+ console.log('New password:', newPassword);
125
+ }}
126
+ />;
127
+ ```
128
+
129
+ ---
130
+
131
+ ### `VerifyEmailPage`
132
+
133
+ An email verification confirmation screen shown after registration.
134
+
135
+ **Features:**
136
+
137
+ - Confirmation message with email address display
138
+ - "Resend email" action
139
+ - Back-to-login link
140
+
141
+ **Props:**
142
+
143
+ | Prop | Type | Description |
144
+ | ---------- | ------------ | -------------------------------------------------------- |
145
+ | `email` | `string` | The email address to display in the confirmation message |
146
+ | `onResend` | `() => void` | Called when the user clicks "Resend verification email" |
147
+
148
+ **Usage:**
149
+
150
+ ```tsx
151
+ import { VerifyEmailPage } from 'xertica-ui/pages';
152
+
153
+ <VerifyEmailPage
154
+ email="user@example.com"
155
+ onResend={() => {
156
+ // resend verification email
157
+ }}
158
+ />;
159
+ ```
160
+
161
+ ---
162
+
163
+ ## Dashboard Pages
164
+
165
+ ### `HomePage`
166
+
167
+ The root dashboard page. Assembles `Sidebar`, `HomeContent`, and `XerticaAssistant` into a full-screen layout.
168
+
169
+ **Features:**
170
+
171
+ - Full-screen `h-screen` layout with sidebar + main content + assistant
172
+ - Integrates `LayoutContext` for synchronized sidebar/assistant state
173
+ - Auth state from `useAuth()` — **no `user` or `onLogout` props needed**
174
+ - `XerticaAssistant` config (suggestions, feedback options) fetched via `useAssistantConfig()` (React Query)
175
+
176
+ **Props:** none — all state consumed from `AuthContext` and React Query.
177
+
178
+ **Usage:**
179
+
180
+ ```tsx
181
+ import { HomePage } from 'xertica-ui/pages';
182
+
183
+ // Inside <AuthProvider> and <QueryClientProvider>
184
+ <Route
185
+ path="/home"
186
+ element={
187
+ <ProtectedRoute>
188
+ <HomePage />
189
+ </ProtectedRoute>
190
+ }
191
+ />;
192
+ ```
193
+
194
+ > **Note**: `HomePage` uses `react-router-dom` hooks internally. It must be rendered inside a `<BrowserRouter>` (or equivalent) and inside `<AuthProvider>`.
195
+
196
+ ---
197
+
198
+ ### `HomeContent`
199
+
200
+ The main content area of the dashboard. Feature cards are fetched via `useFeatureCards()` (React Query) — no hardcoded data.
201
+
202
+ **Features:**
203
+
204
+ - `Header` with breadcrumbs, theme toggle, and language selector
205
+ - Feature card grid — data from `features/home/hooks/useFeatureCards.ts`
206
+ - Skeleton loading state while query is in-flight
207
+
208
+ **Props:** nonelayout from `useLayout()`, data from React Query.
209
+
210
+ **Usage:**
211
+
212
+ ```tsx
213
+ import { HomeContent } from 'xertica-ui/pages';
214
+
215
+ // Self-contained — no props required
216
+ <HomeContent />;
217
+ ```
218
+
219
+ ---
220
+
221
+ ### `TemplatePage`
222
+
223
+ A complete layout shell identical to `HomePage` but with `TemplateContent` as the main area. Use this as the **primary reference** for building new pages.
224
+
225
+ **Features:**
226
+
227
+ - Full-screen layout: Sidebar + TemplateContent + XerticaAssistant
228
+ - Auth state from `useAuth()` — **no props needed**
229
+ - Synchronized layout state via `LayoutContext`
230
+
231
+ **Props:** none.
232
+
233
+ **Usage:**
234
+
235
+ ```tsx
236
+ import { TemplatePage } from 'xertica-ui/pages';
237
+
238
+ <Route
239
+ path="/template"
240
+ element={
241
+ <ProtectedRoute>
242
+ <TemplatePage />
243
+ </ProtectedRoute>
244
+ }
245
+ />;
246
+ ```
247
+
248
+ ---
249
+
250
+ ### `TemplateContent`
251
+
252
+ The main content area of `TemplatePage`. Contains a comprehensive showcase of all Xertica UI components.
253
+
254
+ **Features:**
255
+
256
+ - `Header` with full breadcrumb, user menu, and action buttons
257
+ - All form elements (Input, Select, Checkbox, Switch, Slider, etc.)
258
+ - Data display: Table with team members from `useTeamMembers()` (React Query)
259
+ - UI toggles (progress, slider, switch) from `useDashboardStore` (Zustand)
260
+ - Overlay components (Dialog, Sheet, Drawer, Popover, Tooltip)
261
+ - Media components (AudioPlayer, VideoPlayer)
262
+ - AI components (XerticaAssistant in full-page mode)
263
+
264
+ **Props:** none — all state from React Query hooks and Zustand store.
265
+
266
+ ---
267
+
268
+ ## Page Architecture Pattern
269
+
270
+ All dashboard pages follow the same three-column layout pattern:
271
+
272
+ ```
273
+ ┌─────────────────────────────────────────────────────┐
274
+ │ Sidebar │ Main Content │Assistant │
275
+ (fixed) │ Header + scrollable body │ (fixed) │
276
+ └─────────────────────────────────────────────────────┘
277
+ ```
278
+
279
+ ```tsx
280
+ // Standard page shell — auth from context, data from React Query
281
+ function MyPage() {
282
+ const { user, logout } = useAuth(); // ← no prop drilling
283
+ const { data: myData } = useMyFeatureQuery(); // ← React Query
284
+ const { sidebarExpanded, sidebarWidth, assistenteExpanded, toggleSidebar, toggleAssistente } =
285
+ useLayout();
286
+ const location = useLocation();
287
+ const navigate = useNavigate();
288
+
289
+ return (
290
+ <div className="h-screen flex bg-muted overflow-hidden relative">
291
+ <Sidebar
292
+ expanded={sidebarExpanded}
293
+ width={sidebarWidth}
294
+ onToggle={toggleSidebar}
295
+ user={{ ...user, name: 'Display Name', avatar: '...' }}
296
+ onLogout={logout}
297
+ location={location}
298
+ navigate={navigate}
299
+ routes={routes}
300
+ />
301
+ <MyContent data={myData} />
302
+ <XerticaAssistant isExpanded={assistenteExpanded} onToggle={toggleAssistente} demoMode />
303
+ </div>
304
+ );
305
+ }
306
+ ```
307
+
308
+ ---
309
+
310
+ ## AI Rules
311
+
312
+ > [!IMPORTANT]
313
+ >
314
+ > - **`user` and `onLogout` are NOT props on `HomePage` or `TemplatePage`**: They are consumed via `useAuth()` from `AuthContext`. Never pass `user` or `onLogout` as props to these components.
315
+ > - **Use `TemplatePage` as the reference**: When building a new page, copy the structure from `TemplatePage` — it demonstrates the correct three-column layout with synchronized state.
316
+ > - **Router dependency**: All dashboard pages use `useLocation` and `useNavigate` from `react-router-dom`. They must be rendered inside a `<BrowserRouter>`.
317
+ > - **`LayoutContext` is optional**: Pages use `useOptionalLayout()` and fall back to local state if the context is not available. This allows standalone usage in Storybook or tests.
318
+ > - **Authentication pages are standalone**: `LoginPage`, `ForgotPasswordPage`, `ResetPasswordPage`, and `VerifyEmailPage` do not use `LayoutContext` and can be rendered without `XerticaProvider`.
319
+ > - **Data comes from `features/`**: All server data (team members, stats, feature cards, assistant config) is fetched via React Query hooks in `features/*/hooks/`. Never hardcode this data in components.
320
+ > - **Do not add business logic to page shells**: Page components (`HomePage`, `TemplatePage`) are thin layout containers. Business logic and data fetching belong in `features/*/hooks/` or content components.
321
+ > - **`LoginPage` still accepts `onLogin` prop**: It is a reusable library component decoupled from `AuthContext`. Use a bridge wrapper (e.g., `LoginPageWithAuth`) that reads `useAuth().login` and passes it as `onLogin`.
322
+ > - **Wrap route entries in `<PageErrorBoundary>`**: Place `<PageErrorBoundary>` around `<Routes>` / `<AuthGuard>` so that lazy-chunk load failures and page render errors show a recoverable fallback instead of a blank screen.
323
+ > - **Wrap data-heavy sections in `<SectionErrorBoundary>`**: Any section that renders server data (tables, charts, the assistant panel) must be wrapped in `<SectionErrorBoundary>`. An error in one section must not crash the entire page.