create-nextjs-cms 0.6.0 → 0.6.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-nextjs-cms",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,7 +1,7 @@
1
1
  import { notFound } from 'next/navigation'
2
2
  import auth from 'nextjs-cms/auth'
3
3
  import { getAdminPrivileges } from 'nextjs-cms/api/helpers'
4
- import { findPluginRouteByPath } from 'nextjs-cms/plugins/server'
4
+ import { findPluginRouteByPath, isDashboardOverridePlugin } from 'nextjs-cms/plugins/server'
5
5
  import { getPluginServerComponent } from './plugin-server-registry'
6
6
 
7
7
  export const dynamic = 'force-dynamic'
@@ -22,9 +22,13 @@ export default async function Page(props: { params: Params }) {
22
22
  notFound()
23
23
  }
24
24
 
25
- const privilegeSet = await getAdminPrivileges(session.user.id)
26
- if (!privilegeSet.has(plugin.pluginName)) {
27
- notFound()
25
+ // Bypass privilege check for dashboard override plugin
26
+ const isDashboardPlugin = await isDashboardOverridePlugin(plugin.pluginName)
27
+ if (!isDashboardPlugin) {
28
+ const privilegeSet = await getAdminPrivileges(session.user.id)
29
+ if (!privilegeSet.has(plugin.pluginName)) {
30
+ notFound()
31
+ }
28
32
  }
29
33
 
30
34
  const PluginComponent = await getPluginServerComponent(plugin.pluginRegistryName, plugin.component)
@@ -1,6 +1,9 @@
1
+ import { getDashboardOverride } from 'nextjs-cms/plugins/server'
2
+ import { getPluginServerComponent } from '../(plugins)/[...slug]/plugin-server-registry'
3
+
1
4
  export const dynamic = 'force-dynamic'
2
5
 
3
- export default function DashboardPage() {
6
+ function DefaultDashboard() {
4
7
  return (
5
8
  <div className='w-full'>
6
9
  <div className='bg-linear-to-r from-amber-200 via-orange-200 to-rose-200 p-8 text-foreground dark:from-amber-900 dark:via-orange-900 dark:to-rose-900'>
@@ -42,3 +45,19 @@ export default function DashboardPage() {
42
45
  </div>
43
46
  )
44
47
  }
48
+
49
+ export default async function DashboardPage() {
50
+ // Check for dashboard override configuration
51
+ const override = await getDashboardOverride()
52
+ if (!override) {
53
+ return <DefaultDashboard />
54
+ }
55
+
56
+ // Render the override plugin component (no privilege check for dashboard override)
57
+ const PluginComponent = await getPluginServerComponent(override.pluginRegistryName, override.component)
58
+ if (!PluginComponent) {
59
+ return <DefaultDashboard />
60
+ }
61
+
62
+ return <PluginComponent />
63
+ }
@@ -3,6 +3,11 @@
3
3
 
4
4
  @custom-variant dark (&:is(.dark *));
5
5
 
6
+ /**
7
+ * Background colors for the dashboard plugin
8
+ */
9
+ @source inline("{dark:,}bg-orange-{50,{100..900..100},950}");
10
+
6
11
  @utility container {
7
12
  margin-inline: auto;
8
13
  padding-inline: 2rem;
@@ -4,7 +4,10 @@ import ar from 'nextjs-cms/translations/dictionaries/ar'
4
4
  import process from 'process'
5
5
  import { resolve } from 'path'
6
6
 
7
- export const config: CMSConfig = {
7
+ export const config: CMSConfig = {
8
+ dashboard: {
9
+ override: '/cpanel-dashboard',
10
+ },
8
11
  title: 'NEXTJS CMS',
9
12
  defaultTheme: 'dark',
10
13
  },
@@ -23,6 +23,7 @@ export default function SectionItemCard({
23
23
  item: ArrElement<RouterOutputs['hasItemsSections']['listItems']['items']>
24
24
  action: any
25
25
  }) {
26
+ const t = useI18n()
26
27
  const { setModal } = useModal()
27
28
  const utils = trpc.useUtils()
28
29
  const deleteMutation = trpc.hasItemsSections.deleteItem.useMutation({
@@ -48,6 +48,7 @@ import {
48
48
 
49
49
  import { ConditionalField, FieldType } from 'nextjs-cms/core/types'
50
50
  import { configLastUpdated } from '@/components/form/helpers/util'
51
+ import PhotoGallery from '../PhotoGallery'
51
52
 
52
53
  export default function Form({
53
54
  formType,
@@ -231,9 +232,14 @@ export default function Form({
231
232
  })
232
233
  : null}
233
234
  {data.section.gallery ? (
235
+ <>
236
+ <div className='w-full'>
237
+ <PhotoGallery sectionName={data.section.name} gallery={data.gallery} />
238
+ </div>
234
239
  <div className='w-full'>
235
240
  <Dropzone ref={dropzoneRef} />
236
241
  </div>
242
+ </>
237
243
  ) : null}
238
244
 
239
245
  {/*{data.section.variants && data.section.variants.length > 0 ? (
@@ -8,4 +8,4 @@ export const revalidate = 0
8
8
 
9
9
  // @refresh reset
10
10
 
11
- export const configLastUpdated = 1769701296873
11
+ export const configLastUpdated = 1769812496863
@@ -61,11 +61,11 @@
61
61
  "file-type": "^20.1.0",
62
62
  "isomorphic-dompurify": "^2.21.0",
63
63
  "lodash-es": "^4.17.21",
64
- "lucide-react": "^0.475.0",
64
+ "lucide-react": "^0.563.0",
65
65
  "nanoid": "^5.1.2",
66
66
  "next": "16.1.1",
67
67
  "next-themes": "^0.4.6",
68
- "nextjs-cms": "0.6.0",
68
+ "nextjs-cms": "0.6.2",
69
69
  "plaiceholder": "^3.0.0",
70
70
  "prettier-plugin-tailwindcss": "^0.7.2",
71
71
  "qrcode": "^1.5.4",
@@ -98,7 +98,7 @@
98
98
  "eslint-config-prettier": "^10.0.1",
99
99
  "eslint-plugin-prettier": "^5.2.3",
100
100
  "fs-extra": "^11.3.3",
101
- "nextjs-cms-kit": "0.6.0",
101
+ "nextjs-cms-kit": "0.6.2",
102
102
  "postcss": "^8.5.1",
103
103
  "prettier": "3.5.0",
104
104
  "raw-loader": "^4.0.2",