@aventoapp/framework 0.2.0 → 0.2.2
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/README.md +281 -0
- package/dist/index.js.map +1 -1
- package/dist/native/index.js.map +1 -1
- package/dist/offline/index.js.map +1 -1
- package/dist/server/index.js +69 -6
- package/dist/server/index.js.map +2 -2
- package/dist/server/workflow/index.js.map +1 -1
- package/dist/shared/index.js.map +1 -1
- package/dist/web/index.js.map +1 -1
- package/package.json +84 -79
- package/schemas/Workflow.json +14 -14
- package/schemas/WorkflowHistory.json +22 -22
- package/schemas/WorkflowInstance.json +16 -16
- package/schemas/WorkflowState.json +18 -18
- package/schemas/WorkflowTransition.json +27 -27
- package/src/index.js +8 -8
- package/src/native/components/NativeAuthProvider.jsx +249 -249
- package/src/native/components/NativeDetail.jsx +270 -270
- package/src/native/components/NativeForm.jsx +543 -543
- package/src/native/components/NativeGrid.jsx +90 -90
- package/src/native/components/NativeJsonGrid.jsx +213 -213
- package/src/native/components/NativeJsonView.jsx +454 -454
- package/src/native/components/NativeJsonViewContext.js +17 -17
- package/src/native/components/NativeShell.jsx +68 -68
- package/src/native/components/NativeViewComponent.jsx +351 -351
- package/src/native/extensions/NativeExtensionRegistry.js +81 -81
- package/src/native/hooks/useNativeStore.js +72 -72
- package/src/native/index.js +15 -15
- package/src/native/layouts/NativeStackLayout.jsx +30 -30
- package/src/native/layouts/NativeTabLayout.jsx +96 -96
- package/src/native/storage.js +13 -13
- package/src/native/stores/NativeBaseStore.js +348 -348
- package/src/native/stores/NativeStoreContext.jsx +53 -53
- package/src/offline/index.js +1 -1
- package/src/server/ai/capabilities-routes.js +106 -106
- package/src/server/ai/index.js +1 -1
- package/src/server/cache/MemoryCache.js +153 -153
- package/src/server/cache/index.js +2 -2
- package/src/server/cache/middleware.js +12 -12
- package/src/server/db/index.js +14 -14
- package/src/server/db/mongo.js +137 -137
- package/src/server/db/postgres.js +144 -144
- package/src/server/index.js +42 -42
- package/src/server/middleware/auth.js +682 -682
- package/src/server/middleware/can-flags.js +132 -132
- package/src/server/middleware/entityRoles.js +105 -105
- package/src/server/middleware/index.js +58 -58
- package/src/server/middleware/permissions.js +240 -240
- package/src/server/middleware/tenant.js +203 -203
- package/src/server/offline/field-lww.js +98 -6
- package/src/server/realtime/EventBus.js +45 -45
- package/src/server/realtime/WebSocketServer.js +105 -105
- package/src/server/realtime/index.js +3 -3
- package/src/server/realtime/middleware.js +18 -18
- package/src/server/services/email-templates.js +157 -157
- package/src/server/services/email.js +78 -78
- package/src/server/services/index.js +15 -15
- package/src/server/services/storage.js +119 -119
- package/src/server/utils/index.js +16 -16
- package/src/server/utils/paginate.js +65 -65
- package/src/server/utils/query-builder.js +293 -293
- package/src/server/utils/route-loader.js +61 -61
- package/src/server/workflow/WorkflowEngine.js +494 -494
- package/src/server/workflow/index.js +2 -2
- package/src/server/workflow/workflow-routes.js +174 -174
- package/src/shared/index.js +10 -10
- package/src/shared/utils/field-accessor.js +108 -108
- package/src/shared/utils/index.js +7 -7
- package/src/shared/utils/validation-utils.js +83 -83
- package/src/web/components/AppRouter/AppRouter.jsx +130 -130
- package/src/web/components/AppRouter/index.js +1 -1
- package/src/web/components/AppShell/AppShell.jsx +101 -101
- package/src/web/components/AppShell/DefaultUserMenu.jsx +54 -54
- package/src/web/components/AppShell/ShellConfig.js +53 -53
- package/src/web/components/AppShell/index.js +3 -3
- package/src/web/components/AuthProvider.jsx +426 -426
- package/src/web/components/CardList/CardList.jsx +272 -272
- package/src/web/components/CardList/index.js +2 -2
- package/src/web/components/DetailView/DetailView.jsx +281 -281
- package/src/web/components/DetailView/index.js +2 -2
- package/src/web/components/Form/Form.jsx +300 -300
- package/src/web/components/Form/FormField.jsx +226 -226
- package/src/web/components/Form/index.js +3 -3
- package/src/web/components/Grid/Grid.jsx +304 -304
- package/src/web/components/Grid/index.js +2 -2
- package/src/web/components/IconRegistry/IconRegistry.jsx +127 -127
- package/src/web/components/IconRegistry/index.js +1 -1
- package/src/web/components/JsonView/JsonView.jsx +647 -647
- package/src/web/components/JsonView/ViewComponent.jsx +1045 -1045
- package/src/web/components/JsonView/ViewToolbar.jsx +141 -141
- package/src/web/components/JsonView/index.js +14 -14
- package/src/web/components/JsonView/layouts/SingleLayout.jsx +41 -41
- package/src/web/components/JsonView/layouts/SplitLayout.jsx +122 -122
- package/src/web/components/JsonView/layouts/TabLayout.jsx +112 -112
- package/src/web/components/JsonView/layouts/index.js +8 -8
- package/src/web/components/Layout.jsx +265 -265
- package/src/web/components/MobileLayout/MobileLayout.jsx +385 -385
- package/src/web/components/MobileLayout/index.js +1 -1
- package/src/web/components/Navigation/Navigation.jsx +248 -248
- package/src/web/components/Navigation/index.js +1 -1
- package/src/web/components/NotificationProvider.jsx +55 -55
- package/src/web/components/Pagination/InfiniteScroll.jsx +82 -82
- package/src/web/components/Pagination/Pagination.jsx +73 -73
- package/src/web/components/Pagination/index.js +8 -8
- package/src/web/components/SimpleList/SimpleList.jsx +177 -177
- package/src/web/components/SimpleList/index.js +2 -2
- package/src/web/components/TenantProvider.jsx +121 -121
- package/src/web/components/WorkflowActions/WorkflowActions.jsx +71 -71
- package/src/web/components/WorkflowActions/index.js +1 -1
- package/src/web/components/WorkflowField/WorkflowField.jsx +176 -176
- package/src/web/components/WorkflowField/index.js +2 -2
- package/src/web/components/WorkflowField/workflowColors.js +32 -32
- package/src/web/components/auth/DevTenantSelector.jsx +90 -90
- package/src/web/components/auth/ForgotPasswordForm.jsx +94 -94
- package/src/web/components/auth/RegisterForm.jsx +168 -168
- package/src/web/components/auth/ResetPasswordForm.jsx +121 -121
- package/src/web/components/auth/VerifyEmailView.jsx +85 -85
- package/src/web/components/auth/index.js +5 -5
- package/src/web/components/index.js +39 -39
- package/src/web/components/layouts/CardListLayout.jsx +68 -68
- package/src/web/components/layouts/FullscreenLayout.jsx +30 -30
- package/src/web/components/layouts/MobileStackLayout.jsx +28 -28
- package/src/web/components/layouts/WizardLayout.jsx +86 -86
- package/src/web/components/layouts/index.js +4 -4
- package/src/web/components/mobile/Badge.jsx +105 -105
- package/src/web/components/mobile/BadgeThemeEditor.jsx +104 -104
- package/src/web/components/mobile/EmptyState.jsx +30 -30
- package/src/web/components/mobile/QuickActionButton.jsx +77 -77
- package/src/web/components/mobile/ServerAutocomplete.jsx +123 -123
- package/src/web/components/mobile/StarRating.jsx +42 -42
- package/src/web/components/mobile/StatCard.jsx +65 -65
- package/src/web/components/mobile/index.js +7 -7
- package/src/web/extensions/ExtensionRegistry.js +79 -79
- package/src/web/extensions/index.js +7 -7
- package/src/web/hooks/index.js +15 -15
- package/src/web/hooks/useApi.js +76 -76
- package/src/web/hooks/useAuth.js +37 -37
- package/src/web/hooks/useDebouncedSave.js +158 -158
- package/src/web/hooks/useIsMobile.js +14 -14
- package/src/web/hooks/useOfflineQueue.js +99 -99
- package/src/web/hooks/useSelectionModel.js +143 -143
- package/src/web/hooks/useServerAutocomplete.js +146 -146
- package/src/web/hooks/useStore.js +107 -107
- package/src/web/hooks/useSubscription.js +130 -130
- package/src/web/hooks/useTenant.js +39 -39
- package/src/web/hooks/useTenantResolver.js +65 -65
- package/src/web/hooks/useUndoRedo.js +77 -77
- package/src/web/hooks/useViews.js +113 -113
- package/src/web/hooks/useWorkflow.js +190 -190
- package/src/web/index.js +117 -117
- package/src/web/stores/BaseStore.js +439 -439
- package/src/web/stores/StoreContext.jsx +93 -93
- package/src/web/stores/index.js +3 -3
- package/src/web/theme/index.js +3 -3
- package/src/web/theme/mui-theme.js +228 -228
- package/src/web/utils/formatTimeAgo.js +22 -22
- package/src/web/utils/index.js +1 -1
- package/src/web/views/ViewRegistry.js +235 -235
- package/src/web/views/index.js +2 -2
|
@@ -1,85 +1,85 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* VerifyEmailView Component
|
|
3
|
-
*
|
|
4
|
-
* Auto-verifies email on mount when token is provided.
|
|
5
|
-
* Shows success/error/loading states.
|
|
6
|
-
*/
|
|
7
|
-
import React, { useState, useEffect } from 'react';
|
|
8
|
-
import { useAuth } from '../../hooks/useAuth.js';
|
|
9
|
-
import {
|
|
10
|
-
Box,
|
|
11
|
-
Typography,
|
|
12
|
-
Alert,
|
|
13
|
-
CircularProgress,
|
|
14
|
-
Link
|
|
15
|
-
} from '@mui/material';
|
|
16
|
-
|
|
17
|
-
export function VerifyEmailView({ token, onSuccess, onLoginClick }) {
|
|
18
|
-
const { verifyEmail } = useAuth();
|
|
19
|
-
|
|
20
|
-
const [status, setStatus] = useState('loading'); // loading | success | error
|
|
21
|
-
const [message, setMessage] = useState('');
|
|
22
|
-
|
|
23
|
-
useEffect(() => {
|
|
24
|
-
if (!token) {
|
|
25
|
-
setStatus('error');
|
|
26
|
-
setMessage('No verification token provided');
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
async function verify() {
|
|
31
|
-
try {
|
|
32
|
-
const result = await verifyEmail(token);
|
|
33
|
-
|
|
34
|
-
if (result.success) {
|
|
35
|
-
setStatus('success');
|
|
36
|
-
setMessage(result.message || 'Email verified successfully. You can now log in.');
|
|
37
|
-
onSuccess?.(result);
|
|
38
|
-
} else {
|
|
39
|
-
setStatus('error');
|
|
40
|
-
setMessage(result.error || 'Verification failed');
|
|
41
|
-
}
|
|
42
|
-
} catch (err) {
|
|
43
|
-
setStatus('error');
|
|
44
|
-
setMessage(err.message || 'An error occurred');
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
verify();
|
|
49
|
-
}, [token, verifyEmail, onSuccess]);
|
|
50
|
-
|
|
51
|
-
return (
|
|
52
|
-
<Box sx={{ textAlign: 'center' }}>
|
|
53
|
-
<Typography variant="h5" component="h1" gutterBottom>
|
|
54
|
-
Email Verification
|
|
55
|
-
</Typography>
|
|
56
|
-
|
|
57
|
-
{status === 'loading' && (
|
|
58
|
-
<Box sx={{ my: 3 }}>
|
|
59
|
-
<CircularProgress />
|
|
60
|
-
<Typography variant="body2" color="text.secondary" mt={2}>
|
|
61
|
-
Verifying your email...
|
|
62
|
-
</Typography>
|
|
63
|
-
</Box>
|
|
64
|
-
)}
|
|
65
|
-
|
|
66
|
-
{status === 'success' && (
|
|
67
|
-
<Alert severity="success" sx={{ mb: 2 }}>{message}</Alert>
|
|
68
|
-
)}
|
|
69
|
-
|
|
70
|
-
{status === 'error' && (
|
|
71
|
-
<Alert severity="error" sx={{ mb: 2 }}>{message}</Alert>
|
|
72
|
-
)}
|
|
73
|
-
|
|
74
|
-
{status !== 'loading' && (
|
|
75
|
-
<Typography variant="body2" mt={2}>
|
|
76
|
-
<Link component="button" type="button" onClick={onLoginClick} underline="hover">
|
|
77
|
-
Go to sign in
|
|
78
|
-
</Link>
|
|
79
|
-
</Typography>
|
|
80
|
-
)}
|
|
81
|
-
</Box>
|
|
82
|
-
);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export default VerifyEmailView;
|
|
1
|
+
/**
|
|
2
|
+
* VerifyEmailView Component
|
|
3
|
+
*
|
|
4
|
+
* Auto-verifies email on mount when token is provided.
|
|
5
|
+
* Shows success/error/loading states.
|
|
6
|
+
*/
|
|
7
|
+
import React, { useState, useEffect } from 'react';
|
|
8
|
+
import { useAuth } from '../../hooks/useAuth.js';
|
|
9
|
+
import {
|
|
10
|
+
Box,
|
|
11
|
+
Typography,
|
|
12
|
+
Alert,
|
|
13
|
+
CircularProgress,
|
|
14
|
+
Link
|
|
15
|
+
} from '@mui/material';
|
|
16
|
+
|
|
17
|
+
export function VerifyEmailView({ token, onSuccess, onLoginClick }) {
|
|
18
|
+
const { verifyEmail } = useAuth();
|
|
19
|
+
|
|
20
|
+
const [status, setStatus] = useState('loading'); // loading | success | error
|
|
21
|
+
const [message, setMessage] = useState('');
|
|
22
|
+
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
if (!token) {
|
|
25
|
+
setStatus('error');
|
|
26
|
+
setMessage('No verification token provided');
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
async function verify() {
|
|
31
|
+
try {
|
|
32
|
+
const result = await verifyEmail(token);
|
|
33
|
+
|
|
34
|
+
if (result.success) {
|
|
35
|
+
setStatus('success');
|
|
36
|
+
setMessage(result.message || 'Email verified successfully. You can now log in.');
|
|
37
|
+
onSuccess?.(result);
|
|
38
|
+
} else {
|
|
39
|
+
setStatus('error');
|
|
40
|
+
setMessage(result.error || 'Verification failed');
|
|
41
|
+
}
|
|
42
|
+
} catch (err) {
|
|
43
|
+
setStatus('error');
|
|
44
|
+
setMessage(err.message || 'An error occurred');
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
verify();
|
|
49
|
+
}, [token, verifyEmail, onSuccess]);
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<Box sx={{ textAlign: 'center' }}>
|
|
53
|
+
<Typography variant="h5" component="h1" gutterBottom>
|
|
54
|
+
Email Verification
|
|
55
|
+
</Typography>
|
|
56
|
+
|
|
57
|
+
{status === 'loading' && (
|
|
58
|
+
<Box sx={{ my: 3 }}>
|
|
59
|
+
<CircularProgress />
|
|
60
|
+
<Typography variant="body2" color="text.secondary" mt={2}>
|
|
61
|
+
Verifying your email...
|
|
62
|
+
</Typography>
|
|
63
|
+
</Box>
|
|
64
|
+
)}
|
|
65
|
+
|
|
66
|
+
{status === 'success' && (
|
|
67
|
+
<Alert severity="success" sx={{ mb: 2 }}>{message}</Alert>
|
|
68
|
+
)}
|
|
69
|
+
|
|
70
|
+
{status === 'error' && (
|
|
71
|
+
<Alert severity="error" sx={{ mb: 2 }}>{message}</Alert>
|
|
72
|
+
)}
|
|
73
|
+
|
|
74
|
+
{status !== 'loading' && (
|
|
75
|
+
<Typography variant="body2" mt={2}>
|
|
76
|
+
<Link component="button" type="button" onClick={onLoginClick} underline="hover">
|
|
77
|
+
Go to sign in
|
|
78
|
+
</Link>
|
|
79
|
+
</Typography>
|
|
80
|
+
)}
|
|
81
|
+
</Box>
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export default VerifyEmailView;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { DevTenantSelector } from './DevTenantSelector.jsx';
|
|
2
|
-
export { RegisterForm } from './RegisterForm.jsx';
|
|
3
|
-
export { ForgotPasswordForm } from './ForgotPasswordForm.jsx';
|
|
4
|
-
export { ResetPasswordForm } from './ResetPasswordForm.jsx';
|
|
5
|
-
export { VerifyEmailView } from './VerifyEmailView.jsx';
|
|
1
|
+
export { DevTenantSelector } from './DevTenantSelector.jsx';
|
|
2
|
+
export { RegisterForm } from './RegisterForm.jsx';
|
|
3
|
+
export { ForgotPasswordForm } from './ForgotPasswordForm.jsx';
|
|
4
|
+
export { ResetPasswordForm } from './ResetPasswordForm.jsx';
|
|
5
|
+
export { VerifyEmailView } from './VerifyEmailView.jsx';
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
// Web Components
|
|
2
|
-
export { AuthProvider, AuthContext } from './AuthProvider.jsx';
|
|
3
|
-
export { TenantProvider, TenantContext } from './TenantProvider.jsx';
|
|
4
|
-
export { NotificationProvider, useNotification } from './NotificationProvider.jsx';
|
|
5
|
-
export { Layout } from './Layout.jsx';
|
|
6
|
-
export { Navigation } from './Navigation/index.js';
|
|
7
|
-
export { AppRouter } from './AppRouter/index.js';
|
|
8
|
-
|
|
9
|
-
// Universal Config-Driven Components
|
|
10
|
-
export { Grid } from './Grid/index.js';
|
|
11
|
-
export { Form, FormField } from './Form/index.js';
|
|
12
|
-
export { DetailView } from './DetailView/index.js';
|
|
13
|
-
export { SimpleList } from './SimpleList/index.js';
|
|
14
|
-
export { CardList } from './CardList/index.js';
|
|
15
|
-
|
|
16
|
-
// Pagination Components
|
|
17
|
-
export { Pagination, InfiniteScroll } from './Pagination/index.js';
|
|
18
|
-
|
|
19
|
-
// JSON View System
|
|
20
|
-
export { JsonView, JsonViewContext, useJsonView, ViewComponent, ViewToolbar } from './JsonView/index.js';
|
|
21
|
-
export { SplitLayout, TabLayout, SingleLayout } from './JsonView/layouts/index.js';
|
|
22
|
-
|
|
23
|
-
// Workflow Components
|
|
24
|
-
export { WorkflowActions } from './WorkflowActions/index.js';
|
|
25
|
-
export { WorkflowField } from './WorkflowField/index.js';
|
|
26
|
-
|
|
27
|
-
// Shell
|
|
28
|
-
export { AppShell, useShellConfig } from './AppShell/index.js';
|
|
29
|
-
export { MobileLayout } from './MobileLayout/index.js';
|
|
30
|
-
export { IconRegistry, iconRegistry, resolveIcon } from './IconRegistry/index.js';
|
|
31
|
-
|
|
32
|
-
// Mobile Layouts
|
|
33
|
-
export { MobileStackLayout, CardListLayout, FullscreenLayout, WizardLayout } from './layouts/index.js';
|
|
34
|
-
|
|
35
|
-
// Mobile Primitives
|
|
36
|
-
export { QuickActionButton, StatCard, EmptyState, StarRating, Badge, BadgeLegend, BadgeThemeEditor, ServerAutocomplete } from './mobile/index.js';
|
|
37
|
-
|
|
38
|
-
// Auth Components
|
|
39
|
-
export { DevTenantSelector, RegisterForm, ForgotPasswordForm, ResetPasswordForm, VerifyEmailView } from './auth/index.js';
|
|
1
|
+
// Web Components
|
|
2
|
+
export { AuthProvider, AuthContext } from './AuthProvider.jsx';
|
|
3
|
+
export { TenantProvider, TenantContext } from './TenantProvider.jsx';
|
|
4
|
+
export { NotificationProvider, useNotification } from './NotificationProvider.jsx';
|
|
5
|
+
export { Layout } from './Layout.jsx';
|
|
6
|
+
export { Navigation } from './Navigation/index.js';
|
|
7
|
+
export { AppRouter } from './AppRouter/index.js';
|
|
8
|
+
|
|
9
|
+
// Universal Config-Driven Components
|
|
10
|
+
export { Grid } from './Grid/index.js';
|
|
11
|
+
export { Form, FormField } from './Form/index.js';
|
|
12
|
+
export { DetailView } from './DetailView/index.js';
|
|
13
|
+
export { SimpleList } from './SimpleList/index.js';
|
|
14
|
+
export { CardList } from './CardList/index.js';
|
|
15
|
+
|
|
16
|
+
// Pagination Components
|
|
17
|
+
export { Pagination, InfiniteScroll } from './Pagination/index.js';
|
|
18
|
+
|
|
19
|
+
// JSON View System
|
|
20
|
+
export { JsonView, JsonViewContext, useJsonView, ViewComponent, ViewToolbar } from './JsonView/index.js';
|
|
21
|
+
export { SplitLayout, TabLayout, SingleLayout } from './JsonView/layouts/index.js';
|
|
22
|
+
|
|
23
|
+
// Workflow Components
|
|
24
|
+
export { WorkflowActions } from './WorkflowActions/index.js';
|
|
25
|
+
export { WorkflowField } from './WorkflowField/index.js';
|
|
26
|
+
|
|
27
|
+
// Shell
|
|
28
|
+
export { AppShell, useShellConfig } from './AppShell/index.js';
|
|
29
|
+
export { MobileLayout } from './MobileLayout/index.js';
|
|
30
|
+
export { IconRegistry, iconRegistry, resolveIcon } from './IconRegistry/index.js';
|
|
31
|
+
|
|
32
|
+
// Mobile Layouts
|
|
33
|
+
export { MobileStackLayout, CardListLayout, FullscreenLayout, WizardLayout } from './layouts/index.js';
|
|
34
|
+
|
|
35
|
+
// Mobile Primitives
|
|
36
|
+
export { QuickActionButton, StatCard, EmptyState, StarRating, Badge, BadgeLegend, BadgeThemeEditor, ServerAutocomplete } from './mobile/index.js';
|
|
37
|
+
|
|
38
|
+
// Auth Components
|
|
39
|
+
export { DevTenantSelector, RegisterForm, ForgotPasswordForm, ResetPasswordForm, VerifyEmailView } from './auth/index.js';
|
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CardListLayout
|
|
3
|
-
*
|
|
4
|
-
* Search + title/action header + scrollable card list + empty state.
|
|
5
|
-
*/
|
|
6
|
-
import React, { useState } from 'react';
|
|
7
|
-
import { Box, TextField, InputAdornment, Typography } from '@mui/material';
|
|
8
|
-
import SearchIcon from '@mui/icons-material/Search';
|
|
9
|
-
|
|
10
|
-
export function CardListLayout({
|
|
11
|
-
children,
|
|
12
|
-
searchPlaceholder = 'Search...',
|
|
13
|
-
onSearch,
|
|
14
|
-
title,
|
|
15
|
-
action,
|
|
16
|
-
emptyMessage = 'No items found',
|
|
17
|
-
isEmpty = false,
|
|
18
|
-
maxWidth = 600,
|
|
19
|
-
}) {
|
|
20
|
-
const [searchTerm, setSearchTerm] = useState('');
|
|
21
|
-
|
|
22
|
-
const handleSearch = (e) => {
|
|
23
|
-
const value = e.target.value;
|
|
24
|
-
setSearchTerm(value);
|
|
25
|
-
onSearch?.(value);
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
return (
|
|
29
|
-
<Box sx={{ display: 'flex', flexDirection: 'column', height: '100%', maxWidth, mx: 'auto', width: '100%' }}>
|
|
30
|
-
<Box sx={{ px: 2, pt: 2, pb: 1 }}>
|
|
31
|
-
{title && (
|
|
32
|
-
<Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', mb: 1 }}>
|
|
33
|
-
<Typography variant="h6">{title}</Typography>
|
|
34
|
-
{action}
|
|
35
|
-
</Box>
|
|
36
|
-
)}
|
|
37
|
-
{onSearch && (
|
|
38
|
-
<TextField
|
|
39
|
-
fullWidth
|
|
40
|
-
size="small"
|
|
41
|
-
placeholder={searchPlaceholder}
|
|
42
|
-
value={searchTerm}
|
|
43
|
-
onChange={handleSearch}
|
|
44
|
-
InputProps={{
|
|
45
|
-
startAdornment: (
|
|
46
|
-
<InputAdornment position="start">
|
|
47
|
-
<SearchIcon />
|
|
48
|
-
</InputAdornment>
|
|
49
|
-
),
|
|
50
|
-
}}
|
|
51
|
-
/>
|
|
52
|
-
)}
|
|
53
|
-
</Box>
|
|
54
|
-
|
|
55
|
-
<Box sx={{ flex: 1, overflow: 'auto', px: 2, pb: 2, display: 'flex', flexDirection: 'column', gap: 1.5 }}>
|
|
56
|
-
{isEmpty ? (
|
|
57
|
-
<Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'center', py: 6 }}>
|
|
58
|
-
<Typography color="text.secondary">{emptyMessage}</Typography>
|
|
59
|
-
</Box>
|
|
60
|
-
) : (
|
|
61
|
-
children
|
|
62
|
-
)}
|
|
63
|
-
</Box>
|
|
64
|
-
</Box>
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export default CardListLayout;
|
|
1
|
+
/**
|
|
2
|
+
* CardListLayout
|
|
3
|
+
*
|
|
4
|
+
* Search + title/action header + scrollable card list + empty state.
|
|
5
|
+
*/
|
|
6
|
+
import React, { useState } from 'react';
|
|
7
|
+
import { Box, TextField, InputAdornment, Typography } from '@mui/material';
|
|
8
|
+
import SearchIcon from '@mui/icons-material/Search';
|
|
9
|
+
|
|
10
|
+
export function CardListLayout({
|
|
11
|
+
children,
|
|
12
|
+
searchPlaceholder = 'Search...',
|
|
13
|
+
onSearch,
|
|
14
|
+
title,
|
|
15
|
+
action,
|
|
16
|
+
emptyMessage = 'No items found',
|
|
17
|
+
isEmpty = false,
|
|
18
|
+
maxWidth = 600,
|
|
19
|
+
}) {
|
|
20
|
+
const [searchTerm, setSearchTerm] = useState('');
|
|
21
|
+
|
|
22
|
+
const handleSearch = (e) => {
|
|
23
|
+
const value = e.target.value;
|
|
24
|
+
setSearchTerm(value);
|
|
25
|
+
onSearch?.(value);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<Box sx={{ display: 'flex', flexDirection: 'column', height: '100%', maxWidth, mx: 'auto', width: '100%' }}>
|
|
30
|
+
<Box sx={{ px: 2, pt: 2, pb: 1 }}>
|
|
31
|
+
{title && (
|
|
32
|
+
<Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', mb: 1 }}>
|
|
33
|
+
<Typography variant="h6">{title}</Typography>
|
|
34
|
+
{action}
|
|
35
|
+
</Box>
|
|
36
|
+
)}
|
|
37
|
+
{onSearch && (
|
|
38
|
+
<TextField
|
|
39
|
+
fullWidth
|
|
40
|
+
size="small"
|
|
41
|
+
placeholder={searchPlaceholder}
|
|
42
|
+
value={searchTerm}
|
|
43
|
+
onChange={handleSearch}
|
|
44
|
+
InputProps={{
|
|
45
|
+
startAdornment: (
|
|
46
|
+
<InputAdornment position="start">
|
|
47
|
+
<SearchIcon />
|
|
48
|
+
</InputAdornment>
|
|
49
|
+
),
|
|
50
|
+
}}
|
|
51
|
+
/>
|
|
52
|
+
)}
|
|
53
|
+
</Box>
|
|
54
|
+
|
|
55
|
+
<Box sx={{ flex: 1, overflow: 'auto', px: 2, pb: 2, display: 'flex', flexDirection: 'column', gap: 1.5 }}>
|
|
56
|
+
{isEmpty ? (
|
|
57
|
+
<Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'center', py: 6 }}>
|
|
58
|
+
<Typography color="text.secondary">{emptyMessage}</Typography>
|
|
59
|
+
</Box>
|
|
60
|
+
) : (
|
|
61
|
+
children
|
|
62
|
+
)}
|
|
63
|
+
</Box>
|
|
64
|
+
</Box>
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export default CardListLayout;
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* FullscreenLayout
|
|
3
|
-
*
|
|
4
|
-
* Fixed position full viewport container.
|
|
5
|
-
*/
|
|
6
|
-
import React from 'react';
|
|
7
|
-
import { Box } from '@mui/material';
|
|
8
|
-
|
|
9
|
-
export function FullscreenLayout({ children, sx = {} }) {
|
|
10
|
-
return (
|
|
11
|
-
<Box
|
|
12
|
-
sx={{
|
|
13
|
-
position: 'fixed',
|
|
14
|
-
top: 0,
|
|
15
|
-
left: 0,
|
|
16
|
-
right: 0,
|
|
17
|
-
bottom: 0,
|
|
18
|
-
display: 'flex',
|
|
19
|
-
flexDirection: 'column',
|
|
20
|
-
overflow: 'hidden',
|
|
21
|
-
bgcolor: 'background.default',
|
|
22
|
-
...sx,
|
|
23
|
-
}}
|
|
24
|
-
>
|
|
25
|
-
{children}
|
|
26
|
-
</Box>
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export default FullscreenLayout;
|
|
1
|
+
/**
|
|
2
|
+
* FullscreenLayout
|
|
3
|
+
*
|
|
4
|
+
* Fixed position full viewport container.
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import { Box } from '@mui/material';
|
|
8
|
+
|
|
9
|
+
export function FullscreenLayout({ children, sx = {} }) {
|
|
10
|
+
return (
|
|
11
|
+
<Box
|
|
12
|
+
sx={{
|
|
13
|
+
position: 'fixed',
|
|
14
|
+
top: 0,
|
|
15
|
+
left: 0,
|
|
16
|
+
right: 0,
|
|
17
|
+
bottom: 0,
|
|
18
|
+
display: 'flex',
|
|
19
|
+
flexDirection: 'column',
|
|
20
|
+
overflow: 'hidden',
|
|
21
|
+
bgcolor: 'background.default',
|
|
22
|
+
...sx,
|
|
23
|
+
}}
|
|
24
|
+
>
|
|
25
|
+
{children}
|
|
26
|
+
</Box>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export default FullscreenLayout;
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MobileStackLayout
|
|
3
|
-
*
|
|
4
|
-
* Flex column layout with gap, padding, and centered maxWidth.
|
|
5
|
-
*/
|
|
6
|
-
import React from 'react';
|
|
7
|
-
import { Box } from '@mui/material';
|
|
8
|
-
|
|
9
|
-
export function MobileStackLayout({ children, spacing = 2, padding = 2, maxWidth = 600, sx = {} }) {
|
|
10
|
-
return (
|
|
11
|
-
<Box
|
|
12
|
-
sx={{
|
|
13
|
-
display: 'flex',
|
|
14
|
-
flexDirection: 'column',
|
|
15
|
-
gap: spacing,
|
|
16
|
-
p: padding,
|
|
17
|
-
maxWidth,
|
|
18
|
-
mx: 'auto',
|
|
19
|
-
width: '100%',
|
|
20
|
-
...sx,
|
|
21
|
-
}}
|
|
22
|
-
>
|
|
23
|
-
{children}
|
|
24
|
-
</Box>
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export default MobileStackLayout;
|
|
1
|
+
/**
|
|
2
|
+
* MobileStackLayout
|
|
3
|
+
*
|
|
4
|
+
* Flex column layout with gap, padding, and centered maxWidth.
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import { Box } from '@mui/material';
|
|
8
|
+
|
|
9
|
+
export function MobileStackLayout({ children, spacing = 2, padding = 2, maxWidth = 600, sx = {} }) {
|
|
10
|
+
return (
|
|
11
|
+
<Box
|
|
12
|
+
sx={{
|
|
13
|
+
display: 'flex',
|
|
14
|
+
flexDirection: 'column',
|
|
15
|
+
gap: spacing,
|
|
16
|
+
p: padding,
|
|
17
|
+
maxWidth,
|
|
18
|
+
mx: 'auto',
|
|
19
|
+
width: '100%',
|
|
20
|
+
...sx,
|
|
21
|
+
}}
|
|
22
|
+
>
|
|
23
|
+
{children}
|
|
24
|
+
</Box>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default MobileStackLayout;
|