sitero 0.1.0 → 0.1.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/dist/export/cms/client/components/editor/index.js +3 -0
- package/dist/export/cms/client/components/index.js +24 -21
- package/dist/export/cms/client/i18n/index.js +1 -0
- package/dist/export/cms/client/index.js +10 -0
- package/dist/export/cms/client/pages/index.js +10 -8
- package/dist/export/core/server/index.js +8 -1
- package/dist/export/index.js +2 -1
- package/dist/export/web/server/index.js +1 -0
- package/dist/src/cms/client/applications/create-applications.js +3 -1
- package/dist/src/cms/client/applications/ui/use-nav-items.js +202 -0
- package/dist/src/cms/client/infrastructure/i18n/intor-config.js +8 -5
- package/dist/src/cms/client/infrastructure/i18n/messages/en-US/resources/admin.js +1 -1
- package/dist/src/cms/client/infrastructure/i18n/messages/en-US/resources/index.js +1 -0
- package/dist/src/cms/client/infrastructure/i18n/messages/index.js +9 -0
- package/dist/src/cms/client/infrastructure/i18n/messages/zh-TW/resources/admin.js +1 -1
- package/dist/src/cms/client/infrastructure/i18n/messages/zh-TW/resources/index.js +1 -0
- package/dist/src/cms/client/interfaces/components/create-components.js +25 -24
- package/dist/src/cms/client/interfaces/components/create-post-contents.js +85 -0
- package/dist/src/cms/client/interfaces/components/resources/admin/admin-card.js +6 -2
- package/dist/src/cms/client/interfaces/components/resources/admin/admin-refresh-tokens/admin-refresh-token-card.js +3 -0
- package/dist/src/cms/client/interfaces/components/resources/admin/admin-relations-section.js +2 -3
- package/dist/src/cms/client/interfaces/components/resources/admin/admin-table.js +3 -2
- package/dist/src/cms/client/interfaces/components/resources/config/config-edit-content.js +19 -2
- package/dist/src/cms/client/interfaces/components/resources/file/file-card.js +3 -0
- package/dist/src/cms/client/interfaces/components/resources/file/file-relations-section.js +2 -3
- package/dist/src/cms/client/interfaces/components/resources/file/file-state-icons.js +1 -2
- package/dist/src/cms/client/interfaces/components/resources/file/file-table.js +0 -1
- package/dist/src/cms/client/interfaces/components/resources/file/search/is-locked-buttons.js +6 -0
- package/dist/src/cms/client/interfaces/components/resources/file/search/type-buttons.js +6 -0
- package/dist/src/cms/client/interfaces/components/resources/folder/file-manager/file-manager-header.js +1 -2
- package/dist/src/cms/client/interfaces/components/resources/folder/file-manager/file-manager-list.js +0 -1
- package/dist/src/cms/client/interfaces/components/resources/folder/folder-card.js +3 -0
- package/dist/src/cms/client/interfaces/components/resources/folder/folder-list.js +0 -1
- package/dist/src/cms/client/interfaces/components/resources/folder/folder-relations-section.js +0 -1
- package/dist/src/cms/client/interfaces/components/resources/folder/folder-state-icons.js +1 -2
- package/dist/src/cms/client/interfaces/components/resources/folder/folder-table.js +0 -1
- package/dist/src/cms/client/interfaces/components/resources/inquiry/inquiry-card.js +3 -0
- package/dist/src/cms/client/interfaces/components/resources/{category → post/category}/category-card.js +25 -19
- package/dist/src/cms/client/interfaces/components/resources/{category → post/category}/category-relations-section.js +25 -18
- package/dist/src/cms/client/interfaces/components/resources/{category → post/category}/category-table.js +27 -21
- package/dist/src/cms/client/interfaces/components/resources/post/content/post-create-content.js +462 -0
- package/dist/src/cms/client/interfaces/components/resources/post/content/post-edit-content.js +460 -0
- package/dist/src/cms/client/interfaces/components/resources/post/content/post-show-content.js +217 -0
- package/dist/src/cms/client/interfaces/components/resources/post/content/types.js +12 -0
- package/dist/src/cms/client/interfaces/components/resources/post/post-card.js +16 -71
- package/dist/src/cms/client/interfaces/components/resources/post/post-list.js +3 -6
- package/dist/src/cms/client/interfaces/components/resources/post/post-relations-section.js +0 -1
- package/dist/src/cms/client/interfaces/components/resources/post/post-table.js +0 -1
- package/dist/src/cms/client/interfaces/components/resources/post/search/control-fields-buttons.js +9 -50
- package/dist/src/cms/client/interfaces/components/resources/{tag → post/tag}/tag-card.js +18 -17
- package/dist/src/cms/client/interfaces/components/resources/{tag → post/tag}/tag-relations-section.js +13 -14
- package/dist/src/cms/client/interfaces/components/resources/{tag → post/tag}/tag-table.js +19 -17
- package/dist/src/cms/client/interfaces/components/resources/{topic → post/topic}/topic-card.js +28 -22
- package/dist/src/cms/client/interfaces/components/resources/{topic → post/topic}/topic-table.js +31 -24
- package/dist/src/cms/client/interfaces/components/resources/seo-metadata/seo-form/fields/basic-tags.js +1 -2
- package/dist/src/cms/client/interfaces/components/resources/seo-metadata/seo-form/fields/json-ld-tags.js +1 -2
- package/dist/src/cms/client/interfaces/components/resources/seo-metadata/seo-form/fields/open-graph-tags.js +1 -2
- package/dist/src/cms/client/interfaces/components/resources/seo-metadata/seo-form/fields/twitter-tags.js +1 -2
- package/dist/src/cms/client/interfaces/components/resources/seo-metadata/seo-metadata-dialog.js +5 -0
- package/dist/src/cms/client/interfaces/components/ui/blocks/list-container/list-container.js +5 -0
- package/dist/src/cms/client/interfaces/components/ui/blocks/list-container/page-size-selector.js +5 -0
- package/dist/src/cms/client/interfaces/components/ui/blocks/page-header/page-header.js +6 -1
- package/dist/src/cms/client/interfaces/components/ui/blocks/page-header/presets/index.js +11 -0
- package/dist/src/cms/client/interfaces/components/ui/buttons/return-button.js +6 -0
- package/dist/src/cms/client/interfaces/components/ui/features/external-link.js +6 -0
- package/dist/src/cms/client/interfaces/components/ui/features/file/file-info/file-info.js +4 -1
- package/dist/src/cms/client/interfaces/components/ui/features/file/file-preview/file-preview-list.js +6 -0
- package/dist/src/cms/client/interfaces/components/ui/features/file/uploader.js +0 -1
- package/dist/src/cms/client/interfaces/components/ui/features/pick-modal/pick-modal-body.js +7 -4
- package/dist/src/cms/client/interfaces/components/ui/features/pick-modal/pick-modal-trigger.js +5 -0
- package/dist/src/cms/client/interfaces/components/ui/features/pick-modal/pick-modal.js +5 -0
- package/dist/src/cms/client/interfaces/components/ui/form/index-field.js +1 -0
- package/dist/src/cms/client/interfaces/components/ui/i18n/display/i18n-array-display.js +4 -1
- package/dist/src/cms/client/interfaces/components/ui/i18n/display/i18n-display.js +4 -1
- package/dist/src/cms/client/interfaces/components/ui/i18n/display/i18n-object-array-display.js +4 -1
- package/dist/src/cms/client/interfaces/components/ui/i18n/inputs/i18n-array-input.js +5 -0
- package/dist/src/cms/client/interfaces/components/ui/i18n/inputs/i18n-date-input.js +5 -0
- package/dist/src/cms/client/interfaces/components/ui/i18n/inputs/i18n-input.js +5 -0
- package/dist/src/cms/client/interfaces/components/ui/i18n/inputs/i18n-json-input.js +6 -1
- package/dist/src/cms/client/interfaces/components/ui/i18n/inputs/i18n-number-input.js +5 -0
- package/dist/src/cms/client/interfaces/components/ui/i18n/inputs/i18n-object-array-input.js +5 -0
- package/dist/src/cms/client/interfaces/components/ui/i18n/inputs/i18n-textarea.js +5 -0
- package/dist/src/cms/client/interfaces/components/ui/inputs/array-input.js +5 -0
- package/dist/src/cms/client/interfaces/components/ui/inputs/editor/base/built-in-plugins.js +1 -2
- package/dist/src/cms/client/interfaces/components/ui/inputs/editor/editor.js +0 -1
- package/dist/src/cms/client/interfaces/components/ui/inputs/editor/plugins/file-repository/upload-adapter.js +1 -2
- package/dist/src/cms/client/interfaces/components/ui/layouts/navbar/i18n-selector.js +4 -0
- package/dist/src/cms/client/interfaces/components/ui/layouts/navbar/theme-selector.js +5 -0
- package/dist/src/cms/client/interfaces/pages/dashboard/content/content-management/_topicSlug_/category/_id_/edit/page.js +19 -4
- package/dist/src/cms/client/interfaces/pages/dashboard/content/content-management/_topicSlug_/category/_id_/page.js +42 -4
- package/dist/src/cms/client/interfaces/pages/dashboard/content/content-management/_topicSlug_/category/create/page.js +20 -5
- package/dist/src/cms/client/interfaces/pages/dashboard/content/content-management/_topicSlug_/page.js +97 -40
- package/dist/src/cms/client/interfaces/pages/dashboard/content/content-management/_topicSlug_/post/_id_/edit/page.js +33 -5
- package/dist/src/cms/client/interfaces/pages/dashboard/content/content-management/_topicSlug_/post/_id_/page.js +34 -4
- package/dist/src/cms/client/interfaces/pages/dashboard/content/content-management/_topicSlug_/post/create/page.js +33 -5
- package/dist/src/cms/client/interfaces/pages/dashboard/content/content-management/_topicSlug_/subcategory/_id_/edit/page.js +114 -0
- package/dist/src/cms/client/interfaces/pages/dashboard/content/content-management/_topicSlug_/subcategory/_id_/page.js +169 -0
- package/dist/src/cms/client/interfaces/pages/dashboard/content/content-management/_topicSlug_/subcategory/create/page.js +116 -0
- package/dist/src/cms/client/interfaces/pages/dashboard/content/content-management/page.js +7 -1
- package/dist/src/cms/client/interfaces/pages/dashboard/content/content-management/tag/_id_/edit/page.js +99 -0
- package/dist/src/cms/client/interfaces/pages/dashboard/content/{tag → content-management/tag}/_id_/page.js +39 -22
- package/dist/src/cms/client/interfaces/pages/dashboard/content/{tag/_id_/edit → content-management/tag/create}/page.js +23 -26
- package/dist/src/cms/client/interfaces/pages/dashboard/content/{tag/create → content-management/tag}/page.js +42 -27
- package/dist/src/cms/client/interfaces/pages/dashboard/content/{topic → content-management/topic}/_id_/edit/page.js +31 -15
- package/dist/src/cms/client/interfaces/pages/dashboard/content/{topic → content-management/topic}/_id_/page.js +35 -36
- package/dist/src/cms/client/interfaces/pages/dashboard/content/{topic/create → content-management/topic}/page.js +40 -15
- package/dist/src/cms/client/interfaces/pages/dashboard/system/access/admin/_id_/admin-refresh-token/page.js +0 -1
- package/dist/src/cms/client/interfaces/pages/dashboard/system/access/admin/_id_/edit/page.js +3 -2
- package/dist/src/cms/client/interfaces/pages/dashboard/system/access/admin/_id_/page.js +3 -2
- package/dist/src/cms/client/interfaces/pages/dashboard/system/access/admin/create/page.js +3 -2
- package/dist/src/cms/client/interfaces/pages/dashboard/system/access/page.js +2 -2
- package/dist/src/cms/client/interfaces/pages/dashboard/system/storage/file/_id_/edit/page.js +0 -1
- package/dist/src/cms/client/interfaces/pages/dashboard/system/storage/file/_id_/page.js +0 -1
- package/dist/src/cms/client/interfaces/pages/dashboard/system/storage/file/create/page.js +0 -1
- package/dist/src/cms/client/interfaces/pages/dashboard/system/storage/file/create-many/page.js +0 -1
- package/dist/src/cms/client/interfaces/pages/dashboard/system/storage/file/delete-many/page.js +0 -1
- package/dist/src/cms/client/interfaces/pages/dashboard/system/storage/folder/_id_/edit/page.js +0 -1
- package/dist/src/cms/client/interfaces/pages/dashboard/system/storage/folder/_id_/page.js +0 -1
- package/dist/src/cms/client/interfaces/pages/dashboard/system/storage/folder/create/page.js +0 -1
- package/dist/src/cms/client/interfaces/pages/dashboard/system/storage/page.js +2 -2
- package/dist/src/cms/client/interfaces/pages/dashboard/system/storage/trash/page.js +1 -2
- package/dist/src/cms/client/interfaces/pages/dashboard/website/website-page/_slug_/page.js +0 -1
- package/dist/src/constants/paths/cms-paths.js +7 -4
- package/dist/src/core/domain/static/topics.js +29 -0
- package/dist/src/core/server/create-core-server.js +0 -1
- package/dist/src/core/server/infrastructure/database/file/query/file-query-repository.js +1 -1
- package/dist/src/core/server/infrastructure/database/folder/query/folder-query-repository.js +1 -1
- package/dist/src/core/server/infrastructure/database/post/command/post-command-repository.js +6 -151
- package/dist/src/core/server/infrastructure/database/post/command/post-create-data.js +81 -0
- package/dist/src/core/server/infrastructure/database/post/command/post-update-data.js +86 -0
- package/dist/src/core/server/infrastructure/i18n/messages/index.js +9 -0
- package/dist/src/core/server/interfaces/actions/resources/file/commands/purge-many/file-purge-many-action.js +1 -1
- package/dist/src/core/server/interfaces/actions/resources/file/commands/soft-delete/file-soft-delete-action.js +1 -1
- package/dist/src/core/server/interfaces/actions/resources/file/commands/soft-delete-many/file-soft-delete-many-action.js +1 -1
- package/dist/src/core/server/interfaces/actions/resources/folder/commands/delete/folder-delete-action.js +1 -1
- package/dist/src/core/server/interfaces/actions/resources/folder/queries/folder-find-full-action.js +1 -1
- package/dist/src/core/server/seeders/folder/seeder.js +1 -1
- package/dist/src/web/server/applications/sitemap/get-post-items.js +46 -6
- package/dist/src/web/server/applications/sitemap/get-subcategory-items.js +34 -0
- package/dist/src/web/server/create-web-server.js +0 -1
- package/dist/src/web/server/interfaces/actions/resources/config/queries/config-find-action.js +0 -1
- package/dist/src/web/server/interfaces/actions/resources/post/queries/post-find-full-action.js +0 -1
- package/dist/src/web/server/interfaces/create-web-interfaces.js +4 -0
- package/dist/src/web/server/interfaces/loaders/load-categories.js +6 -4
- package/dist/src/web/server/interfaces/loaders/load-category.js +8 -2
- package/dist/src/web/server/interfaces/loaders/load-post.js +8 -2
- package/dist/src/web/server/interfaces/loaders/load-posts.js +7 -3
- package/dist/src/web/server/interfaces/loaders/load-subcategories.js +60 -0
- package/dist/src/web/server/interfaces/loaders/load-subcategory.js +27 -0
- package/dist/types/export/cms/client/components/index.d.ts +4 -1
- package/dist/types/export/cms/client/components/index.d.ts.map +1 -1
- package/dist/types/export/cms/client/i18n/index.d.ts +1 -1
- package/dist/types/export/cms/client/i18n/index.d.ts.map +1 -1
- package/dist/types/export/cms/client/index.d.ts +1 -1
- package/dist/types/export/cms/client/index.d.ts.map +1 -1
- package/dist/types/export/cms/client/pages/index.d.ts +1 -1
- package/dist/types/export/cms/client/pages/index.d.ts.map +1 -1
- package/dist/types/export/core/server/index.d.ts +6 -1
- package/dist/types/export/core/server/index.d.ts.map +1 -1
- package/dist/types/export/index.d.ts +2 -2
- package/dist/types/export/index.d.ts.map +1 -1
- package/dist/types/export/web/server/index.d.ts +1 -1
- package/dist/types/export/web/server/index.d.ts.map +1 -1
- package/dist/types/src/cms/client/applications/create-applications.d.ts.map +1 -1
- package/dist/types/src/cms/client/applications/resources/post/use-create-form-data.d.ts +1 -1
- package/dist/types/src/cms/client/applications/resources/post/use-create-form-data.d.ts.map +1 -1
- package/dist/types/src/cms/client/applications/types.d.ts +2 -1
- package/dist/types/src/cms/client/applications/types.d.ts.map +1 -1
- package/dist/types/src/cms/client/applications/ui/index.d.ts +1 -0
- package/dist/types/src/cms/client/applications/ui/index.d.ts.map +1 -1
- package/dist/types/src/cms/client/applications/ui/use-nav-items.d.ts +20 -0
- package/dist/types/src/cms/client/applications/ui/use-nav-items.d.ts.map +1 -0
- package/dist/types/src/cms/client/infrastructure/i18n/index.d.ts +1 -0
- package/dist/types/src/cms/client/infrastructure/i18n/index.d.ts.map +1 -1
- package/dist/types/src/cms/client/infrastructure/i18n/intor-config.d.ts.map +1 -1
- package/dist/types/src/cms/client/infrastructure/i18n/messages/en-US/index.d.ts +4 -1
- package/dist/types/src/cms/client/infrastructure/i18n/messages/en-US/index.d.ts.map +1 -1
- package/dist/types/src/cms/client/infrastructure/i18n/messages/en-US/resources/admin.d.ts +1 -1
- package/dist/types/src/cms/client/infrastructure/i18n/messages/en-US/resources/index.d.ts +4 -1
- package/dist/types/src/cms/client/infrastructure/i18n/messages/en-US/resources/index.d.ts.map +1 -1
- package/dist/types/src/cms/client/infrastructure/i18n/messages/index.d.ts +1347 -0
- package/dist/types/src/cms/client/infrastructure/i18n/messages/index.d.ts.map +1 -0
- package/dist/types/src/cms/client/infrastructure/i18n/messages/zh-TW/index.d.ts +4 -1
- package/dist/types/src/cms/client/infrastructure/i18n/messages/zh-TW/index.d.ts.map +1 -1
- package/dist/types/src/cms/client/infrastructure/i18n/messages/zh-TW/resources/admin.d.ts +1 -1
- package/dist/types/src/cms/client/infrastructure/i18n/messages/zh-TW/resources/index.d.ts +4 -1
- package/dist/types/src/cms/client/infrastructure/i18n/messages/zh-TW/resources/index.d.ts.map +1 -1
- package/dist/types/src/cms/client/interfaces/components/create-components.d.ts +10 -5
- package/dist/types/src/cms/client/interfaces/components/create-components.d.ts.map +1 -1
- package/dist/types/src/cms/client/interfaces/components/create-post-contents.d.ts +38 -0
- package/dist/types/src/cms/client/interfaces/components/create-post-contents.d.ts.map +1 -0
- package/dist/types/src/cms/client/interfaces/components/resources/admin/admin-card.d.ts.map +1 -1
- package/dist/types/src/cms/client/interfaces/components/resources/admin/admin-relations-section.d.ts +1 -2
- package/dist/types/src/cms/client/interfaces/components/resources/admin/admin-relations-section.d.ts.map +1 -1
- package/dist/types/src/cms/client/interfaces/components/resources/admin/admin-table.d.ts.map +1 -1
- package/dist/types/src/cms/client/interfaces/components/resources/config/config-edit-content.d.ts +1 -1
- package/dist/types/src/cms/client/interfaces/components/resources/config/config-edit-content.d.ts.map +1 -1
- package/dist/types/src/cms/client/interfaces/components/resources/file/file-relations-section.d.ts +1 -2
- package/dist/types/src/cms/client/interfaces/components/resources/file/file-relations-section.d.ts.map +1 -1
- package/dist/types/src/cms/client/interfaces/components/resources/index.d.ts +5 -4
- package/dist/types/src/cms/client/interfaces/components/resources/index.d.ts.map +1 -1
- package/dist/types/src/cms/client/interfaces/components/resources/post/category/category-card.d.ts +8 -0
- package/dist/types/src/cms/client/interfaces/components/resources/post/category/category-card.d.ts.map +1 -0
- package/dist/types/src/cms/client/interfaces/components/resources/{category → post/category}/category-relations-section.d.ts +4 -4
- package/dist/types/src/cms/client/interfaces/components/resources/post/category/category-relations-section.d.ts.map +1 -0
- package/dist/types/src/cms/client/interfaces/components/resources/post/category/category-table.d.ts +8 -0
- package/dist/types/src/cms/client/interfaces/components/resources/post/category/category-table.d.ts.map +1 -0
- package/dist/types/src/cms/client/interfaces/components/resources/post/category/index.d.ts.map +1 -0
- package/dist/types/src/cms/client/interfaces/components/resources/post/content/index.d.ts +6 -0
- package/dist/types/src/cms/client/interfaces/components/resources/post/content/index.d.ts.map +1 -0
- package/dist/types/src/cms/client/interfaces/components/resources/post/content/post-create-content.d.ts +46 -0
- package/dist/types/src/cms/client/interfaces/components/resources/post/content/post-create-content.d.ts.map +1 -0
- package/dist/types/src/cms/client/interfaces/components/resources/post/content/post-edit-content.d.ts +45 -0
- package/dist/types/src/cms/client/interfaces/components/resources/post/content/post-edit-content.d.ts.map +1 -0
- package/dist/types/src/cms/client/interfaces/components/resources/post/content/post-show-content.d.ts +26 -0
- package/dist/types/src/cms/client/interfaces/components/resources/post/content/post-show-content.d.ts.map +1 -0
- package/dist/types/src/cms/client/interfaces/components/resources/post/content/types.d.ts +19 -0
- package/dist/types/src/cms/client/interfaces/components/resources/post/content/types.d.ts.map +1 -0
- package/dist/types/src/cms/client/interfaces/components/resources/post/index.d.ts +2 -0
- package/dist/types/src/cms/client/interfaces/components/resources/post/index.d.ts.map +1 -1
- package/dist/types/src/cms/client/interfaces/components/resources/post/post-card.d.ts +1 -8
- package/dist/types/src/cms/client/interfaces/components/resources/post/post-card.d.ts.map +1 -1
- package/dist/types/src/cms/client/interfaces/components/resources/post/post-list.d.ts +4 -3
- package/dist/types/src/cms/client/interfaces/components/resources/post/post-list.d.ts.map +1 -1
- package/dist/types/src/cms/client/interfaces/components/resources/post/post-relations-section.d.ts +1 -1
- package/dist/types/src/cms/client/interfaces/components/resources/post/post-relations-section.d.ts.map +1 -1
- package/dist/types/src/cms/client/interfaces/components/resources/post/search/control-fields-buttons.d.ts +0 -2
- package/dist/types/src/cms/client/interfaces/components/resources/post/search/control-fields-buttons.d.ts.map +1 -1
- package/dist/types/src/cms/client/interfaces/components/resources/post/tag/index.d.ts.map +1 -0
- package/dist/types/src/cms/client/interfaces/components/resources/{tag → post/tag}/tag-card.d.ts +1 -1
- package/dist/types/src/cms/client/interfaces/components/resources/post/tag/tag-card.d.ts.map +1 -0
- package/dist/types/src/cms/client/interfaces/components/resources/{tag → post/tag}/tag-relations-section.d.ts +4 -4
- package/dist/types/src/cms/client/interfaces/components/resources/post/tag/tag-relations-section.d.ts.map +1 -0
- package/dist/types/src/cms/client/interfaces/components/resources/{tag → post/tag}/tag-table.d.ts +1 -1
- package/dist/types/src/cms/client/interfaces/components/resources/post/tag/tag-table.d.ts.map +1 -0
- package/dist/types/src/cms/client/interfaces/components/resources/post/topic/index.d.ts.map +1 -0
- package/dist/types/src/cms/client/interfaces/components/resources/{topic → post/topic}/topic-card.d.ts +2 -2
- package/dist/types/src/cms/client/interfaces/components/resources/post/topic/topic-card.d.ts.map +1 -0
- package/dist/types/src/cms/client/interfaces/components/resources/{topic → post/topic}/topic-table.d.ts +2 -2
- package/dist/types/src/cms/client/interfaces/components/resources/post/topic/topic-table.d.ts.map +1 -0
- package/dist/types/src/cms/client/interfaces/components/ui/blocks/page-header/presets/index.d.ts.map +1 -1
- package/dist/types/src/cms/client/interfaces/components/ui/blocks/page-header/types.d.ts +1 -0
- package/dist/types/src/cms/client/interfaces/components/ui/blocks/page-header/types.d.ts.map +1 -1
- package/dist/types/src/cms/client/interfaces/components/ui/features/pick-modal/pick-modal.d.ts +2 -1
- package/dist/types/src/cms/client/interfaces/components/ui/features/pick-modal/pick-modal.d.ts.map +1 -1
- package/dist/types/src/cms/client/interfaces/components/ui/form/index-field.d.ts.map +1 -1
- package/dist/types/src/cms/client/interfaces/components/ui/i18n/display/i18n-array-display.d.ts.map +1 -1
- package/dist/types/src/cms/client/interfaces/components/ui/i18n/display/i18n-display.d.ts.map +1 -1
- package/dist/types/src/cms/client/interfaces/components/ui/i18n/display/i18n-object-array-display.d.ts.map +1 -1
- package/dist/types/src/cms/client/interfaces/components/ui/i18n/inputs/i18n-json-input.d.ts.map +1 -1
- package/dist/types/src/cms/client/interfaces/components/ui/inputs/editor/base/built-in-plugins.d.ts.map +1 -1
- package/dist/types/src/cms/client/interfaces/components/ui/layouts/content-container.d.ts +1 -1
- package/dist/types/src/cms/client/interfaces/components/ui/layouts/content-container.d.ts.map +1 -1
- package/dist/types/src/cms/client/interfaces/components/ui/layouts/sidebar/nav-main.d.ts +1 -1
- package/dist/types/src/cms/client/interfaces/components/ui/layouts/sidebar/nav-main.d.ts.map +1 -1
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/content-management/[topicSlug]/category/[id]/edit/page.d.ts +6 -2
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/content-management/[topicSlug]/category/[id]/edit/page.d.ts.map +1 -1
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/content-management/[topicSlug]/category/[id]/page.d.ts +6 -3
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/content-management/[topicSlug]/category/[id]/page.d.ts.map +1 -1
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/content-management/[topicSlug]/category/create/page.d.ts +6 -2
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/content-management/[topicSlug]/category/create/page.d.ts.map +1 -1
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/content-management/[topicSlug]/page.d.ts +3 -3
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/content-management/[topicSlug]/page.d.ts.map +1 -1
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/content-management/[topicSlug]/post/[id]/edit/page.d.ts +6 -2
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/content-management/[topicSlug]/post/[id]/edit/page.d.ts.map +1 -1
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/content-management/[topicSlug]/post/[id]/page.d.ts +7 -3
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/content-management/[topicSlug]/post/[id]/page.d.ts.map +1 -1
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/content-management/[topicSlug]/post/create/page.d.ts +6 -2
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/content-management/[topicSlug]/post/create/page.d.ts.map +1 -1
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/content-management/[topicSlug]/subcategory/[id]/edit/page.d.ts +24 -0
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/content-management/[topicSlug]/subcategory/[id]/edit/page.d.ts.map +1 -0
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/content-management/[topicSlug]/subcategory/[id]/page.d.ts +27 -0
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/content-management/[topicSlug]/subcategory/[id]/page.d.ts.map +1 -0
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/content-management/[topicSlug]/subcategory/create/page.d.ts +24 -0
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/content-management/[topicSlug]/subcategory/create/page.d.ts.map +1 -0
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/content-management/[topicSlug]/subcategory/index.d.ts +4 -0
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/content-management/[topicSlug]/subcategory/index.d.ts.map +1 -0
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/content-management/page.d.ts +3 -1
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/content-management/page.d.ts.map +1 -1
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/content-management/tag/[id]/edit/page.d.ts +20 -0
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/content-management/tag/[id]/edit/page.d.ts.map +1 -0
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/content-management/tag/[id]/page.d.ts +23 -0
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/content-management/tag/[id]/page.d.ts.map +1 -0
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/content-management/tag/create/page.d.ts +16 -0
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/content-management/tag/create/page.d.ts.map +1 -0
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/content-management/tag/index.d.ts.map +1 -0
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/content-management/tag/page.d.ts +14 -0
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/content-management/tag/page.d.ts.map +1 -0
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/content-management/topic/[id]/edit/page.d.ts +20 -0
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/content-management/topic/[id]/edit/page.d.ts.map +1 -0
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/content-management/topic/[id]/page.d.ts +20 -0
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/content-management/topic/[id]/page.d.ts.map +1 -0
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/{topic → content-management/topic}/index.d.ts +0 -1
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/content-management/topic/index.d.ts.map +1 -0
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/content-management/topic/page.d.ts +14 -0
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/content-management/topic/page.d.ts.map +1 -0
- package/dist/types/src/cms/client/interfaces/pages/dashboard/system/access/admin/[id]/edit/page.d.ts.map +1 -1
- package/dist/types/src/cms/client/interfaces/pages/dashboard/system/access/admin/[id]/page.d.ts.map +1 -1
- package/dist/types/src/cms/client/interfaces/pages/dashboard/system/access/admin/create/page.d.ts.map +1 -1
- package/dist/types/src/cms/client/interfaces/pages/index.d.ts +3 -2
- package/dist/types/src/cms/client/interfaces/pages/index.d.ts.map +1 -1
- package/dist/types/src/constants/paths/cms-paths.d.ts +9 -6
- package/dist/types/src/constants/paths/cms-paths.d.ts.map +1 -1
- package/dist/types/src/core/domain/index.d.ts +2 -2
- package/dist/types/src/core/domain/index.d.ts.map +1 -1
- package/dist/types/src/core/domain/resources/admin/index.d.ts +0 -1
- package/dist/types/src/core/domain/resources/admin/index.d.ts.map +1 -1
- package/dist/types/src/core/domain/resources/index.d.ts +1 -1
- package/dist/types/src/core/domain/resources/index.d.ts.map +1 -1
- package/dist/types/src/core/domain/static/index.d.ts +1 -1
- package/dist/types/src/core/domain/static/index.d.ts.map +1 -1
- package/dist/types/src/core/domain/static/post.d.ts +1 -1
- package/dist/types/src/core/domain/static/post.d.ts.map +1 -1
- package/dist/types/src/core/domain/static/topics.d.ts +36 -3
- package/dist/types/src/core/domain/static/topics.d.ts.map +1 -1
- package/dist/types/src/core/server/infrastructure/database/index.d.ts +1 -1
- package/dist/types/src/core/server/infrastructure/database/index.d.ts.map +1 -1
- package/dist/types/src/core/server/infrastructure/database/post/command/index.d.ts +2 -0
- package/dist/types/src/core/server/infrastructure/database/post/command/index.d.ts.map +1 -1
- package/dist/types/src/core/server/infrastructure/database/post/command/post-command-repository.d.ts +2 -2
- package/dist/types/src/core/server/infrastructure/database/post/command/post-command-repository.d.ts.map +1 -1
- package/dist/types/src/core/server/infrastructure/database/post/command/post-create-data.d.ts +160 -0
- package/dist/types/src/core/server/infrastructure/database/post/command/post-create-data.d.ts.map +1 -0
- package/dist/types/src/core/server/infrastructure/database/post/command/post-update-data.d.ts +207 -0
- package/dist/types/src/core/server/infrastructure/database/post/command/post-update-data.d.ts.map +1 -0
- package/dist/types/src/core/server/infrastructure/database/post/index.d.ts +1 -1
- package/dist/types/src/core/server/infrastructure/database/post/index.d.ts.map +1 -1
- package/dist/types/src/core/server/infrastructure/i18n/index.d.ts +1 -0
- package/dist/types/src/core/server/infrastructure/i18n/index.d.ts.map +1 -1
- package/dist/types/src/core/server/infrastructure/i18n/messages/index.d.ts +105 -0
- package/dist/types/src/core/server/infrastructure/i18n/messages/index.d.ts.map +1 -0
- package/dist/types/src/core/server/infrastructure/index.d.ts +1 -1
- package/dist/types/src/core/server/infrastructure/index.d.ts.map +1 -1
- package/dist/types/src/shared/form/types.d.ts +2 -2
- package/dist/types/src/shared/form/types.d.ts.map +1 -1
- package/dist/types/src/web/server/applications/index.d.ts +1 -1
- package/dist/types/src/web/server/applications/index.d.ts.map +1 -1
- package/dist/types/src/web/server/applications/sitemap/get-post-items.d.ts +3 -1
- package/dist/types/src/web/server/applications/sitemap/get-post-items.d.ts.map +1 -1
- package/dist/types/src/web/server/applications/sitemap/get-subcategory-items.d.ts +18 -0
- package/dist/types/src/web/server/applications/sitemap/get-subcategory-items.d.ts.map +1 -0
- package/dist/types/src/web/server/applications/sitemap/index.d.ts +1 -0
- package/dist/types/src/web/server/applications/sitemap/index.d.ts.map +1 -1
- package/dist/types/src/web/server/index.d.ts +1 -0
- package/dist/types/src/web/server/index.d.ts.map +1 -1
- package/dist/types/src/web/server/interfaces/create-web-interfaces.d.ts.map +1 -1
- package/dist/types/src/web/server/interfaces/loaders/index.d.ts +2 -0
- package/dist/types/src/web/server/interfaces/loaders/index.d.ts.map +1 -1
- package/dist/types/src/web/server/interfaces/loaders/load-categories.d.ts.map +1 -1
- package/dist/types/src/web/server/interfaces/loaders/load-category.d.ts.map +1 -1
- package/dist/types/src/web/server/interfaces/loaders/load-post.d.ts.map +1 -1
- package/dist/types/src/web/server/interfaces/loaders/load-posts.d.ts.map +1 -1
- package/dist/types/src/web/server/interfaces/loaders/load-subcategories.d.ts +10 -0
- package/dist/types/src/web/server/interfaces/loaders/load-subcategories.d.ts.map +1 -0
- package/dist/types/src/web/server/interfaces/loaders/load-subcategory.d.ts +8 -0
- package/dist/types/src/web/server/interfaces/loaders/load-subcategory.d.ts.map +1 -0
- package/dist/types/src/web/server/interfaces/types.d.ts +3 -1
- package/dist/types/src/web/server/interfaces/types.d.ts.map +1 -1
- package/package.json +3 -3
- package/dist/src/cms/client/interfaces/pages/dashboard/content/tag/page.js +0 -81
- package/dist/src/cms/client/interfaces/pages/dashboard/content/topic/page.js +0 -79
- package/dist/src/core/domain/resources/admin/constants.js +0 -9
- package/dist/types/src/cms/client/interfaces/components/resources/category/category-card.d.ts +0 -3
- package/dist/types/src/cms/client/interfaces/components/resources/category/category-card.d.ts.map +0 -1
- package/dist/types/src/cms/client/interfaces/components/resources/category/category-relations-section.d.ts.map +0 -1
- package/dist/types/src/cms/client/interfaces/components/resources/category/category-table.d.ts +0 -3
- package/dist/types/src/cms/client/interfaces/components/resources/category/category-table.d.ts.map +0 -1
- package/dist/types/src/cms/client/interfaces/components/resources/category/index.d.ts.map +0 -1
- package/dist/types/src/cms/client/interfaces/components/resources/tag/index.d.ts.map +0 -1
- package/dist/types/src/cms/client/interfaces/components/resources/tag/tag-card.d.ts.map +0 -1
- package/dist/types/src/cms/client/interfaces/components/resources/tag/tag-relations-section.d.ts.map +0 -1
- package/dist/types/src/cms/client/interfaces/components/resources/tag/tag-table.d.ts.map +0 -1
- package/dist/types/src/cms/client/interfaces/components/resources/topic/index.d.ts.map +0 -1
- package/dist/types/src/cms/client/interfaces/components/resources/topic/topic-card.d.ts.map +0 -1
- package/dist/types/src/cms/client/interfaces/components/resources/topic/topic-table.d.ts.map +0 -1
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/tag/[id]/edit/page.d.ts +0 -15
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/tag/[id]/edit/page.d.ts.map +0 -1
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/tag/[id]/page.d.ts +0 -17
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/tag/[id]/page.d.ts.map +0 -1
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/tag/create/page.d.ts +0 -11
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/tag/create/page.d.ts.map +0 -1
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/tag/index.d.ts.map +0 -1
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/tag/page.d.ts +0 -8
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/tag/page.d.ts.map +0 -1
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/topic/[id]/edit/page.d.ts +0 -15
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/topic/[id]/edit/page.d.ts.map +0 -1
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/topic/[id]/page.d.ts +0 -17
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/topic/[id]/page.d.ts.map +0 -1
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/topic/create/page.d.ts +0 -11
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/topic/create/page.d.ts.map +0 -1
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/topic/index.d.ts.map +0 -1
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/topic/page.d.ts +0 -12
- package/dist/types/src/cms/client/interfaces/pages/dashboard/content/topic/page.d.ts.map +0 -1
- package/dist/types/src/core/domain/resources/admin/constants.d.ts +0 -4
- package/dist/types/src/core/domain/resources/admin/constants.d.ts.map +0 -1
- package/dist/types/src/core/domain/translation.d.ts +0 -7
- package/dist/types/src/core/domain/translation.d.ts.map +0 -1
- /package/dist/types/src/cms/client/interfaces/components/resources/{category → post/category}/index.d.ts +0 -0
- /package/dist/types/src/cms/client/interfaces/components/resources/{tag → post/tag}/index.d.ts +0 -0
- /package/dist/types/src/cms/client/interfaces/components/resources/{topic → post/topic}/index.d.ts +0 -0
- /package/dist/types/src/cms/client/interfaces/pages/dashboard/content/{tag → content-management/tag}/index.d.ts +0 -0
|
@@ -38,7 +38,6 @@ import '@radix-ui/react-tabs';
|
|
|
38
38
|
import '@radix-ui/react-tooltip';
|
|
39
39
|
import 'next/link';
|
|
40
40
|
import { Badge } from '../../../../../../../components/ui/display/badge.js';
|
|
41
|
-
import '../../../../../../../../../../core/domain/resources/admin/constants.js';
|
|
42
41
|
import { ExternalLink } from '../../../../../../../components/ui/features/external-link.js';
|
|
43
42
|
import 'next/image';
|
|
44
43
|
|
|
@@ -50,13 +49,20 @@ function createCategoryShowPage({
|
|
|
50
49
|
postFindFullAction,
|
|
51
50
|
postDeleteAction,
|
|
52
51
|
SeoMetadataDialog,
|
|
53
|
-
renderPostShowContent
|
|
52
|
+
renderPostShowContent,
|
|
53
|
+
PostShowContent,
|
|
54
|
+
allowField,
|
|
55
|
+
CategoryRelationsSection
|
|
54
56
|
}) {
|
|
55
57
|
return function CategoryShowPage() {
|
|
56
58
|
const { t, locale } = useTranslator();
|
|
57
59
|
const { id, topicSlug } = useParams();
|
|
58
60
|
const router = useRouter();
|
|
59
|
-
const postType =
|
|
61
|
+
const postType = POST_TYPES.POST;
|
|
62
|
+
const isFieldAllowed = (type, field, fieldRuleKey) => allowField?.({ topicSlug, type, field, fieldRuleKey }) ?? false;
|
|
63
|
+
const subcategoryType = staticTopics[topicSlug]?.roles.includes(
|
|
64
|
+
POST_TYPES.SUBCATEGORY
|
|
65
|
+
) ? POST_TYPES.SUBCATEGORY : void 0;
|
|
60
66
|
const { data: topic, isFetching: isFetchingTopic } = useQuery(
|
|
61
67
|
() => postFindAction({ type: POST_TYPES.TOPIC, slug: topicSlug }),
|
|
62
68
|
["postFindAction", POST_TYPES.TOPIC, topicSlug],
|
|
@@ -130,7 +136,39 @@ function createCategoryShowPage({
|
|
|
130
136
|
isLocked: category?.isLocked
|
|
131
137
|
}
|
|
132
138
|
),
|
|
133
|
-
|
|
139
|
+
PostShowContent && allowField && /* @__PURE__ */ jsx(
|
|
140
|
+
PostShowContent,
|
|
141
|
+
{
|
|
142
|
+
post: category,
|
|
143
|
+
isFetching,
|
|
144
|
+
isNotFound,
|
|
145
|
+
allowField,
|
|
146
|
+
children: category && CategoryRelationsSection && /* @__PURE__ */ jsx(
|
|
147
|
+
CategoryRelationsSection,
|
|
148
|
+
{
|
|
149
|
+
category,
|
|
150
|
+
headerProps: { children: t("resources.post.text") },
|
|
151
|
+
usableFields: [
|
|
152
|
+
...isFieldAllowed(subcategoryType || postType, "isActive") ? ["isActive"] : [],
|
|
153
|
+
...isFieldAllowed(
|
|
154
|
+
subcategoryType || postType,
|
|
155
|
+
"isIndexActive"
|
|
156
|
+
) ? ["isIndexActive"] : [],
|
|
157
|
+
...isFieldAllowed(
|
|
158
|
+
subcategoryType || postType,
|
|
159
|
+
"isSlugActive"
|
|
160
|
+
) ? ["isSlugActive"] : [],
|
|
161
|
+
...isFieldAllowed(subcategoryType || postType, "isFeatured") ? ["isFeatured"] : [],
|
|
162
|
+
...isFieldAllowed(
|
|
163
|
+
subcategoryType || postType,
|
|
164
|
+
"isShownOnHome"
|
|
165
|
+
) ? ["isShownOnHome"] : []
|
|
166
|
+
]
|
|
167
|
+
}
|
|
168
|
+
)
|
|
169
|
+
}
|
|
170
|
+
),
|
|
171
|
+
renderPostShowContent?.({
|
|
134
172
|
category,
|
|
135
173
|
postType,
|
|
136
174
|
isFetching,
|
|
@@ -20,8 +20,8 @@ import 'zod';
|
|
|
20
20
|
import 'sonner';
|
|
21
21
|
import { useQuery } from '../../../../../../../../../../core/client/infrastructure/react-query/use-query.js';
|
|
22
22
|
import { getControlMeta } from '../../../../../../../../applications/form/get-control-meta.js';
|
|
23
|
-
import { PageHeader } from '../../../../../../../components/ui/blocks/page-header/page-header.js';
|
|
24
23
|
import 'lucide-react';
|
|
24
|
+
import { PageHeader } from '../../../../../../../components/ui/blocks/page-header/page-header.js';
|
|
25
25
|
import '@radix-ui/react-avatar';
|
|
26
26
|
import '../../../../../../../components/shadcn/badge.js';
|
|
27
27
|
import '../../../../../../../components/shadcn/button.js';
|
|
@@ -41,15 +41,18 @@ import 'next/link';
|
|
|
41
41
|
import { Badge } from '../../../../../../../components/ui/display/badge.js';
|
|
42
42
|
|
|
43
43
|
function createCategoryCreatePage({
|
|
44
|
-
topics: staticTopics,
|
|
45
44
|
postFindAction,
|
|
46
45
|
postFindManyAction,
|
|
47
|
-
renderPostCreateContent
|
|
46
|
+
renderPostCreateContent,
|
|
47
|
+
PostCreateContent,
|
|
48
|
+
allowField
|
|
48
49
|
}) {
|
|
49
50
|
return function CategoryCreatePage() {
|
|
50
51
|
const { t, locale } = useTranslator();
|
|
51
52
|
const { topicSlug } = useParams();
|
|
52
|
-
const
|
|
53
|
+
const allowFieldInTopic = (params) => allowField?.({ ...params, topicSlug: params.topicSlug ?? topicSlug }) ?? false;
|
|
54
|
+
const categoryType = POST_TYPES.CATEGORY;
|
|
55
|
+
const subcategoryType = POST_TYPES.SUBCATEGORY;
|
|
53
56
|
const returnHref = joinUrl(
|
|
54
57
|
CMS_PATHS.content["content-management"].pathname,
|
|
55
58
|
topicSlug
|
|
@@ -85,9 +88,21 @@ function createCategoryCreatePage({
|
|
|
85
88
|
isNotFound
|
|
86
89
|
}
|
|
87
90
|
),
|
|
88
|
-
|
|
91
|
+
PostCreateContent && allowField && /* @__PURE__ */ jsx(
|
|
92
|
+
PostCreateContent,
|
|
93
|
+
{
|
|
94
|
+
topic,
|
|
95
|
+
postType: categoryType,
|
|
96
|
+
controlMeta,
|
|
97
|
+
isFetching: isFetchingTopic || isFetchingControlMeta,
|
|
98
|
+
allowField: allowFieldInTopic,
|
|
99
|
+
cancelButtonHref: returnHref
|
|
100
|
+
}
|
|
101
|
+
),
|
|
102
|
+
renderPostCreateContent?.({
|
|
89
103
|
topic,
|
|
90
104
|
categoryType,
|
|
105
|
+
subcategoryType,
|
|
91
106
|
controlMeta,
|
|
92
107
|
isFetching: isFetchingTopic || isFetchingControlMeta,
|
|
93
108
|
cancelButtonHref: returnHref
|
|
@@ -20,7 +20,7 @@ import { DO_NOT_FETCH_KEY } from '../../../../../../../../shared/list-item.js';
|
|
|
20
20
|
import 'zod';
|
|
21
21
|
import 'sonner';
|
|
22
22
|
import { useQuery } from '../../../../../../../../core/client/infrastructure/react-query/use-query.js';
|
|
23
|
-
import '../../../../../../../../core/domain/
|
|
23
|
+
import { isContentTopic, hasTopicRole } from '../../../../../../../../core/domain/static/topics.js';
|
|
24
24
|
import 'next/link';
|
|
25
25
|
import '@radix-ui/react-avatar';
|
|
26
26
|
import '../../../../../components/shadcn/badge.js';
|
|
@@ -42,8 +42,8 @@ import { PageHeader } from '../../../../../components/ui/blocks/page-header/page
|
|
|
42
42
|
import { Accordion } from '../../../../../components/ui/features/accordion/accordion.js';
|
|
43
43
|
import { ExternalLink } from '../../../../../components/ui/features/external-link.js';
|
|
44
44
|
import 'next/image';
|
|
45
|
-
import { CategoryCard } from '../../../../../components/resources/category/category-card.js';
|
|
46
|
-
import { CategoryTable } from '../../../../../components/resources/category/category-table.js';
|
|
45
|
+
import { CategoryCard } from '../../../../../components/resources/post/category/category-card.js';
|
|
46
|
+
import { CategoryTable } from '../../../../../components/resources/post/category/category-table.js';
|
|
47
47
|
import 'intor/next';
|
|
48
48
|
import { ContentContainer } from '../../../../../components/ui/layouts/content-container.js';
|
|
49
49
|
|
|
@@ -55,11 +55,22 @@ function createTopicScopePage({
|
|
|
55
55
|
PostList: PostListBase,
|
|
56
56
|
allowField
|
|
57
57
|
}) {
|
|
58
|
-
return function
|
|
58
|
+
return function ContentTopicScopePage() {
|
|
59
59
|
const { t, locale } = useTranslator();
|
|
60
60
|
const { topicSlug } = useParams();
|
|
61
|
-
const
|
|
62
|
-
const
|
|
61
|
+
const isFieldAllowed = (type, field, fieldRuleKey) => allowField({ topicSlug, type, field, fieldRuleKey });
|
|
62
|
+
const isContentTopicScope = isContentTopic(staticTopics, topicSlug);
|
|
63
|
+
const hasPost = isContentTopicScope;
|
|
64
|
+
const hasCategory = hasTopicRole(
|
|
65
|
+
staticTopics,
|
|
66
|
+
topicSlug,
|
|
67
|
+
POST_TYPES.CATEGORY
|
|
68
|
+
);
|
|
69
|
+
const hasSubcategory = hasTopicRole(
|
|
70
|
+
staticTopics,
|
|
71
|
+
topicSlug,
|
|
72
|
+
POST_TYPES.SUBCATEGORY
|
|
73
|
+
);
|
|
63
74
|
const {
|
|
64
75
|
data: topic,
|
|
65
76
|
isFetching,
|
|
@@ -71,26 +82,25 @@ function createTopicScopePage({
|
|
|
71
82
|
);
|
|
72
83
|
const topicT = findTranslation(topic?.translations, locale);
|
|
73
84
|
const [categoryStates, setCategoryStates] = useState({});
|
|
85
|
+
const [subcategoryStates, setSubcategoryStates] = useState({});
|
|
74
86
|
const [postStates, setPostStates] = useState(
|
|
75
87
|
{}
|
|
76
88
|
);
|
|
77
|
-
const
|
|
89
|
+
const getUsableFields = (type) => [
|
|
90
|
+
...isFieldAllowed(type, "isActive") ? ["isActive"] : [],
|
|
91
|
+
...isFieldAllowed(type, "isIndexActive") ? ["isIndexActive"] : [],
|
|
92
|
+
...isFieldAllowed(type, "isSlugActive") ? ["isSlugActive"] : [],
|
|
93
|
+
...isFieldAllowed(type, "isFeatured") ? ["isFeatured"] : [],
|
|
94
|
+
...isFieldAllowed(type, "isShownOnHome") ? ["isShownOnHome"] : []
|
|
95
|
+
];
|
|
96
|
+
const postList = /* @__PURE__ */ jsx(
|
|
78
97
|
PostListBase,
|
|
79
98
|
{
|
|
80
|
-
usableFields:
|
|
81
|
-
|
|
82
|
-
...allowField(postType, "isIndexActive") ? ["isIndexActive"] : [],
|
|
83
|
-
...allowField(postType, "isSlugActive") ? ["isSlugActive"] : [],
|
|
84
|
-
...allowField(postType, "isFeatured") ? ["isFeatured"] : [],
|
|
85
|
-
...allowField(postType, "isShownOnHome") ? ["isShownOnHome"] : [],
|
|
86
|
-
// TODO: remove (currently only for kowkun)
|
|
87
|
-
...allowField(postType, "state3") ? ["state3"] : [],
|
|
88
|
-
...allowField(postType, "state4") ? ["state4"] : []
|
|
89
|
-
],
|
|
90
|
-
type: postType,
|
|
99
|
+
usableFields: getUsableFields(POST_TYPES.POST),
|
|
100
|
+
type: POST_TYPES.POST,
|
|
91
101
|
topicId: topic?.id ?? DO_NOT_FETCH_KEY,
|
|
92
102
|
setListItemStates: setPostStates,
|
|
93
|
-
localKey: `post-${
|
|
103
|
+
localKey: `post-${POST_TYPES.POST}`
|
|
94
104
|
}
|
|
95
105
|
);
|
|
96
106
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -104,9 +114,12 @@ function createTopicScopePage({
|
|
|
104
114
|
title: !isFetching ? topicT.title : /* @__PURE__ */ jsx(Spinner, {})
|
|
105
115
|
},
|
|
106
116
|
settingButtonProps: {
|
|
107
|
-
href: joinUrl(
|
|
117
|
+
href: joinUrl(
|
|
118
|
+
CMS_PATHS.content["content-management"].topic.pathname,
|
|
119
|
+
topic?.id
|
|
120
|
+
)
|
|
108
121
|
},
|
|
109
|
-
createCategoryButtonProps:
|
|
122
|
+
createCategoryButtonProps: hasCategory ? {
|
|
110
123
|
href: joinUrl(
|
|
111
124
|
CMS_PATHS.content["content-management"].category.pathname(
|
|
112
125
|
topicSlug
|
|
@@ -115,20 +128,29 @@ function createTopicScopePage({
|
|
|
115
128
|
),
|
|
116
129
|
children: t("ui.create.text") + t("resources.category.text")
|
|
117
130
|
} : void 0,
|
|
118
|
-
|
|
131
|
+
createSubcategoryButtonProps: hasSubcategory ? {
|
|
132
|
+
href: joinUrl(
|
|
133
|
+
CMS_PATHS.content["content-management"].subcategory.pathname(topicSlug),
|
|
134
|
+
"create"
|
|
135
|
+
),
|
|
136
|
+
children: t("ui.create.text") + t("resources.subcategory.text")
|
|
137
|
+
} : void 0,
|
|
138
|
+
createButtonProps: hasPost ? {
|
|
119
139
|
icon: File,
|
|
120
140
|
href: joinUrl(
|
|
121
|
-
CMS_PATHS.content["content-management"].post.pathname(
|
|
141
|
+
CMS_PATHS.content["content-management"].post.pathname(
|
|
142
|
+
topicSlug
|
|
143
|
+
),
|
|
122
144
|
"create"
|
|
123
145
|
),
|
|
124
146
|
children: t("ui.create.text") + t("resources.post.text")
|
|
125
|
-
},
|
|
147
|
+
} : void 0,
|
|
126
148
|
rightChildren: /* @__PURE__ */ jsx(ExternalLink, { href: externalHref?.(topicSlug) ?? `/${topicSlug}` }),
|
|
127
149
|
isDisabled: isFetching,
|
|
128
|
-
isNotFound
|
|
150
|
+
isNotFound: isNotFound || !isContentTopicScope
|
|
129
151
|
}
|
|
130
152
|
),
|
|
131
|
-
/* @__PURE__ */ jsx(ContentContainer, { isFixHeight: !
|
|
153
|
+
isContentTopicScope && /* @__PURE__ */ jsx(ContentContainer, { isFixHeight: !hasCategory, children: hasCategory ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
132
154
|
/* @__PURE__ */ jsx(
|
|
133
155
|
Accordion,
|
|
134
156
|
{
|
|
@@ -145,19 +167,52 @@ function createTopicScopePage({
|
|
|
145
167
|
children: /* @__PURE__ */ jsx(
|
|
146
168
|
PostListBase,
|
|
147
169
|
{
|
|
148
|
-
usableFields:
|
|
149
|
-
|
|
150
|
-
...allowField(categoryType, "isIndexActive") ? ["isIndexActive"] : [],
|
|
151
|
-
...allowField(categoryType, "isSlugActive") ? ["isSlugActive"] : [],
|
|
152
|
-
...allowField(categoryType, "isFeatured") ? ["isFeatured"] : [],
|
|
153
|
-
...allowField(categoryType, "isShownOnHome") ? ["isShownOnHome"] : []
|
|
154
|
-
],
|
|
155
|
-
type: categoryType,
|
|
170
|
+
usableFields: getUsableFields(POST_TYPES.CATEGORY),
|
|
171
|
+
type: POST_TYPES.CATEGORY,
|
|
156
172
|
topicId: topic?.id ?? DO_NOT_FETCH_KEY,
|
|
157
173
|
setListItemStates: setCategoryStates,
|
|
158
|
-
Card:
|
|
159
|
-
|
|
160
|
-
|
|
174
|
+
Card: (props) => /* @__PURE__ */ jsx(
|
|
175
|
+
CategoryCard,
|
|
176
|
+
{
|
|
177
|
+
...props,
|
|
178
|
+
hasSubcategory
|
|
179
|
+
}
|
|
180
|
+
),
|
|
181
|
+
Table: (props) => /* @__PURE__ */ jsx(
|
|
182
|
+
CategoryTable,
|
|
183
|
+
{
|
|
184
|
+
...props,
|
|
185
|
+
hasSubcategory
|
|
186
|
+
}
|
|
187
|
+
),
|
|
188
|
+
localKey: `category-${POST_TYPES.CATEGORY}`
|
|
189
|
+
}
|
|
190
|
+
)
|
|
191
|
+
}
|
|
192
|
+
),
|
|
193
|
+
hasSubcategory && /* @__PURE__ */ jsx(
|
|
194
|
+
Accordion,
|
|
195
|
+
{
|
|
196
|
+
accordionHeaderProps: {
|
|
197
|
+
count: subcategoryStates.count,
|
|
198
|
+
children: /* @__PURE__ */ jsxs("span", { className: "flex-center gap-2", children: [
|
|
199
|
+
/* @__PURE__ */ jsx(Notebook, { className: "size-4" }),
|
|
200
|
+
t("resources.subcategory.text")
|
|
201
|
+
] })
|
|
202
|
+
},
|
|
203
|
+
hasBorder: true,
|
|
204
|
+
initialOpen: true,
|
|
205
|
+
deps: [subcategoryStates.isFetching],
|
|
206
|
+
children: /* @__PURE__ */ jsx(
|
|
207
|
+
PostListBase,
|
|
208
|
+
{
|
|
209
|
+
usableFields: getUsableFields(POST_TYPES.SUBCATEGORY),
|
|
210
|
+
type: POST_TYPES.SUBCATEGORY,
|
|
211
|
+
topicId: topic?.id ?? DO_NOT_FETCH_KEY,
|
|
212
|
+
setListItemStates: setSubcategoryStates,
|
|
213
|
+
Card: (props) => /* @__PURE__ */ jsx(CategoryCard, { ...props, isSubcategory: true }),
|
|
214
|
+
Table: (props) => /* @__PURE__ */ jsx(CategoryTable, { ...props, isSubcategory: true }),
|
|
215
|
+
localKey: `subcategory-${POST_TYPES.SUBCATEGORY}`
|
|
161
216
|
}
|
|
162
217
|
)
|
|
163
218
|
}
|
|
@@ -174,11 +229,13 @@ function createTopicScopePage({
|
|
|
174
229
|
},
|
|
175
230
|
hasBorder: true,
|
|
176
231
|
initialOpen: true,
|
|
177
|
-
deps: [
|
|
178
|
-
|
|
232
|
+
deps: [
|
|
233
|
+
categoryStates.isFetching || subcategoryStates.isFetching
|
|
234
|
+
],
|
|
235
|
+
children: postList
|
|
179
236
|
}
|
|
180
237
|
)
|
|
181
|
-
] }) :
|
|
238
|
+
] }) : postList })
|
|
182
239
|
] });
|
|
183
240
|
};
|
|
184
241
|
}
|
|
@@ -20,8 +20,8 @@ import 'zod';
|
|
|
20
20
|
import 'sonner';
|
|
21
21
|
import { useQuery } from '../../../../../../../../../../../core/client/infrastructure/react-query/use-query.js';
|
|
22
22
|
import { getControlMeta } from '../../../../../../../../../applications/form/get-control-meta.js';
|
|
23
|
-
import { PageHeader } from '../../../../../../../../components/ui/blocks/page-header/page-header.js';
|
|
24
23
|
import 'lucide-react';
|
|
24
|
+
import { PageHeader } from '../../../../../../../../components/ui/blocks/page-header/page-header.js';
|
|
25
25
|
import '@radix-ui/react-avatar';
|
|
26
26
|
import '../../../../../../../../components/shadcn/badge.js';
|
|
27
27
|
import '../../../../../../../../components/shadcn/button.js';
|
|
@@ -45,13 +45,20 @@ function createPostEditPage({
|
|
|
45
45
|
postFindAction,
|
|
46
46
|
postFindFullAction,
|
|
47
47
|
postFindManyAction,
|
|
48
|
-
renderPostEditContent
|
|
48
|
+
renderPostEditContent,
|
|
49
|
+
PostEditContent,
|
|
50
|
+
allowField
|
|
49
51
|
}) {
|
|
50
52
|
return function PostEditPage() {
|
|
51
53
|
const { t, locale } = useTranslator();
|
|
52
54
|
const { id, topicSlug } = useParams();
|
|
53
|
-
const
|
|
54
|
-
const
|
|
55
|
+
const allowFieldInTopic = (params) => allowField?.({ ...params, topicSlug: params.topicSlug ?? topicSlug }) ?? false;
|
|
56
|
+
const postType = POST_TYPES.POST;
|
|
57
|
+
const roles = staticTopics[topicSlug]?.roles ?? [];
|
|
58
|
+
const hasCategory = roles.includes(POST_TYPES.CATEGORY);
|
|
59
|
+
const hasSubcategory = roles.includes(POST_TYPES.SUBCATEGORY);
|
|
60
|
+
const categoryType = POST_TYPES.CATEGORY;
|
|
61
|
+
const subcategoryType = POST_TYPES.SUBCATEGORY;
|
|
55
62
|
const { data: topic, isFetching: isFetchingTopic } = useQuery(
|
|
56
63
|
() => postFindAction({ type: POST_TYPES.TOPIC, slug: topicSlug }),
|
|
57
64
|
["postFindAction", POST_TYPES.TOPIC, topicSlug],
|
|
@@ -91,10 +98,31 @@ function createPostEditPage({
|
|
|
91
98
|
}
|
|
92
99
|
}
|
|
93
100
|
),
|
|
94
|
-
|
|
101
|
+
PostEditContent && allowField && /* @__PURE__ */ jsx(
|
|
102
|
+
PostEditContent,
|
|
103
|
+
{
|
|
104
|
+
post,
|
|
105
|
+
postType,
|
|
106
|
+
...hasSubcategory ? {
|
|
107
|
+
parentType: subcategoryType,
|
|
108
|
+
isSubcategoryParent: true,
|
|
109
|
+
parentLabelKey: "resources.subcategory.text"
|
|
110
|
+
} : hasCategory ? {
|
|
111
|
+
parentType: categoryType,
|
|
112
|
+
isSubcategoryParent: false,
|
|
113
|
+
parentLabelKey: "resources.category.text"
|
|
114
|
+
} : {},
|
|
115
|
+
controlMeta,
|
|
116
|
+
isFetching: isFetchingTopic || isFetching || isFetchingControlMeta,
|
|
117
|
+
isNotFound,
|
|
118
|
+
allowField: allowFieldInTopic
|
|
119
|
+
}
|
|
120
|
+
),
|
|
121
|
+
renderPostEditContent && renderPostEditContent({
|
|
95
122
|
post,
|
|
96
123
|
postType,
|
|
97
124
|
categoryType,
|
|
125
|
+
subcategoryType,
|
|
98
126
|
controlMeta,
|
|
99
127
|
isFetching: isFetchingTopic || isFetching || isFetchingControlMeta,
|
|
100
128
|
isNotFound
|
|
@@ -38,7 +38,6 @@ import '@radix-ui/react-tabs';
|
|
|
38
38
|
import '@radix-ui/react-tooltip';
|
|
39
39
|
import 'next/link';
|
|
40
40
|
import { Badge } from '../../../../../../../components/ui/display/badge.js';
|
|
41
|
-
import '../../../../../../../../../../core/domain/resources/admin/constants.js';
|
|
42
41
|
import { ExternalLink } from '../../../../../../../components/ui/features/external-link.js';
|
|
43
42
|
import 'next/image';
|
|
44
43
|
|
|
@@ -50,13 +49,20 @@ function createPostShowPage({
|
|
|
50
49
|
postFindFullAction,
|
|
51
50
|
postDeleteAction,
|
|
52
51
|
SeoMetadataDialog,
|
|
53
|
-
renderPostShowContent
|
|
52
|
+
renderPostShowContent,
|
|
53
|
+
PostShowContent,
|
|
54
|
+
allowField,
|
|
55
|
+
PostRelationsSection
|
|
54
56
|
}) {
|
|
55
57
|
return function PostShowPage() {
|
|
56
58
|
const { t, locale } = useTranslator();
|
|
57
59
|
const { id, topicSlug } = useParams();
|
|
58
60
|
const router = useRouter();
|
|
59
|
-
const postType =
|
|
61
|
+
const postType = POST_TYPES.POST;
|
|
62
|
+
const isFieldAllowed = (type, field, fieldRuleKey) => allowField?.({ topicSlug, type, field, fieldRuleKey }) ?? false;
|
|
63
|
+
const subcategoryType = staticTopics[topicSlug]?.roles.includes(
|
|
64
|
+
POST_TYPES.SUBCATEGORY
|
|
65
|
+
) ? POST_TYPES.SUBCATEGORY : void 0;
|
|
60
66
|
const { data: topic, isFetching: isFetchingTopic } = useQuery(
|
|
61
67
|
() => postFindAction({ type: POST_TYPES.TOPIC, slug: topicSlug }),
|
|
62
68
|
["postFindAction", POST_TYPES.TOPIC, topicSlug],
|
|
@@ -126,9 +132,33 @@ function createPostShowPage({
|
|
|
126
132
|
isNotFound
|
|
127
133
|
}
|
|
128
134
|
),
|
|
129
|
-
|
|
135
|
+
PostShowContent && allowField && /* @__PURE__ */ jsx(
|
|
136
|
+
PostShowContent,
|
|
137
|
+
{
|
|
138
|
+
post,
|
|
139
|
+
isFetching,
|
|
140
|
+
isNotFound,
|
|
141
|
+
subcategoryType,
|
|
142
|
+
allowField,
|
|
143
|
+
children: isFieldAllowed(postType, "relatedPosts") && PostRelationsSection && /* @__PURE__ */ jsx(
|
|
144
|
+
PostRelationsSection,
|
|
145
|
+
{
|
|
146
|
+
post,
|
|
147
|
+
usableFields: [
|
|
148
|
+
...isFieldAllowed(postType, "isActive") ? ["isActive"] : [],
|
|
149
|
+
...isFieldAllowed(postType, "isIndexActive") ? ["isIndexActive"] : [],
|
|
150
|
+
...isFieldAllowed(postType, "isSlugActive") ? ["isSlugActive"] : [],
|
|
151
|
+
...isFieldAllowed(postType, "isFeatured") ? ["isFeatured"] : [],
|
|
152
|
+
...isFieldAllowed(postType, "isShownOnHome") ? ["isShownOnHome"] : []
|
|
153
|
+
]
|
|
154
|
+
}
|
|
155
|
+
)
|
|
156
|
+
}
|
|
157
|
+
),
|
|
158
|
+
renderPostShowContent && renderPostShowContent({
|
|
130
159
|
post,
|
|
131
160
|
postType,
|
|
161
|
+
subcategoryType,
|
|
132
162
|
isFetching,
|
|
133
163
|
isNotFound
|
|
134
164
|
})
|
|
@@ -20,8 +20,8 @@ import 'zod';
|
|
|
20
20
|
import 'sonner';
|
|
21
21
|
import { useQuery } from '../../../../../../../../../../core/client/infrastructure/react-query/use-query.js';
|
|
22
22
|
import { getControlMeta } from '../../../../../../../../applications/form/get-control-meta.js';
|
|
23
|
-
import { PageHeader } from '../../../../../../../components/ui/blocks/page-header/page-header.js';
|
|
24
23
|
import 'lucide-react';
|
|
24
|
+
import { PageHeader } from '../../../../../../../components/ui/blocks/page-header/page-header.js';
|
|
25
25
|
import '@radix-ui/react-avatar';
|
|
26
26
|
import '../../../../../../../components/shadcn/badge.js';
|
|
27
27
|
import '../../../../../../../components/shadcn/button.js';
|
|
@@ -44,13 +44,20 @@ function createPostCreatePage({
|
|
|
44
44
|
topics: staticTopics,
|
|
45
45
|
postFindAction,
|
|
46
46
|
postFindManyAction,
|
|
47
|
-
renderPostCreateContent
|
|
47
|
+
renderPostCreateContent,
|
|
48
|
+
PostCreateContent,
|
|
49
|
+
allowField
|
|
48
50
|
}) {
|
|
49
51
|
return function PostCreatePage() {
|
|
50
52
|
const { t, locale } = useTranslator();
|
|
51
53
|
const { topicSlug } = useParams();
|
|
52
|
-
const
|
|
53
|
-
const
|
|
54
|
+
const allowFieldInTopic = (params) => allowField?.({ ...params, topicSlug: params.topicSlug ?? topicSlug }) ?? false;
|
|
55
|
+
const postType = POST_TYPES.POST;
|
|
56
|
+
const roles = staticTopics[topicSlug]?.roles ?? [];
|
|
57
|
+
const hasCategory = roles.includes(POST_TYPES.CATEGORY);
|
|
58
|
+
const hasSubcategory = roles.includes(POST_TYPES.SUBCATEGORY);
|
|
59
|
+
const categoryType = POST_TYPES.CATEGORY;
|
|
60
|
+
const subcategoryType = POST_TYPES.SUBCATEGORY;
|
|
54
61
|
const returnHref = joinUrl(
|
|
55
62
|
CMS_PATHS.content["content-management"].pathname,
|
|
56
63
|
topicSlug
|
|
@@ -86,10 +93,31 @@ function createPostCreatePage({
|
|
|
86
93
|
isNotFound
|
|
87
94
|
}
|
|
88
95
|
),
|
|
89
|
-
|
|
96
|
+
PostCreateContent && allowField && /* @__PURE__ */ jsx(
|
|
97
|
+
PostCreateContent,
|
|
98
|
+
{
|
|
99
|
+
topic,
|
|
100
|
+
postType,
|
|
101
|
+
...hasSubcategory ? {
|
|
102
|
+
parentType: subcategoryType,
|
|
103
|
+
isSubcategoryParent: true,
|
|
104
|
+
parentLabelKey: "resources.subcategory.text"
|
|
105
|
+
} : hasCategory ? {
|
|
106
|
+
parentType: categoryType,
|
|
107
|
+
isSubcategoryParent: false,
|
|
108
|
+
parentLabelKey: "resources.category.text"
|
|
109
|
+
} : {},
|
|
110
|
+
controlMeta,
|
|
111
|
+
isFetching: isFetchingTopic || isFetchingControlMeta,
|
|
112
|
+
allowField: allowFieldInTopic,
|
|
113
|
+
cancelButtonHref: returnHref
|
|
114
|
+
}
|
|
115
|
+
),
|
|
116
|
+
renderPostCreateContent && renderPostCreateContent({
|
|
90
117
|
topic,
|
|
91
118
|
postType,
|
|
92
119
|
categoryType,
|
|
120
|
+
subcategoryType,
|
|
93
121
|
controlMeta,
|
|
94
122
|
isFetching: isFetchingTopic || isFetchingControlMeta,
|
|
95
123
|
cancelButtonHref: returnHref
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useTranslator } from 'intor/react';
|
|
4
|
+
import { Notebook } from 'lucide-react';
|
|
5
|
+
import { useParams } from 'next/navigation';
|
|
6
|
+
import { POST_TYPES } from 'sitero-domain';
|
|
7
|
+
import '../../../../../../../../../../../constants/paths/redirect.js';
|
|
8
|
+
import '../../../../../../../../../../../constants/cms-locale.js';
|
|
9
|
+
import '../../../../../../../../../../../core/client/infrastructure/contexts/admin/admin.js';
|
|
10
|
+
import 'react';
|
|
11
|
+
import '../../../../../../../../../../../core/client/infrastructure/react-query/client.js';
|
|
12
|
+
import '@tanstack/react-query';
|
|
13
|
+
import 'mime-types';
|
|
14
|
+
import { findTranslation } from '../../../../../../../../../../../shared/translation/find-translation.js';
|
|
15
|
+
import 'clsx';
|
|
16
|
+
import 'tailwind-merge';
|
|
17
|
+
import { ensureArray } from '../../../../../../../../../../../shared/utils/ensure-array.js';
|
|
18
|
+
import 'zod';
|
|
19
|
+
import 'sonner';
|
|
20
|
+
import { useQuery } from '../../../../../../../../../../../core/client/infrastructure/react-query/use-query.js';
|
|
21
|
+
import { getControlMeta } from '../../../../../../../../../applications/form/get-control-meta.js';
|
|
22
|
+
import { PageHeader } from '../../../../../../../../components/ui/blocks/page-header/page-header.js';
|
|
23
|
+
import '@radix-ui/react-avatar';
|
|
24
|
+
import '../../../../../../../../components/shadcn/badge.js';
|
|
25
|
+
import '../../../../../../../../components/shadcn/button.js';
|
|
26
|
+
import '@radix-ui/react-collapsible';
|
|
27
|
+
import '@radix-ui/react-dialog';
|
|
28
|
+
import '@radix-ui/react-dropdown-menu';
|
|
29
|
+
import '../../../../../../../../components/shadcn/input-group.js';
|
|
30
|
+
import '@radix-ui/react-label';
|
|
31
|
+
import '@radix-ui/react-radio-group';
|
|
32
|
+
import '@radix-ui/react-select';
|
|
33
|
+
import '@radix-ui/react-separator';
|
|
34
|
+
import '../../../../../../../../components/shadcn/sidebar/sidebar.js';
|
|
35
|
+
import 'next-themes';
|
|
36
|
+
import '@radix-ui/react-tabs';
|
|
37
|
+
import '@radix-ui/react-tooltip';
|
|
38
|
+
import 'next/link';
|
|
39
|
+
import { Badge } from '../../../../../../../../components/ui/display/badge.js';
|
|
40
|
+
|
|
41
|
+
function createSubcategoryEditPage({
|
|
42
|
+
postFindAction,
|
|
43
|
+
postFindFullAction,
|
|
44
|
+
postFindManyAction,
|
|
45
|
+
renderPostEditContent,
|
|
46
|
+
PostEditContent,
|
|
47
|
+
allowField
|
|
48
|
+
}) {
|
|
49
|
+
return function SubcategoryEditPage() {
|
|
50
|
+
const { t, locale } = useTranslator();
|
|
51
|
+
const { id, topicSlug } = useParams();
|
|
52
|
+
const allowFieldInTopic = (params) => allowField?.({ ...params, topicSlug: params.topicSlug ?? topicSlug }) ?? false;
|
|
53
|
+
const categoryType = POST_TYPES.CATEGORY;
|
|
54
|
+
const subcategoryType = POST_TYPES.SUBCATEGORY;
|
|
55
|
+
const { data: topic, isFetching: isFetchingTopic } = useQuery(
|
|
56
|
+
() => postFindAction({ type: POST_TYPES.TOPIC, slug: topicSlug }),
|
|
57
|
+
["postFindAction", POST_TYPES.TOPIC, topicSlug],
|
|
58
|
+
{ select: (data) => data?.post }
|
|
59
|
+
);
|
|
60
|
+
const {
|
|
61
|
+
data: subcategory,
|
|
62
|
+
isFetching,
|
|
63
|
+
isNotFound
|
|
64
|
+
} = useQuery(() => postFindFullAction({ id }), ["postFindFullAction", id], {
|
|
65
|
+
select: (data) => data?.post
|
|
66
|
+
});
|
|
67
|
+
const { data: categories, isFetching: isFetchingControlMeta } = useQuery(
|
|
68
|
+
() => postFindManyAction({ type: subcategoryType, topicId: topic?.id }),
|
|
69
|
+
["postFindManyAction", subcategoryType, topic?.id],
|
|
70
|
+
{ select: (data) => data?.posts, enabled: !!topic }
|
|
71
|
+
);
|
|
72
|
+
const controlMeta = getControlMeta({
|
|
73
|
+
records: ensureArray(categories),
|
|
74
|
+
excludeIndex: subcategory?.index,
|
|
75
|
+
excludeSlug: subcategory?.slug
|
|
76
|
+
});
|
|
77
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
78
|
+
/* @__PURE__ */ jsx(
|
|
79
|
+
PageHeader,
|
|
80
|
+
{
|
|
81
|
+
variant: "edit",
|
|
82
|
+
titleProps: {
|
|
83
|
+
icon: Notebook,
|
|
84
|
+
title: t("resources.subcategory.text"),
|
|
85
|
+
leftChildren: /* @__PURE__ */ jsx(Badge, { isLoading: isFetchingTopic, children: findTranslation(topic?.translations, locale)?.title })
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
),
|
|
89
|
+
PostEditContent && allowField && /* @__PURE__ */ jsx(
|
|
90
|
+
PostEditContent,
|
|
91
|
+
{
|
|
92
|
+
post: subcategory,
|
|
93
|
+
postType: subcategoryType,
|
|
94
|
+
parentType: categoryType,
|
|
95
|
+
parentLabelKey: "resources.category.text",
|
|
96
|
+
controlMeta,
|
|
97
|
+
isFetching: isFetchingTopic || isFetching || isFetchingControlMeta,
|
|
98
|
+
isNotFound,
|
|
99
|
+
allowField: allowFieldInTopic
|
|
100
|
+
}
|
|
101
|
+
),
|
|
102
|
+
renderPostEditContent?.({
|
|
103
|
+
subcategory,
|
|
104
|
+
categoryType,
|
|
105
|
+
subcategoryType,
|
|
106
|
+
controlMeta,
|
|
107
|
+
isFetching: isFetchingTopic || isFetching || isFetchingControlMeta,
|
|
108
|
+
isNotFound
|
|
109
|
+
})
|
|
110
|
+
] });
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export { createSubcategoryEditPage };
|