create-nextjs-cms 0.9.22 → 0.9.24
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 +2 -2
- package/templates/default/app/(auth)/layout.tsx +1 -1
- package/templates/default/app/(rootLayout)/(plugins)/[...slug]/page.tsx +47 -40
- package/templates/default/app/(rootLayout)/(plugins)/[...slug]/plugin-server-registry.ts +16 -16
- package/templates/default/app/(rootLayout)/admins/page.tsx +2 -2
- package/templates/default/app/(rootLayout)/browse/[section]/[page]/page.tsx +2 -2
- package/templates/default/app/(rootLayout)/categorized/[section]/page.tsx +2 -2
- package/templates/default/app/(rootLayout)/dashboard/page.tsx +10 -3
- package/templates/default/app/(rootLayout)/edit/[section]/[itemId]/page.tsx +2 -2
- package/templates/default/app/(rootLayout)/layout.tsx +3 -3
- package/templates/default/app/(rootLayout)/loading.tsx +1 -1
- package/templates/default/app/(rootLayout)/log/page.tsx +1 -1
- package/templates/default/app/(rootLayout)/new/[section]/page.tsx +2 -2
- package/templates/default/app/(rootLayout)/section/[section]/page.tsx +2 -2
- package/templates/default/app/(rootLayout)/settings/page.tsx +2 -2
- package/templates/default/app/_trpc/client.tsx +6 -0
- package/templates/default/app/_trpc/server.ts +9 -0
- package/templates/default/app/_trpc/types.ts +6 -0
- package/templates/default/app/api/document/route.ts +1 -1
- package/templates/default/app/api/photo/route.ts +1 -1
- package/templates/default/app/api/trpc/[trpc]/route.ts +3 -33
- package/templates/default/app/api/video/route.ts +1 -1
- package/templates/default/app/providers.tsx +20 -152
- package/templates/default/cms.config.ts +4 -2
- package/templates/default/components/{AdminCard.tsx → admin/admin-card.tsx} +4 -4
- package/templates/default/components/{AdminEditPage.tsx → admin/admin-edit-page.tsx} +3 -3
- package/templates/default/components/{AdminPrivilegeCard.tsx → admin/admin-privilege-card.tsx} +1 -1
- package/templates/default/components/{NewAdminForm.tsx → admin/new-admin-form.tsx} +4 -4
- package/templates/default/components/{ContainerBox.tsx → container-box.tsx} +1 -1
- package/templates/default/components/{ErrorComponent.tsx → feedback/error-component.tsx} +1 -1
- package/templates/default/{context/ModalProvider.tsx → components/feedback/modal-context.tsx} +56 -53
- package/templates/default/components/{Modal.tsx → feedback/modal.tsx} +1 -1
- package/templates/default/components/form/{FormInputs.tsx → form-inputs.tsx} +17 -17
- package/templates/default/components/form/{Form.tsx → form.tsx} +17 -11
- package/templates/default/components/form/helpers/_section-hot-reload.js +1 -1
- package/templates/default/components/form/inputs/{CheckboxFormInput.tsx → checkbox-form-input.tsx} +1 -1
- package/templates/default/components/form/inputs/{ColorFormInput.tsx → color-form-input.tsx} +1 -1
- package/templates/default/components/form/inputs/{DateFormInput.tsx → date-form-input.tsx} +1 -1
- package/templates/default/components/form/inputs/{DateRangeFormInput.tsx → date-range-form-input.tsx} +1 -1
- package/templates/default/components/form/inputs/{DocumentFormInput.tsx → document-form-input.tsx} +3 -3
- package/templates/default/components/form/inputs/{MapFormInput.tsx → map-form-input.tsx} +5 -4
- package/templates/default/components/form/inputs/{MultipleSelectFormInput.tsx → multiple-select-form-input.tsx} +1 -1
- package/templates/default/components/form/inputs/{NumberFormInput.tsx → number-form-input.tsx} +1 -1
- package/templates/default/components/form/inputs/{PasswordFormInput.tsx → password-form-input.tsx} +1 -1
- package/templates/default/components/form/inputs/{PhotoFormInput.tsx → photo-form-input.tsx} +3 -3
- package/templates/default/components/form/inputs/{RichTextFormInput.tsx → rich-text-form-input.tsx} +3 -3
- package/templates/default/components/form/inputs/{SelectFormInput.tsx → select-form-input.tsx} +4 -4
- package/templates/default/components/form/inputs/{SlugFormInput.tsx → slug-form-input.tsx} +1 -1
- package/templates/default/components/form/inputs/{TagsFormInput.tsx → tags-form-input.tsx} +1 -1
- package/templates/default/components/form/inputs/{TextFormInput.tsx → text-form-input.tsx} +3 -3
- package/templates/default/components/form/inputs/{TextareaFormInput.tsx → textarea-form-input.tsx} +2 -2
- package/templates/default/components/form/inputs/{VideoFormInput.tsx → video-form-input.tsx} +3 -3
- package/templates/default/components/{Layout.tsx → layout/layout.tsx} +4 -4
- package/templates/default/components/{Navbar.tsx → layout/navbar.tsx} +2 -2
- package/templates/default/components/{SidebarDropdownItem.tsx → layout/sidebar-dropdown-item.tsx} +1 -1
- package/templates/default/components/{SidebarItem.tsx → layout/sidebar-item.tsx} +1 -1
- package/templates/default/components/layout/sidebar-plugin-group.tsx +63 -0
- package/templates/default/components/{Sidebar.tsx → layout/sidebar.tsx} +28 -3
- package/templates/default/components/{LocaleSwitcher.tsx → locale/locale-switcher.tsx} +2 -2
- package/templates/default/components/{Dropzone.tsx → media/dropzone.tsx} +1 -1
- package/templates/default/components/{GalleryPhoto.tsx → media/gallery-photo.tsx} +2 -2
- package/templates/default/components/{PhotoGallery.tsx → media/photo-gallery.tsx} +2 -2
- package/templates/default/components/{ProtectedImage.tsx → media/protected-image.tsx} +1 -1
- package/templates/default/components/multi-select.tsx +8 -4
- package/templates/default/components/{AdminsPage.tsx → pages/admins-page.tsx} +4 -4
- package/templates/default/components/{BrowsePage.tsx → pages/browse-page.tsx} +7 -7
- package/templates/default/components/{CategorizedSectionPage.tsx → pages/categorized-section-page.tsx} +2 -2
- package/templates/default/components/{ItemEditPage.tsx → pages/item-edit-page.tsx} +8 -34
- package/templates/default/components/{LogPage.tsx → pages/log-page.tsx} +1 -1
- package/templates/default/components/{NewPage.tsx → pages/new-page.tsx} +28 -51
- package/templates/default/components/{SectionPage.tsx → pages/section-page.tsx} +7 -7
- package/templates/default/components/{SettingsPage.tsx → pages/settings-page.tsx} +4 -4
- package/templates/default/components/pagination/{Pagination.tsx → pagination.tsx} +1 -1
- package/templates/default/components/{CategoryDeleteConfirmPage.tsx → sections/category-delete-confirm-page.tsx} +4 -4
- package/templates/default/components/{CategorySectionSelectInput.tsx → sections/category-section-select-input.tsx} +5 -5
- package/templates/default/components/{ConditionalFields.tsx → sections/conditional-fields.tsx} +1 -1
- package/templates/default/components/{SectionItemCard.tsx → sections/section-item-card.tsx} +4 -4
- package/templates/default/components/{SelectInputButtons.tsx → sections/select-input-buttons.tsx} +4 -4
- package/templates/default/dynamic-schemas/schema.ts +44 -2
- package/templates/default/env/env.ts +42 -0
- package/templates/default/next.config.ts +1 -0
- package/templates/default/package.json +2 -1
- package/templates/default/app/_trpc/client.ts +0 -3
- package/templates/default/components/AnalyticsPage.tsx +0 -144
- package/templates/default/components/BarChartBox.tsx +0 -42
- package/templates/default/components/NewVariantComponent.tsx +0 -229
- package/templates/default/components/PieChartBox.tsx +0 -101
- package/templates/default/components/VariantCard.tsx +0 -124
- package/templates/default/components/VariantEditPage.tsx +0 -230
- package/templates/default/components/analytics/BounceRate.tsx +0 -70
- package/templates/default/components/analytics/LivePageViews.tsx +0 -55
- package/templates/default/components/analytics/LiveUsersCount.tsx +0 -33
- package/templates/default/components/analytics/MonthlyPageViews.tsx +0 -42
- package/templates/default/components/analytics/TopCountries.tsx +0 -52
- package/templates/default/components/analytics/TopDevices.tsx +0 -46
- package/templates/default/components/analytics/TopMediums.tsx +0 -58
- package/templates/default/components/analytics/TopSources.tsx +0 -45
- package/templates/default/components/analytics/TotalPageViews.tsx +0 -41
- package/templates/default/components/analytics/TotalSessions.tsx +0 -41
- package/templates/default/components/analytics/TotalUniqueUsers.tsx +0 -41
- package/templates/default/components/custom/RightHomeRoomVariantCard.tsx +0 -138
- package/templates/default/env/env.js +0 -130
- package/templates/default/hooks/useModal.ts +0 -8
- package/templates/default/lib/apiHelpers.ts +0 -92
- /package/templates/default/components/{dndKit/Draggable.tsx → dnd-kit/draggable.tsx} +0 -0
- /package/templates/default/components/{dndKit/Droppable.tsx → dnd-kit/droppable.tsx} +0 -0
- /package/templates/default/components/{dndKit/SortableItem.tsx → dnd-kit/sortable-item.tsx} +0 -0
- /package/templates/default/components/{InfoCard.tsx → feedback/info-card.tsx} +0 -0
- /package/templates/default/components/{LoadingSpinners.tsx → feedback/loading-spinners.tsx} +0 -0
- /package/templates/default/components/{ProgressBar.tsx → feedback/progress-bar.tsx} +0 -0
- /package/templates/default/components/{TooltipComponent.tsx → feedback/tooltip-component.tsx} +0 -0
- /package/templates/default/components/form/{ContentLocaleContext.tsx → content-locale-context.tsx} +0 -0
- /package/templates/default/components/form/{FormInputElement.tsx → form-input-element.tsx} +0 -0
- /package/templates/default/components/{language-dropdown.tsx → i18n/language-dropdown.tsx} +0 -0
- /package/templates/default/components/{language-picker.tsx → i18n/language-picker.tsx} +0 -0
- /package/templates/default/components/{login-language-dropdown.tsx → i18n/login-language-dropdown.tsx} +0 -0
- /package/templates/default/components/{DefaultNavItems.tsx → layout/default-nav-items.tsx} +0 -0
- /package/templates/default/components/{ThemeProvider.tsx → layout/theme-provider.tsx} +0 -0
- /package/templates/default/components/{theme-toggle.tsx → layout/theme-toggle.tsx} +0 -0
- /package/templates/default/components/{ProtectedDocument.tsx → media/protected-document.tsx} +0 -0
- /package/templates/default/components/{ProtectedVideo.tsx → media/protected-video.tsx} +0 -0
- /package/templates/default/components/{DashboardPageAlt.tsx → pages/dashboard-page-alt.tsx} +0 -0
- /package/templates/default/components/pagination/{PaginationButtons.tsx → pagination-buttons.tsx} +0 -0
- /package/templates/default/components/{SectionIcon.tsx → sections/section-icon.tsx} +0 -0
- /package/templates/default/components/{SectionItemStatusBadge.tsx → sections/section-item-status-badge.tsx} +0 -0
- /package/templates/default/components/{SelectBox.tsx → select-box.tsx} +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { useI18n } from 'nextjs-cms/translations/client'
|
|
2
2
|
import React from 'react'
|
|
3
|
-
import useModal from '@/
|
|
4
|
-
import InfoCard from '@/components/
|
|
3
|
+
import { useModal } from '@/components/feedback/modal-context'
|
|
4
|
+
import InfoCard from '@/components/feedback/info-card'
|
|
5
5
|
import { useToast } from '@/components/ui/use-toast'
|
|
6
6
|
import { trpc } from '@/app/_trpc/client'
|
|
7
|
-
import AdminRoleCard from '@/components/
|
|
7
|
+
import AdminRoleCard from '@/components/admin/admin-privilege-card'
|
|
8
8
|
import { Button } from '@/components/ui/button'
|
|
9
|
-
import type { RouterOutputs } from '
|
|
9
|
+
import type { RouterOutputs } from '@/app/_trpc/types'
|
|
10
10
|
|
|
11
11
|
export default function NewAdminForm({
|
|
12
12
|
privileges,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
// import { Card, CardContent, CardHeader, CardTitle } from '
|
|
2
|
+
// import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
|
|
3
3
|
|
|
4
4
|
export default function ContainerBox({ children, title }: { children: React.ReactNode; title?: string }) {
|
|
5
5
|
return (
|
package/templates/default/{context/ModalProvider.tsx → components/feedback/modal-context.tsx}
RENAMED
|
@@ -1,53 +1,56 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
|
|
3
|
-
import React, { createContext, useState } from 'react'
|
|
4
|
-
|
|
5
|
-
export type ModalResponse = {
|
|
6
|
-
message: React.ReactNode | string
|
|
7
|
-
messageColor?: string
|
|
8
|
-
borderColor?: string
|
|
9
|
-
bgColor?: string
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export type Modal = {
|
|
13
|
-
title: string
|
|
14
|
-
titleColor: string
|
|
15
|
-
headerColor: string
|
|
16
|
-
body: React.ReactNode
|
|
17
|
-
lang: string
|
|
18
|
-
size?: 'sm' | 'md' | 'lg' | 'xl'
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
modal: Modal | null
|
|
23
|
-
setModal: React.Dispatch<React.SetStateAction<Modal | null>>
|
|
24
|
-
modalResponse: ModalResponse | null
|
|
25
|
-
setModalResponse: React.Dispatch<React.SetStateAction<ModalResponse | null>>
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import React, { createContext, useContext, useState } from 'react'
|
|
4
|
+
|
|
5
|
+
export type ModalResponse = {
|
|
6
|
+
message: React.ReactNode | string
|
|
7
|
+
messageColor?: string
|
|
8
|
+
borderColor?: string
|
|
9
|
+
bgColor?: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type Modal = {
|
|
13
|
+
title: string
|
|
14
|
+
titleColor: string
|
|
15
|
+
headerColor: string
|
|
16
|
+
body: React.ReactNode
|
|
17
|
+
lang: string
|
|
18
|
+
size?: 'sm' | 'md' | 'lg' | 'xl'
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
type ModalContextValue = {
|
|
22
|
+
modal: Modal | null
|
|
23
|
+
setModal: React.Dispatch<React.SetStateAction<Modal | null>>
|
|
24
|
+
modalResponse: ModalResponse | null
|
|
25
|
+
setModalResponse: React.Dispatch<React.SetStateAction<ModalResponse | null>>
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const ModalContext = createContext<ModalContextValue | null>(null)
|
|
29
|
+
|
|
30
|
+
export function ModalProvider({ children }: { children: React.ReactNode }) {
|
|
31
|
+
const [modal, setModal] = useState<Modal | null>(null)
|
|
32
|
+
const [modalResponse, setModalResponse] = useState<ModalResponse | null>(null)
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<ModalContext.Provider
|
|
36
|
+
value={{
|
|
37
|
+
modal,
|
|
38
|
+
setModal,
|
|
39
|
+
modalResponse,
|
|
40
|
+
setModalResponse,
|
|
41
|
+
}}
|
|
42
|
+
>
|
|
43
|
+
{children}
|
|
44
|
+
</ModalContext.Provider>
|
|
45
|
+
)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function useModal() {
|
|
49
|
+
const context = useContext(ModalContext)
|
|
50
|
+
|
|
51
|
+
if (!context) {
|
|
52
|
+
throw new Error('useModal must be used within ModalProvider')
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return context
|
|
56
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
3
|
import { Suspense, useEffect, useRef, useState } from 'react'
|
|
4
|
-
import useModal from '@/
|
|
4
|
+
import { useModal } from '@/components/feedback/modal-context'
|
|
5
5
|
import classNames from 'classnames'
|
|
6
6
|
import { X, Loader2 } from 'lucide-react'
|
|
7
7
|
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import type { FieldClientConfig } from 'nextjs-cms/core/fields'
|
|
2
2
|
import React from 'react'
|
|
3
|
-
import CheckboxFormInput from '@/components/form/inputs/
|
|
4
|
-
import ColorFormInput from '@/components/form/inputs/
|
|
5
|
-
import DateFormInput from '@/components/form/inputs/
|
|
6
|
-
import DateRangeFormInput from '@/components/form/inputs/
|
|
7
|
-
import DocumentFormInput from '@/components/form/inputs/
|
|
8
|
-
import MapFormInput from '@/components/form/inputs/
|
|
9
|
-
import MultipleSelectFormInput from '@/components/form/inputs/
|
|
10
|
-
import NumberFormInput from '@/components/form/inputs/
|
|
11
|
-
import PasswordFormInput from '@/components/form/inputs/
|
|
12
|
-
import PhotoFormInput from '@/components/form/inputs/
|
|
13
|
-
import RichTextFormInput from '@/components/form/inputs/
|
|
14
|
-
import SelectFormInput from '@/components/form/inputs/
|
|
15
|
-
import SlugFormInput from '@/components/form/inputs/
|
|
16
|
-
import TagsFormInput from '@/components/form/inputs/
|
|
17
|
-
import TextareaFormInput from '@/components/form/inputs/
|
|
18
|
-
import TextFormInput from '@/components/form/inputs/
|
|
19
|
-
import VideoFormInput from '@/components/form/inputs/
|
|
3
|
+
import CheckboxFormInput from '@/components/form/inputs/checkbox-form-input'
|
|
4
|
+
import ColorFormInput from '@/components/form/inputs/color-form-input'
|
|
5
|
+
import DateFormInput from '@/components/form/inputs/date-form-input'
|
|
6
|
+
import DateRangeFormInput from '@/components/form/inputs/date-range-form-input'
|
|
7
|
+
import DocumentFormInput from '@/components/form/inputs/document-form-input'
|
|
8
|
+
import MapFormInput from '@/components/form/inputs/map-form-input'
|
|
9
|
+
import MultipleSelectFormInput from '@/components/form/inputs/multiple-select-form-input'
|
|
10
|
+
import NumberFormInput from '@/components/form/inputs/number-form-input'
|
|
11
|
+
import PasswordFormInput from '@/components/form/inputs/password-form-input'
|
|
12
|
+
import PhotoFormInput from '@/components/form/inputs/photo-form-input'
|
|
13
|
+
import RichTextFormInput from '@/components/form/inputs/rich-text-form-input'
|
|
14
|
+
import SelectFormInput from '@/components/form/inputs/select-form-input'
|
|
15
|
+
import SlugFormInput from '@/components/form/inputs/slug-form-input'
|
|
16
|
+
import TagsFormInput from '@/components/form/inputs/tags-form-input'
|
|
17
|
+
import TextareaFormInput from '@/components/form/inputs/textarea-form-input'
|
|
18
|
+
import TextFormInput from '@/components/form/inputs/text-form-input'
|
|
19
|
+
import VideoFormInput from '@/components/form/inputs/video-form-input'
|
|
20
20
|
import {
|
|
21
21
|
CheckboxFieldClientConfig,
|
|
22
22
|
ColorFieldClientConfig,
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import type { RouterOutputs } from '
|
|
1
|
+
import type { RouterOutputs } from '@/app/_trpc/types'
|
|
2
2
|
import React, { RefObject, useCallback, useEffect } from 'react'
|
|
3
|
-
import ContainerBox from '@/components/
|
|
4
|
-
import Dropzone, { DropzoneHandles } from '@/components/
|
|
5
|
-
import { LocalizationProvider } from '@/components/form/
|
|
6
|
-
import FormInputs from '@/components/form/
|
|
3
|
+
import ContainerBox from '@/components/container-box'
|
|
4
|
+
import Dropzone, { DropzoneHandles } from '@/components/media/dropzone'
|
|
5
|
+
import { LocalizationProvider } from '@/components/form/content-locale-context'
|
|
6
|
+
import FormInputs from '@/components/form/form-inputs'
|
|
7
7
|
import { configLastUpdated } from '@/components/form/helpers/util'
|
|
8
|
-
import
|
|
9
|
-
import ProgressBar from '@/components/ProgressBar'
|
|
8
|
+
import ProgressBar from '@/components/feedback/progress-bar'
|
|
10
9
|
import { zodResolver } from '@hookform/resolvers/zod'
|
|
11
10
|
import classNames from 'classnames'
|
|
12
11
|
import { useSession } from 'nextjs-cms/auth/react'
|
|
@@ -24,6 +23,7 @@ import {
|
|
|
24
23
|
SelectFieldClientConfig,
|
|
25
24
|
SelectMultipleFieldClientConfig,
|
|
26
25
|
SlugFieldClientConfig,
|
|
26
|
+
TagsFieldClientConfig,
|
|
27
27
|
TextAreaFieldClientConfig,
|
|
28
28
|
TextFieldClientConfig,
|
|
29
29
|
VideoFieldClientConfig,
|
|
@@ -44,6 +44,7 @@ import {
|
|
|
44
44
|
selectFieldSchema,
|
|
45
45
|
selectMultipleFieldSchema,
|
|
46
46
|
slugFieldSchema,
|
|
47
|
+
tagsFieldSchema,
|
|
47
48
|
textareaFieldSchema,
|
|
48
49
|
textFieldSchema,
|
|
49
50
|
videoFieldSchema,
|
|
@@ -51,7 +52,7 @@ import {
|
|
|
51
52
|
import { FormProvider, useForm } from 'react-hook-form'
|
|
52
53
|
import * as z from 'zod'
|
|
53
54
|
|
|
54
|
-
import PhotoGallery from '
|
|
55
|
+
import PhotoGallery from '@/components/media/photo-gallery'
|
|
55
56
|
|
|
56
57
|
export const revalidate = 1
|
|
57
58
|
|
|
@@ -59,7 +60,6 @@ export default function Form({
|
|
|
59
60
|
formType,
|
|
60
61
|
data,
|
|
61
62
|
dropzoneRef,
|
|
62
|
-
variantRef,
|
|
63
63
|
handleSubmit,
|
|
64
64
|
isSubmitting,
|
|
65
65
|
response,
|
|
@@ -102,7 +102,6 @@ export default function Form({
|
|
|
102
102
|
| undefined
|
|
103
103
|
}
|
|
104
104
|
dropzoneRef?: RefObject<DropzoneHandles | null>
|
|
105
|
-
variantRef?: RefObject<VariantHandles[]>
|
|
106
105
|
handleSubmit: any
|
|
107
106
|
isSubmitting: boolean
|
|
108
107
|
response?: any
|
|
@@ -230,6 +229,12 @@ export default function Form({
|
|
|
230
229
|
})
|
|
231
230
|
break
|
|
232
231
|
|
|
232
|
+
case 'tags':
|
|
233
|
+
schema = schema.extend({
|
|
234
|
+
[input.name]: tagsFieldSchema(input as TagsFieldClientConfig, language),
|
|
235
|
+
})
|
|
236
|
+
break
|
|
237
|
+
|
|
233
238
|
case 'slug':
|
|
234
239
|
schema = schema.extend({
|
|
235
240
|
[input.name]: slugFieldSchema(input as SlugFieldClientConfig, language),
|
|
@@ -345,7 +350,8 @@ export default function Form({
|
|
|
345
350
|
className={classNames({
|
|
346
351
|
'w-full': buttonType === 'big',
|
|
347
352
|
'float-end': buttonType === 'small',
|
|
348
|
-
'bg-linear-to-r
|
|
353
|
+
'rounded bg-linear-to-r px-4 py-2 font-bold text-white drop-shadow-sm':
|
|
354
|
+
true,
|
|
349
355
|
'from-emerald-700 via-green-700 to-green-500 dark:from-blue-800 dark:via-sky-800 dark:to-slate-500':
|
|
350
356
|
!isSubmitting,
|
|
351
357
|
'from-gray-600 via-gray-500 to-gray-400': isSubmitting,
|
package/templates/default/components/form/inputs/{CheckboxFormInput.tsx → checkbox-form-input.tsx}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import FormInputElement from '@/components/form/
|
|
2
|
+
import FormInputElement from '@/components/form/form-input-element'
|
|
3
3
|
import { CheckboxFieldClientConfig } from 'nextjs-cms/core/fields'
|
|
4
4
|
import { useController, useFormContext } from 'react-hook-form'
|
|
5
5
|
import { Switch } from '@/components/ui/switch'
|
package/templates/default/components/form/inputs/{ColorFormInput.tsx → color-form-input.tsx}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import FormInputElement from '@/components/form/
|
|
2
|
+
import FormInputElement from '@/components/form/form-input-element'
|
|
3
3
|
import { ColorFieldClientConfig } from 'nextjs-cms/core/fields'
|
|
4
4
|
import { useController, useFormContext } from 'react-hook-form'
|
|
5
5
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import dayjs from 'dayjs'
|
|
3
|
-
import FormInputElement from '@/components/form/
|
|
3
|
+
import FormInputElement from '@/components/form/form-input-element'
|
|
4
4
|
import { Button } from '@/components/ui/button'
|
|
5
5
|
import { Calendar } from '@/components/ui/calendar'
|
|
6
6
|
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover'
|
|
@@ -8,7 +8,7 @@ import { CalendarIcon, ChevronDownIcon } from '@radix-ui/react-icons'
|
|
|
8
8
|
import { Button } from '@/components/ui/button'
|
|
9
9
|
import { Calendar } from '@/components/ui/calendar'
|
|
10
10
|
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover'
|
|
11
|
-
import FormInputElement from '@/components/form/
|
|
11
|
+
import FormInputElement from '@/components/form/form-input-element'
|
|
12
12
|
import type { DateRangeFieldClientConfig } from 'nextjs-cms/core/fields'
|
|
13
13
|
|
|
14
14
|
const seasonEmoji: Record<string, string> = {
|
package/templates/default/components/form/inputs/{DocumentFormInput.tsx → document-form-input.tsx}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useRef, useState } from 'react'
|
|
2
|
-
import FormInputElement from '@/components/form/
|
|
3
|
-
import ProtectedDocument from '@/components/
|
|
2
|
+
import FormInputElement from '@/components/form/form-input-element'
|
|
3
|
+
import ProtectedDocument from '@/components/media/protected-document'
|
|
4
4
|
import { Badge } from '@/components/ui/badge'
|
|
5
5
|
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
|
|
6
|
-
import useModal from '@/
|
|
6
|
+
import { useModal } from '@/components/feedback/modal-context'
|
|
7
7
|
import { ChevronRight, InfoIcon, Trash2Icon, Undo2Icon, UploadIcon, X } from 'lucide-react'
|
|
8
8
|
import { DocumentFieldClientConfig } from 'nextjs-cms/core/fields'
|
|
9
9
|
import { useI18n } from 'nextjs-cms/translations/client'
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import React, { useEffect } from 'react'
|
|
2
2
|
import { APIProvider, Map, Marker } from '@vis.gl/react-google-maps'
|
|
3
|
-
import ContainerBox from '@/components/
|
|
3
|
+
import ContainerBox from '@/components/container-box'
|
|
4
4
|
import { Button } from '@/components/ui/button'
|
|
5
|
-
import TooltipComponent from '@/components/
|
|
5
|
+
import TooltipComponent from '@/components/feedback/tooltip-component'
|
|
6
6
|
import { useI18n } from 'nextjs-cms/translations/client'
|
|
7
7
|
import { MapFieldClientConfig } from 'nextjs-cms/core/fields'
|
|
8
8
|
import { useController, useFormContext } from 'react-hook-form'
|
|
9
|
-
import FormInputElement from '@/components/form/
|
|
9
|
+
import FormInputElement from '@/components/form/form-input-element'
|
|
10
|
+
import { env } from '@/env/env'
|
|
10
11
|
|
|
11
12
|
export default function MapFormInput({ input }: { input: MapFieldClientConfig }) {
|
|
12
13
|
const t = useI18n()
|
|
@@ -62,7 +63,7 @@ export default function MapFormInput({ input }: { input: MapFieldClientConfig })
|
|
|
62
63
|
onBlur={field.onBlur}
|
|
63
64
|
ref={field.ref}
|
|
64
65
|
/>
|
|
65
|
-
<APIProvider apiKey={
|
|
66
|
+
<APIProvider apiKey={env.NEXT_PUBLIC_GOOGLE_MAPS_API_KEY ?? ''}>
|
|
66
67
|
<Map
|
|
67
68
|
clickableIcons={false}
|
|
68
69
|
zoomControl={true}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import FormInputElement from '@/components/form/
|
|
1
|
+
import FormInputElement from '@/components/form/form-input-element'
|
|
2
2
|
import { useEffect, useState } from 'react'
|
|
3
3
|
import { SelectMultipleFieldClientConfig, SelectOption } from 'nextjs-cms/core/fields'
|
|
4
4
|
import { useController, useFormContext } from 'react-hook-form'
|
package/templates/default/components/form/inputs/{NumberFormInput.tsx → number-form-input.tsx}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import FormInputElement from '@/components/form/
|
|
2
|
+
import FormInputElement from '@/components/form/form-input-element'
|
|
3
3
|
import type { NumberFieldClientConfig } from 'nextjs-cms/core/fields'
|
|
4
4
|
import { useController, useFormContext } from 'react-hook-form'
|
|
5
5
|
import { isNumber, toNumber } from 'lodash-es'
|
package/templates/default/components/form/inputs/{PasswordFormInput.tsx → password-form-input.tsx}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import FormInputElement from '@/components/form/
|
|
2
|
+
import FormInputElement from '@/components/form/form-input-element'
|
|
3
3
|
import { PasswordFieldClientConfig } from 'nextjs-cms/core/fields'
|
|
4
4
|
import { useController, useFormContext } from 'react-hook-form'
|
|
5
5
|
|
package/templates/default/components/form/inputs/{PhotoFormInput.tsx → photo-form-input.tsx}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useRef, useState } from 'react'
|
|
2
2
|
import { useI18n } from 'nextjs-cms/translations/client'
|
|
3
|
-
import FormInputElement from '@/components/form/
|
|
4
|
-
import ProtectedImage from '@/components/
|
|
3
|
+
import FormInputElement from '@/components/form/form-input-element'
|
|
4
|
+
import ProtectedImage from '@/components/media/protected-image'
|
|
5
5
|
import Image from 'next/image'
|
|
6
|
-
import useModal from '@/
|
|
6
|
+
import { useModal } from '@/components/feedback/modal-context'
|
|
7
7
|
import { ChevronRight, InfoIcon, Trash2Icon, Undo2Icon, UploadIcon, X } from 'lucide-react'
|
|
8
8
|
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
|
|
9
9
|
import { Badge } from '@/components/ui/badge'
|
package/templates/default/components/form/inputs/{RichTextFormInput.tsx → rich-text-form-input.tsx}
RENAMED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React, { useRef, useState } from 'react'
|
|
2
2
|
import { Editor } from '@tinymce/tinymce-react'
|
|
3
|
-
import FormInputElement from '@/components/form/
|
|
3
|
+
import FormInputElement from '@/components/form/form-input-element'
|
|
4
4
|
// import { useTheme } from 'next-themes'
|
|
5
|
-
import { useAxiosPrivate } from 'nextjs-cms/
|
|
5
|
+
import { useAxiosPrivate } from 'nextjs-cms/api/client'
|
|
6
6
|
import { RichTextFieldClientConfig } from 'nextjs-cms/core/fields'
|
|
7
7
|
import { FieldError, useFormContext } from 'react-hook-form'
|
|
8
|
-
import { useLocale } from '@/components/form/
|
|
8
|
+
import { useLocale } from '@/components/form/content-locale-context'
|
|
9
9
|
|
|
10
10
|
export default function RichTextFormInput({ input }: { input: RichTextFieldClientConfig }) {
|
|
11
11
|
const { setValue, register, formState } = useFormContext()
|
package/templates/default/components/form/inputs/{SelectFormInput.tsx → select-form-input.tsx}
RENAMED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { useEffect, useState, useMemo } from 'react'
|
|
2
|
-
import FormInputElement from '@/components/form/
|
|
3
|
-
import SelectBox from '@/components/
|
|
4
|
-
import LoadingSpinners from '@/components/
|
|
2
|
+
import FormInputElement from '@/components/form/form-input-element'
|
|
3
|
+
import SelectBox from '@/components/select-box'
|
|
4
|
+
import LoadingSpinners from '@/components/feedback/loading-spinners'
|
|
5
5
|
import { useAutoAnimate } from '@formkit/auto-animate/react'
|
|
6
6
|
import { useI18n } from 'nextjs-cms/translations/client'
|
|
7
7
|
import { useSession } from 'nextjs-cms/auth/react'
|
|
8
8
|
import { trpc } from '@/app/_trpc/client'
|
|
9
9
|
import { SelectFieldClientConfig, SelectOption } from 'nextjs-cms/core/fields'
|
|
10
|
-
import { ConditionalFields } from '@/components/
|
|
10
|
+
import { ConditionalFields } from '@/components/sections/conditional-fields'
|
|
11
11
|
import { useController, useFormContext } from 'react-hook-form'
|
|
12
12
|
|
|
13
13
|
export default function SelectFormInput({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
3
|
import React, { useCallback, useEffect, useRef } from 'react'
|
|
4
|
-
import FormInputElement from '@/components/form/
|
|
4
|
+
import FormInputElement from '@/components/form/form-input-element'
|
|
5
5
|
import type { SlugFieldClientConfig } from 'nextjs-cms/core/fields'
|
|
6
6
|
import { useFormContext, useController, useWatch } from 'react-hook-form'
|
|
7
7
|
import { InputGroup, InputGroupInput, InputGroupAddon } from '@/components/ui/input-group'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import FormInputElement from '@/components/form/
|
|
1
|
+
import FormInputElement from '@/components/form/form-input-element'
|
|
2
2
|
import { useI18n } from 'nextjs-cms/translations/client'
|
|
3
3
|
import { TagsFieldClientConfig } from 'nextjs-cms/core/fields'
|
|
4
4
|
import { useController, useFormContext } from 'react-hook-form'
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import FormInputElement from '@/components/form/
|
|
2
|
+
import FormInputElement from '@/components/form/form-input-element'
|
|
3
3
|
import type { TextFieldClientConfig } from 'nextjs-cms/core/fields'
|
|
4
4
|
import { useFormContext, useController } from 'react-hook-form'
|
|
5
|
-
import { useLocale } from '@/components/form/
|
|
5
|
+
import { useLocale } from '@/components/form/content-locale-context'
|
|
6
6
|
|
|
7
7
|
export default function TextFormInput({
|
|
8
8
|
input,
|
|
@@ -36,7 +36,7 @@ export default function TextFormInput({
|
|
|
36
36
|
<input
|
|
37
37
|
placeholder={input.placeholder ? input.placeholder : input.label}
|
|
38
38
|
type='text'
|
|
39
|
-
dir={input.rtl !== undefined ? (input.rtl ? 'rtl' : 'ltr') :
|
|
39
|
+
dir={input.rtl !== undefined ? (input.rtl ? 'rtl' : 'ltr') : locale?.rtl ? 'rtl' : 'ltr'}
|
|
40
40
|
readOnly={disabled}
|
|
41
41
|
disabled={field.disabled}
|
|
42
42
|
name={field.name}
|
package/templates/default/components/form/inputs/{TextareaFormInput.tsx → textarea-form-input.tsx}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import FormInputElement from '@/components/form/
|
|
2
|
+
import FormInputElement from '@/components/form/form-input-element'
|
|
3
3
|
import { TextAreaFieldClientConfig } from 'nextjs-cms/core/fields'
|
|
4
4
|
import { FieldError, useController, useFormContext } from 'react-hook-form'
|
|
5
|
-
import { useLocale } from '@/components/form/
|
|
5
|
+
import { useLocale } from '@/components/form/content-locale-context'
|
|
6
6
|
|
|
7
7
|
export default function TextareaFormInput({
|
|
8
8
|
input,
|
package/templates/default/components/form/inputs/{VideoFormInput.tsx → video-form-input.tsx}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useRef, useState } from 'react'
|
|
2
|
-
import FormInputElement from '@/components/form/
|
|
3
|
-
import ProtectedVideo from '@/components/
|
|
2
|
+
import FormInputElement from '@/components/form/form-input-element'
|
|
3
|
+
import ProtectedVideo from '@/components/media/protected-video'
|
|
4
4
|
import { Badge } from '@/components/ui/badge'
|
|
5
5
|
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
|
|
6
|
-
import useModal from '@/
|
|
6
|
+
import { useModal } from '@/components/feedback/modal-context'
|
|
7
7
|
import { ChevronRight, InfoIcon, Trash2Icon, Undo2Icon, UploadIcon, X } from 'lucide-react'
|
|
8
8
|
import { VideoFieldClientConfig } from 'nextjs-cms/core/fields'
|
|
9
9
|
import { useI18n } from 'nextjs-cms/translations/client'
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
import classNames from 'classnames'
|
|
4
4
|
import React, { useState } from 'react'
|
|
5
|
-
import Navbar from '@/components/
|
|
6
|
-
import Sidebar from '@/components/
|
|
7
|
-
import Modal from '@/components/
|
|
5
|
+
import Navbar from '@/components/layout/navbar'
|
|
6
|
+
import Sidebar from '@/components/layout/sidebar'
|
|
7
|
+
import Modal from '@/components/feedback/modal'
|
|
8
8
|
import { Toaster } from '@/components/ui/toaster'
|
|
9
9
|
import { useSession } from 'nextjs-cms/auth/react'
|
|
10
|
-
import LoadingSpinners from '@/components/
|
|
10
|
+
import LoadingSpinners from '@/components/feedback/loading-spinners'
|
|
11
11
|
|
|
12
12
|
function Layout({
|
|
13
13
|
children,
|
|
@@ -6,7 +6,7 @@ import Link from 'next/link'
|
|
|
6
6
|
import { useI18n } from 'nextjs-cms/translations/client'
|
|
7
7
|
import { RTL_LANGUAGES } from 'nextjs-cms/translations'
|
|
8
8
|
import { trpc } from '@/app/_trpc/client'
|
|
9
|
-
import ProtectedImage from '@/components/
|
|
9
|
+
import ProtectedImage from '@/components/media/protected-image'
|
|
10
10
|
import { Spinner } from '@/components/ui/spinner'
|
|
11
11
|
import Image from 'next/image'
|
|
12
12
|
import { LogOut, Settings } from 'lucide-react'
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
import { useToast } from '@/components/ui/use-toast'
|
|
25
25
|
import { logout, useSession } from 'nextjs-cms/auth/react'
|
|
26
26
|
import ThemeToggle from './theme-toggle'
|
|
27
|
-
import LanguageDropdown from '
|
|
27
|
+
import LanguageDropdown from '@/components/i18n/language-dropdown'
|
|
28
28
|
type Props = {
|
|
29
29
|
/**
|
|
30
30
|
* Allows the parent component to modify the state when the
|
package/templates/default/components/{SidebarDropdownItem.tsx → layout/sidebar-dropdown-item.tsx}
RENAMED
|
@@ -5,7 +5,7 @@ import { SidebarItemProps } from 'nextjs-cms/core/types'
|
|
|
5
5
|
import { useAutoAnimate } from '@formkit/auto-animate/react'
|
|
6
6
|
import { ChevronDownIcon, ChevronUpIcon, FolderIcon, PlusIcon } from 'lucide-react'
|
|
7
7
|
import { useI18n } from 'nextjs-cms/translations/client'
|
|
8
|
-
import SectionIcon from '@/components/
|
|
8
|
+
import SectionIcon from '@/components/sections/section-icon'
|
|
9
9
|
|
|
10
10
|
export default function SidebarDropdownItem({ item, closeSideBar }: SidebarItemProps) {
|
|
11
11
|
const t = useI18n()
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Link from 'next/link'
|
|
2
2
|
import classNames from 'classnames'
|
|
3
3
|
import { SidebarItemProps } from 'nextjs-cms/core/types'
|
|
4
|
-
import SectionIcon from '@/components/
|
|
4
|
+
import SectionIcon from '@/components/sections/section-icon'
|
|
5
5
|
|
|
6
6
|
export default function SidebarItem({ item, closeSideBar }: SidebarItemProps) {
|
|
7
7
|
return (
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import Link from 'next/link'
|
|
2
|
+
import classNames from 'classnames'
|
|
3
|
+
import { useState } from 'react'
|
|
4
|
+
import { useAutoAnimate } from '@formkit/auto-animate/react'
|
|
5
|
+
import { ChevronDownIcon, ChevronUpIcon } from 'lucide-react'
|
|
6
|
+
import type { SidebarPluginGroupProps } from 'nextjs-cms/core/types'
|
|
7
|
+
import SectionIcon from '@/components/sections/section-icon'
|
|
8
|
+
|
|
9
|
+
export default function SidebarPluginGroup({ group, closeSideBar }: SidebarPluginGroupProps) {
|
|
10
|
+
const [parent] = useAutoAnimate()
|
|
11
|
+
const [open, setOpen] = useState(false)
|
|
12
|
+
return (
|
|
13
|
+
<div ref={parent}>
|
|
14
|
+
<div
|
|
15
|
+
className={classNames({
|
|
16
|
+
'flex cursor-pointer text-white hover:bg-indigo-900 dark:hover:bg-emerald-600': true,
|
|
17
|
+
'gap-4 rounded-md p-2': true,
|
|
18
|
+
'rounded-b-none bg-indigo-700 dark:bg-emerald-600': open,
|
|
19
|
+
})}
|
|
20
|
+
onClick={() => setOpen((prev) => !prev)}
|
|
21
|
+
>
|
|
22
|
+
<li className='relative flex w-full items-center justify-between gap-2'>
|
|
23
|
+
<span className='flex items-center gap-2 text-start'>
|
|
24
|
+
{group.icon && <SectionIcon name={group.icon} className='size-4' />}
|
|
25
|
+
<span>{group.title}</span>
|
|
26
|
+
</span>
|
|
27
|
+
<span>
|
|
28
|
+
{open ? (
|
|
29
|
+
<ChevronUpIcon className='h-5 w-5' />
|
|
30
|
+
) : (
|
|
31
|
+
<ChevronDownIcon className='h-5 w-5' />
|
|
32
|
+
)}
|
|
33
|
+
</span>
|
|
34
|
+
</li>
|
|
35
|
+
</div>
|
|
36
|
+
{open && (
|
|
37
|
+
<div
|
|
38
|
+
className={classNames({
|
|
39
|
+
'rounded border border-t-0 border-indigo-700/50 text-white dark:border-emerald-600/50': true,
|
|
40
|
+
'flex flex-col items-stretch rounded-md rounded-t-none py-2': true,
|
|
41
|
+
})}
|
|
42
|
+
>
|
|
43
|
+
{group.children.map((child, index) => (
|
|
44
|
+
<Link
|
|
45
|
+
key={index}
|
|
46
|
+
onClick={closeSideBar}
|
|
47
|
+
href={child.path}
|
|
48
|
+
className={classNames({
|
|
49
|
+
'flex rounded text-white hover:underline': true,
|
|
50
|
+
'mx-3 gap-2 p-2': true,
|
|
51
|
+
})}
|
|
52
|
+
>
|
|
53
|
+
<li className='flex flex-row items-center gap-2'>
|
|
54
|
+
{child.icon && <SectionIcon name={child.icon} className='size-4' />}
|
|
55
|
+
<span>{child.title}</span>
|
|
56
|
+
</li>
|
|
57
|
+
</Link>
|
|
58
|
+
))}
|
|
59
|
+
</div>
|
|
60
|
+
)}
|
|
61
|
+
</div>
|
|
62
|
+
)
|
|
63
|
+
}
|