create-nextjs-cms 0.5.92 → 0.5.94
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/app/(auth)/auth/login/LoginPage.tsx +13 -12
- package/templates/default/app/(auth)/layout.tsx +56 -0
- package/templates/default/app/(rootLayout)/layout.tsx +58 -8
- package/templates/default/app/globals.css +1 -1
- package/templates/default/components/AdminCard.tsx +16 -15
- package/templates/default/components/AdminEditPage.tsx +8 -7
- package/templates/default/components/AdminPrivilegeCard.tsx +12 -11
- package/templates/default/components/AdminsPage.tsx +5 -4
- package/templates/default/components/AnalyticsPage.tsx +8 -7
- package/templates/default/components/BrowsePage.tsx +7 -6
- package/templates/default/components/CategoryDeleteConfirmPage.tsx +12 -11
- package/templates/default/components/CategorySectionSelectInput.tsx +3 -2
- package/templates/default/components/DashboardNewPage.tsx +40 -39
- package/templates/default/components/DashboardPage.tsx +34 -33
- package/templates/default/components/DashboardPageAlt.tsx +3 -1
- package/templates/default/components/Dropzone.tsx +8 -7
- package/templates/default/components/EmailCard.tsx +12 -11
- package/templates/default/components/EmailPasswordForm.tsx +7 -6
- package/templates/default/components/EmailQuotaForm.tsx +7 -6
- package/templates/default/components/EmailsPage.tsx +6 -5
- package/templates/default/components/GalleryPhoto.tsx +6 -5
- package/templates/default/components/ItemEditPage.tsx +5 -4
- package/templates/default/components/Layout.tsx +1 -1
- package/templates/default/components/LoadingSpinners.tsx +1 -1
- package/templates/default/components/LogPage.tsx +24 -9
- package/templates/default/components/Navbar.tsx +13 -12
- package/templates/default/components/NewAdminForm.tsx +12 -11
- package/templates/default/components/NewEmailForm.tsx +11 -10
- package/templates/default/components/NewPage.tsx +6 -5
- package/templates/default/components/NewVariantComponent.tsx +6 -5
- package/templates/default/components/PhotoGallery.tsx +4 -3
- package/templates/default/components/SectionItemCard.tsx +8 -8
- package/templates/default/components/SectionItemStatusBadge.tsx +3 -2
- package/templates/default/components/SectionPage.tsx +6 -5
- package/templates/default/components/SelectInputButtons.tsx +8 -7
- package/templates/default/components/SettingsPage.tsx +18 -17
- package/templates/default/components/Sidebar.tsx +23 -15
- package/templates/default/components/SidebarDropdownItem.tsx +11 -5
- package/templates/default/components/SidebarItem.tsx +1 -0
- package/templates/default/components/VariantCard.tsx +8 -8
- package/templates/default/components/VariantEditPage.tsx +5 -4
- package/templates/default/components/analytics/BounceRate.tsx +6 -5
- package/templates/default/components/analytics/LivePageViews.tsx +8 -7
- package/templates/default/components/analytics/LiveUsersCount.tsx +3 -2
- package/templates/default/components/analytics/MonthlyPageViews.tsx +3 -2
- package/templates/default/components/analytics/TopCountries.tsx +4 -3
- package/templates/default/components/analytics/TopDevices.tsx +4 -3
- package/templates/default/components/analytics/TopMediums.tsx +4 -3
- package/templates/default/components/analytics/TopSources.tsx +4 -3
- package/templates/default/components/analytics/TotalPageViews.tsx +3 -2
- package/templates/default/components/analytics/TotalSessions.tsx +3 -2
- package/templates/default/components/analytics/TotalUniqueUsers.tsx +3 -2
- package/templates/default/components/custom/RightHomeRoomVariantCard.tsx +9 -8
- package/templates/default/components/form/Form.tsx +5 -4
- package/templates/default/components/form/FormInputElement.tsx +3 -1
- package/templates/default/components/form/helpers/_section-hot-reload.js +1 -1
- package/templates/default/components/form/inputs/DateFormInput.tsx +3 -2
- package/templates/default/components/form/inputs/DocumentFormInput.tsx +16 -15
- package/templates/default/components/form/inputs/MapFormInput.tsx +5 -4
- package/templates/default/components/form/inputs/PhotoFormInput.tsx +16 -15
- package/templates/default/components/form/inputs/SelectFormInput.tsx +3 -2
- package/templates/default/components/form/inputs/TagsFormInput.tsx +3 -2
- package/templates/default/components/form/inputs/VideoFormInput.tsx +7 -6
- package/templates/default/components/pagination/PaginationButtons.tsx +8 -6
- package/templates/default/package.json +2 -2
- package/templates/default/app/layout.tsx +0 -40
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useI18n } from 'nextjs-cms/translations/client'
|
|
2
2
|
import React from 'react'
|
|
3
3
|
import useModal from '@/hooks/useModal'
|
|
4
4
|
import InfoCard from '@/components/InfoCard'
|
|
@@ -15,6 +15,7 @@ export default function NewAdminForm({
|
|
|
15
15
|
privileges: RouterOutputs['admins']['list']['privileges']
|
|
16
16
|
action: any
|
|
17
17
|
}) {
|
|
18
|
+
const t = useI18n()
|
|
18
19
|
const { setModal, modal, modalResponse, setModalResponse } = useModal()
|
|
19
20
|
const { toast } = useToast()
|
|
20
21
|
const formRef = React.useRef<HTMLFormElement>(null)
|
|
@@ -25,7 +26,7 @@ export default function NewAdminForm({
|
|
|
25
26
|
const mutation = trpc.admins.create.useMutation({
|
|
26
27
|
onError: (error) => {
|
|
27
28
|
setModal({
|
|
28
|
-
title:
|
|
29
|
+
title: t('createNewAdmin'),
|
|
29
30
|
body: (
|
|
30
31
|
<div className='p-4'>
|
|
31
32
|
<InfoCard result={{ key: 'danger', title: error.message, status: false }} />
|
|
@@ -55,8 +56,8 @@ export default function NewAdminForm({
|
|
|
55
56
|
*/
|
|
56
57
|
toast({
|
|
57
58
|
variant: 'success',
|
|
58
|
-
title:
|
|
59
|
-
description:
|
|
59
|
+
title: t('createNewAdmin'),
|
|
60
|
+
description: t('itemCreatedSuccessfully'),
|
|
60
61
|
})
|
|
61
62
|
},
|
|
62
63
|
})
|
|
@@ -69,8 +70,8 @@ export default function NewAdminForm({
|
|
|
69
70
|
*/
|
|
70
71
|
if (!usernameRef.current?.value || !passwordRef.current?.value) {
|
|
71
72
|
setModal({
|
|
72
|
-
title:
|
|
73
|
-
body: <div className='p-4'>{
|
|
73
|
+
title: t('createNewAdmin'),
|
|
74
|
+
body: <div className='p-4'>{t('usernamePasswordRequired')}</div>,
|
|
74
75
|
headerColor: 'bg-red-700',
|
|
75
76
|
titleColor: 'text-white',
|
|
76
77
|
lang: 'en',
|
|
@@ -97,7 +98,7 @@ export default function NewAdminForm({
|
|
|
97
98
|
<form ref={formRef} onSubmit={handleSubmit} className='flex flex-col gap-2'>
|
|
98
99
|
<div>
|
|
99
100
|
<label htmlFor='email' className='block text-sm font-medium leading-6 text-foreground'>
|
|
100
|
-
{
|
|
101
|
+
{t('username')}
|
|
101
102
|
</label>
|
|
102
103
|
<div className=''>
|
|
103
104
|
<input
|
|
@@ -113,7 +114,7 @@ export default function NewAdminForm({
|
|
|
113
114
|
|
|
114
115
|
<div>
|
|
115
116
|
<label htmlFor='password' className='block text-sm font-medium leading-6 text-foreground'>
|
|
116
|
-
{
|
|
117
|
+
{t('password')}
|
|
117
118
|
</label>
|
|
118
119
|
<div className=''>
|
|
119
120
|
<input
|
|
@@ -128,7 +129,7 @@ export default function NewAdminForm({
|
|
|
128
129
|
</div>
|
|
129
130
|
{privileges && privileges.length > 0 && (
|
|
130
131
|
<>
|
|
131
|
-
<div className='mt-5 w-full font-semibold'>{
|
|
132
|
+
<div className='mt-5 w-full font-semibold'>{t('adminPrivileges')}</div>
|
|
132
133
|
<div className='flex'>
|
|
133
134
|
<Button
|
|
134
135
|
className='border border-foreground'
|
|
@@ -144,7 +145,7 @@ export default function NewAdminForm({
|
|
|
144
145
|
}
|
|
145
146
|
}}
|
|
146
147
|
>
|
|
147
|
-
{allChecked === true ?
|
|
148
|
+
{allChecked === true ? t('removeAll') : t('checkAll')}
|
|
148
149
|
</Button>
|
|
149
150
|
</div>
|
|
150
151
|
<div className='mt-2 grid w-full grid-cols-1 gap-2 md-sidebar:grid-cols-2 lg-sidebar:grid-cols-3 xl-sidebar:grid-cols-4 2xl-sidebar:grid-cols-5'>
|
|
@@ -164,7 +165,7 @@ export default function NewAdminForm({
|
|
|
164
165
|
|
|
165
166
|
<div className='mt-4'>
|
|
166
167
|
<button type='submit' className='rounded bg-blue-700 px-2 py-1 font-bold text-white'>
|
|
167
|
-
{
|
|
168
|
+
{t('submitNewAdmin')}
|
|
168
169
|
</button>
|
|
169
170
|
</div>
|
|
170
171
|
</form>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useI18n } from 'nextjs-cms/translations/client'
|
|
2
2
|
import React from 'react'
|
|
3
3
|
import useModal from '@/hooks/useModal'
|
|
4
4
|
import { Badge } from '@/components/ui/badge'
|
|
@@ -7,13 +7,14 @@ import InfoCard from '@/components/InfoCard'
|
|
|
7
7
|
import { trpc } from '@/app/_trpc/client'
|
|
8
8
|
|
|
9
9
|
export default function NewEmailForm({ action }: { action: any }) {
|
|
10
|
+
const t = useI18n()
|
|
10
11
|
const { setModal, modal, modalResponse, setModalResponse } = useModal()
|
|
11
12
|
const formRef = React.useRef<HTMLFormElement>(null)
|
|
12
13
|
const { toast } = useToast()
|
|
13
14
|
const newEmailMutation = trpc.cpanelEmails.createEmail.useMutation({
|
|
14
15
|
onError: (error) => {
|
|
15
16
|
setModal({
|
|
16
|
-
title:
|
|
17
|
+
title: t('error'),
|
|
17
18
|
body: (
|
|
18
19
|
<div className='p-4'>
|
|
19
20
|
<InfoCard result={{ key: 'danger', title: error.message, status: false }} />
|
|
@@ -28,7 +29,7 @@ export default function NewEmailForm({ action }: { action: any }) {
|
|
|
28
29
|
action()
|
|
29
30
|
toast({
|
|
30
31
|
variant: 'success',
|
|
31
|
-
title:
|
|
32
|
+
title: t('success'),
|
|
32
33
|
description: data.message,
|
|
33
34
|
})
|
|
34
35
|
|
|
@@ -52,7 +53,7 @@ export default function NewEmailForm({ action }: { action: any }) {
|
|
|
52
53
|
const response = await handleEmailSubmission(values, axiosPrivate, controller)
|
|
53
54
|
if (response.error) {
|
|
54
55
|
setModal({
|
|
55
|
-
title:
|
|
56
|
+
title: t('error'),
|
|
56
57
|
body: (
|
|
57
58
|
<div className='p-4'>
|
|
58
59
|
<InfoCard result={{ key: 'danger', title: response.error.message, status: false }} />
|
|
@@ -66,7 +67,7 @@ export default function NewEmailForm({ action }: { action: any }) {
|
|
|
66
67
|
action()
|
|
67
68
|
toast({
|
|
68
69
|
variant: 'success',
|
|
69
|
-
title:
|
|
70
|
+
title: t('success'),
|
|
70
71
|
description: response.message,
|
|
71
72
|
})
|
|
72
73
|
}*/
|
|
@@ -76,7 +77,7 @@ export default function NewEmailForm({ action }: { action: any }) {
|
|
|
76
77
|
<form ref={formRef} onSubmit={handleSubmit} className='flex flex-col gap-2'>
|
|
77
78
|
<div>
|
|
78
79
|
<label htmlFor='username' className='block text-sm font-medium leading-6 text-foreground'>
|
|
79
|
-
{
|
|
80
|
+
{t('email')}
|
|
80
81
|
</label>
|
|
81
82
|
<div className=''>
|
|
82
83
|
<input
|
|
@@ -92,7 +93,7 @@ export default function NewEmailForm({ action }: { action: any }) {
|
|
|
92
93
|
|
|
93
94
|
<div>
|
|
94
95
|
<label htmlFor='password' className='block text-sm font-medium leading-6 text-foreground'>
|
|
95
|
-
{
|
|
96
|
+
{t('password')}
|
|
96
97
|
</label>
|
|
97
98
|
<div className=''>
|
|
98
99
|
<input
|
|
@@ -107,7 +108,7 @@ export default function NewEmailForm({ action }: { action: any }) {
|
|
|
107
108
|
</div>
|
|
108
109
|
<div>
|
|
109
110
|
<label htmlFor='quota' className='block text-sm font-medium leading-6 text-foreground'>
|
|
110
|
-
{
|
|
111
|
+
{t('emailQuota')}
|
|
111
112
|
</label>
|
|
112
113
|
<div className=''>
|
|
113
114
|
<input
|
|
@@ -119,12 +120,12 @@ export default function NewEmailForm({ action }: { action: any }) {
|
|
|
119
120
|
className='block rounded-md border-0 bg-input p-2.5 text-foreground shadow-xs outline-0 ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6'
|
|
120
121
|
/>
|
|
121
122
|
<Badge className='rounded-sm border-muted-foreground text-muted-foreground' variant='secondary'>
|
|
122
|
-
0 = {
|
|
123
|
+
0 = {t('unlimited')}
|
|
123
124
|
</Badge>
|
|
124
125
|
</div>
|
|
125
126
|
</div>
|
|
126
127
|
<div className='mt-4'>
|
|
127
|
-
<button className='rounded bg-blue-700 px-2 py-1 font-bold text-white'>{
|
|
128
|
+
<button className='rounded bg-blue-700 px-2 py-1 font-bold text-white'>{t('create')}</button>
|
|
128
129
|
</div>
|
|
129
130
|
</form>
|
|
130
131
|
)
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { useAxiosPrivate } from 'nextjs-cms/auth/hooks'
|
|
4
4
|
import { RefObject, useEffect, useRef, useState } from 'react'
|
|
5
5
|
import { SectionType } from 'nextjs-cms/core/types'
|
|
6
|
-
import
|
|
6
|
+
import { useI18n } from 'nextjs-cms/translations/client'
|
|
7
7
|
import useModal from '@/hooks/useModal'
|
|
8
8
|
import { AxiosError } from 'axios'
|
|
9
9
|
import InfoCard from '@/components/InfoCard'
|
|
@@ -29,6 +29,7 @@ export default function NewPage({
|
|
|
29
29
|
}[]
|
|
30
30
|
action?: any
|
|
31
31
|
}) {
|
|
32
|
+
const t = useI18n()
|
|
32
33
|
const [progress, setProgress] = useState(0)
|
|
33
34
|
const [progressVariant, setProgressVariant] = useState<'determinate' | 'query'>('determinate')
|
|
34
35
|
const [isSubmitting, setIsSubmitting] = useState(false)
|
|
@@ -114,10 +115,10 @@ export default function NewPage({
|
|
|
114
115
|
if (res.status === 200) {
|
|
115
116
|
toast({
|
|
116
117
|
variant: res.data?.errors?.length ? 'warning' : 'success',
|
|
117
|
-
title:
|
|
118
|
+
title: t('itemCreatedSuccessfully'),
|
|
118
119
|
description: res.data?.errors?.length
|
|
119
|
-
?
|
|
120
|
-
:
|
|
120
|
+
? t('errorsInSubmit')
|
|
121
|
+
: t('itemCreatedSuccessfully'),
|
|
121
122
|
})
|
|
122
123
|
|
|
123
124
|
switch (sectionType) {
|
|
@@ -183,7 +184,7 @@ export default function NewPage({
|
|
|
183
184
|
<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>
|
|
184
185
|
<h1 className='pb-4 text-4xl'>{data.section?.title.section}</h1>
|
|
185
186
|
<span>
|
|
186
|
-
/{
|
|
187
|
+
/{t('new')} {data.section?.title.singular}
|
|
187
188
|
</span>
|
|
188
189
|
</div>
|
|
189
190
|
<Form
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle, SheetTrigger } from '@/components/ui/sheet'
|
|
2
2
|
import React, { forwardRef, Ref, useEffect, useImperativeHandle, useState } from 'react'
|
|
3
3
|
import ContainerBox from '@/components/ContainerBox'
|
|
4
|
-
import
|
|
4
|
+
import { useI18n } from 'nextjs-cms/translations/client'
|
|
5
5
|
import { Button } from '@/components/ui/button'
|
|
6
6
|
import { useQuery } from '@tanstack/react-query'
|
|
7
7
|
import { getNewVariantPage } from '@/lib/apiHelpers'
|
|
@@ -34,6 +34,7 @@ function NewVariantComponent(
|
|
|
34
34
|
},
|
|
35
35
|
ref: Ref<VariantHandles>,
|
|
36
36
|
) {
|
|
37
|
+
const t = useI18n()
|
|
37
38
|
const [open, setOpen] = React.useState(false)
|
|
38
39
|
const axiosPrivate = useAxiosPrivate()
|
|
39
40
|
const controller = new AbortController()
|
|
@@ -137,7 +138,7 @@ function NewVariantComponent(
|
|
|
137
138
|
}))
|
|
138
139
|
|
|
139
140
|
return (
|
|
140
|
-
<ContainerBox title={`${
|
|
141
|
+
<ContainerBox title={`${t('add')} ${variantInfo.variant_html_name_en}`}>
|
|
141
142
|
<div className='mb-4 grid grid-cols-1 gap-4 rounded-2xl border-4 border-dashed border-gray-400 bg-accent p-2 md:grid-cols-2 lg:grid-cols-4'>
|
|
142
143
|
{variants.map((v) => (
|
|
143
144
|
<ContainerBox title={v.title} key={v.id}>
|
|
@@ -163,11 +164,11 @@ function NewVariantComponent(
|
|
|
163
164
|
</div>
|
|
164
165
|
<Sheet open={open} onOpenChange={setOpen}>
|
|
165
166
|
<SheetTrigger>
|
|
166
|
-
<Button type='button'>{
|
|
167
|
+
<Button type='button'>{t('add')} +</Button>
|
|
167
168
|
</SheetTrigger>
|
|
168
169
|
<SheetContent className='w-1/2 max-w-[2/3] sm:w-[940px] sm:max-w-full'>
|
|
169
170
|
<SheetHeader>
|
|
170
|
-
<SheetTitle>{
|
|
171
|
+
<SheetTitle>{t('newVariant')}</SheetTitle>
|
|
171
172
|
<SheetDescription>
|
|
172
173
|
<form onSubmit={handleSubmit}>
|
|
173
174
|
<div className=''>
|
|
@@ -205,7 +206,7 @@ function NewVariantComponent(
|
|
|
205
206
|
type='submit'
|
|
206
207
|
disabled={isSubmitting}
|
|
207
208
|
>
|
|
208
|
-
{isSubmitting ?
|
|
209
|
+
{isSubmitting ? t('loading') : t('create')}
|
|
209
210
|
</button>
|
|
210
211
|
{isSubmitting && (
|
|
211
212
|
<div className='mt-0.5'>
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useI18n } from 'nextjs-cms/translations/client'
|
|
2
2
|
import { PhotoGalleryItem } from 'nextjs-cms/core/types'
|
|
3
3
|
import GalleryPhoto from '@/components/GalleryPhoto'
|
|
4
4
|
import { Alert, AlertDescription } from '@/components/ui/alert'
|
|
5
5
|
import ContainerBox from '@/components/ContainerBox'
|
|
6
6
|
|
|
7
7
|
const PhotoGallery = ({ sectionName, gallery }: { sectionName: string; gallery: PhotoGalleryItem[] }) => {
|
|
8
|
+
const t = useI18n()
|
|
8
9
|
return (
|
|
9
|
-
<ContainerBox title={
|
|
10
|
+
<ContainerBox title={t('gallery')}>
|
|
10
11
|
{gallery && gallery.length > 0 ? (
|
|
11
12
|
<div className='flex flex-wrap gap-4'>
|
|
12
13
|
{gallery.map((photo: PhotoGalleryItem, index: number) => (
|
|
@@ -24,7 +25,7 @@ const PhotoGallery = ({ sectionName, gallery }: { sectionName: string; gallery:
|
|
|
24
25
|
</div>
|
|
25
26
|
) : (
|
|
26
27
|
<Alert variant='light' className='mt-4'>
|
|
27
|
-
<AlertDescription className='font-bold'>{
|
|
28
|
+
<AlertDescription className='font-bold'>{t('noItems')}</AlertDescription>
|
|
28
29
|
</Alert>
|
|
29
30
|
)}
|
|
30
31
|
</ContainerBox>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import
|
|
2
|
+
import { useI18n } from 'nextjs-cms/translations/client'
|
|
3
3
|
import useModal from '@/hooks/useModal'
|
|
4
4
|
import ProtectedImage from '@/components/ProtectedImage'
|
|
5
5
|
import SectionItemStatusBadge from '@/components/SectionItemStatusBadge'
|
|
@@ -28,7 +28,7 @@ export default function SectionItemCard({
|
|
|
28
28
|
const deleteMutation = trpc.hasItemsSections.deleteItem.useMutation({
|
|
29
29
|
onError: (error) => {
|
|
30
30
|
setModal({
|
|
31
|
-
title:
|
|
31
|
+
title: t('delete'),
|
|
32
32
|
body: (
|
|
33
33
|
<div className='rounded border-2 border-dashed border-red-500 bg-red-100 p-2 text-red-800'>
|
|
34
34
|
{error.message}
|
|
@@ -46,10 +46,10 @@ export default function SectionItemCard({
|
|
|
46
46
|
})
|
|
47
47
|
action()
|
|
48
48
|
setModal({
|
|
49
|
-
title:
|
|
49
|
+
title: t('delete'),
|
|
50
50
|
body: (
|
|
51
51
|
<div className='rounded border-2 border-dashed border-green-500 bg-green-100 p-2 text-green-800'>
|
|
52
|
-
{
|
|
52
|
+
{t('itemDeletedSuccessfully')}
|
|
53
53
|
</div>
|
|
54
54
|
),
|
|
55
55
|
headerColor: 'bg-green-700',
|
|
@@ -97,16 +97,16 @@ export default function SectionItemCard({
|
|
|
97
97
|
href={`/edit/${sectionName}/${item.id}`}
|
|
98
98
|
className='rounded bg-primary px-3 py-1 font-semibold text-primary-foreground'
|
|
99
99
|
>
|
|
100
|
-
{
|
|
100
|
+
{t('edit')}
|
|
101
101
|
</Link>
|
|
102
102
|
<Button
|
|
103
103
|
onClick={() => {
|
|
104
104
|
setModal({
|
|
105
|
-
title:
|
|
105
|
+
title: t('delete'),
|
|
106
106
|
body: (
|
|
107
107
|
<div className='p-4'>
|
|
108
108
|
<div className='flex flex-col gap-4'>
|
|
109
|
-
<div>{
|
|
109
|
+
<div>{t('deleteItemText')}</div>
|
|
110
110
|
<div className='flex gap-2'>
|
|
111
111
|
<button
|
|
112
112
|
className='rounded bg-success px-2 py-1 text-success-foreground'
|
|
@@ -134,7 +134,7 @@ export default function SectionItemCard({
|
|
|
134
134
|
variant='destructive'
|
|
135
135
|
className='rounded px-3 py-1 font-semibold'
|
|
136
136
|
>
|
|
137
|
-
{
|
|
137
|
+
{t('delete')}
|
|
138
138
|
</Button>
|
|
139
139
|
</CardFooter>
|
|
140
140
|
</Card>
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import
|
|
2
|
+
import { useI18n } from 'nextjs-cms/translations/client'
|
|
3
3
|
import { Badge } from '@/components/ui/badge'
|
|
4
4
|
|
|
5
5
|
const SectionItemStatusBadge = ({ status }: { status: number }) => {
|
|
6
|
+
const t = useI18n()
|
|
6
7
|
return (
|
|
7
8
|
<Badge
|
|
8
9
|
variant={status === 1 ? 'success' : 'destructive'}
|
|
9
10
|
className='absolute top-3 shadow-sm left-3 z-30 font-bold'
|
|
10
11
|
>
|
|
11
|
-
{status === 1 ?
|
|
12
|
+
{status === 1 ? t('approved') : t('pendingApproval')}
|
|
12
13
|
</Badge>
|
|
13
14
|
)
|
|
14
15
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { useAxiosPrivate } from 'nextjs-cms/auth/hooks'
|
|
4
4
|
import { RefObject, useEffect, useRef, useState } from 'react'
|
|
5
|
-
import
|
|
5
|
+
import { useI18n } from 'nextjs-cms/translations/client'
|
|
6
6
|
import { AxiosError } from 'axios'
|
|
7
7
|
import InfoCard from '@/components/InfoCard'
|
|
8
8
|
import { DropzoneHandles } from '@/components/Dropzone'
|
|
@@ -12,6 +12,7 @@ import Form from '@/components/form/Form'
|
|
|
12
12
|
import ErrorComponent from './ErrorComponent'
|
|
13
13
|
|
|
14
14
|
export default function SectionPage({ section }: { section: string }) {
|
|
15
|
+
const t = useI18n()
|
|
15
16
|
const [progress, setProgress] = useState(0)
|
|
16
17
|
const [progressVariant, setProgressVariant] = useState<'determinate' | 'query'>('determinate')
|
|
17
18
|
const [isSubmitting, setIsSubmitting] = useState(false)
|
|
@@ -57,10 +58,10 @@ export default function SectionPage({ section }: { section: string }) {
|
|
|
57
58
|
if (res.status === 200) {
|
|
58
59
|
toast({
|
|
59
60
|
variant: res.data?.errors?.length ? 'warning' : 'success',
|
|
60
|
-
title:
|
|
61
|
+
title: t('sectionUpdatedSuccessfully'),
|
|
61
62
|
description: res.data?.errors?.length
|
|
62
|
-
?
|
|
63
|
-
:
|
|
63
|
+
? t('errorsInSubmit')
|
|
64
|
+
: t('sectionUpdatedSuccessfully'),
|
|
64
65
|
})
|
|
65
66
|
|
|
66
67
|
// Refetch the page
|
|
@@ -104,7 +105,7 @@ export default function SectionPage({ section }: { section: string }) {
|
|
|
104
105
|
<div className='absolute left-0 top-0 z-2 h-4 w-full bg-linear-to-r from-emerald-800 via-emerald-400 to-sky-600'></div>
|
|
105
106
|
<h1 className='pb-4 text-4xl'>{data.section?.title}</h1>
|
|
106
107
|
<span>
|
|
107
|
-
/{
|
|
108
|
+
/{t('edit')} {data.section?.title}
|
|
108
109
|
</span>
|
|
109
110
|
</div>
|
|
110
111
|
<Form
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useI18n } from 'nextjs-cms/translations/client'
|
|
2
2
|
import useModal from '@/hooks/useModal'
|
|
3
3
|
import React from 'react'
|
|
4
4
|
import NewPage from '@/components/NewPage'
|
|
@@ -25,10 +25,11 @@ export default function SelectInputButtons({
|
|
|
25
25
|
reset: any
|
|
26
26
|
allowRecursiveDelete: boolean
|
|
27
27
|
}) {
|
|
28
|
+
const t = useI18n()
|
|
28
29
|
const { setModal } = useModal()
|
|
29
30
|
const newCatInit = () => {
|
|
30
31
|
setModal({
|
|
31
|
-
title:
|
|
32
|
+
title: t('addNewItem'),
|
|
32
33
|
body: (
|
|
33
34
|
<NewPage
|
|
34
35
|
section={section}
|
|
@@ -56,7 +57,7 @@ export default function SelectInputButtons({
|
|
|
56
57
|
const catEditInit = () => {
|
|
57
58
|
if (value === undefined) return
|
|
58
59
|
setModal({
|
|
59
|
-
title:
|
|
60
|
+
title: t('edit'),
|
|
60
61
|
body: (
|
|
61
62
|
<ItemEditPage
|
|
62
63
|
sectionType='categorized'
|
|
@@ -88,7 +89,7 @@ export default function SelectInputButtons({
|
|
|
88
89
|
const catDeleteInit = () => {
|
|
89
90
|
if (value === undefined) return
|
|
90
91
|
setModal({
|
|
91
|
-
title:
|
|
92
|
+
title: t('delete'),
|
|
92
93
|
body: (
|
|
93
94
|
<CategoryDeleteConfirmPage
|
|
94
95
|
action={() => {
|
|
@@ -111,13 +112,13 @@ export default function SelectInputButtons({
|
|
|
111
112
|
return (
|
|
112
113
|
<div className='flex flex-row gap-1 pt-1'>
|
|
113
114
|
<Button variant='default' size='sm' onClick={newCatInit} type='button'>
|
|
114
|
-
{
|
|
115
|
+
{t('add')}
|
|
115
116
|
</Button>
|
|
116
117
|
<Button variant='secondary' size='sm' onClick={catEditInit} type='button' disabled={value === undefined}>
|
|
117
|
-
{
|
|
118
|
+
{t('edit')}
|
|
118
119
|
</Button>
|
|
119
120
|
<Button variant='destructive' size='sm' onClick={catDeleteInit} disabled={value === undefined}>
|
|
120
|
-
{
|
|
121
|
+
{t('delete')}
|
|
121
122
|
</Button>
|
|
122
123
|
</div>
|
|
123
124
|
)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
3
|
import React, { useEffect, useState } from 'react'
|
|
4
|
-
import
|
|
4
|
+
import { useI18n } from 'nextjs-cms/translations/client'
|
|
5
5
|
import useModal from '@/hooks/useModal'
|
|
6
6
|
import InfoCard from '@/components/InfoCard'
|
|
7
7
|
import LoadingSpinners from '@/components/LoadingSpinners'
|
|
@@ -10,6 +10,7 @@ import { trpc } from '@/app/_trpc/client'
|
|
|
10
10
|
import Form from '@/components/form/Form'
|
|
11
11
|
|
|
12
12
|
export default function SettingsPage() {
|
|
13
|
+
const t = useI18n()
|
|
13
14
|
const [isSubmitting, setIsSubmitting] = useState(false)
|
|
14
15
|
const { setModal, modal, modalResponse, setModalResponse } = useModal()
|
|
15
16
|
const controller = new AbortController()
|
|
@@ -21,7 +22,7 @@ export default function SettingsPage() {
|
|
|
21
22
|
onError: (error) => {
|
|
22
23
|
setIsSubmitting(false)
|
|
23
24
|
setModal({
|
|
24
|
-
title:
|
|
25
|
+
title: t('error'),
|
|
25
26
|
body: (
|
|
26
27
|
<div className='p-4'>
|
|
27
28
|
<InfoCard result={{ key: 'danger', title: error.message }} />
|
|
@@ -40,8 +41,8 @@ export default function SettingsPage() {
|
|
|
40
41
|
await refetch()
|
|
41
42
|
|
|
42
43
|
toast({
|
|
43
|
-
title:
|
|
44
|
-
description:
|
|
44
|
+
title: t('success'),
|
|
45
|
+
description: t('success'),
|
|
45
46
|
duration: 2000,
|
|
46
47
|
})
|
|
47
48
|
}
|
|
@@ -52,7 +53,7 @@ export default function SettingsPage() {
|
|
|
52
53
|
onError: (error) => {
|
|
53
54
|
setIsSubmitting(false)
|
|
54
55
|
setModal({
|
|
55
|
-
title:
|
|
56
|
+
title: t('error'),
|
|
56
57
|
body: (
|
|
57
58
|
<div className='p-4'>
|
|
58
59
|
<InfoCard result={{ key: 'danger', title: error.message }} />
|
|
@@ -71,8 +72,8 @@ export default function SettingsPage() {
|
|
|
71
72
|
await refetch()
|
|
72
73
|
|
|
73
74
|
toast({
|
|
74
|
-
title:
|
|
75
|
-
description:
|
|
75
|
+
title: t('success'),
|
|
76
|
+
description: t('success'),
|
|
76
77
|
duration: 2000,
|
|
77
78
|
})
|
|
78
79
|
}
|
|
@@ -114,7 +115,7 @@ export default function SettingsPage() {
|
|
|
114
115
|
<div>
|
|
115
116
|
<div className='bg-background w-full overflow-hidden'>
|
|
116
117
|
<div className='bg-linear-to-r from-rose-200 via-rose-400 to-sky-400 p-8 font-extrabold text-black'>
|
|
117
|
-
<h1 className='text-3xl'>{
|
|
118
|
+
<h1 className='text-3xl'>{t('accountSettings')}</h1>
|
|
118
119
|
</div>
|
|
119
120
|
<div className='flex w-full flex-col'>
|
|
120
121
|
<div className='flex flex-col'>
|
|
@@ -128,13 +129,13 @@ export default function SettingsPage() {
|
|
|
128
129
|
inputGroups: [
|
|
129
130
|
{
|
|
130
131
|
groupId: 1,
|
|
131
|
-
groupTitle:
|
|
132
|
+
groupTitle: t('adminDetails'),
|
|
132
133
|
groupOrder: 1,
|
|
133
134
|
inputs: [
|
|
134
135
|
{
|
|
135
136
|
type: 'text',
|
|
136
137
|
required: false,
|
|
137
|
-
label:
|
|
138
|
+
label: t('username'),
|
|
138
139
|
name: 'username',
|
|
139
140
|
value: data?.username,
|
|
140
141
|
readonly: true,
|
|
@@ -143,7 +144,7 @@ export default function SettingsPage() {
|
|
|
143
144
|
{
|
|
144
145
|
type: 'text',
|
|
145
146
|
required: false,
|
|
146
|
-
label:
|
|
147
|
+
label: t('name'),
|
|
147
148
|
name: 'name',
|
|
148
149
|
value: data?.fullName,
|
|
149
150
|
readonly: false,
|
|
@@ -152,7 +153,7 @@ export default function SettingsPage() {
|
|
|
152
153
|
{
|
|
153
154
|
type: 'text',
|
|
154
155
|
required: false,
|
|
155
|
-
label:
|
|
156
|
+
label: t('emailAddress'),
|
|
156
157
|
name: 'emailAddress',
|
|
157
158
|
value: data?.emailAddress,
|
|
158
159
|
readonly: false,
|
|
@@ -161,7 +162,7 @@ export default function SettingsPage() {
|
|
|
161
162
|
{
|
|
162
163
|
type: 'text',
|
|
163
164
|
required: false,
|
|
164
|
-
label:
|
|
165
|
+
label: t('phoneNumber'),
|
|
165
166
|
name: 'phoneNumber',
|
|
166
167
|
value: data?.phoneNumber,
|
|
167
168
|
readonly: false,
|
|
@@ -185,13 +186,13 @@ export default function SettingsPage() {
|
|
|
185
186
|
inputGroups: [
|
|
186
187
|
{
|
|
187
188
|
groupId: 1,
|
|
188
|
-
groupTitle:
|
|
189
|
+
groupTitle: t('password'),
|
|
189
190
|
groupOrder: 1,
|
|
190
191
|
inputs: [
|
|
191
192
|
{
|
|
192
193
|
type: 'password',
|
|
193
194
|
required: true,
|
|
194
|
-
label:
|
|
195
|
+
label: t('oldPassword'),
|
|
195
196
|
name: 'oldPassword',
|
|
196
197
|
value: undefined,
|
|
197
198
|
readonly: false,
|
|
@@ -200,7 +201,7 @@ export default function SettingsPage() {
|
|
|
200
201
|
{
|
|
201
202
|
type: 'password',
|
|
202
203
|
required: true,
|
|
203
|
-
label:
|
|
204
|
+
label: t('newPassword'),
|
|
204
205
|
name: 'newPassword',
|
|
205
206
|
value: undefined,
|
|
206
207
|
readonly: false,
|
|
@@ -209,7 +210,7 @@ export default function SettingsPage() {
|
|
|
209
210
|
{
|
|
210
211
|
type: 'password',
|
|
211
212
|
required: true,
|
|
212
|
-
label:
|
|
213
|
+
label: t('confirmNewPassword'),
|
|
213
214
|
name: 'confirmPassword',
|
|
214
215
|
value: undefined,
|
|
215
216
|
readonly: false,
|