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.
- package/CHANGELOG.md +22 -2
- package/README.md +33 -22
- package/bin/cli.ts +136 -47
- package/bin/language-config.ts +5 -8
- package/components/assistant/modern-chat-input/ModernChatInput.tsx +17 -7
- package/components/assistant/xertica-assistant/parts/AssistantConversationList.tsx +1 -3
- package/components/assistant/xertica-assistant/parts/AssistantFeedbackDialog.tsx +13 -3
- package/components/assistant/xertica-assistant/parts/AssistantMessageBubble.tsx +10 -6
- package/components/assistant/xertica-assistant/xertica-assistant.tsx +1 -3
- package/components/blocks/card-patterns/FeatureCardSkeleton.tsx +1 -6
- package/components/blocks/card-patterns/ProfileCard.tsx +1 -3
- package/components/blocks/card-patterns/ProjectCardSkeleton.tsx +1 -6
- package/components/brand/language-selector/language-selector.stories.tsx +1 -4
- package/components/brand/theme-toggle/ThemeToggle.tsx +5 -1
- package/components/brand/xertica-provider/XerticaProvider.tsx +1 -4
- package/components/index.ts +1 -5
- package/components/layout/sidebar/sidebar.tsx +9 -3
- package/components/media/audio-player/AudioPlayer.tsx +4 -2
- package/components/pages/forgot-password-page/ForgotPasswordPage.tsx +188 -188
- package/components/pages/home-content/HomeContent.tsx +55 -55
- package/components/pages/home-page/HomePage.tsx +5 -1
- package/components/pages/login-page/LoginPage.tsx +4 -2
- package/components/pages/reset-password-page/ResetPasswordPage.tsx +7 -3
- package/components/pages/template-content/TemplateContent.tsx +268 -149
- package/components/pages/verify-email-page/VerifyEmailPage.tsx +9 -9
- package/components/shared/error-boundary.stories.tsx +114 -132
- package/components/shared/error-boundary.tsx +150 -154
- package/components/shared/error-fallbacks.tsx +222 -226
- package/components/ui/stats-card/stats-card-skeleton.tsx +1 -3
- package/components/ui/stats-card/stats-card.stories.tsx +18 -0
- package/components/ui/stats-card/stats-card.tsx +18 -2
- package/components.json +512 -892
- package/contexts/AuthContext.tsx +121 -118
- package/contexts/LanguageContext.tsx +1 -2
- package/dist/AssistantChart-BKVtGUKF.js +3383 -0
- package/dist/AssistantChart-WeycT5Pd.cjs +3551 -0
- package/dist/VerifyEmailPage-Bp1XXl3H.cjs +3305 -0
- package/dist/VerifyEmailPage-DGhuIqkb.js +3296 -0
- package/dist/XerticaProvider-BErr83Bg.js +42 -0
- package/dist/XerticaProvider-CwOkHxiT.cjs +44 -0
- package/dist/XerticaXLogo-BX3ueACh.js +255 -0
- package/dist/XerticaXLogo-qBPhwK3g.cjs +260 -0
- package/dist/assistant.cjs.js +1 -1
- package/dist/assistant.es.js +1 -1
- package/dist/brand.cjs.js +2 -2
- package/dist/brand.es.js +2 -2
- package/dist/cli.js +90 -37
- package/dist/components/brand/theme-toggle/ThemeToggle.d.ts +1 -1
- package/dist/components/index.d.ts +1 -1
- package/dist/components/ui/stats-card/stats-card.d.ts +10 -0
- package/dist/index.cjs.js +6 -6
- package/dist/index.es.js +6 -6
- package/dist/layout.cjs.js +1 -1
- package/dist/layout.es.js +1 -1
- package/dist/pages.cjs.js +1 -1
- package/dist/pages.es.js +1 -1
- package/dist/sidebar-B4ZWaMrE.js +792 -0
- package/dist/sidebar-BS1p2V7t.cjs +795 -0
- package/dist/ui.cjs.js +1 -1
- package/dist/ui.es.js +1 -1
- package/dist/xertica-assistant-B1NaSFFj.js +2173 -0
- package/dist/xertica-assistant-CIaUlbIt.cjs +2180 -0
- package/dist/xertica-ui.css +1 -1
- package/docs/architecture-improvements.md +5 -5
- package/docs/architecture.md +16 -10
- package/docs/components/card-patterns.md +19 -17
- package/docs/components/error-boundary.md +201 -191
- package/docs/components/hooks.md +15 -13
- package/docs/components/language-selector.md +20 -16
- package/docs/components/pages.md +323 -309
- package/docs/components/stats-card.md +20 -2
- package/docs/doc-audit.md +12 -11
- package/docs/getting-started.md +41 -28
- package/docs/guidelines.md +14 -12
- package/docs/i18n.md +61 -57
- package/docs/installation.md +268 -267
- package/docs/llms.md +17 -17
- package/docs/state-management.md +17 -17
- package/guidelines/Guidelines.md +17 -14
- package/llms-compact.txt +1 -1
- package/llms-full.txt +11553 -7133
- package/llms.txt +1 -1
- package/package.json +1 -1
- package/styles/xertica/base.css +90 -84
- package/templates/CLAUDE.md +16 -1
- package/templates/guidelines/Guidelines.md +42 -18
- package/templates/package.json +3 -3
- package/templates/src/app/components/AuthGuard.tsx +131 -82
- package/templates/src/features/auth/ui/AuthPageShell.tsx +32 -32
- package/templates/src/features/auth/ui/ForgotPasswordContent.tsx +1 -3
- package/templates/src/features/auth/ui/ResetPasswordContent.tsx +6 -2
- package/templates/src/features/auth/ui/VerifyEmailContent.tsx +2 -6
- package/templates/src/features/home/data/mock.ts +41 -35
- package/templates/src/features/home/ui/HomeContent.tsx +62 -64
- package/templates/src/features/template/ui/CrudTemplate.tsx +1 -4
- package/templates/src/features/template/ui/LoginTemplate.tsx +1 -1
- package/templates/src/features/template/ui/TemplateContent.tsx +28 -20
- package/templates/src/locales/en/pages/templates.json +17 -17
- package/templates/src/locales/es/pages/templates.json +17 -17
- package/templates/src/locales/pt-BR/pages/templates.json +17 -17
- package/templates/src/pages/AssistantPage.tsx +26 -20
- package/templates/src/pages/HomePage.tsx +5 -1
- package/templates/src/shared/error-boundary.tsx +150 -154
- package/templates/src/shared/error-fallbacks.tsx +222 -226
- package/templates/vite.config.ts +12 -9
package/docs/components/pages.md
CHANGED
|
@@ -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
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
>
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
>
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
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:** none — layout 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.
|