@donotdev/ui 0.3.0 → 0.3.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/dist/components/auth/AuthHeader.js +1 -93
- package/dist/components/auth/AuthMenu.d.ts.map +1 -1
- package/dist/components/auth/AuthMenu.js +3 -286
- package/dist/components/auth/index.js +1 -9
- package/dist/components/common/FeatureCard.d.ts.map +1 -1
- package/dist/components/common/FeatureCard.js +1 -86
- package/dist/components/common/FeatureDisabled.js +1 -67
- package/dist/components/common/IconPlaceholder.d.ts +24 -0
- package/dist/components/common/IconPlaceholder.d.ts.map +1 -0
- package/dist/components/common/IconPlaceholder.js +1 -0
- package/dist/components/common/LazyLucideIcon.d.ts +39 -0
- package/dist/components/common/LazyLucideIcon.d.ts.map +1 -0
- package/dist/components/common/LazyLucideIcon.js +1 -0
- package/dist/components/common/ProgressBar.js +1 -84
- package/dist/components/common/RedirectOverlay.js +1 -243
- package/dist/components/common/Skeleton.js +1 -144
- package/dist/components/common/TechBento.d.ts.map +1 -1
- package/dist/components/common/TechBento.js +1 -53
- package/dist/components/common/icon.d.ts +1 -1
- package/dist/components/common/icon.d.ts.map +1 -1
- package/dist/components/common/icon.js +1 -84
- package/dist/components/common/iconByName.d.ts +33 -0
- package/dist/components/common/iconByName.d.ts.map +1 -0
- package/dist/components/common/iconByName.js +1 -0
- package/dist/components/common/index.js +1 -16
- package/dist/components/cookie-consent/ConsentBanner.d.ts +3 -1
- package/dist/components/cookie-consent/ConsentBanner.d.ts.map +1 -1
- package/dist/components/cookie-consent/ConsentBanner.js +1 -31
- package/dist/components/cookie-consent/CookieConsent.d.ts.map +1 -1
- package/dist/components/cookie-consent/CookieConsent.js +1 -183
- package/dist/components/cookie-consent/index.js +1 -11
- package/dist/components/cookie-consent/useCookieNoticeRequired.d.ts +7 -0
- package/dist/components/cookie-consent/useCookieNoticeRequired.d.ts.map +1 -0
- package/dist/components/cookie-consent/useCookieNoticeRequired.js +1 -0
- package/dist/components/index.js +1 -13
- package/dist/components/layout/GameContainer.d.ts.map +1 -1
- package/dist/components/layout/GameContainer.js +1 -72
- package/dist/components/layout/GameFlow.d.ts.map +1 -1
- package/dist/components/layout/GameFlow.js +1 -93
- package/dist/components/layout/PageConfig.d.ts.map +1 -1
- package/dist/components/layout/PageConfig.js +1 -47
- package/dist/components/layout/PageContainer.d.ts.map +1 -1
- package/dist/components/layout/PageContainer.js +1 -38
- package/dist/components/layout/components/Breadcrumbs.d.ts +2 -1
- package/dist/components/layout/components/Breadcrumbs.d.ts.map +1 -1
- package/dist/components/layout/components/Breadcrumbs.js +1 -89
- package/dist/components/layout/components/DropdownNavigation.d.ts.map +1 -1
- package/dist/components/layout/components/DropdownNavigation.js +1 -30
- package/dist/components/layout/components/FloatingLanguageSwitcher.d.ts.map +1 -1
- package/dist/components/layout/components/FloatingLanguageSwitcher.js +1 -26
- package/dist/components/layout/components/Notifications.js +1 -182
- package/dist/components/layout/components/header/AppBranding.d.ts.map +1 -1
- package/dist/components/layout/components/header/AppBranding.js +1 -54
- package/dist/components/layout/components/header/AppIcon.d.ts.map +1 -1
- package/dist/components/layout/components/header/AppIcon.js +1 -59
- package/dist/components/layout/components/header/AppTitle.d.ts.map +1 -1
- package/dist/components/layout/components/header/AppTitle.js +1 -40
- package/dist/components/layout/components/header/CacheSettings.js +1 -225
- package/dist/components/layout/components/header/GameTitle.d.ts.map +1 -1
- package/dist/components/layout/components/header/GameTitle.js +1 -66
- package/dist/components/layout/components/header/HeaderMenu.d.ts +17 -16
- package/dist/components/layout/components/header/HeaderMenu.d.ts.map +1 -1
- package/dist/components/layout/components/header/HeaderMenu.js +1 -47
- package/dist/components/layout/components/header/HeaderNavigation.d.ts.map +1 -1
- package/dist/components/layout/components/header/HeaderNavigation.js +1 -66
- package/dist/components/layout/components/header/SettingsMenu.d.ts.map +1 -1
- package/dist/components/layout/components/header/SettingsMenu.js +1 -85
- package/dist/components/layout/components/header/ThemeToggle.d.ts.map +1 -1
- package/dist/components/layout/components/header/ThemeToggle.js +1 -93
- package/dist/components/layout/components/index.js +1 -25
- package/dist/components/layout/index.js +1 -14
- package/dist/crud/components/ChildRowsPicker.js +1 -68
- package/dist/crud/components/CrudCardLink.js +1 -14
- package/dist/crud/components/EntityCardList.js +1 -184
- package/dist/crud/components/EntityDisplayRenderer.js +1 -130
- package/dist/crud/components/EntityFormRenderer.js +1 -433
- package/dist/crud/components/EntityList.js +1 -521
- package/dist/crud/components/EntityRecommendations.js +1 -87
- package/dist/crud/components/EntityWorkflow.js +1 -55
- package/dist/crud/components/Form.d.ts.map +1 -1
- package/dist/crud/components/Form.js +1 -198
- package/dist/crud/components/cellEditFor.js +1 -74
- package/dist/crud/components/entityParent.js +1 -76
- package/dist/crud/components/index.js +1 -16
- package/dist/crud/components/useRecordBreadcrumb.d.ts.map +1 -1
- package/dist/crud/components/useRecordBreadcrumb.js +1 -43
- package/dist/crud/crudImports.js +1 -51
- package/dist/crud/index.js +1 -11
- package/dist/data/techLogos.js +1 -99
- package/dist/dndev-next.css +104 -17
- package/dist/dndev.css +104 -17
- package/dist/index.js +1 -5
- package/dist/internal/common/DnDevErrorBoundary.js +1 -55
- package/dist/internal/common/ErrorFallback.js +3 -214
- package/dist/internal/common/GlobalErrorFallback.js +1 -45
- package/dist/internal/common/RouteErrorFallback.js +3 -140
- package/dist/internal/devtools/DebugTools.js +1 -131
- package/dist/internal/devtools/components/AuthDebugButton.js +1 -72
- package/dist/internal/devtools/components/ConfigTab.js +1 -61
- package/dist/internal/devtools/components/CookieTab.js +1 -156
- package/dist/internal/devtools/components/DebugDialog.js +1 -48
- package/dist/internal/devtools/components/DesignTab.js +1 -469
- package/dist/internal/devtools/components/LayoutReset.js +1 -214
- package/dist/internal/devtools/components/MaskedValue.js +1 -39
- package/dist/internal/devtools/components/StoresTab.js +1 -90
- package/dist/internal/devtools/components/index.js +1 -16
- package/dist/internal/devtools/index.js +1 -13
- package/dist/internal/devtools/types.js +0 -2
- package/dist/internal/devtools/utils/envVarDiscovery.js +1 -106
- package/dist/internal/devtools/utils/index.js +1 -12
- package/dist/internal/devtools/utils/maskSensitive.js +1 -59
- package/dist/internal/devtools/utils/virtualModuleInspector.js +1 -309
- package/dist/internal/initializers/BaseStoresInitializer.js +1 -367
- package/dist/internal/initializers/NextJsStoresInitializer.js +1 -78
- package/dist/internal/initializers/ViteStoresInitializer.js +1 -20
- package/dist/internal/initializers/index.js +1 -11
- package/dist/internal/layout/DnDevLayout.js +1 -321
- package/dist/internal/layout/components/AutoMetaTags.d.ts +2 -0
- package/dist/internal/layout/components/AutoMetaTags.d.ts.map +1 -1
- package/dist/internal/layout/components/AutoMetaTags.js +1 -338
- package/dist/internal/layout/components/FaviconHead.js +1 -60
- package/dist/internal/layout/components/FontPreloadLinks.js +1 -31
- package/dist/internal/layout/components/HeadTags.js +1 -20
- package/dist/internal/layout/components/PWAUpdateNotification.js +1 -131
- package/dist/internal/layout/components/footer/FooterBranding.d.ts.map +1 -1
- package/dist/internal/layout/components/footer/FooterBranding.js +1 -35
- package/dist/internal/layout/components/footer/FooterCopyright.d.ts.map +1 -1
- package/dist/internal/layout/components/footer/FooterCopyright.js +1 -37
- package/dist/internal/layout/components/footer/FooterLegalLinks.d.ts.map +1 -1
- package/dist/internal/layout/components/footer/FooterLegalLinks.js +1 -44
- package/dist/internal/layout/components/footer/useLegalLinks.d.ts +4 -2
- package/dist/internal/layout/components/footer/useLegalLinks.d.ts.map +1 -1
- package/dist/internal/layout/components/footer/useLegalLinks.js +1 -21
- package/dist/internal/layout/components/i18nSeoMeta.js +1 -53
- package/dist/internal/layout/components/index.js +1 -13
- package/dist/internal/layout/config/defaults.js +1 -47
- package/dist/internal/layout/config/index.js +1 -11
- package/dist/internal/layout/config/presets/admin.js +1 -35
- package/dist/internal/layout/config/presets/blog.js +1 -31
- package/dist/internal/layout/config/presets/docs.js +1 -51
- package/dist/internal/layout/config/presets/game.js +1 -53
- package/dist/internal/layout/config/presets/index.js +1 -24
- package/dist/internal/layout/config/presets/landing.js +1 -42
- package/dist/internal/layout/config/presets/moolti.js +1 -52
- package/dist/internal/layout/config/presets/plain.js +1 -25
- package/dist/internal/layout/renderers/index.js +0 -10
- package/dist/internal/layout/zones/DnDevFooter.d.ts.map +1 -1
- package/dist/internal/layout/zones/DnDevFooter.js +1 -67
- package/dist/internal/layout/zones/DnDevHeader.js +1 -41
- package/dist/internal/layout/zones/DnDevMergedBar.d.ts.map +1 -1
- package/dist/internal/layout/zones/DnDevMergedBar.js +1 -52
- package/dist/internal/layout/zones/DnDevSidebar.d.ts.map +1 -1
- package/dist/internal/layout/zones/DnDevSidebar.js +1 -181
- package/dist/internal/layout/zones/index.js +1 -14
- package/dist/internal/providers/NavigationProvider.d.ts.map +1 -1
- package/dist/internal/providers/NavigationProvider.js +1 -71
- package/dist/internal/providers/SentryInitializer.d.ts.map +1 -1
- package/dist/internal/providers/SentryInitializer.js +1 -36
- package/dist/internal/providers/UIProviders.js +1 -79
- package/dist/internal/providers/index.js +1 -12
- package/dist/next.js +1 -11
- package/dist/providers/NextJsAppProviders.d.ts.map +1 -1
- package/dist/providers/NextJsAppProviders.js +1 -107
- package/dist/providers/ViteAppProviders.d.ts.map +1 -1
- package/dist/providers/ViteAppProviders.js +1 -117
- package/dist/providers/index.js +1 -11
- package/dist/routing/404.js +1 -108
- package/dist/routing/AuthGuard.js +1 -178
- package/dist/routing/AuthGuardFallback.d.ts.map +1 -1
- package/dist/routing/AuthGuardFallback.js +1 -67
- package/dist/routing/AuthReturnTo.js +1 -68
- package/dist/routing/DnDevNavigationMenu.d.ts.map +1 -1
- package/dist/routing/DnDevNavigationMenu.js +1 -138
- package/dist/routing/GoTo.d.ts.map +1 -1
- package/dist/routing/GoTo.js +1 -38
- package/dist/routing/GoToDialog.d.ts.map +1 -1
- package/dist/routing/GoToDialog.js +1 -97
- package/dist/routing/GoToInput.d.ts.map +1 -1
- package/dist/routing/GoToInput.js +1 -49
- package/dist/routing/GoToWrapper.d.ts.map +1 -1
- package/dist/routing/GoToWrapper.js +1 -59
- package/dist/routing/Link.d.ts +10 -2
- package/dist/routing/Link.d.ts.map +1 -1
- package/dist/routing/Link.js +1 -109
- package/dist/routing/NavigationItem.d.ts.map +1 -1
- package/dist/routing/NavigationItem.js +1 -44
- package/dist/routing/NotFoundDocument.d.ts +33 -0
- package/dist/routing/NotFoundDocument.d.ts.map +1 -0
- package/dist/routing/NotFoundDocument.js +1 -0
- package/dist/routing/SignedInRedirect.js +1 -47
- package/dist/routing/hooks/hooks.vite.js +1 -1
- package/dist/routing/hooks/index.js +1 -26
- package/dist/routing/hooks/types.js +0 -2
- package/dist/routing/hooks/useLocation.next.js +1 -35
- package/dist/routing/hooks/useLocation.vite.js +1 -13
- package/dist/routing/hooks/useMatch.next.js +1 -31
- package/dist/routing/hooks/useMatch.vite.js +1 -6
- package/dist/routing/hooks/useNavigate.next.js +1 -64
- package/dist/routing/hooks/useNavigate.vite.js +1 -61
- package/dist/routing/hooks/useParams.next.js +1 -9
- package/dist/routing/hooks/useParams.vite.js +1 -6
- package/dist/routing/hooks/useQueryParams.next.js +1 -66
- package/dist/routing/hooks/useQueryParams.vite.js +1 -66
- package/dist/routing/hooks/useRedirectGuard.next.js +1 -119
- package/dist/routing/hooks/useRedirectGuard.vite.js +1 -117
- package/dist/routing/hooks/useRouteParam.next.js +1 -38
- package/dist/routing/hooks/useRouteParam.vite.js +1 -38
- package/dist/routing/hooks/useRoutePath.next.js +1 -36
- package/dist/routing/hooks/useRoutePath.vite.js +1 -25
- package/dist/routing/hooks/useSearchParams.next.js +1 -22
- package/dist/routing/hooks/useSearchParams.vite.js +1 -22
- package/dist/routing/hooks/useUrlLanguage.next.js +1 -50
- package/dist/routing/hooks/useUrlLanguage.vite.js +1 -41
- package/dist/routing/index.d.ts +1 -0
- package/dist/routing/index.d.ts.map +1 -1
- package/dist/routing/index.js +1 -32
- package/dist/routing/link/InternalLink.next.d.ts +23 -0
- package/dist/routing/link/InternalLink.next.d.ts.map +1 -0
- package/dist/routing/link/InternalLink.next.js +1 -0
- package/dist/routing/link/InternalLink.vite.d.ts +22 -0
- package/dist/routing/link/InternalLink.vite.d.ts.map +1 -0
- package/dist/routing/link/InternalLink.vite.js +1 -0
- package/dist/routing/link/absolutePath.d.ts +17 -0
- package/dist/routing/link/absolutePath.d.ts.map +1 -0
- package/dist/routing/link/absolutePath.js +1 -0
- package/dist/routing/link/link.next.d.ts +12 -0
- package/dist/routing/link/link.next.d.ts.map +1 -0
- package/dist/routing/link/link.next.js +1 -0
- package/dist/routing/link/link.vite.d.ts +12 -0
- package/dist/routing/link/link.vite.d.ts.map +1 -0
- package/dist/routing/link/link.vite.js +1 -0
- package/dist/routing/link/types.d.ts +30 -0
- package/dist/routing/link/types.d.ts.map +1 -0
- package/dist/routing/link/types.js +0 -0
- package/dist/routing/parentRoute.js +1 -43
- package/dist/routing/useGoTo.d.ts.map +1 -1
- package/dist/routing/useGoTo.js +1 -59
- package/dist/routing/useNavigation.d.ts.map +1 -1
- package/dist/routing/useNavigation.js +1 -114
- package/dist/routing/useRouteDiscovery.d.ts +1 -0
- package/dist/routing/useRouteDiscovery.d.ts.map +1 -1
- package/dist/routing/useRouteDiscovery.js +1 -313
- package/dist/rsc.d.ts +28 -0
- package/dist/rsc.d.ts.map +1 -0
- package/dist/rsc.js +1 -0
- package/dist/styles/index.css +104 -17
- package/dist/styles/index.js +1 -10
- package/dist/styles/layoutConstants.js +1 -134
- package/dist/symbol-index.json +1 -1
- package/dist/utils/assetResolver.d.ts.map +1 -1
- package/dist/utils/assetResolver.js +1 -297
- package/dist/utils/index.js +1 -23
- package/dist/utils/sanitizeSvg.js +1 -51
- package/dist/utils/tList.js +1 -42
- package/dist/utils/useAISafe.d.ts.map +1 -1
- package/dist/utils/useAISafe.js +1 -53
- package/dist/utils/useAuthSafe.d.ts.map +1 -1
- package/dist/utils/useAuthSafe.js +1 -78
- package/dist/utils/useAuthVisibility.d.ts.map +1 -1
- package/dist/utils/useAuthVisibility.js +1 -63
- package/dist/utils/useBillingVisibility.d.ts.map +1 -1
- package/dist/utils/useBillingVisibility.js +1 -57
- package/dist/utils/useCrudSafe.d.ts.map +1 -1
- package/dist/utils/useCrudSafe.js +1 -75
- package/dist/utils/useDeleteAccountSafe.js +1 -52
- package/dist/utils/useFormStoreSafe.d.ts.map +1 -1
- package/dist/utils/useFormStoreSafe.js +1 -85
- package/dist/utils/useOAuthSafe.d.ts.map +1 -1
- package/dist/utils/useOAuthSafe.js +1 -38
- package/dist/utils/useSeo.js +1 -151
- package/dist/utils/useStripeBillingSafe.d.ts.map +1 -1
- package/dist/utils/useStripeBillingSafe.js +1 -81
- package/dist/vite-routing/AppRoutes.d.ts.map +1 -1
- package/dist/vite-routing/AppRoutes.js +1 -235
- package/dist/vite-routing/RootLayout.d.ts.map +1 -1
- package/dist/vite-routing/RootLayout.js +1 -205
- package/dist/vite-routing/index.js +1 -11
- package/dist/vite.js +1 -10
- package/guidelines/COMPONENTS.md +4 -4
- package/guidelines/PAGES.md +3 -0
- package/guidelines/ROUTING.md +15 -0
- package/guidelines/SEO.md +4 -1
- package/package.json +18 -8
- package/dist/ChildRowsPicker-63M4EQUQ.js +0 -1
- package/dist/ChildRowsPicker-ISP365ON.js +0 -1
- package/dist/ChildRowsPicker-PQFE6NCR.js +0 -1
- package/dist/ChildRowsPicker-XXFFSMWY.js +0 -1
- package/dist/CookieConsent-QOUAY6B4.js +0 -1
- package/dist/GoToDialog-KSBGOIWO.js +0 -1
- package/dist/GoToDialog-XBK5EZF4.js +0 -1
- package/dist/chunk-3CIZFGST.js +0 -1
- package/dist/chunk-LHMKU342.js +0 -1
- package/dist/chunk-MS7ZIW5Z.js +0 -1
- package/dist/chunk-O2XFH626.js +0 -1
- package/dist/chunk-P2DHZWPY.js +0 -1
- package/dist/components/common/lucideIconByName.d.ts +0 -9
- package/dist/components/common/lucideIconByName.d.ts.map +0 -1
- package/dist/components/common/lucideIconByName.js +0 -32
- package/dist/internal/layout/components/PerformanceHints.d.ts +0 -71
- package/dist/internal/layout/components/PerformanceHints.d.ts.map +0 -1
- package/dist/internal/layout/components/PerformanceHints.js +0 -71
|
@@ -1,214 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @fileoverview Shared Error Fallback Component
|
|
6
|
-
* @description A single error UI that takes full viewport and adapts recovery actions based on the context (global vs route errors). Uses only native HTML elements and emojis to avoid component dependencies.
|
|
7
|
-
* it's not using anything to make sure it doesnt crash.
|
|
8
|
-
*
|
|
9
|
-
* @version 0.1.0
|
|
10
|
-
* @since 0.0.1
|
|
11
|
-
* @author AMBROISE PARK Consulting
|
|
12
|
-
*/
|
|
13
|
-
import { useState } from 'react';
|
|
14
|
-
/**
|
|
15
|
-
* Shared Error Fallback Component
|
|
16
|
-
*
|
|
17
|
-
* Single error UI that takes full viewport and adapts recovery actions
|
|
18
|
-
* based on the context (global vs route errors).
|
|
19
|
-
* Uses only native HTML elements and emojis to avoid component dependencies.
|
|
20
|
-
*
|
|
21
|
-
* @version 0.1.0
|
|
22
|
-
* @since 0.0.1
|
|
23
|
-
* @author AMBROISE PARK Consulting
|
|
24
|
-
*/
|
|
25
|
-
const ErrorFallback = ({ error, resetError, componentStack, eventId, onGoBack, onGoHome, onRetry, onReportIssue, }) => {
|
|
26
|
-
const [copiedStack, setCopiedStack] = useState(false);
|
|
27
|
-
// Extract error details once
|
|
28
|
-
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
|
29
|
-
const errorStack = error instanceof Error ? error.stack : undefined;
|
|
30
|
-
const isDevelopment = process.env.NODE_ENV === 'development';
|
|
31
|
-
const handleCopyStackTrace = async () => {
|
|
32
|
-
if (!errorStack)
|
|
33
|
-
return;
|
|
34
|
-
const fullErrorInfo = [
|
|
35
|
-
`Error: ${errorMessage}`,
|
|
36
|
-
`Timestamp: ${new Date().toISOString()}`,
|
|
37
|
-
`User Agent: ${navigator.userAgent}`,
|
|
38
|
-
eventId ? `Event ID: ${eventId}` : null,
|
|
39
|
-
'',
|
|
40
|
-
'Stack Trace:',
|
|
41
|
-
errorStack,
|
|
42
|
-
componentStack ? '\nComponent Stack:' : null,
|
|
43
|
-
componentStack || null,
|
|
44
|
-
]
|
|
45
|
-
.filter(Boolean)
|
|
46
|
-
.join('\n');
|
|
47
|
-
try {
|
|
48
|
-
await navigator.clipboard.writeText(fullErrorInfo);
|
|
49
|
-
setCopiedStack(true);
|
|
50
|
-
// Reset copied state after 2 seconds
|
|
51
|
-
setTimeout(() => setCopiedStack(false), 2000);
|
|
52
|
-
}
|
|
53
|
-
catch (err) {
|
|
54
|
-
console.error('Failed to copy stack trace:', err);
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
const handleRetry = () => {
|
|
58
|
-
onRetry?.() || resetError();
|
|
59
|
-
};
|
|
60
|
-
const handleGoBack = () => {
|
|
61
|
-
onGoBack?.();
|
|
62
|
-
};
|
|
63
|
-
const handleGoHome = () => {
|
|
64
|
-
onGoHome?.();
|
|
65
|
-
};
|
|
66
|
-
const handleReportIssue = () => {
|
|
67
|
-
onReportIssue?.();
|
|
68
|
-
};
|
|
69
|
-
return (_jsx("div", { style: {
|
|
70
|
-
width: '100%',
|
|
71
|
-
height: '100%',
|
|
72
|
-
display: 'flex',
|
|
73
|
-
alignItems: 'center',
|
|
74
|
-
justifyContent: 'center',
|
|
75
|
-
padding: '1rem',
|
|
76
|
-
backgroundColor: '#ffffff',
|
|
77
|
-
fontFamily: 'system-ui, -apple-system, sans-serif',
|
|
78
|
-
}, children: _jsxs("div", { style: {
|
|
79
|
-
backgroundColor: '#ffffff',
|
|
80
|
-
width: '100%',
|
|
81
|
-
textAlign: 'center',
|
|
82
|
-
maxWidth: '65ch',
|
|
83
|
-
padding: '2rem',
|
|
84
|
-
border: '1px solid #e5e7eb',
|
|
85
|
-
borderRadius: '12px',
|
|
86
|
-
boxShadow: '0 1px 3px rgba(0, 0, 0, 0.1)',
|
|
87
|
-
}, children: [_jsxs("div", { style: { marginBottom: '2rem' }, children: [_jsx("div", { style: {
|
|
88
|
-
display: 'flex',
|
|
89
|
-
alignItems: 'center',
|
|
90
|
-
justifyContent: 'center',
|
|
91
|
-
margin: '0 auto 2rem',
|
|
92
|
-
width: '5rem',
|
|
93
|
-
height: '5rem',
|
|
94
|
-
backgroundColor: 'rgba(220, 38, 38, 0.1)',
|
|
95
|
-
borderRadius: '50%',
|
|
96
|
-
border: '1px solid #dc2626',
|
|
97
|
-
}, children: _jsx("span", { style: {
|
|
98
|
-
fontSize: '2rem',
|
|
99
|
-
lineHeight: 1,
|
|
100
|
-
fontWeight: 600,
|
|
101
|
-
color: '#dc2626',
|
|
102
|
-
}, children: "!" }) }), _jsx("h1", { style: {
|
|
103
|
-
fontSize: '2rem',
|
|
104
|
-
fontWeight: 700,
|
|
105
|
-
marginBottom: '1rem',
|
|
106
|
-
color: '#000000',
|
|
107
|
-
}, children: "Something went wrong" }), _jsx("p", { style: {
|
|
108
|
-
fontSize: '1.25rem',
|
|
109
|
-
marginBottom: '0.5rem',
|
|
110
|
-
color: '#555555',
|
|
111
|
-
}, children: "We encountered an error while loading this page." }), _jsx("p", { style: {
|
|
112
|
-
color: '#10b981',
|
|
113
|
-
fontWeight: 500,
|
|
114
|
-
}, children: "Don't worry, your data is safe." })] }), eventId && (_jsxs("div", { style: {
|
|
115
|
-
display: 'inline-block',
|
|
116
|
-
padding: '0.5rem 1rem',
|
|
117
|
-
fontSize: '0.875rem',
|
|
118
|
-
marginBottom: '2rem',
|
|
119
|
-
backgroundColor: 'rgba(220, 38, 38, 0.1)',
|
|
120
|
-
color: '#dc2626',
|
|
121
|
-
borderRadius: '9999px',
|
|
122
|
-
fontFamily: 'monospace',
|
|
123
|
-
}, children: ["Error ID: ", eventId] })), isDevelopment && errorMessage && (_jsxs("div", { style: {
|
|
124
|
-
backgroundColor: '#ffffff',
|
|
125
|
-
marginBottom: '2rem',
|
|
126
|
-
padding: '1rem',
|
|
127
|
-
textAlign: 'start',
|
|
128
|
-
border: '1px solid #fecaca',
|
|
129
|
-
borderRadius: '8px',
|
|
130
|
-
}, children: [_jsxs("div", { style: {
|
|
131
|
-
display: 'flex',
|
|
132
|
-
alignItems: 'center',
|
|
133
|
-
justifyContent: 'space-between',
|
|
134
|
-
marginBottom: '0.5rem',
|
|
135
|
-
}, children: [_jsx("span", { style: {
|
|
136
|
-
fontSize: '0.875rem',
|
|
137
|
-
fontWeight: 600,
|
|
138
|
-
color: '#dc2626',
|
|
139
|
-
}, children: "Error Message:" }), _jsxs("button", { onClick: handleCopyStackTrace, disabled: copiedStack, style: {
|
|
140
|
-
height: '1.75rem',
|
|
141
|
-
cursor: copiedStack ? 'default' : 'pointer',
|
|
142
|
-
display: 'flex',
|
|
143
|
-
alignItems: 'center',
|
|
144
|
-
gap: '0.5rem',
|
|
145
|
-
padding: '0.25rem 0.5rem',
|
|
146
|
-
border: copiedStack
|
|
147
|
-
? '1px solid #10b981'
|
|
148
|
-
: '1px solid #e5e7eb',
|
|
149
|
-
borderRadius: '4px',
|
|
150
|
-
backgroundColor: copiedStack
|
|
151
|
-
? 'rgba(16, 185, 129, 0.1)'
|
|
152
|
-
: '#ffffff',
|
|
153
|
-
color: copiedStack ? '#10b981' : '#000000',
|
|
154
|
-
fontSize: '0.875rem',
|
|
155
|
-
}, children: [copiedStack ? '✅' : '📋', copiedStack ? 'Copied' : 'Copy Details'] })] }), _jsx("p", { style: {
|
|
156
|
-
fontSize: '0.875rem',
|
|
157
|
-
fontFamily: 'monospace',
|
|
158
|
-
wordBreak: 'break-word',
|
|
159
|
-
whiteSpace: 'pre-wrap',
|
|
160
|
-
color: '#000000',
|
|
161
|
-
}, children: errorMessage })] })), _jsxs("div", { style: {
|
|
162
|
-
display: 'flex',
|
|
163
|
-
flexDirection: 'column',
|
|
164
|
-
gap: '1rem',
|
|
165
|
-
marginTop: '2rem',
|
|
166
|
-
}, children: [_jsx("button", { onClick: handleRetry, style: {
|
|
167
|
-
width: '100%',
|
|
168
|
-
display: 'flex',
|
|
169
|
-
alignItems: 'center',
|
|
170
|
-
justifyContent: 'center',
|
|
171
|
-
gap: '1rem',
|
|
172
|
-
fontSize: '1.125rem',
|
|
173
|
-
fontWeight: 500,
|
|
174
|
-
padding: '0.75rem 1.5rem',
|
|
175
|
-
backgroundColor: '#dc2626',
|
|
176
|
-
color: '#ffffff',
|
|
177
|
-
border: 'none',
|
|
178
|
-
borderRadius: '12px',
|
|
179
|
-
cursor: 'pointer',
|
|
180
|
-
}, children: "\uD83D\uDD04 Try Again" }), onGoBack && (_jsx("button", { onClick: handleGoBack, style: {
|
|
181
|
-
width: '100%',
|
|
182
|
-
display: 'flex',
|
|
183
|
-
alignItems: 'center',
|
|
184
|
-
justifyContent: 'center',
|
|
185
|
-
gap: '1rem',
|
|
186
|
-
fontSize: '1.125rem',
|
|
187
|
-
fontWeight: 500,
|
|
188
|
-
padding: '0.75rem 1.5rem',
|
|
189
|
-
backgroundColor: '#059669',
|
|
190
|
-
color: '#ffffff',
|
|
191
|
-
border: 'none',
|
|
192
|
-
borderRadius: '12px',
|
|
193
|
-
cursor: 'pointer',
|
|
194
|
-
}, children: "\u2190 Go Back" })), _jsx("button", { onClick: handleGoHome, style: {
|
|
195
|
-
width: '100%',
|
|
196
|
-
display: 'flex',
|
|
197
|
-
alignItems: 'center',
|
|
198
|
-
justifyContent: 'center',
|
|
199
|
-
gap: '1rem',
|
|
200
|
-
fontSize: '1.125rem',
|
|
201
|
-
fontWeight: 500,
|
|
202
|
-
padding: '0.75rem 1.5rem',
|
|
203
|
-
backgroundColor: '#059669',
|
|
204
|
-
color: '#ffffff',
|
|
205
|
-
border: 'none',
|
|
206
|
-
borderRadius: '12px',
|
|
207
|
-
cursor: 'pointer',
|
|
208
|
-
}, children: "\uD83C\uDFE0 Go to Homepage" })] }), _jsx("p", { style: {
|
|
209
|
-
fontSize: '0.875rem',
|
|
210
|
-
marginTop: '2rem',
|
|
211
|
-
color: '#555555',
|
|
212
|
-
}, children: "If the problem persists, please contact support." })] }) }));
|
|
213
|
-
};
|
|
214
|
-
export default ErrorFallback;
|
|
1
|
+
"use client";import{useState as x}from"react";import{jsx as e,jsxs as r}from"react/jsx-runtime";var C=({error:t,resetError:c,componentStack:a,eventId:n,onGoBack:s,onGoHome:f,onRetry:p,onReportIssue:m})=>{let[o,l]=x(!1),i=t instanceof Error?t.message:"Unknown error",d=t instanceof Error?t.stack:void 0,g=!1,u=async()=>{if(!d)return;let k=[`Error: ${i}`,`Timestamp: ${new Date().toISOString()}`,`User Agent: ${navigator.userAgent}`,n?`Event ID: ${n}`:null,"","Stack Trace:",d,a?`
|
|
2
|
+
Component Stack:`:null,a||null].filter(Boolean).join(`
|
|
3
|
+
`);try{await navigator.clipboard.writeText(k),l(!0),setTimeout(()=>l(!1),2e3)}catch{}},y=()=>{p?.()||c()},b=()=>{s?.()},h=()=>{f?.()},v=()=>{m?.()};return e("div",{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",padding:"1rem",backgroundColor:"#ffffff",fontFamily:"system-ui, -apple-system, sans-serif"},children:r("div",{style:{backgroundColor:"#ffffff",width:"100%",textAlign:"center",maxWidth:"65ch",padding:"2rem",border:"1px solid #e5e7eb",borderRadius:"12px",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},children:[r("div",{style:{marginBottom:"2rem"},children:[e("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",margin:"0 auto 2rem",width:"5rem",height:"5rem",backgroundColor:"rgba(220, 38, 38, 0.1)",borderRadius:"50%",border:"1px solid #dc2626"},children:e("span",{style:{fontSize:"2rem",lineHeight:1,fontWeight:600,color:"#dc2626"},children:"!"})}),e("h1",{style:{fontSize:"2rem",fontWeight:700,marginBottom:"1rem",color:"#000000"},children:"Something went wrong"}),e("p",{style:{fontSize:"1.25rem",marginBottom:"0.5rem",color:"#555555"},children:"We encountered an error while loading this page."}),e("p",{style:{color:"#10b981",fontWeight:500},children:"Don't worry, your data is safe."})]}),n&&r("div",{style:{display:"inline-block",padding:"0.5rem 1rem",fontSize:"0.875rem",marginBottom:"2rem",backgroundColor:"rgba(220, 38, 38, 0.1)",color:"#dc2626",borderRadius:"9999px",fontFamily:"monospace"},children:["Error ID: ",n]}),g&&i&&r("div",{style:{backgroundColor:"#ffffff",marginBottom:"2rem",padding:"1rem",textAlign:"start",border:"1px solid #fecaca",borderRadius:"8px"},children:[r("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"0.5rem"},children:[e("span",{style:{fontSize:"0.875rem",fontWeight:600,color:"#dc2626"},children:"Error Message:"}),r("button",{onClick:u,disabled:o,style:{height:"1.75rem",cursor:o?"default":"pointer",display:"flex",alignItems:"center",gap:"0.5rem",padding:"0.25rem 0.5rem",border:o?"1px solid #10b981":"1px solid #e5e7eb",borderRadius:"4px",backgroundColor:o?"rgba(16, 185, 129, 0.1)":"#ffffff",color:o?"#10b981":"#000000",fontSize:"0.875rem"},children:[o?"\u2705":"\u{1F4CB}",o?"Copied":"Copy Details"]})]}),e("p",{style:{fontSize:"0.875rem",fontFamily:"monospace",wordBreak:"break-word",whiteSpace:"pre-wrap",color:"#000000"},children:i})]}),r("div",{style:{display:"flex",flexDirection:"column",gap:"1rem",marginTop:"2rem"},children:[e("button",{onClick:y,style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"center",gap:"1rem",fontSize:"1.125rem",fontWeight:500,padding:"0.75rem 1.5rem",backgroundColor:"#dc2626",color:"#ffffff",border:"none",borderRadius:"12px",cursor:"pointer"},children:"\u{1F504} Try Again"}),s&&e("button",{onClick:b,style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"center",gap:"1rem",fontSize:"1.125rem",fontWeight:500,padding:"0.75rem 1.5rem",backgroundColor:"#059669",color:"#ffffff",border:"none",borderRadius:"12px",cursor:"pointer"},children:"\u2190 Go Back"}),e("button",{onClick:h,style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"center",gap:"1rem",fontSize:"1.125rem",fontWeight:500,padding:"0.75rem 1.5rem",backgroundColor:"#059669",color:"#ffffff",border:"none",borderRadius:"12px",cursor:"pointer"},children:"\u{1F3E0} Go to Homepage"})]}),e("p",{style:{fontSize:"0.875rem",marginTop:"2rem",color:"#555555"},children:"If the problem persists, please contact support."})]})})},E=C;export{E as default};
|
|
@@ -1,45 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
// packages/ui/src/internal/common/GlobalErrorFallback.tsx
|
|
4
|
-
/**
|
|
5
|
-
* @fileoverview GlobalErrorFallback component
|
|
6
|
-
* @description Global error boundary fallback for application-level errors
|
|
7
|
-
*
|
|
8
|
-
* @version 0.1.0
|
|
9
|
-
* @since 0.0.1
|
|
10
|
-
* @author AMBROISE PARK Consulting
|
|
11
|
-
*/
|
|
12
|
-
import { useEffect } from 'react';
|
|
13
|
-
import { handleError } from '@donotdev/core';
|
|
14
|
-
import ErrorFallback from './ErrorFallback';
|
|
15
|
-
/**
|
|
16
|
-
* Global error boundary fallback component
|
|
17
|
-
*
|
|
18
|
-
* @version 0.1.0
|
|
19
|
-
* @since 0.0.1
|
|
20
|
-
* @author AMBROISE PARK Consulting
|
|
21
|
-
*/
|
|
22
|
-
const GlobalErrorFallback = ({ error, resetError, componentStack, eventId, }) => {
|
|
23
|
-
useEffect(() => {
|
|
24
|
-
// Use your existing error handling system
|
|
25
|
-
handleError(error, {
|
|
26
|
-
userMessage: 'A global error occurred',
|
|
27
|
-
context: { component: 'GlobalErrorFallback', componentStack, eventId },
|
|
28
|
-
showNotification: false, // Don't show notification since we're already showing the fallback UI
|
|
29
|
-
});
|
|
30
|
-
}, [error, componentStack, eventId]);
|
|
31
|
-
const handleReloadPage = () => {
|
|
32
|
-
resetError();
|
|
33
|
-
if (typeof window !== 'undefined') {
|
|
34
|
-
window.location.reload();
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
const handleGoHome = () => {
|
|
38
|
-
resetError();
|
|
39
|
-
if (typeof window !== 'undefined') {
|
|
40
|
-
window.location.href = '/';
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
return (_jsx(ErrorFallback, { error: error, resetError: resetError, componentStack: componentStack, eventId: eventId, onRetry: handleReloadPage, onGoHome: handleGoHome }));
|
|
44
|
-
};
|
|
45
|
-
export default GlobalErrorFallback;
|
|
1
|
+
"use client";import{useEffect as l}from"react";import{handleError as a}from"@donotdev/core";import t from"./ErrorFallback.js";import{jsx as d}from"react/jsx-runtime";var i=({error:o,resetError:e,componentStack:n,eventId:r})=>(l(()=>{a(o,{userMessage:"A global error occurred",context:{component:"GlobalErrorFallback",componentStack:n,eventId:r},showNotification:!1})},[o,n,r]),d(t,{error:o,resetError:e,componentStack:n,eventId:r,onRetry:()=>{e(),typeof window<"u"&&window.location.reload()},onGoHome:()=>{e(),typeof window<"u"&&(window.location.href="/")}})),u=i;export{u as default};
|
|
@@ -1,140 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @fileoverview Route error fallback component
|
|
6
|
-
* @description Professional route error fallback using framework components. Only for route-level errors (framework is stable).
|
|
7
|
-
*
|
|
8
|
-
* @version 0.1.0
|
|
9
|
-
* @since 0.0.1
|
|
10
|
-
* @author AMBROISE PARK Consulting
|
|
11
|
-
*/
|
|
12
|
-
import { AlertTriangle, Home, ArrowLeft, RotateCw, Copy, Check, } from 'lucide-react';
|
|
13
|
-
import { useEffect, useState } from 'react';
|
|
14
|
-
import { Button, BUTTON_VARIANT, Card, CARD_VARIANT, Alert, ALERT_VARIANT, Stack, } from '@donotdev/components';
|
|
15
|
-
import { handleError, useTranslation } from '@donotdev/core';
|
|
16
|
-
import { useBack, useRoutePath } from '@donotdev/ui/routing/hooks';
|
|
17
|
-
// Platform-specific hooks via conditional exports
|
|
18
|
-
import { Link } from '../../routing/Link';
|
|
19
|
-
/**
|
|
20
|
-
* Professional Route Error Fallback Component
|
|
21
|
-
*
|
|
22
|
-
* Uses framework components (Card, Button, Alert, PageContainer) for consistent design.
|
|
23
|
-
* Only used for route-level errors where framework is stable.
|
|
24
|
-
*
|
|
25
|
-
* @version 0.1.0
|
|
26
|
-
* @since 0.0.1
|
|
27
|
-
* @author AMBROISE PARK Consulting
|
|
28
|
-
*/
|
|
29
|
-
export const RouteErrorFallback = ({ error, resetError, componentStack, eventId, }) => {
|
|
30
|
-
const { t } = useTranslation('dndev');
|
|
31
|
-
const [copiedStack, setCopiedStack] = useState(false);
|
|
32
|
-
const back = useBack();
|
|
33
|
-
const pathname = useRoutePath();
|
|
34
|
-
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
|
35
|
-
const errorStack = error instanceof Error ? error.stack : undefined;
|
|
36
|
-
const isDevelopment = process.env.NODE_ENV === 'development';
|
|
37
|
-
useEffect(() => {
|
|
38
|
-
try {
|
|
39
|
-
handleError(error, {
|
|
40
|
-
userMessage: 'Page encountered an error',
|
|
41
|
-
context: { component: 'RouteErrorFallback', location: pathname },
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
catch (err) {
|
|
45
|
-
console.error('Error in RouteErrorFallback:', error);
|
|
46
|
-
console.error('handleError also failed:', err);
|
|
47
|
-
}
|
|
48
|
-
}, [error, pathname]);
|
|
49
|
-
const handleCopyStackTrace = async () => {
|
|
50
|
-
if (!errorStack)
|
|
51
|
-
return;
|
|
52
|
-
const fullErrorInfo = [
|
|
53
|
-
`Error: ${errorMessage}`,
|
|
54
|
-
`Timestamp: ${new Date().toISOString()}`,
|
|
55
|
-
`User Agent: ${navigator.userAgent}`,
|
|
56
|
-
eventId ? `Event ID: ${eventId}` : null,
|
|
57
|
-
`Path: ${pathname}`,
|
|
58
|
-
'',
|
|
59
|
-
'Stack Trace:',
|
|
60
|
-
errorStack,
|
|
61
|
-
componentStack ? '\nComponent Stack:' : null,
|
|
62
|
-
componentStack || null,
|
|
63
|
-
]
|
|
64
|
-
.filter(Boolean)
|
|
65
|
-
.join('\n');
|
|
66
|
-
try {
|
|
67
|
-
await navigator.clipboard.writeText(fullErrorInfo);
|
|
68
|
-
setCopiedStack(true);
|
|
69
|
-
setTimeout(() => setCopiedStack(false), 2000);
|
|
70
|
-
}
|
|
71
|
-
catch (err) {
|
|
72
|
-
console.error('Failed to copy stack trace:', err);
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
const handleRetry = () => {
|
|
76
|
-
try {
|
|
77
|
-
resetError();
|
|
78
|
-
}
|
|
79
|
-
catch (err) {
|
|
80
|
-
if (typeof window !== 'undefined') {
|
|
81
|
-
window.location.reload();
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
const handleGoBack = () => {
|
|
86
|
-
try {
|
|
87
|
-
back();
|
|
88
|
-
}
|
|
89
|
-
catch {
|
|
90
|
-
if (typeof window !== 'undefined') {
|
|
91
|
-
window.history.back();
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
return (_jsx("div", { className: "dndev-container", "data-variant": "standard", "data-centered": "true", children: _jsx(Card, { variant: CARD_VARIANT.DEFAULT, elevated: true, className: "dndev-w-full", style: { maxWidth: '65ch', margin: '0 auto' }, children: _jsxs(Stack, { gap: "large", align: "center", className: "dndev-text-center", children: [_jsx(Stack, { align: "center", justify: "center", style: {
|
|
96
|
-
width: '5rem',
|
|
97
|
-
height: '5rem',
|
|
98
|
-
backgroundColor: 'rgba(220, 38, 38, 0.1)',
|
|
99
|
-
borderRadius: '50%',
|
|
100
|
-
border: '1px solid var(--destructive)',
|
|
101
|
-
}, children: _jsx(AlertTriangle, { style: {
|
|
102
|
-
width: '2.5rem',
|
|
103
|
-
height: '2.5rem',
|
|
104
|
-
color: 'var(--destructive)',
|
|
105
|
-
}, "aria-hidden": "true" }) }), _jsxs(Stack, { children: [_jsx("h1", { className: "dndev-text-base", "data-level": "h1", style: {
|
|
106
|
-
fontSize: 'var(--font-size-2xl)',
|
|
107
|
-
fontWeight: 'var(--font-weight-bold)',
|
|
108
|
-
margin: 0,
|
|
109
|
-
}, children: t('routeError.title', 'Something went wrong') }), _jsx("p", { className: "dndev-text-base", style: {
|
|
110
|
-
fontSize: 'var(--font-size-lg)',
|
|
111
|
-
color: 'var(--muted-foreground)',
|
|
112
|
-
margin: 0,
|
|
113
|
-
}, children: t('routeError.description', 'We encountered an error while loading this page.') }), _jsx(Alert, { variant: ALERT_VARIANT.INFO, hideIcon: true, children: _jsx("div", { style: { fontSize: 'var(--font-size-sm)', textAlign: 'center' }, children: t('routeError.dataSafe', "Don't worry, your data is safe.") }) })] }), eventId && (_jsxs("code", { style: {
|
|
114
|
-
padding: 'var(--gap-sm) var(--gap-md)',
|
|
115
|
-
background: 'var(--muted)',
|
|
116
|
-
borderRadius: 'var(--radius-full)',
|
|
117
|
-
fontSize: 'var(--font-size-xs)',
|
|
118
|
-
fontFamily: 'var(--font-mono)',
|
|
119
|
-
color: 'var(--foreground)',
|
|
120
|
-
}, children: [t('routeError.errorId', 'Error ID'), ": ", eventId] })), isDevelopment && errorMessage && (_jsxs(Card, { variant: CARD_VARIANT.MUTED, className: "dndev-w-full", children: [_jsxs(Stack, { direction: "row", align: "center", justify: "between", children: [_jsx("span", { className: "dndev-text-base", style: {
|
|
121
|
-
fontSize: 'var(--font-size-sm)',
|
|
122
|
-
fontWeight: 'var(--font-weight-semibold)',
|
|
123
|
-
color: 'var(--destructive)',
|
|
124
|
-
}, children: "Error Message:" }), _jsx(Button, { variant: BUTTON_VARIANT.GHOST, icon: copiedStack ? Check : Copy, onClick: handleCopyStackTrace, disabled: copiedStack, children: copiedStack
|
|
125
|
-
? t('routeError.copied', 'Copied')
|
|
126
|
-
: t('routeError.copyDetails', 'Copy Details') })] }), _jsx("pre", { style: {
|
|
127
|
-
fontSize: 'var(--font-size-xs)',
|
|
128
|
-
fontFamily: 'var(--font-mono)',
|
|
129
|
-
wordBreak: 'break-word',
|
|
130
|
-
whiteSpace: 'pre-wrap',
|
|
131
|
-
color: 'var(--foreground)',
|
|
132
|
-
margin: 0,
|
|
133
|
-
marginTop: 'var(--gap-sm)',
|
|
134
|
-
}, children: errorMessage })] })), _jsxs(Stack, { className: "dndev-w-full", children: [_jsx(Button, { variant: BUTTON_VARIANT.DESTRUCTIVE, icon: RotateCw, onClick: handleRetry, fullWidth: true, children: t('routeError.tryAgain', 'Try Again') }), _jsxs(Stack, { direction: "row", justify: "center", children: [_jsx(Link, { path: "/", children: _jsx(Button, { variant: BUTTON_VARIANT.DEFAULT, icon: Home, fullWidth: true, children: t('routeError.goHome', 'Go Home') }) }), _jsx(Button, { variant: BUTTON_VARIANT.OUTLINE, icon: ArrowLeft, onClick: handleGoBack, fullWidth: true, children: t('routeError.goBack', 'Go Back') })] })] }), _jsx("p", { className: "dndev-text-base", style: {
|
|
135
|
-
fontSize: 'var(--font-size-sm)',
|
|
136
|
-
color: 'var(--muted-foreground)',
|
|
137
|
-
margin: 0,
|
|
138
|
-
}, children: t('routeError.contactSupport', 'If the problem persists, please contact support.') })] }) }) }));
|
|
139
|
-
};
|
|
140
|
-
export default RouteErrorFallback;
|
|
1
|
+
"use client";import{AlertTriangle as b,Home as T,ArrowLeft as A,RotateCw as C,Copy as N,Check as R}from"lucide-react";import{useEffect as x,useState as z}from"react";import{Button as i,BUTTON_VARIANT as s,Card as v,CARD_VARIANT as g,Alert as D,ALERT_VARIANT as B,Stack as a}from"@donotdev/components";import{handleError as F,useTranslation as I}from"@donotdev/core";import{useBack as U,useRoutePath as L}from"@donotdev/ui/routing/hooks";import{Link as W}from"../../routing/Link.js";import{jsx as r,jsxs as t}from"react/jsx-runtime";var O=({error:o,resetError:h,componentStack:f,eventId:n})=>{let{t:e}=I("dndev"),[c,m]=z(!1),k=U(),l=L(),d=o instanceof Error?o.message:"Unknown error",p=o instanceof Error?o.stack:void 0,y=!1;x(()=>{try{F(o,{userMessage:"Page encountered an error",context:{component:"RouteErrorFallback",location:l}})}catch{}},[o,l]);let E=async()=>{if(!p)return;let u=[`Error: ${d}`,`Timestamp: ${new Date().toISOString()}`,`User Agent: ${navigator.userAgent}`,n?`Event ID: ${n}`:null,`Path: ${l}`,"","Stack Trace:",p,f?`
|
|
2
|
+
Component Stack:`:null,f||null].filter(Boolean).join(`
|
|
3
|
+
`);try{await navigator.clipboard.writeText(u),m(!0),setTimeout(()=>m(!1),2e3)}catch{}},w=()=>{try{h()}catch{typeof window<"u"&&window.location.reload()}},S=()=>{try{k()}catch{typeof window<"u"&&window.history.back()}};return r("div",{className:"dndev-container","data-variant":"standard","data-centered":"true",children:r(v,{variant:g.DEFAULT,elevated:!0,className:"dndev-w-full",style:{maxWidth:"65ch",margin:"0 auto"},children:t(a,{gap:"large",align:"center",className:"dndev-text-center",children:[r(a,{align:"center",justify:"center",style:{width:"5rem",height:"5rem",backgroundColor:"rgba(220, 38, 38, 0.1)",borderRadius:"50%",border:"1px solid var(--destructive)"},children:r(b,{style:{width:"2.5rem",height:"2.5rem",color:"var(--destructive)"},"aria-hidden":"true"})}),t(a,{children:[r("h1",{className:"dndev-text-base","data-level":"h1",style:{fontSize:"var(--font-size-2xl)",fontWeight:"var(--font-weight-bold)",margin:0},children:e("routeError.title","Something went wrong")}),r("p",{className:"dndev-text-base",style:{fontSize:"var(--font-size-lg)",color:"var(--muted-foreground)",margin:0},children:e("routeError.description","We encountered an error while loading this page.")}),r(D,{variant:B.INFO,hideIcon:!0,children:r("div",{style:{fontSize:"var(--font-size-sm)",textAlign:"center"},children:e("routeError.dataSafe","Don't worry, your data is safe.")})})]}),n&&t("code",{style:{padding:"var(--gap-sm) var(--gap-md)",background:"var(--muted)",borderRadius:"var(--radius-full)",fontSize:"var(--font-size-xs)",fontFamily:"var(--font-mono)",color:"var(--foreground)"},children:[e("routeError.errorId","Error ID"),": ",n]}),y&&d&&t(v,{variant:g.MUTED,className:"dndev-w-full",children:[t(a,{direction:"row",align:"center",justify:"between",children:[r("span",{className:"dndev-text-base",style:{fontSize:"var(--font-size-sm)",fontWeight:"var(--font-weight-semibold)",color:"var(--destructive)"},children:"Error Message:"}),r(i,{variant:s.GHOST,icon:c?R:N,onClick:E,disabled:c,children:c?e("routeError.copied","Copied"):e("routeError.copyDetails","Copy Details")})]}),r("pre",{style:{fontSize:"var(--font-size-xs)",fontFamily:"var(--font-mono)",wordBreak:"break-word",whiteSpace:"pre-wrap",color:"var(--foreground)",margin:0,marginTop:"var(--gap-sm)"},children:d})]}),t(a,{className:"dndev-w-full",children:[r(i,{variant:s.DESTRUCTIVE,icon:C,onClick:w,fullWidth:!0,children:e("routeError.tryAgain","Try Again")}),t(a,{direction:"row",justify:"center",children:[r(W,{path:"/",children:r(i,{variant:s.DEFAULT,icon:T,fullWidth:!0,children:e("routeError.goHome","Go Home")})}),r(i,{variant:s.OUTLINE,icon:A,onClick:S,fullWidth:!0,children:e("routeError.goBack","Go Back")})]})]}),r("p",{className:"dndev-text-base",style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)",margin:0},children:e("routeError.contactSupport","If the problem persists, please contact support.")})]})})})},j=O;export{O as RouteErrorFallback,j as default};
|
|
@@ -1,131 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
// packages/ui/src/internal/devtools/DebugTools.tsx
|
|
4
|
-
/**
|
|
5
|
-
* @fileoverview DebugTools component
|
|
6
|
-
* @description Development tools for debugging framework state
|
|
7
|
-
*
|
|
8
|
-
* @version 0.1.0
|
|
9
|
-
* @since 0.0.1
|
|
10
|
-
* @author AMBROISE PARK Consulting
|
|
11
|
-
*/
|
|
12
|
-
import { Bug, Trash2, X } from 'lucide-react';
|
|
13
|
-
import { Cookie } from 'lucide-react';
|
|
14
|
-
import { useEffect, useRef, useState } from 'react';
|
|
15
|
-
import { Button, BUTTON_VARIANT, Card, Label, Portal, PortalButton, cn, Stack, } from '@donotdev/components';
|
|
16
|
-
import { useBreakpoint, useConsent } from '@donotdev/core';
|
|
17
|
-
import { DebugDialog } from './components/DebugDialog';
|
|
18
|
-
const DebugTools = ({ className }) => {
|
|
19
|
-
const [isVisible, setIsVisible] = useState(false);
|
|
20
|
-
const [debugEnabled, setDebugEnabled] = useState(false);
|
|
21
|
-
const [position, setPosition] = useState(null);
|
|
22
|
-
const [isDragging, setIsDragging] = useState(false);
|
|
23
|
-
const startPos = useRef({ x: 0, y: 0 });
|
|
24
|
-
const hasConsented = useConsent('hasConsented');
|
|
25
|
-
const showCookieBanner = useConsent('showCookieBanner');
|
|
26
|
-
const reset = useConsent('reset');
|
|
27
|
-
const current = useBreakpoint('current');
|
|
28
|
-
const width = useBreakpoint('width');
|
|
29
|
-
const height = useBreakpoint('height');
|
|
30
|
-
useEffect(() => {
|
|
31
|
-
if (!isDragging)
|
|
32
|
-
return;
|
|
33
|
-
const handleMove = (e) => {
|
|
34
|
-
const newX = Math.max(0, Math.min(e.clientX - startPos.current.x, window.innerWidth - 300));
|
|
35
|
-
const newY = Math.max(0, Math.min(e.clientY - startPos.current.y, window.innerHeight - 200));
|
|
36
|
-
setPosition({ x: newX, y: newY });
|
|
37
|
-
};
|
|
38
|
-
const handleUp = () => setIsDragging(false);
|
|
39
|
-
document.addEventListener('mousemove', handleMove);
|
|
40
|
-
document.addEventListener('mouseup', handleUp);
|
|
41
|
-
return () => {
|
|
42
|
-
document.removeEventListener('mousemove', handleMove);
|
|
43
|
-
document.removeEventListener('mouseup', handleUp);
|
|
44
|
-
};
|
|
45
|
-
}, [isDragging]);
|
|
46
|
-
const handleMouseDown = (e) => {
|
|
47
|
-
if (e.target.closest('.drag-handle')) {
|
|
48
|
-
// Get current position from element if not yet dragged
|
|
49
|
-
const el = e.currentTarget;
|
|
50
|
-
const rect = el.getBoundingClientRect();
|
|
51
|
-
const currentX = position?.x ?? rect.left;
|
|
52
|
-
const currentY = position?.y ?? rect.top;
|
|
53
|
-
setIsDragging(true);
|
|
54
|
-
startPos.current = {
|
|
55
|
-
x: e.clientX - currentX,
|
|
56
|
-
y: e.clientY - currentY,
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
const toggleDebug = () => {
|
|
61
|
-
const newValue = !debugEnabled;
|
|
62
|
-
const value = newValue ? '1' : '0';
|
|
63
|
-
document.documentElement.style.setProperty('--debug-enabled', value);
|
|
64
|
-
if (newValue) {
|
|
65
|
-
document.documentElement.setAttribute('data-debug', 'true');
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
68
|
-
document.documentElement.removeAttribute('data-debug');
|
|
69
|
-
}
|
|
70
|
-
setDebugEnabled(newValue);
|
|
71
|
-
};
|
|
72
|
-
// Don't render if hidden - use PortalButton for minimized state
|
|
73
|
-
if (!isVisible) {
|
|
74
|
-
return (_jsx(PortalButton, { onClick: () => setIsVisible(true), className: "dndev-z-overlay", style: {
|
|
75
|
-
position: 'fixed',
|
|
76
|
-
top: 'calc(var(--gap-lg) + var(--header-height))',
|
|
77
|
-
insetInlineStart: 'calc(var(--gap-sm) + var(--sidebar-width))',
|
|
78
|
-
}, icon: Bug, title: "Show Debug Tools" }));
|
|
79
|
-
}
|
|
80
|
-
return (_jsx(Portal, { children: _jsx("div", { className: cn('dndev-z-overlay drag-handle', className), style: {
|
|
81
|
-
position: 'fixed',
|
|
82
|
-
insetInlineStart: position?.x ?? 'calc(var(--sidebar-width) + var(--gap-lg))',
|
|
83
|
-
top: position?.y ?? 'calc(var(--header-height) + var(--gap-lg))',
|
|
84
|
-
cursor: isDragging ? 'grabbing' : 'grab',
|
|
85
|
-
minWidth: '20rem',
|
|
86
|
-
}, onMouseDown: handleMouseDown, children: _jsx(Card, { title: _jsxs(Stack, { direction: "row", align: "center", justify: "between", children: [_jsx(DebugDialog, {}), _jsx(Button, { onClick: () => setIsVisible(false), icon: X, variant: BUTTON_VARIANT.GHOST, title: "Hide Debug Tools" })] }), content: _jsx(_Fragment, { children: _jsxs(Stack, { direction: "row", align: "center", justify: "center", gap: "tight", wrap: "wrap", children: [_jsx(Button, { onClick: toggleDebug, variant: debugEnabled
|
|
87
|
-
? BUTTON_VARIANT.DEFAULT
|
|
88
|
-
: BUTTON_VARIANT.OUTLINE, icon: Bug, title: `Display Lines (${debugEnabled ? 'ON' : 'OFF'})`, children: "Display Lines" }), _jsx(Button, { onClick: async () => {
|
|
89
|
-
try {
|
|
90
|
-
// Reset consent (deletes cookie and resets store)
|
|
91
|
-
reset();
|
|
92
|
-
// Clear all storage
|
|
93
|
-
localStorage.clear();
|
|
94
|
-
sessionStorage.clear();
|
|
95
|
-
if ('caches' in window) {
|
|
96
|
-
const keys = await caches.keys();
|
|
97
|
-
await Promise.all(keys.map((key) => caches.delete(key)));
|
|
98
|
-
}
|
|
99
|
-
if ('indexedDB' in window && 'databases' in indexedDB) {
|
|
100
|
-
try {
|
|
101
|
-
const databases = await indexedDB.databases();
|
|
102
|
-
await Promise.all(databases.map((db) => db.name && indexedDB.deleteDatabase(db.name)));
|
|
103
|
-
}
|
|
104
|
-
catch (dbError) {
|
|
105
|
-
console.error('Failed to clear IndexedDB:', dbError);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
// Clear store registry (DEV mode: HMR preserves globalThis, prevents re-init)
|
|
109
|
-
if (typeof globalThis !== 'undefined' &&
|
|
110
|
-
globalThis._DNDEV_STORES_) {
|
|
111
|
-
globalThis._DNDEV_STORES_ = {};
|
|
112
|
-
}
|
|
113
|
-
// ⚠️ Force hard reload (bypasses HMR cache)
|
|
114
|
-
window.location.reload();
|
|
115
|
-
}
|
|
116
|
-
catch (error) {
|
|
117
|
-
console.error('Failed to clear cache:', error);
|
|
118
|
-
}
|
|
119
|
-
}, variant: BUTTON_VARIANT.OUTLINE, icon: Trash2, title: "Clear all Cache", children: "Clear Cache" }), _jsx(Button, { onClick: () => {
|
|
120
|
-
if (hasConsented) {
|
|
121
|
-
showCookieBanner(); // ✅ Triggers store update → components re-render → banner appears
|
|
122
|
-
}
|
|
123
|
-
}, variant: hasConsented ? BUTTON_VARIANT.OUTLINE : BUTTON_VARIANT.GHOST, icon: Cookie, title: hasConsented
|
|
124
|
-
? 'Reset consent (show banner)'
|
|
125
|
-
: 'Consent banner visible', children: hasConsented
|
|
126
|
-
? 'Show Cookie Banner'
|
|
127
|
-
: 'Cookie Banner Visible' })] }) }), footer: _jsx(Stack, { align: "center", justify: "center", className: cn('drag-handle', current === 'mobile' && 'dndev-text-destructive', current === 'tablet' && 'dndev-text-primary', current === 'laptop' && 'dndev-text-secondary-foreground', current === 'desktop' && 'dndev-text-muted-foreground'), style: {
|
|
128
|
-
cursor: 'grab',
|
|
129
|
-
}, children: _jsxs(Label, { className: "dndev-font-mono dndev-text-lg", children: [current.toUpperCase(), " : ", width, " \u00D7 ", height, "px"] }) }) }) }) }));
|
|
130
|
-
};
|
|
131
|
-
export default DebugTools;
|
|
1
|
+
"use client";import{Bug as D,Trash2 as P,X as I}from"lucide-react";import{Cookie as U}from"lucide-react";import{useEffect as V,useRef as _,useState as l}from"react";import{Button as c,BUTTON_VARIANT as o,Card as H,Label as R,Portal as A,PortalButton as F,cn as E,Stack as b}from"@donotdev/components";import{useBreakpoint as p,useConsent as v}from"@donotdev/core";import{DebugDialog as X}from"./components/DebugDialog.js";import{Fragment as j,jsx as t,jsxs as f}from"react/jsx-runtime";var Y=({className:T})=>{let[x,w]=l(!1),[d,C]=l(!1),[s,k]=l(null),[u,y]=l(!1),m=_({x:0,y:0}),i=v("hasConsented"),B=v("showCookieBanner"),S=v("reset"),a=p("current"),L=p("width"),N=p("height");V(()=>{if(!u)return;let e=r=>{let g=Math.max(0,Math.min(r.clientX-m.current.x,window.innerWidth-300)),h=Math.max(0,Math.min(r.clientY-m.current.y,window.innerHeight-200));k({x:g,y:h})},n=()=>y(!1);return document.addEventListener("mousemove",e),document.addEventListener("mouseup",n),()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",n)}},[u]);let M=e=>{if(e.target.closest(".drag-handle")){let r=e.currentTarget.getBoundingClientRect(),g=s?.x??r.left,h=s?.y??r.top;y(!0),m.current={x:e.clientX-g,y:e.clientY-h}}},O=()=>{let e=!d,n=e?"1":"0";document.documentElement.style.setProperty("--debug-enabled",n),e?document.documentElement.setAttribute("data-debug","true"):document.documentElement.removeAttribute("data-debug"),C(e)};return x?t(A,{children:t("div",{className:E("dndev-z-overlay drag-handle",T),style:{position:"fixed",insetInlineStart:s?.x??"calc(var(--sidebar-width) + var(--gap-lg))",top:s?.y??"calc(var(--header-height) + var(--gap-lg))",cursor:u?"grabbing":"grab",minWidth:"20rem"},onMouseDown:M,children:t(H,{title:f(b,{direction:"row",align:"center",justify:"between",children:[t(X,{}),t(c,{onClick:()=>w(!1),icon:I,variant:o.GHOST,title:"Hide Debug Tools"})]}),content:t(j,{children:f(b,{direction:"row",align:"center",justify:"center",gap:"tight",wrap:"wrap",children:[t(c,{onClick:O,variant:d?o.DEFAULT:o.OUTLINE,icon:D,title:`Display Lines (${d?"ON":"OFF"})`,children:"Display Lines"}),t(c,{onClick:async()=>{try{if(S(),localStorage.clear(),sessionStorage.clear(),"caches"in window){let e=await caches.keys();await Promise.all(e.map(n=>caches.delete(n)))}if("indexedDB"in window&&"databases"in indexedDB)try{let e=await indexedDB.databases();await Promise.all(e.map(n=>n.name&&indexedDB.deleteDatabase(n.name)))}catch{}typeof globalThis<"u"&&globalThis._DNDEV_STORES_&&(globalThis._DNDEV_STORES_={}),window.location.reload()}catch{}},variant:o.OUTLINE,icon:P,title:"Clear all Cache",children:"Clear Cache"}),t(c,{onClick:()=>{i&&B()},variant:i?o.OUTLINE:o.GHOST,icon:U,title:i?"Reset consent (show banner)":"Consent banner visible",children:i?"Show Cookie Banner":"Cookie Banner Visible"})]})}),footer:t(b,{align:"center",justify:"center",className:E("drag-handle",a==="mobile"&&"dndev-text-destructive",a==="tablet"&&"dndev-text-primary",a==="laptop"&&"dndev-text-secondary-foreground",a==="desktop"&&"dndev-text-muted-foreground"),style:{cursor:"grab"},children:f(R,{className:"dndev-font-mono dndev-text-lg",children:[a.toUpperCase()," : ",L," \xD7 ",N,"px"]})})})})}):t(F,{onClick:()=>w(!0),className:"dndev-z-overlay",style:{position:"fixed",top:"calc(var(--gap-lg) + var(--header-height))",insetInlineStart:"calc(var(--gap-sm) + var(--sidebar-width))"},icon:D,title:"Show Debug Tools"})},K=Y;export{K as default};
|
|
@@ -1,72 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
// packages/ui/src/internal/devtools/components/AuthDebugButton.tsx
|
|
4
|
-
/**
|
|
5
|
-
* @fileoverview Auth Debug Button Component
|
|
6
|
-
* @description Shows authentication state in a compact button format for debugging
|
|
7
|
-
*
|
|
8
|
-
* @version 0.1.0
|
|
9
|
-
* @since 0.0.1
|
|
10
|
-
* @author AMBROISE PARK Consulting
|
|
11
|
-
*/
|
|
12
|
-
import { useState } from 'react';
|
|
13
|
-
import { useAuthSafe } from '../../../utils/useAuthSafe';
|
|
14
|
-
/**
|
|
15
|
-
* Auth Debug Button Component
|
|
16
|
-
* Shows authentication state in a compact button format
|
|
17
|
-
*/
|
|
18
|
-
export const AuthDebugButton = () => {
|
|
19
|
-
const user = useAuthSafe('user');
|
|
20
|
-
const loading = useAuthSafe('loading');
|
|
21
|
-
const error = useAuthSafe('error');
|
|
22
|
-
const [isExpanded, setIsExpanded] = useState(false);
|
|
23
|
-
const getStatusIcon = () => {
|
|
24
|
-
if (loading)
|
|
25
|
-
return '⏳';
|
|
26
|
-
if (error)
|
|
27
|
-
return '❌';
|
|
28
|
-
if (user)
|
|
29
|
-
return '✅';
|
|
30
|
-
return '❌';
|
|
31
|
-
};
|
|
32
|
-
const getStatusBg = () => {
|
|
33
|
-
if (loading)
|
|
34
|
-
return 'rgb(234 179 8 / 0.2)'; // yellow
|
|
35
|
-
if (error)
|
|
36
|
-
return 'rgb(239 68 68 / 0.2)'; // red
|
|
37
|
-
if (user)
|
|
38
|
-
return 'rgb(34 197 94 / 0.2)'; // green
|
|
39
|
-
return 'rgb(107 114 128 / 0.2)'; // gray
|
|
40
|
-
};
|
|
41
|
-
const getStatusHoverBg = () => {
|
|
42
|
-
if (loading)
|
|
43
|
-
return 'rgb(234 179 8 / 0.3)';
|
|
44
|
-
if (error)
|
|
45
|
-
return 'rgb(239 68 68 / 0.3)';
|
|
46
|
-
if (user)
|
|
47
|
-
return 'rgb(34 197 94 / 0.3)';
|
|
48
|
-
return 'rgb(107 114 128 / 0.3)';
|
|
49
|
-
};
|
|
50
|
-
return (_jsxs("div", { className: "dndev-relative", children: [_jsxs("button", { onClick: () => setIsExpanded(!isExpanded), style: {
|
|
51
|
-
padding: 'var(--gap-sm) var(--gap-md)',
|
|
52
|
-
borderRadius: 'var(--radius-lg)',
|
|
53
|
-
fontSize: 'var(--font-size-sm)',
|
|
54
|
-
fontFamily: 'monospace',
|
|
55
|
-
transition: 'background-color var(--duration-normal)',
|
|
56
|
-
backgroundColor: getStatusBg(),
|
|
57
|
-
}, onMouseEnter: (e) => {
|
|
58
|
-
e.currentTarget.style.backgroundColor = getStatusHoverBg();
|
|
59
|
-
}, onMouseLeave: (e) => {
|
|
60
|
-
e.currentTarget.style.backgroundColor = getStatusBg();
|
|
61
|
-
}, title: "Auth Debug", children: [getStatusIcon(), " Auth"] }), isExpanded && (_jsx("div", { className: "dndev-absolute bottom-full font-mono", style: {
|
|
62
|
-
zIndex: 'calc(var(--z-toast) + 100)',
|
|
63
|
-
marginBottom: 'var(--gap-sm)',
|
|
64
|
-
padding: 'var(--gap-md)',
|
|
65
|
-
insetInlineEnd: 0,
|
|
66
|
-
backgroundColor: 'rgba(0, 0, 0, 0.9)',
|
|
67
|
-
color: 'white',
|
|
68
|
-
borderRadius: 'var(--radius-lg)',
|
|
69
|
-
minWidth: '200px',
|
|
70
|
-
border: '1px solid rgb(75 85 99)',
|
|
71
|
-
}, children: _jsxs("div", { className: "dndev-flex dndev-items-center dndev-gap-sm", children: [_jsxs("div", { children: ["Loading: ", loading ? '⏳' : '✅'] }), _jsxs("div", { children: ["Auth: ", user ? '✅' : '❌'] }), _jsxs("div", { children: ["User: ", user?.email || 'None'] }), error && (_jsxs("div", { style: { color: 'rgb(248 113 113)' }, children: ["Error: ", error.message] }))] }) }))] }));
|
|
72
|
-
};
|
|
1
|
+
"use client";import{useState as l}from"react";import{useAuthSafe as a}from"../../../utils/useAuthSafe.js";import{jsx as v,jsxs as r}from"react/jsx-runtime";var b=()=>{let e=a("user"),o=a("loading"),t=a("error"),[d,s]=l(!1),u=()=>o?"\u23F3":t?"\u274C":e?"\u2705":"\u274C",i=()=>o?"rgb(234 179 8 / 0.2)":t?"rgb(239 68 68 / 0.2)":e?"rgb(34 197 94 / 0.2)":"rgb(107 114 128 / 0.2)",g=()=>o?"rgb(234 179 8 / 0.3)":t?"rgb(239 68 68 / 0.3)":e?"rgb(34 197 94 / 0.3)":"rgb(107 114 128 / 0.3)";return r("div",{className:"dndev-relative",children:[r("button",{onClick:()=>s(!d),style:{padding:"var(--gap-sm) var(--gap-md)",borderRadius:"var(--radius-lg)",fontSize:"var(--font-size-sm)",fontFamily:"monospace",transition:"background-color var(--duration-normal)",backgroundColor:i()},onMouseEnter:n=>{n.currentTarget.style.backgroundColor=g()},onMouseLeave:n=>{n.currentTarget.style.backgroundColor=i()},title:"Auth Debug",children:[u()," Auth"]}),d&&v("div",{className:"dndev-absolute bottom-full font-mono",style:{zIndex:"calc(var(--z-toast) + 100)",marginBottom:"var(--gap-sm)",padding:"var(--gap-md)",insetInlineEnd:0,backgroundColor:"rgba(0, 0, 0, 0.9)",color:"white",borderRadius:"var(--radius-lg)",minWidth:"200px",border:"1px solid rgb(75 85 99)"},children:r("div",{className:"dndev-flex dndev-items-center dndev-gap-sm",children:[r("div",{children:["Loading: ",o?"\u23F3":"\u2705"]}),r("div",{children:["Auth: ",e?"\u2705":"\u274C"]}),r("div",{children:["User: ",e?.email||"None"]}),t&&r("div",{style:{color:"rgb(248 113 113)"},children:["Error: ",t.message]})]})})]})};export{b as AuthDebugButton};
|