@umituz/web-dashboard 6.11.0 → 7.1.0
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/package.json +2 -3
- package/src/domains/analytics/components/AnalyticsCard.tsx +11 -0
- package/src/domains/analytics/components/AnalyticsChart.tsx +24 -5
- package/src/domains/analytics/components/AnalyticsLayout.tsx +26 -26
- package/src/domains/analytics/components/MetricCard.tsx +2 -5
- package/src/domains/analytics/hooks/useAnalytics.ts +1 -7
- package/src/domains/analytics/index.ts +0 -1
- package/src/domains/analytics/types/analytics.ts +11 -0
- package/src/domains/analytics/utils/analytics.ts +2 -115
- package/src/domains/analytics/utils/index.ts +0 -1
- package/src/domains/calendar/services/CalendarService.ts +2 -25
- package/src/domains/charts/components.test.tsx +1 -0
- package/src/domains/charts/components.tsx +65 -0
- package/src/domains/layouts/components/BrandLogo.tsx +1 -0
- package/src/domains/layouts/components/DashboardHeader.tsx +56 -20
- package/src/domains/layouts/components/DashboardLayout.test.tsx +33 -20
- package/src/domains/layouts/components/DashboardLayout.tsx +21 -25
- package/src/domains/layouts/components/DashboardSidebar.tsx +33 -32
- package/src/domains/layouts/components/FilterBar.test.tsx +3 -0
- package/src/domains/layouts/components/FilterBar.tsx +5 -9
- package/src/domains/layouts/components/FilterSelect.test.tsx +28 -0
- package/src/domains/layouts/components/FilterSelect.tsx +47 -0
- package/src/domains/layouts/components/PageHeader.test.tsx +3 -0
- package/src/domains/layouts/components/PageHeader.tsx +11 -2
- package/src/domains/layouts/components/SectionHeader.tsx +7 -4
- package/src/domains/layouts/components/index.ts +3 -0
- package/src/domains/layouts/components/labels.ts +26 -0
- package/src/domains/layouts/hooks/dashboard.ts +4 -7
- package/src/domains/layouts/types/index.ts +12 -1
- package/src/domains/layouts/types/layout.ts +73 -63
- package/src/domains/layouts/types/sidebar.ts +0 -8
- package/src/domains/layouts/utils/dashboard.test.ts +2 -2
- package/src/domains/layouts/utils/dashboard.ts +15 -11
- package/src/domains/layouts/utils/index.ts +2 -1
- package/src/domains/modules/build.test.tsx +4 -0
- package/src/domains/modules/build.tsx +1 -0
- package/src/domains/onboarding/calc/slider-value-bounds.ts +1 -1
- package/src/domains/onboarding/components/AnimationWrapper.tsx +3 -0
- package/src/domains/onboarding/components/OnboardingErrorBoundary.tsx +6 -0
- package/src/domains/onboarding/components/OnboardingFlow.test.tsx +48 -27
- package/src/domains/onboarding/components/OnboardingFlow.tsx +10 -2
- package/src/domains/onboarding/components/OnboardingIntl.tsx +7 -65
- package/src/domains/onboarding/components/PrimaryButton.tsx +3 -0
- package/src/domains/onboarding/components/ProgressBar.tsx +5 -1
- package/src/domains/onboarding/components/QuestionWrapper.tsx +5 -0
- package/src/domains/onboarding/components/ScreenContainer.tsx +4 -0
- package/src/domains/onboarding/components/SwipeCard.test.tsx +43 -1
- package/src/domains/onboarding/components/SwipeCard.tsx +7 -0
- package/src/domains/onboarding/components/screens/AccountGateScreen.tsx +7 -0
- package/src/domains/onboarding/components/screens/AppDemoScreen.tsx +4 -0
- package/src/domains/onboarding/components/screens/ComparisonScreen.tsx +9 -0
- package/src/domains/onboarding/components/screens/GoalQuestionScreen.tsx +3 -0
- package/src/domains/onboarding/components/screens/PainPointsScreen.tsx +3 -0
- package/src/domains/onboarding/components/screens/PaywallScreen.tsx +17 -0
- package/src/domains/onboarding/components/screens/PermissionPrimingScreen.tsx +10 -0
- package/src/domains/onboarding/components/screens/PersonalizedSolutionScreen.tsx +9 -0
- package/src/domains/onboarding/components/screens/PreferencesScreen.tsx +15 -0
- package/src/domains/onboarding/components/screens/ProcessingScreen.tsx +8 -0
- package/src/domains/onboarding/components/screens/SocialProofScreen.tsx +17 -0
- package/src/domains/onboarding/components/screens/TinderCardsScreen.tsx +12 -0
- package/src/domains/onboarding/components/screens/ValueDeliveryScreen.tsx +9 -0
- package/src/domains/onboarding/components/screens/WelcomeScreen.tsx +7 -0
- package/src/domains/onboarding/hooks/useOnboardingProgress.test.tsx +4 -5
- package/src/domains/onboarding/index.ts +0 -12
- package/src/domains/onboarding/predicates/predicates.test.ts +1 -1
- package/src/domains/onboarding/types/config.ts +1 -1
- package/src/domains/onboarding/types/labels.ts +1 -0
- package/src/domains/onboarding/utils/analytics-dispatch.ts +2 -2
- package/src/domains/onboarding/utils/local-storage-bridge.ts +1 -1
- package/src/domains/onboarding/validation/validation.test.ts +2 -2
- package/src/domains/permissions/PermissionsContext.tsx +6 -18
- package/src/domains/permissions/index.ts +0 -1
- package/src/domains/search/searchItems.test.ts +1 -1
- package/src/domains/search/searchItems.ts +0 -3
- package/src/domains/settings/components/AuditLogList.tsx +14 -7
- package/src/domains/settings/components/PermissionMatrixScreen.tsx +10 -0
- package/src/domains/settings/components/SettingsLayout.tsx +20 -3
- package/src/domains/settings/components/SettingsSection.tsx +12 -6
- package/src/domains/settings/components/UserManagementTable.tsx +16 -9
- package/src/domains/settings/types/settings.ts +7 -1
- package/src/domains/settings/utils/index.ts +0 -1
- package/src/domains/timing/hooks/useCountdown.test.ts +1 -2
- package/src/domains/timing/hooks/useCountdown.ts +0 -4
- package/src/internal/formatPattern.ts +8 -0
- package/src/domains/analytics/utils/i18nKeys.ts +0 -31
- package/src/domains/onboarding/templates/TemplateDemoFallback.tsx +0 -92
- package/src/domains/onboarding/templates/art-onboarding.ts +0 -71
- package/src/domains/onboarding/templates/health-onboarding.ts +0 -92
- package/src/domains/onboarding/templates/index.ts +0 -6
- package/src/domains/onboarding/templates/platform-onboarding.ts +0 -201
- package/src/domains/onboarding/templates/video-onboarding.ts +0 -95
- package/src/domains/permissions/utils/i18nKeys.ts +0 -6
- package/src/domains/settings/utils/i18nKeys.ts +0 -12
|
@@ -46,16 +46,20 @@ export function TinderCardsScreen({ config, onNext }: TinderCardsScreenProps) {
|
|
|
46
46
|
return (
|
|
47
47
|
<div className="udb-onb-stage">
|
|
48
48
|
<p className="udb-onb-lead">{labels.allDone}</p>
|
|
49
|
+
|
|
49
50
|
<PrimaryButton onClick={() => onNext({ liked: likedRef.current })}>
|
|
50
51
|
{config.cta ?? labels.continueAction}
|
|
51
52
|
</PrimaryButton>
|
|
53
|
+
|
|
52
54
|
</div>
|
|
55
|
+
|
|
53
56
|
);
|
|
54
57
|
}
|
|
55
58
|
|
|
56
59
|
return (
|
|
57
60
|
<div className="udb-onb-proof">
|
|
58
61
|
{config.title && <h2 className="udb-onb-title">{config.title}</h2>}
|
|
62
|
+
|
|
59
63
|
<div className="udb-onb-proof__stage">
|
|
60
64
|
<AnimatePresence mode="wait">
|
|
61
65
|
<motion.div
|
|
@@ -73,19 +77,27 @@ export function TinderCardsScreen({ config, onNext }: TinderCardsScreenProps) {
|
|
|
73
77
|
onSwipeRight={onSwipeRight}
|
|
74
78
|
/>
|
|
75
79
|
</motion.div>
|
|
80
|
+
|
|
76
81
|
</AnimatePresence>
|
|
82
|
+
|
|
77
83
|
</div>
|
|
84
|
+
|
|
78
85
|
<div className="udb-onb-proof__nav">
|
|
79
86
|
<button type="button" onClick={onSwipeLeft} className="udb-onb-choice udb-onb-choice--no">
|
|
80
87
|
{labels.disagree}
|
|
81
88
|
</button>
|
|
89
|
+
|
|
82
90
|
<button type="button" onClick={onSwipeRight} className="udb-onb-choice udb-onb-choice--yes">
|
|
83
91
|
{labels.agree}
|
|
84
92
|
</button>
|
|
93
|
+
|
|
85
94
|
</div>
|
|
95
|
+
|
|
86
96
|
<p className="udb-onb-note" aria-live="polite">
|
|
87
97
|
{formatLabel(labels.countOfPattern, { current: index + 1, total })}
|
|
88
98
|
</p>
|
|
99
|
+
|
|
89
100
|
</div>
|
|
101
|
+
|
|
90
102
|
);
|
|
91
103
|
}
|
|
@@ -51,19 +51,28 @@ export function ValueDeliveryScreen<TResult = unknown>({
|
|
|
51
51
|
<div className="udb-onb-hero udb-onb-hero--lg" aria-hidden="true">
|
|
52
52
|
<Sparkles className="udb-onb-icon--lg" />
|
|
53
53
|
</div>
|
|
54
|
+
|
|
54
55
|
<h2 className="udb-onb-title udb-onb-title--display">{config.title}</h2>
|
|
56
|
+
|
|
55
57
|
<div className="udb-onb-result">
|
|
56
58
|
<pre className="udb-onb-result__pre">{JSON.stringify(config.result, null, 2)}</pre>
|
|
59
|
+
|
|
57
60
|
</div>
|
|
61
|
+
|
|
58
62
|
{config.shareConfig && (
|
|
59
63
|
<div className="udb-onb-share">
|
|
60
64
|
<Button variant="outline" size="sm" onClick={handleShare}>
|
|
61
65
|
{copied ? labels.copied : labels.share}
|
|
62
66
|
</Button>
|
|
67
|
+
|
|
63
68
|
<span>{config.shareConfig.text}</span>
|
|
69
|
+
|
|
64
70
|
</div>
|
|
71
|
+
|
|
65
72
|
)}
|
|
66
73
|
<PrimaryButton onClick={onNext}>{config.cta ?? labels.continueAction}</PrimaryButton>
|
|
74
|
+
|
|
67
75
|
</div>
|
|
76
|
+
|
|
68
77
|
);
|
|
69
78
|
}
|
|
@@ -18,15 +18,22 @@ export function WelcomeScreen({ config, onNext, isLoading }: WelcomeScreenProps)
|
|
|
18
18
|
<div className="udb-onb-hero udb-onb-hero--xl" aria-hidden="true">
|
|
19
19
|
{renderBundledIcon(config.heroIconName, 'udb-onb-icon--xl')}
|
|
20
20
|
</div>
|
|
21
|
+
|
|
21
22
|
)}
|
|
22
23
|
<div className="udb-onb-welcome__group">
|
|
23
24
|
{config.title && <h1 className="udb-onb-welcome__title">{config.title}</h1>}
|
|
25
|
+
|
|
24
26
|
{config.subtitle && <p className="udb-onb-welcome__subtitle">{config.subtitle}</p>}
|
|
27
|
+
|
|
25
28
|
{config.highlight && <p className="udb-onb-welcome__highlight">{config.highlight}</p>}
|
|
29
|
+
|
|
26
30
|
</div>
|
|
31
|
+
|
|
27
32
|
<PrimaryButton onClick={config.onCta ?? onNext} loading={isLoading}>
|
|
28
33
|
{config.cta ?? labels.continueAction}
|
|
29
34
|
</PrimaryButton>
|
|
35
|
+
|
|
30
36
|
</div>
|
|
37
|
+
|
|
31
38
|
);
|
|
32
39
|
}
|
|
@@ -48,7 +48,7 @@ describe('useOnboardingProgress — state machine (§1.1, §1.2)', () => {
|
|
|
48
48
|
act(() => result.current.prev());
|
|
49
49
|
expect(result.current.currentStep).toBe(1);
|
|
50
50
|
act(() => result.current.prev());
|
|
51
|
-
act(() => result.current.prev());
|
|
51
|
+
act(() => result.current.prev());
|
|
52
52
|
expect(result.current.currentStep).toBe(0);
|
|
53
53
|
});
|
|
54
54
|
|
|
@@ -72,7 +72,7 @@ describe('useOnboardingProgress — state machine (§1.1, §1.2)', () => {
|
|
|
72
72
|
useOnboardingProgress({ screens: makeScreens(2), ephemeral: true }),
|
|
73
73
|
);
|
|
74
74
|
act(() => result.current.next());
|
|
75
|
-
act(() => result.current.next());
|
|
75
|
+
act(() => result.current.next());
|
|
76
76
|
expect(result.current.isFinished).toBe(true);
|
|
77
77
|
expect(result.current.completedSteps).toEqual(['s0', 's1']);
|
|
78
78
|
});
|
|
@@ -87,7 +87,7 @@ describe('useOnboardingProgress — state machine (§1.1, §1.2)', () => {
|
|
|
87
87
|
expect(result.current.currentStep).toBe(0);
|
|
88
88
|
expect(result.current.completedSteps).toEqual([]);
|
|
89
89
|
expect(result.current.collected).toEqual({});
|
|
90
|
-
|
|
90
|
+
|
|
91
91
|
const stored = JSON.parse(localStorage.getItem('k') ?? 'null');
|
|
92
92
|
expect(stored).not.toBeNull();
|
|
93
93
|
expect(stored.currentStep).toBe(0);
|
|
@@ -129,8 +129,7 @@ describe('useOnboardingProgress — persistence (§1.4, §1.5, §1.6)', () => {
|
|
|
129
129
|
});
|
|
130
130
|
|
|
131
131
|
it('rehydration past the end of a shortened flow starts fresh', () => {
|
|
132
|
-
|
|
133
|
-
// out of bounds and must not be restored.
|
|
132
|
+
|
|
134
133
|
localStorage.setItem(
|
|
135
134
|
'short',
|
|
136
135
|
JSON.stringify({
|
|
@@ -5,7 +5,6 @@ export {
|
|
|
5
5
|
OnboardingIntlProvider,
|
|
6
6
|
OnboardingIntlContext,
|
|
7
7
|
useOnboardingIntl,
|
|
8
|
-
defaultOnboardingLabels,
|
|
9
8
|
formatLabel,
|
|
10
9
|
} from './components/OnboardingIntl';
|
|
11
10
|
export type { OnboardingIntl, OnboardingIntlProviderProps } from './components/OnboardingIntl';
|
|
@@ -54,17 +53,6 @@ export type {
|
|
|
54
53
|
UseOnboardingAnalyticsReturn,
|
|
55
54
|
} from './hooks';
|
|
56
55
|
|
|
57
|
-
export {
|
|
58
|
-
healthOnboardingTemplate,
|
|
59
|
-
artOnboardingTemplate,
|
|
60
|
-
videoOnboardingTemplate,
|
|
61
|
-
platformOnboardingTemplate,
|
|
62
|
-
withDefaultDemo,
|
|
63
|
-
defaultDemoResult,
|
|
64
|
-
TemplateDemoFallback,
|
|
65
|
-
} from './templates';
|
|
66
|
-
export type { TemplateDemoResult } from './templates';
|
|
67
|
-
|
|
68
56
|
export {
|
|
69
57
|
computeProgressFraction,
|
|
70
58
|
computeProgressPercentage,
|
|
@@ -45,7 +45,7 @@ describe('icon-name-resolves (§24.4)', () => {
|
|
|
45
45
|
expect(resolveIconByName('Infinity')).toBeTruthy();
|
|
46
46
|
});
|
|
47
47
|
|
|
48
|
-
it('resolves
|
|
48
|
+
it('resolves the curated icon set — including the video set', () => {
|
|
49
49
|
const templateIcons = [
|
|
50
50
|
'Activity', 'Apple', 'Award', 'Ban', 'Bell', 'BookOpen', 'Camera', 'Check',
|
|
51
51
|
'CheckCircle2', 'Download', 'Dumbbell', 'GraduationCap', 'Headphones',
|
|
@@ -40,7 +40,7 @@ export interface OnboardingConfig {
|
|
|
40
40
|
demo?: DemoConfig;
|
|
41
41
|
paywall?: PaywallScreenConfig;
|
|
42
42
|
analytics?: AnalyticsConfig;
|
|
43
|
-
labels
|
|
43
|
+
labels: OnboardingLabels;
|
|
44
44
|
locale?: string;
|
|
45
45
|
headerSlot?: ReactNode;
|
|
46
46
|
footerSlot?: ReactNode;
|
|
@@ -34,7 +34,7 @@ function dispatchToCustomTracker(
|
|
|
34
34
|
customTracker: ((e: OnboardingAnalyticsEvent) => void) | undefined,
|
|
35
35
|
): void {
|
|
36
36
|
if (typeof customTracker !== 'function') {
|
|
37
|
-
|
|
37
|
+
|
|
38
38
|
console.warn(
|
|
39
39
|
'[web-onboarding] analytics provider is "custom" but no customTracker was provided; event dropped:',
|
|
40
40
|
event.name,
|
|
@@ -57,7 +57,7 @@ export function dispatchAnalyticsEvent(
|
|
|
57
57
|
if (!provider) return;
|
|
58
58
|
dispatchToProvider(event, provider);
|
|
59
59
|
} catch (error) {
|
|
60
|
-
|
|
60
|
+
|
|
61
61
|
console.error('[web-onboarding] analytics dispatch failed; event dropped:', event.name, error);
|
|
62
62
|
}
|
|
63
63
|
}
|
|
@@ -40,9 +40,9 @@ describe('flow-structure-check (§23.1)', () => {
|
|
|
40
40
|
|
|
41
41
|
describe('screen-config-check (§23.2)', () => {
|
|
42
42
|
it('rejects malformed screens', () => {
|
|
43
|
-
// @ts-expect-error
|
|
43
|
+
// @ts-expect-error deliberately malformed input
|
|
44
44
|
expect(checkScreenConfig(null).ok).toBe(false);
|
|
45
|
-
// @ts-expect-error
|
|
45
|
+
// @ts-expect-error deliberately malformed input
|
|
46
46
|
expect(checkScreenConfig({ type: 'welcome' }).ok).toBe(false);
|
|
47
47
|
expect(checkScreenConfig({ id: '', type: 'welcome' } as OnboardingScreen).ok).toBe(false);
|
|
48
48
|
expect(
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { createContext, useCallback, useContext, useMemo, type ReactNode } from "react";
|
|
2
|
-
import { Lock } from "lucide-react";
|
|
3
|
-
import { useT } from "@umituz/web-localization/react";
|
|
4
2
|
import { hasPermission } from "./hasPermission";
|
|
5
|
-
import { PERMISSIONS_KEYS } from "./utils/i18nKeys";
|
|
6
3
|
import type { Permission, PermissionMatrix, RoleKey } from "./types";
|
|
7
4
|
|
|
8
5
|
export interface PermissionsProviderProps {
|
|
@@ -38,6 +35,7 @@ export const PermissionsProvider = ({
|
|
|
38
35
|
<PermissionsContext.Provider value={value}>
|
|
39
36
|
{children}
|
|
40
37
|
</PermissionsContext.Provider>
|
|
38
|
+
|
|
41
39
|
);
|
|
42
40
|
};
|
|
43
41
|
|
|
@@ -49,19 +47,6 @@ export const usePermissions = (): PermissionsContextValue => {
|
|
|
49
47
|
return context;
|
|
50
48
|
};
|
|
51
49
|
|
|
52
|
-
const ForbiddenFallback = () => {
|
|
53
|
-
const t = useT();
|
|
54
|
-
return (
|
|
55
|
-
<div className="udb-empty" role="alert">
|
|
56
|
-
<div className="udb-empty__icon">
|
|
57
|
-
<Lock className="udb-empty__glyph" aria-hidden="true" />
|
|
58
|
-
</div>
|
|
59
|
-
<p className="udb-empty__text">{t(PERMISSIONS_KEYS.forbidden.title)}</p>
|
|
60
|
-
<p className="udb-empty__hint">{t(PERMISSIONS_KEYS.forbidden.hint)}</p>
|
|
61
|
-
</div>
|
|
62
|
-
);
|
|
63
|
-
};
|
|
64
|
-
|
|
65
50
|
export interface RequirePermissionProps {
|
|
66
51
|
permission: Permission;
|
|
67
52
|
children: ReactNode;
|
|
@@ -71,11 +56,13 @@ export interface RequirePermissionProps {
|
|
|
71
56
|
export const RequirePermission = ({
|
|
72
57
|
permission,
|
|
73
58
|
children,
|
|
74
|
-
fallback,
|
|
59
|
+
fallback = null,
|
|
75
60
|
}: RequirePermissionProps) => {
|
|
76
61
|
const { can } = usePermissions();
|
|
77
62
|
if (can(permission)) return <>{children}</>;
|
|
78
|
-
|
|
63
|
+
|
|
64
|
+
return <>{fallback}</>;
|
|
65
|
+
|
|
79
66
|
};
|
|
80
67
|
|
|
81
68
|
export interface CanProps extends RequirePermissionProps {}
|
|
@@ -84,4 +71,5 @@ export const Can = ({ permission, children, fallback }: CanProps) => (
|
|
|
84
71
|
<RequirePermission permission={permission} fallback={fallback}>
|
|
85
72
|
{children}
|
|
86
73
|
</RequirePermission>
|
|
74
|
+
|
|
87
75
|
);
|
|
@@ -29,7 +29,7 @@ describe('searchItems', () => {
|
|
|
29
29
|
});
|
|
30
30
|
|
|
31
31
|
it('ranks title matches above body-only matches', () => {
|
|
32
|
-
|
|
32
|
+
|
|
33
33
|
const hits = searchItems(COURSES, 'present', toHit);
|
|
34
34
|
expect(hits[0]?.id).toBe('c1');
|
|
35
35
|
expect(hits).toHaveLength(2);
|
|
@@ -6,9 +6,6 @@ export interface SearchHit {
|
|
|
6
6
|
to: string;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
/** Case-insensitive substring scoring across a haystack of fields.
|
|
10
|
-
* Title matches weigh 3×; every additional field hit adds 1. Empty
|
|
11
|
-
* queries return no hits. Results are sorted by descending score. */
|
|
12
9
|
export function searchItems<T extends object>(
|
|
13
10
|
items: readonly T[],
|
|
14
11
|
query: string,
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { ScrollText } from "lucide-react";
|
|
2
|
-
import { useT } from "@umituz/web-localization/react";
|
|
3
|
-
import { SETTINGS_ADMIN_KEYS } from "../utils/i18nKeys";
|
|
4
2
|
|
|
5
3
|
export interface AuditEntry {
|
|
6
4
|
id: string;
|
|
@@ -12,24 +10,27 @@ export interface AuditEntry {
|
|
|
12
10
|
|
|
13
11
|
export interface AuditLogListProps {
|
|
14
12
|
entries: AuditEntry[];
|
|
13
|
+
emptyLabel: string;
|
|
14
|
+
formatAt?: (iso: string) => string;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
const
|
|
17
|
+
const defaultFormatAt = (iso: string): string => {
|
|
18
18
|
const date = new Date(iso);
|
|
19
19
|
return Number.isNaN(date.getTime()) ? iso : date.toISOString().slice(0, 16).replace("T", " ");
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
-
export const AuditLogList = ({ entries }: AuditLogListProps) => {
|
|
23
|
-
const t = useT();
|
|
24
|
-
|
|
22
|
+
export const AuditLogList = ({ entries, emptyLabel, formatAt = defaultFormatAt }: AuditLogListProps) => {
|
|
25
23
|
if (entries.length === 0) {
|
|
26
24
|
return (
|
|
27
25
|
<div className="udb-empty">
|
|
28
26
|
<div className="udb-empty__icon">
|
|
29
27
|
<ScrollText className="udb-empty__glyph" aria-hidden="true" />
|
|
30
28
|
</div>
|
|
31
|
-
|
|
29
|
+
|
|
30
|
+
<p className="udb-empty__text">{emptyLabel}</p>
|
|
31
|
+
|
|
32
32
|
</div>
|
|
33
|
+
|
|
33
34
|
);
|
|
34
35
|
}
|
|
35
36
|
|
|
@@ -38,12 +39,18 @@ export const AuditLogList = ({ entries }: AuditLogListProps) => {
|
|
|
38
39
|
{entries.map((entry) => (
|
|
39
40
|
<li key={entry.id} className="udb-audit__item">
|
|
40
41
|
<span className="udb-audit__at">{formatAt(entry.at)}</span>
|
|
42
|
+
|
|
41
43
|
<span className="udb-audit__actor">{entry.actor}</span>
|
|
44
|
+
|
|
42
45
|
<span className="udb-audit__action">{entry.action}</span>
|
|
46
|
+
|
|
43
47
|
{entry.target && <span className="udb-audit__target">{entry.target}</span>}
|
|
48
|
+
|
|
44
49
|
</li>
|
|
50
|
+
|
|
45
51
|
))}
|
|
46
52
|
</ul>
|
|
53
|
+
|
|
47
54
|
);
|
|
48
55
|
};
|
|
49
56
|
|
|
@@ -29,13 +29,17 @@ export const PermissionMatrixScreen = ({
|
|
|
29
29
|
<th key={permission} className="udb-table__th udb-table__th--code">
|
|
30
30
|
{permission}
|
|
31
31
|
</th>
|
|
32
|
+
|
|
32
33
|
))}
|
|
33
34
|
</tr>
|
|
35
|
+
|
|
34
36
|
</thead>
|
|
37
|
+
|
|
35
38
|
<tbody>
|
|
36
39
|
{roles.map((role) => (
|
|
37
40
|
<tr key={role.key} className="udb-table__row">
|
|
38
41
|
<td className="udb-table__td udb-table__td--strong">{role.label}</td>
|
|
42
|
+
|
|
39
43
|
{permissions.map((permission) => {
|
|
40
44
|
const granted = hasPermission(matrix, role.key, permission);
|
|
41
45
|
const cell = granted ? (
|
|
@@ -57,17 +61,23 @@ export const PermissionMatrixScreen = ({
|
|
|
57
61
|
>
|
|
58
62
|
{cell}
|
|
59
63
|
</button>
|
|
64
|
+
|
|
60
65
|
) : (
|
|
61
66
|
cell
|
|
62
67
|
)}
|
|
63
68
|
</td>
|
|
69
|
+
|
|
64
70
|
);
|
|
65
71
|
})}
|
|
66
72
|
</tr>
|
|
73
|
+
|
|
67
74
|
))}
|
|
68
75
|
</tbody>
|
|
76
|
+
|
|
69
77
|
</table>
|
|
78
|
+
|
|
70
79
|
</div>
|
|
80
|
+
|
|
71
81
|
);
|
|
72
82
|
|
|
73
83
|
export default PermissionMatrixScreen;
|
|
@@ -3,15 +3,17 @@ import { Outlet, useLocation, useNavigate } from "react-router";
|
|
|
3
3
|
import { Skeleton, Button } from "@umituz/web-design-system/atoms";
|
|
4
4
|
import { ChevronLeft, Menu } from "lucide-react";
|
|
5
5
|
import { SettingsSection } from "./SettingsSection";
|
|
6
|
-
import type { SettingsConfig } from "../types/settings";
|
|
6
|
+
import type { SettingsConfig, SettingsLayoutLabels } from "../types/settings";
|
|
7
7
|
|
|
8
8
|
interface SettingsLayoutProps {
|
|
9
9
|
config: SettingsConfig;
|
|
10
|
+
labels: SettingsLayoutLabels;
|
|
10
11
|
routeTransitionMs?: number;
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
export const SettingsLayout = ({
|
|
14
15
|
config,
|
|
16
|
+
labels,
|
|
15
17
|
routeTransitionMs = 0,
|
|
16
18
|
}: SettingsLayoutProps) => {
|
|
17
19
|
const location = useLocation();
|
|
@@ -41,13 +43,14 @@ export const SettingsLayout = ({
|
|
|
41
43
|
<h2 className="udb-settings__sidebar-title">
|
|
42
44
|
{config.brandName}
|
|
43
45
|
</h2>
|
|
46
|
+
|
|
44
47
|
)}
|
|
45
48
|
<Button
|
|
46
49
|
variant="ghost"
|
|
47
50
|
size="icon"
|
|
48
51
|
onClick={onMenuClick}
|
|
49
52
|
className="udb-settings__sidebar-toggle"
|
|
50
|
-
aria-label={showMenuButton ?
|
|
53
|
+
aria-label={showMenuButton ? labels.openSidebar : labels.toggleSidebar}
|
|
51
54
|
>
|
|
52
55
|
{showMenuButton ? (
|
|
53
56
|
<Menu className="udb-settings__toggle-icon" />
|
|
@@ -57,7 +60,9 @@ export const SettingsLayout = ({
|
|
|
57
60
|
<ChevronLeft className="udb-settings__toggle-icon" />
|
|
58
61
|
)}
|
|
59
62
|
</Button>
|
|
63
|
+
|
|
60
64
|
</div>
|
|
65
|
+
|
|
61
66
|
);
|
|
62
67
|
|
|
63
68
|
return (
|
|
@@ -75,6 +80,7 @@ export const SettingsLayout = ({
|
|
|
75
80
|
/>
|
|
76
81
|
))}
|
|
77
82
|
</nav>
|
|
83
|
+
|
|
78
84
|
</aside>
|
|
79
85
|
|
|
80
86
|
{mobileOpen && (
|
|
@@ -96,8 +102,11 @@ export const SettingsLayout = ({
|
|
|
96
102
|
/>
|
|
97
103
|
))}
|
|
98
104
|
</nav>
|
|
105
|
+
|
|
99
106
|
</aside>
|
|
107
|
+
|
|
100
108
|
</div>
|
|
109
|
+
|
|
101
110
|
)}
|
|
102
111
|
|
|
103
112
|
<div className="udb-settings__main">
|
|
@@ -107,14 +116,17 @@ export const SettingsLayout = ({
|
|
|
107
116
|
variant="ghost"
|
|
108
117
|
size="icon"
|
|
109
118
|
onClick={() => setMobileOpen(true)}
|
|
110
|
-
aria-label=
|
|
119
|
+
aria-label={labels.openMobileMenu}
|
|
111
120
|
>
|
|
112
121
|
<Menu className="udb-settings__toggle-icon-lg" />
|
|
113
122
|
</Button>
|
|
123
|
+
|
|
114
124
|
<h2 className="udb-settings__mobile-title">
|
|
115
125
|
{config.brandName}
|
|
116
126
|
</h2>
|
|
127
|
+
|
|
117
128
|
</div>
|
|
129
|
+
|
|
118
130
|
</header>
|
|
119
131
|
|
|
120
132
|
<main className="udb-settings__content">
|
|
@@ -126,13 +138,18 @@ export const SettingsLayout = ({
|
|
|
126
138
|
<Skeleton key={i} className="udb-settings__skeleton-row" />
|
|
127
139
|
))}
|
|
128
140
|
</div>
|
|
141
|
+
|
|
129
142
|
</div>
|
|
143
|
+
|
|
130
144
|
) : (
|
|
131
145
|
<Outlet />
|
|
132
146
|
)}
|
|
133
147
|
</main>
|
|
148
|
+
|
|
134
149
|
</div>
|
|
150
|
+
|
|
135
151
|
</div>
|
|
152
|
+
|
|
136
153
|
);
|
|
137
154
|
};
|
|
138
155
|
|
|
@@ -30,6 +30,7 @@ export const SettingsSection = ({
|
|
|
30
30
|
<h3 className="udb-settings-nav__title">
|
|
31
31
|
{section.title}
|
|
32
32
|
</h3>
|
|
33
|
+
|
|
33
34
|
)}
|
|
34
35
|
|
|
35
36
|
<div className="udb-settings-nav__items">
|
|
@@ -49,13 +50,12 @@ export const SettingsSection = ({
|
|
|
49
50
|
{!collapsed && (
|
|
50
51
|
<>
|
|
51
52
|
<span className="udb-settings-nav__item-label">{item.label}</span>
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
>
|
|
57
|
-
{item.badge > 99 ? "99+" : item.badge}
|
|
53
|
+
|
|
54
|
+
{item.badge !== undefined && item.badge !== "" && item.badge !== 0 && (
|
|
55
|
+
<span className="udb-settings-nav__badge">
|
|
56
|
+
{item.badge}
|
|
58
57
|
</span>
|
|
58
|
+
|
|
59
59
|
)}
|
|
60
60
|
{item.path && (
|
|
61
61
|
<ChevronRight
|
|
@@ -64,8 +64,10 @@ export const SettingsSection = ({
|
|
|
64
64
|
/>
|
|
65
65
|
)}
|
|
66
66
|
</>
|
|
67
|
+
|
|
67
68
|
)}
|
|
68
69
|
</>
|
|
70
|
+
|
|
69
71
|
);
|
|
70
72
|
|
|
71
73
|
const itemClassName = cn(
|
|
@@ -85,6 +87,7 @@ export const SettingsSection = ({
|
|
|
85
87
|
>
|
|
86
88
|
{itemContent}
|
|
87
89
|
</Link>
|
|
90
|
+
|
|
88
91
|
);
|
|
89
92
|
}
|
|
90
93
|
|
|
@@ -99,9 +102,12 @@ export const SettingsSection = ({
|
|
|
99
102
|
>
|
|
100
103
|
{itemContent}
|
|
101
104
|
</button>
|
|
105
|
+
|
|
102
106
|
);
|
|
103
107
|
})}
|
|
104
108
|
</div>
|
|
109
|
+
|
|
105
110
|
</div>
|
|
111
|
+
|
|
106
112
|
);
|
|
107
113
|
};
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { DataTable, type Column } from "@umituz/web-design-system/organisms";
|
|
2
|
-
import { useT } from "@umituz/web-localization/react";
|
|
3
|
-
import { SETTINGS_ADMIN_KEYS } from "../utils/i18nKeys";
|
|
4
2
|
import type { RoleKey, RoleInfo } from "../../permissions/types";
|
|
5
3
|
|
|
6
4
|
export interface ManagedUser {
|
|
@@ -11,39 +9,48 @@ export interface ManagedUser {
|
|
|
11
9
|
status?: string;
|
|
12
10
|
}
|
|
13
11
|
|
|
12
|
+
export interface UserManagementTableLabels {
|
|
13
|
+
nameColumn: string;
|
|
14
|
+
emailColumn: string;
|
|
15
|
+
roleColumn: string;
|
|
16
|
+
empty: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
14
19
|
export interface UserManagementTableProps {
|
|
15
20
|
users: ManagedUser[];
|
|
16
21
|
roles: RoleInfo[];
|
|
22
|
+
labels: UserManagementTableLabels;
|
|
17
23
|
onRoleChange?: (userId: string, role: RoleKey) => void;
|
|
18
24
|
}
|
|
19
25
|
|
|
20
26
|
export const UserManagementTable = ({
|
|
21
27
|
users,
|
|
22
28
|
roles,
|
|
29
|
+
labels,
|
|
23
30
|
onRoleChange,
|
|
24
31
|
}: UserManagementTableProps) => {
|
|
25
|
-
const t = useT();
|
|
26
|
-
|
|
27
32
|
const columns: Column<ManagedUser>[] = [
|
|
28
|
-
{ id: "name", header:
|
|
29
|
-
{ id: "email", header:
|
|
33
|
+
{ id: "name", header: labels.nameColumn, accessor: "name" },
|
|
34
|
+
{ id: "email", header: labels.emailColumn, accessor: "email" },
|
|
30
35
|
{
|
|
31
36
|
id: "role",
|
|
32
|
-
header:
|
|
37
|
+
header: labels.roleColumn,
|
|
33
38
|
accessor: (user) =>
|
|
34
39
|
onRoleChange ? (
|
|
35
40
|
<select
|
|
36
41
|
className="udb-period-select__select"
|
|
37
42
|
value={user.role}
|
|
38
|
-
aria-label={
|
|
43
|
+
aria-label={labels.roleColumn}
|
|
39
44
|
onChange={(e) => onRoleChange(user.id, e.target.value as RoleKey)}
|
|
40
45
|
>
|
|
41
46
|
{roles.map((role) => (
|
|
42
47
|
<option key={role.key} value={role.key}>
|
|
43
48
|
{role.label}
|
|
44
49
|
</option>
|
|
50
|
+
|
|
45
51
|
))}
|
|
46
52
|
</select>
|
|
53
|
+
|
|
47
54
|
) : (
|
|
48
55
|
roles.find((role) => role.key === user.role)?.label ?? user.role
|
|
49
56
|
),
|
|
@@ -54,7 +61,7 @@ export const UserManagementTable = ({
|
|
|
54
61
|
<DataTable
|
|
55
62
|
data={users}
|
|
56
63
|
columns={columns}
|
|
57
|
-
emptyState={{ title:
|
|
64
|
+
emptyState={{ title: labels.empty }}
|
|
58
65
|
/>
|
|
59
66
|
);
|
|
60
67
|
};
|
|
@@ -9,7 +9,7 @@ export interface SettingsItem {
|
|
|
9
9
|
onClick?: () => void;
|
|
10
10
|
enabled?: boolean;
|
|
11
11
|
permission?: string;
|
|
12
|
-
badge?: number;
|
|
12
|
+
badge?: string | number;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export interface SettingsSection {
|
|
@@ -37,3 +37,9 @@ export interface SettingsSectionProps {
|
|
|
37
37
|
onNavigate?: (path: string) => void;
|
|
38
38
|
collapsed?: boolean;
|
|
39
39
|
}
|
|
40
|
+
|
|
41
|
+
export interface SettingsLayoutLabels {
|
|
42
|
+
openSidebar: string;
|
|
43
|
+
toggleSidebar: string;
|
|
44
|
+
openMobileMenu: string;
|
|
45
|
+
}
|