@nextsparkjs/core 0.1.0-beta.143 → 0.1.0-beta.144

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.
@@ -1,5 +1,5 @@
1
1
  {
2
- "generated": "2026-04-15T14:10:16.186Z",
2
+ "generated": "2026-04-15T14:36:02.678Z",
3
3
  "totalClasses": 1078,
4
4
  "classes": [
5
5
  "!text-2xl",
@@ -1,6 +1,10 @@
1
+ import { Suspense } from 'react'
2
+ import { NextIntlClientProvider } from 'next-intl'
3
+ import { getMessages } from 'next-intl/server'
1
4
  import { SuperAdminGuard } from "@nextsparkjs/core/components/app/guards/SuperAdminGuard";
2
5
  import { DashboardProviders } from "@nextsparkjs/core/providers/DashboardProviders";
3
6
  import { SuperadminSidebar } from "@nextsparkjs/core/components/superadmin/layouts/SuperadminSidebar";
7
+ import { Loader2 } from 'lucide-react'
4
8
  import { Metadata } from "next";
5
9
  import { getTemplateOrDefault, getMetadataOrDefault } from '@nextsparkjs/core/lib/template-resolver'
6
10
  import { getPluginNavItems } from '@nextsparkjs/registries/plugin-registry'
@@ -21,52 +25,72 @@ interface SuperadminLayoutProps {
21
25
  }
22
26
 
23
27
  /**
24
- * Superadmin Layout
28
+ * Inner async component that loads translations server-side.
29
+ * Wrapped in Suspense so PPR doesn't fail during prerender.
25
30
  *
26
- * Protected layout for superadmin-only sections with dedicated sidebar navigation.
27
- * Applies SuperAdminGuard protection to all child routes.
28
- * Includes responsive design for mobile and desktop.
31
+ * Loads ALL translations (core + theme + entity + plugin) via getMessages()
32
+ * so plugin settings pages can use useTranslations() for their namespaces.
29
33
  */
30
- function SuperadminLayout({ children }: SuperadminLayoutProps) {
34
+ async function SuperadminWithTranslations({ children }: SuperadminLayoutProps) {
35
+ const messages = await getMessages()
31
36
  const pluginNavItems = getPluginNavItems('superadmin')
37
+
32
38
  return (
33
39
  <DashboardProviders>
34
- <SuperAdminGuard>
35
- <div className="flex h-screen bg-background" data-cy="superadmin-container">
36
- {/* Sidebar - Hidden on mobile, visible on desktop */}
37
- <div className="hidden lg:block">
38
- <SuperadminSidebar pluginItems={pluginNavItems} />
39
- </div>
40
+ <NextIntlClientProvider messages={messages}>
41
+ <SuperAdminGuard>
42
+ <div className="flex h-screen bg-background" data-cy="superadmin-container">
43
+ {/* Sidebar - Hidden on mobile, visible on desktop */}
44
+ <div className="hidden lg:block">
45
+ <SuperadminSidebar pluginItems={pluginNavItems} />
46
+ </div>
40
47
 
41
- {/* Main content area */}
42
- <div className="flex-1 flex flex-col overflow-hidden">
43
- {/* Mobile header for Superadmin - Only visible on mobile */}
44
- <div className="lg:hidden bg-card border-b border-border p-4">
45
- <div className="flex items-center gap-2">
46
- <div className="flex items-center justify-center w-8 h-8 bg-red-100 rounded-lg">
47
- <div className="h-5 w-5 bg-red-600 rounded-sm"></div>
48
+ {/* Main content area */}
49
+ <div className="flex-1 flex flex-col overflow-hidden">
50
+ {/* Mobile header for Superadmin - Only visible on mobile */}
51
+ <div className="lg:hidden bg-card border-b border-border p-4">
52
+ <div className="flex items-center gap-2">
53
+ <div className="flex items-center justify-center w-8 h-8 bg-red-100 rounded-lg">
54
+ <div className="h-5 w-5 bg-red-600 rounded-sm"></div>
55
+ </div>
56
+ <div>
57
+ <h1 className="text-lg font-bold text-red-600">Super Admin</h1>
58
+ <p className="text-xs text-muted-foreground">Super Admin Area</p>
59
+ </div>
60
+ </div>
48
61
  </div>
49
- <div>
50
- <h1 className="text-lg font-bold text-red-600">Super Admin</h1>
51
- <p className="text-xs text-muted-foreground">Super Admin Area</p>
52
- </div>
53
- </div>
54
- </div>
55
62
 
56
- {/* Content area with scrolling */}
57
- <main className="flex-1 overflow-y-auto">
58
- <div className="container mx-auto p-6 max-w-7xl">
59
- {children}
63
+ {/* Content area with scrolling */}
64
+ <main className="flex-1 overflow-y-auto">
65
+ <div className="container mx-auto p-6 max-w-7xl">
66
+ {children}
67
+ </div>
68
+ </main>
60
69
  </div>
61
- </main>
62
- </div>
70
+ </div>
71
+ </SuperAdminGuard>
72
+ </NextIntlClientProvider>
73
+ </DashboardProviders>
74
+ )
75
+ }
63
76
 
64
- {/* Mobile sidebar overlay (future enhancement) */}
65
- {/* Could add a mobile drawer/overlay sidebar here if needed */}
77
+ /**
78
+ * Superadmin Layout
79
+ *
80
+ * Protected layout for superadmin-only sections with dedicated sidebar navigation.
81
+ * Loads ALL translations (core + theme + entity + plugin) server-side via
82
+ * NextIntlClientProvider so plugin settings pages can use useTranslations().
83
+ */
84
+ function SuperadminLayout({ children }: SuperadminLayoutProps) {
85
+ return (
86
+ <Suspense fallback={
87
+ <div className="min-h-screen flex items-center justify-center">
88
+ <Loader2 className="h-8 w-8 animate-spin text-muted-foreground" />
66
89
  </div>
67
- </SuperAdminGuard>
68
- </DashboardProviders>
69
- );
90
+ }>
91
+ <SuperadminWithTranslations>{children}</SuperadminWithTranslations>
92
+ </Suspense>
93
+ )
70
94
  }
71
95
 
72
- export default getTemplateOrDefault('app/superadmin/layout.tsx', SuperadminLayout)
96
+ export default getTemplateOrDefault('app/superadmin/layout.tsx', SuperadminLayout)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextsparkjs/core",
3
- "version": "0.1.0-beta.143",
3
+ "version": "0.1.0-beta.144",
4
4
  "description": "NextSpark - The complete SaaS framework for Next.js",
5
5
  "license": "MIT",
6
6
  "author": "NextSpark <hello@nextspark.dev>",
@@ -463,7 +463,7 @@
463
463
  "tailwind-merge": "^3.3.1",
464
464
  "uuid": "^13.0.0",
465
465
  "zod": "^4.1.5",
466
- "@nextsparkjs/testing": "0.1.0-beta.143"
466
+ "@nextsparkjs/testing": "0.1.0-beta.144"
467
467
  },
468
468
  "scripts": {
469
469
  "postinstall": "node scripts/postinstall.mjs || true",
@@ -1,6 +1,10 @@
1
+ import { Suspense } from 'react'
2
+ import { NextIntlClientProvider } from 'next-intl'
3
+ import { getMessages } from 'next-intl/server'
1
4
  import { SuperAdminGuard } from "@nextsparkjs/core/components/app/guards/SuperAdminGuard";
2
5
  import { DashboardProviders } from "@nextsparkjs/core/providers/DashboardProviders";
3
6
  import { SuperadminSidebar } from "@nextsparkjs/core/components/superadmin/layouts/SuperadminSidebar";
7
+ import { Loader2 } from 'lucide-react'
4
8
  import { Metadata } from "next";
5
9
  import { getTemplateOrDefault, getMetadataOrDefault } from '@nextsparkjs/core/lib/template-resolver'
6
10
  import { getPluginNavItems } from '@nextsparkjs/registries/plugin-registry'
@@ -21,52 +25,72 @@ interface SuperadminLayoutProps {
21
25
  }
22
26
 
23
27
  /**
24
- * Superadmin Layout
28
+ * Inner async component that loads translations server-side.
29
+ * Wrapped in Suspense so PPR doesn't fail during prerender.
25
30
  *
26
- * Protected layout for superadmin-only sections with dedicated sidebar navigation.
27
- * Applies SuperAdminGuard protection to all child routes.
28
- * Includes responsive design for mobile and desktop.
31
+ * Loads ALL translations (core + theme + entity + plugin) via getMessages()
32
+ * so plugin settings pages can use useTranslations() for their namespaces.
29
33
  */
30
- function SuperadminLayout({ children }: SuperadminLayoutProps) {
34
+ async function SuperadminWithTranslations({ children }: SuperadminLayoutProps) {
35
+ const messages = await getMessages()
31
36
  const pluginNavItems = getPluginNavItems('superadmin')
37
+
32
38
  return (
33
39
  <DashboardProviders>
34
- <SuperAdminGuard>
35
- <div className="flex h-screen bg-background" data-cy="superadmin-container">
36
- {/* Sidebar - Hidden on mobile, visible on desktop */}
37
- <div className="hidden lg:block">
38
- <SuperadminSidebar pluginItems={pluginNavItems} />
39
- </div>
40
+ <NextIntlClientProvider messages={messages}>
41
+ <SuperAdminGuard>
42
+ <div className="flex h-screen bg-background" data-cy="superadmin-container">
43
+ {/* Sidebar - Hidden on mobile, visible on desktop */}
44
+ <div className="hidden lg:block">
45
+ <SuperadminSidebar pluginItems={pluginNavItems} />
46
+ </div>
40
47
 
41
- {/* Main content area */}
42
- <div className="flex-1 flex flex-col overflow-hidden">
43
- {/* Mobile header for Superadmin - Only visible on mobile */}
44
- <div className="lg:hidden bg-card border-b border-border p-4">
45
- <div className="flex items-center gap-2">
46
- <div className="flex items-center justify-center w-8 h-8 bg-red-100 rounded-lg">
47
- <div className="h-5 w-5 bg-red-600 rounded-sm"></div>
48
+ {/* Main content area */}
49
+ <div className="flex-1 flex flex-col overflow-hidden">
50
+ {/* Mobile header for Superadmin - Only visible on mobile */}
51
+ <div className="lg:hidden bg-card border-b border-border p-4">
52
+ <div className="flex items-center gap-2">
53
+ <div className="flex items-center justify-center w-8 h-8 bg-red-100 rounded-lg">
54
+ <div className="h-5 w-5 bg-red-600 rounded-sm"></div>
55
+ </div>
56
+ <div>
57
+ <h1 className="text-lg font-bold text-red-600">Super Admin</h1>
58
+ <p className="text-xs text-muted-foreground">Super Admin Area</p>
59
+ </div>
60
+ </div>
48
61
  </div>
49
- <div>
50
- <h1 className="text-lg font-bold text-red-600">Super Admin</h1>
51
- <p className="text-xs text-muted-foreground">Super Admin Area</p>
52
- </div>
53
- </div>
54
- </div>
55
62
 
56
- {/* Content area with scrolling */}
57
- <main className="flex-1 overflow-y-auto">
58
- <div className="container mx-auto p-6 max-w-7xl">
59
- {children}
63
+ {/* Content area with scrolling */}
64
+ <main className="flex-1 overflow-y-auto">
65
+ <div className="container mx-auto p-6 max-w-7xl">
66
+ {children}
67
+ </div>
68
+ </main>
60
69
  </div>
61
- </main>
62
- </div>
70
+ </div>
71
+ </SuperAdminGuard>
72
+ </NextIntlClientProvider>
73
+ </DashboardProviders>
74
+ )
75
+ }
63
76
 
64
- {/* Mobile sidebar overlay (future enhancement) */}
65
- {/* Could add a mobile drawer/overlay sidebar here if needed */}
77
+ /**
78
+ * Superadmin Layout
79
+ *
80
+ * Protected layout for superadmin-only sections with dedicated sidebar navigation.
81
+ * Loads ALL translations (core + theme + entity + plugin) server-side via
82
+ * NextIntlClientProvider so plugin settings pages can use useTranslations().
83
+ */
84
+ function SuperadminLayout({ children }: SuperadminLayoutProps) {
85
+ return (
86
+ <Suspense fallback={
87
+ <div className="min-h-screen flex items-center justify-center">
88
+ <Loader2 className="h-8 w-8 animate-spin text-muted-foreground" />
66
89
  </div>
67
- </SuperAdminGuard>
68
- </DashboardProviders>
69
- );
90
+ }>
91
+ <SuperadminWithTranslations>{children}</SuperadminWithTranslations>
92
+ </Suspense>
93
+ )
70
94
  }
71
95
 
72
- export default getTemplateOrDefault('app/superadmin/layout.tsx', SuperadminLayout)
96
+ export default getTemplateOrDefault('app/superadmin/layout.tsx', SuperadminLayout)