create-nextjs-cms 0.9.14 → 0.9.15
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 +3 -3
- package/templates/default/components/ItemEditPage.tsx +2 -3
- package/templates/default/components/SectionPage.tsx +23 -26
- package/templates/default/components/form/helpers/_section-hot-reload.js +1 -1
- package/templates/default/next-env.d.ts +1 -1
- package/templates/default/package.json +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-nextjs-cms",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.15",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"tsx": "^4.20.6",
|
|
30
30
|
"typescript": "^5.9.2",
|
|
31
31
|
"@lzcms/eslint-config": "0.3.0",
|
|
32
|
-
"@lzcms/
|
|
33
|
-
"@lzcms/
|
|
32
|
+
"@lzcms/tsconfig": "0.1.0",
|
|
33
|
+
"@lzcms/prettier-config": "0.1.0"
|
|
34
34
|
},
|
|
35
35
|
"prettier": "@lzcms/prettier-config",
|
|
36
36
|
"scripts": {
|
|
@@ -17,7 +17,6 @@ import ErrorComponent from '@/components/ErrorComponent'
|
|
|
17
17
|
import LocaleSwitcher from '@/components/LocaleSwitcher'
|
|
18
18
|
import { Trash2 } from 'lucide-react'
|
|
19
19
|
import { Alert, AlertDescription } from './ui/alert'
|
|
20
|
-
import { ExclamationTriangleIcon } from '@radix-ui/react-icons'
|
|
21
20
|
|
|
22
21
|
export default function ItemEditPage({
|
|
23
22
|
section,
|
|
@@ -236,7 +235,7 @@ export default function ItemEditPage({
|
|
|
236
235
|
/{t('edit')} {data.section?.title.singular}
|
|
237
236
|
</span>
|
|
238
237
|
</div>
|
|
239
|
-
{data.localization
|
|
238
|
+
{data.localization?.localeSwitcherEnabled ? (
|
|
240
239
|
<div className="px-4 pt-4">
|
|
241
240
|
<LocaleSwitcher
|
|
242
241
|
section={section}
|
|
@@ -271,7 +270,7 @@ export default function ItemEditPage({
|
|
|
271
270
|
</Alert>
|
|
272
271
|
)}
|
|
273
272
|
</div>
|
|
274
|
-
)}
|
|
273
|
+
) : null}
|
|
275
274
|
<Form
|
|
276
275
|
key={locale ?? 'default'}
|
|
277
276
|
formType='edit'
|
|
@@ -32,7 +32,7 @@ export default function SectionPage({ section }: { section: string }) {
|
|
|
32
32
|
const handleDirtyChange = useCallback((isDirty: boolean) => setFormDirty(isDirty), [])
|
|
33
33
|
const dropzoneRef: RefObject<DropzoneHandles | null> = useRef(null)
|
|
34
34
|
|
|
35
|
-
const [data, {refetch, error, isError}] = trpc.simpleSections.create.useSuspenseQuery({
|
|
35
|
+
const [data, { refetch, error, isError }] = trpc.simpleSections.create.useSuspenseQuery({
|
|
36
36
|
sectionName: section,
|
|
37
37
|
locale,
|
|
38
38
|
})
|
|
@@ -98,9 +98,7 @@ export default function SectionPage({ section }: { section: string }) {
|
|
|
98
98
|
toast({
|
|
99
99
|
variant: res.data?.errors?.length ? 'warning' : 'success',
|
|
100
100
|
title: t('sectionUpdatedSuccessfully'),
|
|
101
|
-
description: res.data?.errors?.length
|
|
102
|
-
? t('errorsInSubmit')
|
|
103
|
-
: t('sectionUpdatedSuccessfully'),
|
|
101
|
+
description: res.data?.errors?.length ? t('errorsInSubmit') : t('sectionUpdatedSuccessfully'),
|
|
104
102
|
})
|
|
105
103
|
|
|
106
104
|
// Refetch the page
|
|
@@ -131,9 +129,8 @@ export default function SectionPage({ section }: { section: string }) {
|
|
|
131
129
|
}
|
|
132
130
|
}, [])
|
|
133
131
|
|
|
134
|
-
|
|
135
132
|
if (data.error) {
|
|
136
|
-
|
|
133
|
+
return <ErrorComponent message={data.error.message} />
|
|
137
134
|
}
|
|
138
135
|
|
|
139
136
|
return (
|
|
@@ -141,15 +138,15 @@ export default function SectionPage({ section }: { section: string }) {
|
|
|
141
138
|
{isError ? <div>{error?.message}</div> : null}
|
|
142
139
|
{data ? (
|
|
143
140
|
<div className='flex w-full flex-col'>
|
|
144
|
-
<div className='relative z-1 border-b-2 p-8 pt-12 font-extrabold
|
|
145
|
-
<div className='absolute
|
|
141
|
+
<div className='text-foreground relative z-1 border-b-2 p-8 pt-12 font-extrabold'>
|
|
142
|
+
<div className='absolute top-0 left-0 z-2 h-4 w-full bg-linear-to-r from-emerald-800 via-emerald-400 to-sky-600'></div>
|
|
146
143
|
<h1 className='pb-4 text-4xl'>{data.section?.title}</h1>
|
|
147
144
|
<span>
|
|
148
145
|
/{t('edit')} {data.section?.title}
|
|
149
146
|
</span>
|
|
150
147
|
</div>
|
|
151
|
-
{data.localization
|
|
152
|
-
<div className=
|
|
148
|
+
{data.localization?.localeSwitcherEnabled ? (
|
|
149
|
+
<div className='px-8 pt-4'>
|
|
153
150
|
<LocaleSwitcher
|
|
154
151
|
section={section}
|
|
155
152
|
currentLocale={data.localization.currentLocale}
|
|
@@ -163,26 +160,26 @@ export default function SectionPage({ section }: { section: string }) {
|
|
|
163
160
|
<Alert variant='info' className='mt-2 w-full'>
|
|
164
161
|
<AlertDescription className='text-md font-bold'>
|
|
165
162
|
<div className='flex items-center justify-between'>
|
|
166
|
-
|
|
167
|
-
{
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
163
|
+
<span>{t('editingContentTranslation', { locale })}</span>
|
|
164
|
+
{data.localization.existingTranslations.includes(locale) && (
|
|
165
|
+
<button
|
|
166
|
+
type='button'
|
|
167
|
+
onClick={handleDeleteLocale}
|
|
168
|
+
disabled={deleteLocaleMutation.isPending}
|
|
169
|
+
className='inline-flex items-center gap-1.5 rounded-md bg-red-600 px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-red-700 disabled:opacity-50'
|
|
170
|
+
>
|
|
171
|
+
<Trash2 className='h-3.5 w-3.5' />
|
|
172
|
+
{deleteLocaleMutation.isPending
|
|
173
|
+
? t('loading')
|
|
174
|
+
: t('deleteLocaleTranslation')}
|
|
175
|
+
</button>
|
|
176
|
+
)}
|
|
177
|
+
</div>
|
|
181
178
|
</AlertDescription>
|
|
182
179
|
</Alert>
|
|
183
180
|
)}
|
|
184
181
|
</div>
|
|
185
|
-
)}
|
|
182
|
+
) : null}
|
|
186
183
|
<Form
|
|
187
184
|
key={locale ?? 'default'}
|
|
188
185
|
formType='edit'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="next" />
|
|
2
2
|
/// <reference types="next/image-types/global" />
|
|
3
|
-
import "./.next/types/routes.d.ts";
|
|
3
|
+
import "./.next/dev/types/routes.d.ts";
|
|
4
4
|
|
|
5
5
|
// NOTE: This file should not be edited
|
|
6
6
|
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
|