@djangocfg/layouts 1.0.5 → 1.0.6
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@djangocfg/layouts",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "Layout system and components for Unrealon applications",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "DjangoCFG",
|
|
@@ -53,9 +53,9 @@
|
|
|
53
53
|
"check": "tsc --noEmit"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"@djangocfg/api": "^1.0.
|
|
57
|
-
"@djangocfg/og-image": "^1.0.
|
|
58
|
-
"@djangocfg/ui": "^1.0.
|
|
56
|
+
"@djangocfg/api": "^1.0.6",
|
|
57
|
+
"@djangocfg/og-image": "^1.0.6",
|
|
58
|
+
"@djangocfg/ui": "^1.0.6",
|
|
59
59
|
"@hookform/resolvers": "^5.2.0",
|
|
60
60
|
"consola": "^3.4.2",
|
|
61
61
|
"lucide-react": "^0.468.0",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"vidstack": "0.6.15"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
|
-
"@djangocfg/typescript-config": "^1.0.
|
|
79
|
+
"@djangocfg/typescript-config": "^1.0.6",
|
|
80
80
|
"@types/node": "^24.7.2",
|
|
81
81
|
"@types/react": "19.2.2",
|
|
82
82
|
"@types/react-dom": "19.2.1",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
'use client';
|
|
19
19
|
|
|
20
|
-
import React, { ReactNode,
|
|
20
|
+
import React, { ReactNode, useEffect, useState } from 'react';
|
|
21
21
|
import { useRouter } from 'next/router';
|
|
22
22
|
import { AppContextProvider } from './context';
|
|
23
23
|
import { CoreProviders } from './providers';
|
|
@@ -50,41 +50,35 @@ function LayoutRouter({ children }: { children: ReactNode }) {
|
|
|
50
50
|
setIsMounted(true);
|
|
51
51
|
}, []);
|
|
52
52
|
|
|
53
|
-
//
|
|
54
|
-
const
|
|
53
|
+
// Determine layout mode based on route (synchronous - works with SSR)
|
|
54
|
+
const getLayoutMode = (): 'public' | 'private' | 'auth' => {
|
|
55
|
+
if (router.pathname.startsWith('/auth')) return 'auth';
|
|
56
|
+
if (router.pathname.startsWith('/private')) return 'private';
|
|
57
|
+
return 'public';
|
|
58
|
+
};
|
|
55
59
|
|
|
56
|
-
|
|
57
|
-
// This will be properly determined by AppContext
|
|
58
|
-
// For now, simple detection
|
|
59
|
-
if (router.pathname.startsWith('/auth')) {
|
|
60
|
-
setLayoutMode('auth');
|
|
61
|
-
} else if (router.pathname.startsWith('/private')) {
|
|
62
|
-
setLayoutMode('private');
|
|
63
|
-
} else {
|
|
64
|
-
setLayoutMode('public');
|
|
65
|
-
}
|
|
66
|
-
}, [router.pathname]);
|
|
67
|
-
|
|
68
|
-
// Show loading during SSR or auth check
|
|
69
|
-
if (!isMounted || isLoading) {
|
|
70
|
-
return (
|
|
71
|
-
<div className="min-h-screen flex items-center justify-center">
|
|
72
|
-
<div className="text-muted-foreground">Loading...</div>
|
|
73
|
-
</div>
|
|
74
|
-
);
|
|
75
|
-
}
|
|
60
|
+
const layoutMode = getLayoutMode();
|
|
76
61
|
|
|
77
62
|
// Render appropriate layout
|
|
78
63
|
switch (layoutMode) {
|
|
64
|
+
// Public routes: render immediately (SSR enabled)
|
|
65
|
+
case 'public':
|
|
66
|
+
return <PublicLayout>{children}</PublicLayout>;
|
|
67
|
+
|
|
68
|
+
// Auth routes: render immediately (SSR enabled)
|
|
79
69
|
case 'auth':
|
|
80
70
|
return <AuthLayout>{children}</AuthLayout>;
|
|
81
71
|
|
|
72
|
+
// Private routes: wait for client-side hydration and auth check
|
|
82
73
|
case 'private':
|
|
74
|
+
if (!isMounted || isLoading) {
|
|
75
|
+
return (
|
|
76
|
+
<div className="min-h-screen flex items-center justify-center">
|
|
77
|
+
<div className="text-muted-foreground">Loading...</div>
|
|
78
|
+
</div>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
83
81
|
return <PrivateLayout>{children}</PrivateLayout>;
|
|
84
|
-
|
|
85
|
-
case 'public':
|
|
86
|
-
default:
|
|
87
|
-
return <PublicLayout>{children}</PublicLayout>;
|
|
88
82
|
}
|
|
89
83
|
}
|
|
90
84
|
|