@canvas-digital/blog-sdk 2.0.0
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/README.md +110 -0
- package/dist/BlogPlatform.d.ts +40 -0
- package/dist/BlogPlatform.d.ts.map +1 -0
- package/dist/BlogPlatform.js +38 -0
- package/dist/admin/components/BlogAdmin.d.ts +10 -0
- package/dist/admin/components/BlogAdmin.d.ts.map +1 -0
- package/dist/admin/components/BlogAdmin.js +36 -0
- package/dist/admin/components/CategoryManager.d.ts +5 -0
- package/dist/admin/components/CategoryManager.d.ts.map +1 -0
- package/dist/admin/components/CategoryManager.js +43 -0
- package/dist/admin/components/MediaManager.d.ts +7 -0
- package/dist/admin/components/MediaManager.d.ts.map +1 -0
- package/dist/admin/components/MediaManager.js +37 -0
- package/dist/admin/components/PostEditor.d.ts +7 -0
- package/dist/admin/components/PostEditor.d.ts.map +1 -0
- package/dist/admin/components/PostEditor.js +160 -0
- package/dist/admin/components/PostList.d.ts +8 -0
- package/dist/admin/components/PostList.d.ts.map +1 -0
- package/dist/admin/components/PostList.js +32 -0
- package/dist/admin/components/TagManager.d.ts +5 -0
- package/dist/admin/components/TagManager.d.ts.map +1 -0
- package/dist/admin/components/TagManager.js +41 -0
- package/dist/admin/components/editor/RichTextEditor.d.ts +8 -0
- package/dist/admin/components/editor/RichTextEditor.d.ts.map +1 -0
- package/dist/admin/components/editor/RichTextEditor.js +47 -0
- package/dist/admin/components/internal/States.d.ts +16 -0
- package/dist/admin/components/internal/States.d.ts.map +1 -0
- package/dist/admin/components/internal/States.js +15 -0
- package/dist/admin/hooks/useAsync.d.ts +23 -0
- package/dist/admin/hooks/useAsync.d.ts.map +1 -0
- package/dist/admin/hooks/useAsync.js +40 -0
- package/dist/admin/index.d.ts +10 -0
- package/dist/admin/index.d.ts.map +1 -0
- package/dist/admin/index.js +9 -0
- package/dist/admin/theme.d.ts +6 -0
- package/dist/admin/theme.d.ts.map +1 -0
- package/dist/admin/theme.js +52 -0
- package/dist/admin/types.d.ts +27 -0
- package/dist/admin/types.d.ts.map +1 -0
- package/dist/admin/types.js +1 -0
- package/dist/blog-client.iife.js +1 -0
- package/dist/client/admin-client.d.ts +33 -0
- package/dist/client/admin-client.d.ts.map +1 -0
- package/dist/client/admin-client.js +153 -0
- package/dist/client/errors.d.ts +14 -0
- package/dist/client/errors.d.ts.map +1 -0
- package/dist/client/errors.js +26 -0
- package/dist/client/http.d.ts +12 -0
- package/dist/client/http.d.ts.map +1 -0
- package/dist/client/http.js +135 -0
- package/dist/client/index.d.ts +7 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +6 -0
- package/dist/client/pagination.d.ts +4 -0
- package/dist/client/pagination.d.ts.map +1 -0
- package/dist/client/pagination.js +32 -0
- package/dist/client/public-client.d.ts +23 -0
- package/dist/client/public-client.d.ts.map +1 -0
- package/dist/client/public-client.js +94 -0
- package/dist/client/types.d.ts +115 -0
- package/dist/client/types.d.ts.map +1 -0
- package/dist/client/types.js +1 -0
- package/dist/components/BlogUploader/BackButton.d.ts +5 -0
- package/dist/components/BlogUploader/BackButton.d.ts.map +1 -0
- package/dist/components/BlogUploader/BackButton.js +27 -0
- package/dist/components/BlogUploader/CommentSection.d.ts +12 -0
- package/dist/components/BlogUploader/CommentSection.d.ts.map +1 -0
- package/dist/components/BlogUploader/CommentSection.js +65 -0
- package/dist/components/BlogUploader/PostCard.d.ts +17 -0
- package/dist/components/BlogUploader/PostCard.d.ts.map +1 -0
- package/dist/components/BlogUploader/PostCard.js +42 -0
- package/dist/components/BlogUploader/PostFormatHero.d.ts +7 -0
- package/dist/components/BlogUploader/PostFormatHero.d.ts.map +1 -0
- package/dist/components/BlogUploader/PostFormatHero.js +47 -0
- package/dist/components/BlogUploader/ReadingProgress.d.ts +9 -0
- package/dist/components/BlogUploader/ReadingProgress.d.ts.map +1 -0
- package/dist/components/BlogUploader/ReadingProgress.js +28 -0
- package/dist/components/BlogUploader/RichText.d.ts +5 -0
- package/dist/components/BlogUploader/RichText.d.ts.map +1 -0
- package/dist/components/BlogUploader/RichText.js +59 -0
- package/dist/components/BlogUploader/ShareRow.d.ts +12 -0
- package/dist/components/BlogUploader/ShareRow.d.ts.map +1 -0
- package/dist/components/BlogUploader/ShareRow.js +13 -0
- package/dist/components/BlogUploader/ViewBeacon.d.ts +12 -0
- package/dist/components/BlogUploader/ViewBeacon.d.ts.map +1 -0
- package/dist/components/BlogUploader/ViewBeacon.js +37 -0
- package/dist/components/BlogUploader/dashboard/BrandSettings.d.ts +28 -0
- package/dist/components/BlogUploader/dashboard/BrandSettings.d.ts.map +1 -0
- package/dist/components/BlogUploader/dashboard/BrandSettings.js +60 -0
- package/dist/components/BlogUploader/dashboard/BrandSwitcher.d.ts +14 -0
- package/dist/components/BlogUploader/dashboard/BrandSwitcher.d.ts.map +1 -0
- package/dist/components/BlogUploader/dashboard/BrandSwitcher.js +25 -0
- package/dist/components/BlogUploader/dashboard/Chips.d.ts +15 -0
- package/dist/components/BlogUploader/dashboard/Chips.d.ts.map +1 -0
- package/dist/components/BlogUploader/dashboard/Chips.js +15 -0
- package/dist/components/BlogUploader/dashboard/CommentsManager.d.ts +19 -0
- package/dist/components/BlogUploader/dashboard/CommentsManager.d.ts.map +1 -0
- package/dist/components/BlogUploader/dashboard/CommentsManager.js +32 -0
- package/dist/components/BlogUploader/dashboard/LogOutButton.d.ts +4 -0
- package/dist/components/BlogUploader/dashboard/LogOutButton.d.ts.map +1 -0
- package/dist/components/BlogUploader/dashboard/LogOutButton.js +22 -0
- package/dist/components/BlogUploader/dashboard/MediaLibrary.d.ts +16 -0
- package/dist/components/BlogUploader/dashboard/MediaLibrary.d.ts.map +1 -0
- package/dist/components/BlogUploader/dashboard/MediaLibrary.js +124 -0
- package/dist/components/BlogUploader/dashboard/MediaPicker.d.ts +19 -0
- package/dist/components/BlogUploader/dashboard/MediaPicker.d.ts.map +1 -0
- package/dist/components/BlogUploader/dashboard/MediaPicker.js +99 -0
- package/dist/components/BlogUploader/dashboard/PostsTable.d.ts +46 -0
- package/dist/components/BlogUploader/dashboard/PostsTable.d.ts.map +1 -0
- package/dist/components/BlogUploader/dashboard/PostsTable.js +109 -0
- package/dist/components/BlogUploader/dashboard/Shell.d.ts +25 -0
- package/dist/components/BlogUploader/dashboard/Shell.d.ts.map +1 -0
- package/dist/components/BlogUploader/dashboard/Shell.js +128 -0
- package/dist/components/BlogUploader/dashboard/TermManager.d.ts +29 -0
- package/dist/components/BlogUploader/dashboard/TermManager.d.ts.map +1 -0
- package/dist/components/BlogUploader/dashboard/TermManager.js +96 -0
- package/dist/components/BlogUploader/dashboard/ToastProvider.d.ts +6 -0
- package/dist/components/BlogUploader/dashboard/ToastProvider.d.ts.map +1 -0
- package/dist/components/BlogUploader/dashboard/ToastProvider.js +5 -0
- package/dist/components/BlogUploader/dashboard/UsersManager.d.ts +32 -0
- package/dist/components/BlogUploader/dashboard/UsersManager.d.ts.map +1 -0
- package/dist/components/BlogUploader/dashboard/UsersManager.js +98 -0
- package/dist/components/BlogUploader/dashboard/charts.d.ts +22 -0
- package/dist/components/BlogUploader/dashboard/charts.d.ts.map +1 -0
- package/dist/components/BlogUploader/dashboard/charts.js +79 -0
- package/dist/components/BlogUploader/dashboard/editor/FormatContentPanel.d.ts +25 -0
- package/dist/components/BlogUploader/dashboard/editor/FormatContentPanel.d.ts.map +1 -0
- package/dist/components/BlogUploader/dashboard/editor/FormatContentPanel.js +62 -0
- package/dist/components/BlogUploader/dashboard/editor/PostEditor.d.ts +95 -0
- package/dist/components/BlogUploader/dashboard/editor/PostEditor.d.ts.map +1 -0
- package/dist/components/BlogUploader/dashboard/editor/PostEditor.js +649 -0
- package/dist/components/BlogUploader/dashboard/editor/RichTextEditor.d.ts +37 -0
- package/dist/components/BlogUploader/dashboard/editor/RichTextEditor.d.ts.map +1 -0
- package/dist/components/BlogUploader/dashboard/editor/RichTextEditor.js +475 -0
- package/dist/components/BlogUploader/dashboard/editor/SeoAnalysisPanel.d.ts +11 -0
- package/dist/components/BlogUploader/dashboard/editor/SeoAnalysisPanel.d.ts.map +1 -0
- package/dist/components/BlogUploader/dashboard/editor/SeoAnalysisPanel.js +31 -0
- package/dist/components/BlogUploader/dashboard/editor/YoastCollapsible.d.ts +12 -0
- package/dist/components/BlogUploader/dashboard/editor/YoastCollapsible.d.ts.map +1 -0
- package/dist/components/BlogUploader/dashboard/editor/YoastCollapsible.js +5 -0
- package/dist/components/BlogUploader/dashboard/editor/YoastInsightsPanel.d.ts +4 -0
- package/dist/components/BlogUploader/dashboard/editor/YoastInsightsPanel.d.ts.map +1 -0
- package/dist/components/BlogUploader/dashboard/editor/YoastInsightsPanel.js +31 -0
- package/dist/components/BlogUploader/dashboard/editor/YoastInternalLinksPanel.d.ts +4 -0
- package/dist/components/BlogUploader/dashboard/editor/YoastInternalLinksPanel.d.ts.map +1 -0
- package/dist/components/BlogUploader/dashboard/editor/YoastInternalLinksPanel.js +35 -0
- package/dist/components/BlogUploader/dashboard/editor/YoastSeoAnalysisPanel.d.ts +11 -0
- package/dist/components/BlogUploader/dashboard/editor/YoastSeoAnalysisPanel.d.ts.map +1 -0
- package/dist/components/BlogUploader/dashboard/editor/YoastSeoAnalysisPanel.js +23 -0
- package/dist/components/BlogUploader/dashboard/editor/YoastSeoMetabox.d.ts +50 -0
- package/dist/components/BlogUploader/dashboard/editor/YoastSeoMetabox.d.ts.map +1 -0
- package/dist/components/BlogUploader/dashboard/editor/YoastSeoMetabox.js +101 -0
- package/dist/components/BlogUploader/dashboard/editor/YoastSnippetField.d.ts +22 -0
- package/dist/components/BlogUploader/dashboard/editor/YoastSnippetField.d.ts.map +1 -0
- package/dist/components/BlogUploader/dashboard/editor/YoastSnippetField.js +51 -0
- package/dist/components/BlogUploader/dashboard/editor/load.d.ts +10 -0
- package/dist/components/BlogUploader/dashboard/editor/load.d.ts.map +1 -0
- package/dist/components/BlogUploader/dashboard/editor/load.js +141 -0
- package/dist/components/BlogUploader/dashboard/loadTerms.d.ts +13 -0
- package/dist/components/BlogUploader/dashboard/loadTerms.d.ts.map +1 -0
- package/dist/components/BlogUploader/dashboard/loadTerms.js +41 -0
- package/dist/components/BlogUploader/dashboard/seo/BrandSeoActions.d.ts +8 -0
- package/dist/components/BlogUploader/dashboard/seo/BrandSeoActions.d.ts.map +1 -0
- package/dist/components/BlogUploader/dashboard/seo/BrandSeoActions.js +35 -0
- package/dist/components/BlogUploader/dashboard/seo/Ga4Settings.d.ts +9 -0
- package/dist/components/BlogUploader/dashboard/seo/Ga4Settings.d.ts.map +1 -0
- package/dist/components/BlogUploader/dashboard/seo/Ga4Settings.js +40 -0
- package/dist/components/BlogUploader/dashboard/seo/RedirectAnalyticsDashboard.d.ts +5 -0
- package/dist/components/BlogUploader/dashboard/seo/RedirectAnalyticsDashboard.d.ts.map +1 -0
- package/dist/components/BlogUploader/dashboard/seo/RedirectAnalyticsDashboard.js +29 -0
- package/dist/components/BlogUploader/dashboard/seo/RedirectDetail.d.ts +10 -0
- package/dist/components/BlogUploader/dashboard/seo/RedirectDetail.d.ts.map +1 -0
- package/dist/components/BlogUploader/dashboard/seo/RedirectDetail.js +31 -0
- package/dist/components/BlogUploader/dashboard/seo/RedirectForm.d.ts +27 -0
- package/dist/components/BlogUploader/dashboard/seo/RedirectForm.d.ts.map +1 -0
- package/dist/components/BlogUploader/dashboard/seo/RedirectForm.js +79 -0
- package/dist/components/BlogUploader/dashboard/seo/RedirectList.d.ts +20 -0
- package/dist/components/BlogUploader/dashboard/seo/RedirectList.d.ts.map +1 -0
- package/dist/components/BlogUploader/dashboard/seo/RedirectList.js +33 -0
- package/dist/components/BlogUploader/dashboard/seo/RobotsEditor.d.ts +11 -0
- package/dist/components/BlogUploader/dashboard/seo/RobotsEditor.d.ts.map +1 -0
- package/dist/components/BlogUploader/dashboard/seo/RobotsEditor.js +54 -0
- package/dist/components/BlogUploader/dashboard/seo/SearchConsoleSettings.d.ts +9 -0
- package/dist/components/BlogUploader/dashboard/seo/SearchConsoleSettings.d.ts.map +1 -0
- package/dist/components/BlogUploader/dashboard/seo/SearchConsoleSettings.js +38 -0
- package/dist/components/BlogUploader/dashboard/seo/SeoBrandList.d.ts +28 -0
- package/dist/components/BlogUploader/dashboard/seo/SeoBrandList.d.ts.map +1 -0
- package/dist/components/BlogUploader/dashboard/seo/SeoBrandList.js +29 -0
- package/dist/components/BlogUploader/dashboard/seo/SeoBrandLists.d.ts +17 -0
- package/dist/components/BlogUploader/dashboard/seo/SeoBrandLists.d.ts.map +1 -0
- package/dist/components/BlogUploader/dashboard/seo/SeoBrandLists.js +8 -0
- package/dist/components/BlogUploader/dashboard/seo/shared.d.ts +18 -0
- package/dist/components/BlogUploader/dashboard/seo/shared.d.ts.map +1 -0
- package/dist/components/BlogUploader/dashboard/seo/shared.js +6 -0
- package/dist/components/BlogUploader/dashboard/tools/ExportTool.d.ts +8 -0
- package/dist/components/BlogUploader/dashboard/tools/ExportTool.d.ts.map +1 -0
- package/dist/components/BlogUploader/dashboard/tools/ExportTool.js +78 -0
- package/dist/components/BlogUploader/dashboard/tools/ImportTool.d.ts +7 -0
- package/dist/components/BlogUploader/dashboard/tools/ImportTool.d.ts.map +1 -0
- package/dist/components/BlogUploader/dashboard/tools/ImportTool.js +70 -0
- package/dist/components/BlogUploader/dashboard/upload.d.ts +47 -0
- package/dist/components/BlogUploader/dashboard/upload.d.ts.map +1 -0
- package/dist/components/BlogUploader/dashboard/upload.js +68 -0
- package/dist/components/BlogUploader/site/ArticleDetailHero.d.ts +27 -0
- package/dist/components/BlogUploader/site/ArticleDetailHero.d.ts.map +1 -0
- package/dist/components/BlogUploader/site/ArticleDetailHero.js +13 -0
- package/dist/components/BlogUploader/site/ArticleRailDetails.d.ts +27 -0
- package/dist/components/BlogUploader/site/ArticleRailDetails.d.ts.map +1 -0
- package/dist/components/BlogUploader/site/ArticleRailDetails.js +17 -0
- package/dist/components/BlogUploader/site/BlogIndexView.d.ts +28 -0
- package/dist/components/BlogUploader/site/BlogIndexView.d.ts.map +1 -0
- package/dist/components/BlogUploader/site/BlogIndexView.js +34 -0
- package/dist/components/BlogUploader/site/BrandTableOfContents.d.ts +18 -0
- package/dist/components/BlogUploader/site/BrandTableOfContents.d.ts.map +1 -0
- package/dist/components/BlogUploader/site/BrandTableOfContents.js +15 -0
- package/dist/components/BlogUploader/site/HeroFadeSlide.d.ts +11 -0
- package/dist/components/BlogUploader/site/HeroFadeSlide.d.ts.map +1 -0
- package/dist/components/BlogUploader/site/HeroFadeSlide.js +3 -0
- package/dist/components/BlogUploader/site/HeroMediaVisual.d.ts +23 -0
- package/dist/components/BlogUploader/site/HeroMediaVisual.d.ts.map +1 -0
- package/dist/components/BlogUploader/site/HeroMediaVisual.js +50 -0
- package/dist/components/BlogUploader/site/IndexFeedSection.d.ts +14 -0
- package/dist/components/BlogUploader/site/IndexFeedSection.d.ts.map +1 -0
- package/dist/components/BlogUploader/site/IndexFeedSection.js +12 -0
- package/dist/components/BlogUploader/site/InfinitePostFeed.d.ts +23 -0
- package/dist/components/BlogUploader/site/InfinitePostFeed.d.ts.map +1 -0
- package/dist/components/BlogUploader/site/InfinitePostFeed.js +152 -0
- package/dist/components/BlogUploader/site/SiteMediaHero.d.ts +12 -0
- package/dist/components/BlogUploader/site/SiteMediaHero.d.ts.map +1 -0
- package/dist/components/BlogUploader/site/SiteMediaHero.js +80 -0
- package/dist/components/BlogUploader/site/SiteMotion.d.ts +12 -0
- package/dist/components/BlogUploader/site/SiteMotion.d.ts.map +1 -0
- package/dist/components/BlogUploader/site/SiteMotion.js +27 -0
- package/dist/components/BlogUploader/site/SiteNavAuth.d.ts +8 -0
- package/dist/components/BlogUploader/site/SiteNavAuth.d.ts.map +1 -0
- package/dist/components/BlogUploader/site/SiteNavAuth.js +36 -0
- package/dist/components/admin/AdminPostDetail.d.ts +7 -0
- package/dist/components/admin/AdminPostDetail.d.ts.map +1 -0
- package/dist/components/admin/AdminPostDetail.js +105 -0
- package/dist/components/admin/BrandSettings.d.ts +11 -0
- package/dist/components/admin/BrandSettings.d.ts.map +1 -0
- package/dist/components/admin/BrandSettings.js +71 -0
- package/dist/components/admin/BrandSwitcher.d.ts +3 -0
- package/dist/components/admin/BrandSwitcher.d.ts.map +1 -0
- package/dist/components/admin/BrandSwitcher.js +12 -0
- package/dist/components/admin/CategoryManager.d.ts +2 -0
- package/dist/components/admin/CategoryManager.d.ts.map +1 -0
- package/dist/components/admin/CategoryManager.js +1 -0
- package/dist/components/admin/Chips.d.ts +15 -0
- package/dist/components/admin/Chips.d.ts.map +1 -0
- package/dist/components/admin/Chips.js +15 -0
- package/dist/components/admin/CommentsManager.d.ts +6 -0
- package/dist/components/admin/CommentsManager.d.ts.map +1 -0
- package/dist/components/admin/CommentsManager.js +30 -0
- package/dist/components/admin/Dashboard.d.ts +3 -0
- package/dist/components/admin/Dashboard.d.ts.map +1 -0
- package/dist/components/admin/Dashboard.js +34 -0
- package/dist/components/admin/MediaLibrary.d.ts +4 -0
- package/dist/components/admin/MediaLibrary.d.ts.map +1 -0
- package/dist/components/admin/MediaLibrary.js +119 -0
- package/dist/components/admin/MediaManager.d.ts +2 -0
- package/dist/components/admin/MediaManager.d.ts.map +1 -0
- package/dist/components/admin/MediaManager.js +1 -0
- package/dist/components/admin/MediaPicker.d.ts +10 -0
- package/dist/components/admin/MediaPicker.d.ts.map +1 -0
- package/dist/components/admin/MediaPicker.js +86 -0
- package/dist/components/admin/PostEditor.d.ts +2 -0
- package/dist/components/admin/PostEditor.d.ts.map +1 -0
- package/dist/components/admin/PostEditor.js +1 -0
- package/dist/components/admin/PostList.d.ts +13 -0
- package/dist/components/admin/PostList.d.ts.map +1 -0
- package/dist/components/admin/PostList.js +93 -0
- package/dist/components/admin/PostsTable.d.ts +15 -0
- package/dist/components/admin/PostsTable.d.ts.map +1 -0
- package/dist/components/admin/PostsTable.js +106 -0
- package/dist/components/admin/Shell.d.ts +18 -0
- package/dist/components/admin/Shell.d.ts.map +1 -0
- package/dist/components/admin/Shell.js +99 -0
- package/dist/components/admin/TagManager.d.ts +2 -0
- package/dist/components/admin/TagManager.d.ts.map +1 -0
- package/dist/components/admin/TagManager.js +1 -0
- package/dist/components/admin/TermManager.d.ts +9 -0
- package/dist/components/admin/TermManager.d.ts.map +1 -0
- package/dist/components/admin/TermManager.js +105 -0
- package/dist/components/admin/UsersManager.d.ts +5 -0
- package/dist/components/admin/UsersManager.d.ts.map +1 -0
- package/dist/components/admin/UsersManager.js +96 -0
- package/dist/components/admin/api/mappers.d.ts +37 -0
- package/dist/components/admin/api/mappers.d.ts.map +1 -0
- package/dist/components/admin/api/mappers.js +174 -0
- package/dist/components/admin/charts.d.ts +30 -0
- package/dist/components/admin/charts.d.ts.map +1 -0
- package/dist/components/admin/charts.js +79 -0
- package/dist/components/admin/editor/FormatContentPanel.d.ts +25 -0
- package/dist/components/admin/editor/FormatContentPanel.d.ts.map +1 -0
- package/dist/components/admin/editor/FormatContentPanel.js +62 -0
- package/dist/components/admin/editor/PostEditor.d.ts +5 -0
- package/dist/components/admin/editor/PostEditor.d.ts.map +1 -0
- package/dist/components/admin/editor/PostEditor.js +404 -0
- package/dist/components/admin/editor/RichTextEditor.d.ts +42 -0
- package/dist/components/admin/editor/RichTextEditor.d.ts.map +1 -0
- package/dist/components/admin/editor/RichTextEditor.js +475 -0
- package/dist/components/admin/editor/SeoAnalysisPanel.d.ts +11 -0
- package/dist/components/admin/editor/SeoAnalysisPanel.d.ts.map +1 -0
- package/dist/components/admin/editor/SeoAnalysisPanel.js +31 -0
- package/dist/components/admin/editor/YoastCollapsible.d.ts +12 -0
- package/dist/components/admin/editor/YoastCollapsible.d.ts.map +1 -0
- package/dist/components/admin/editor/YoastCollapsible.js +5 -0
- package/dist/components/admin/editor/YoastInsightsPanel.d.ts +4 -0
- package/dist/components/admin/editor/YoastInsightsPanel.d.ts.map +1 -0
- package/dist/components/admin/editor/YoastInsightsPanel.js +31 -0
- package/dist/components/admin/editor/YoastInternalLinksPanel.d.ts +4 -0
- package/dist/components/admin/editor/YoastInternalLinksPanel.d.ts.map +1 -0
- package/dist/components/admin/editor/YoastInternalLinksPanel.js +35 -0
- package/dist/components/admin/editor/YoastSeoAnalysisPanel.d.ts +11 -0
- package/dist/components/admin/editor/YoastSeoAnalysisPanel.d.ts.map +1 -0
- package/dist/components/admin/editor/YoastSeoAnalysisPanel.js +23 -0
- package/dist/components/admin/editor/YoastSeoMetabox.d.ts +54 -0
- package/dist/components/admin/editor/YoastSeoMetabox.d.ts.map +1 -0
- package/dist/components/admin/editor/YoastSeoMetabox.js +101 -0
- package/dist/components/admin/editor/YoastSnippetField.d.ts +22 -0
- package/dist/components/admin/editor/YoastSnippetField.d.ts.map +1 -0
- package/dist/components/admin/editor/YoastSnippetField.js +51 -0
- package/dist/components/admin/editor/load.d.ts +10 -0
- package/dist/components/admin/editor/load.d.ts.map +1 -0
- package/dist/components/admin/editor/load.js +141 -0
- package/dist/components/admin/index.d.ts +28 -0
- package/dist/components/admin/index.d.ts.map +1 -0
- package/dist/components/admin/index.js +27 -0
- package/dist/components/admin/internal/States.d.ts +16 -0
- package/dist/components/admin/internal/States.d.ts.map +1 -0
- package/dist/components/admin/internal/States.js +15 -0
- package/dist/components/admin/lib/format.d.ts +7 -0
- package/dist/components/admin/lib/format.d.ts.map +1 -0
- package/dist/components/admin/lib/format.js +43 -0
- package/dist/components/admin/lib/publishing.d.ts +8 -0
- package/dist/components/admin/lib/publishing.d.ts.map +1 -0
- package/dist/components/admin/lib/publishing.js +10 -0
- package/dist/components/admin/lib/robots.d.ts +13 -0
- package/dist/components/admin/lib/robots.d.ts.map +1 -0
- package/dist/components/admin/lib/robots.js +22 -0
- package/dist/components/admin/mock/fixtures.d.ts +240 -0
- package/dist/components/admin/mock/fixtures.d.ts.map +1 -0
- package/dist/components/admin/mock/fixtures.js +546 -0
- package/dist/components/admin/mock/store.d.ts +139 -0
- package/dist/components/admin/mock/store.d.ts.map +1 -0
- package/dist/components/admin/mock/store.js +1067 -0
- package/dist/components/admin/seo/Ga4Settings.d.ts +34 -0
- package/dist/components/admin/seo/Ga4Settings.d.ts.map +1 -0
- package/dist/components/admin/seo/Ga4Settings.js +80 -0
- package/dist/components/admin/seo/RedirectAnalyticsDashboard.d.ts +5 -0
- package/dist/components/admin/seo/RedirectAnalyticsDashboard.d.ts.map +1 -0
- package/dist/components/admin/seo/RedirectAnalyticsDashboard.js +24 -0
- package/dist/components/admin/seo/RedirectDetail.d.ts +11 -0
- package/dist/components/admin/seo/RedirectDetail.d.ts.map +1 -0
- package/dist/components/admin/seo/RedirectDetail.js +30 -0
- package/dist/components/admin/seo/RedirectForm.d.ts +29 -0
- package/dist/components/admin/seo/RedirectForm.d.ts.map +1 -0
- package/dist/components/admin/seo/RedirectForm.js +89 -0
- package/dist/components/admin/seo/RedirectList.d.ts +10 -0
- package/dist/components/admin/seo/RedirectList.d.ts.map +1 -0
- package/dist/components/admin/seo/RedirectList.js +28 -0
- package/dist/components/admin/seo/RobotsEditor.d.ts +5 -0
- package/dist/components/admin/seo/RobotsEditor.d.ts.map +1 -0
- package/dist/components/admin/seo/RobotsEditor.js +50 -0
- package/dist/components/admin/seo/SearchConsoleSettings.d.ts +3 -0
- package/dist/components/admin/seo/SearchConsoleSettings.d.ts.map +1 -0
- package/dist/components/admin/seo/SearchConsoleSettings.js +1 -0
- package/dist/components/admin/seo/SeoBrandList.d.ts +3 -0
- package/dist/components/admin/seo/SeoBrandList.d.ts.map +1 -0
- package/dist/components/admin/seo/SeoBrandList.js +1 -0
- package/dist/components/admin/seo/shared.d.ts +17 -0
- package/dist/components/admin/seo/shared.d.ts.map +1 -0
- package/dist/components/admin/seo/shared.js +7 -0
- package/dist/components/admin/tools/ExportTool.d.ts +3 -0
- package/dist/components/admin/tools/ExportTool.d.ts.map +1 -0
- package/dist/components/admin/tools/ExportTool.js +1 -0
- package/dist/components/admin/tools/ImportTool.d.ts +3 -0
- package/dist/components/admin/tools/ImportTool.d.ts.map +1 -0
- package/dist/components/admin/tools/ImportTool.js +1 -0
- package/dist/components/admin/tools/ToolsHub.d.ts +10 -0
- package/dist/components/admin/tools/ToolsHub.d.ts.map +1 -0
- package/dist/components/admin/tools/ToolsHub.js +106 -0
- package/dist/components/admin/tools/index.d.ts +3 -0
- package/dist/components/admin/tools/index.d.ts.map +1 -0
- package/dist/components/admin/tools/index.js +1 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +2 -0
- package/dist/components/user/BlogCard.d.ts +20 -0
- package/dist/components/user/BlogCard.d.ts.map +1 -0
- package/dist/components/user/BlogCard.js +22 -0
- package/dist/components/user/BlogCategories.d.ts +6 -0
- package/dist/components/user/BlogCategories.d.ts.map +1 -0
- package/dist/components/user/BlogCategories.js +11 -0
- package/dist/components/user/BlogDetail.d.ts +25 -0
- package/dist/components/user/BlogDetail.d.ts.map +1 -0
- package/dist/components/user/BlogDetail.js +90 -0
- package/dist/components/user/BlogList.d.ts +20 -0
- package/dist/components/user/BlogList.d.ts.map +1 -0
- package/dist/components/user/BlogList.js +56 -0
- package/dist/components/user/BlogSearch.d.ts +8 -0
- package/dist/components/user/BlogSearch.d.ts.map +1 -0
- package/dist/components/user/BlogSearch.js +19 -0
- package/dist/components/user/BlogTags.d.ts +6 -0
- package/dist/components/user/BlogTags.d.ts.map +1 -0
- package/dist/components/user/BlogTags.js +11 -0
- package/dist/components/user/FeaturedBlogs.d.ts +8 -0
- package/dist/components/user/FeaturedBlogs.d.ts.map +1 -0
- package/dist/components/user/FeaturedBlogs.js +12 -0
- package/dist/components/user/RelatedBlogs.d.ts +9 -0
- package/dist/components/user/RelatedBlogs.d.ts.map +1 -0
- package/dist/components/user/RelatedBlogs.js +12 -0
- package/dist/components/user/SiteMediaHero.d.ts +14 -0
- package/dist/components/user/SiteMediaHero.d.ts.map +1 -0
- package/dist/components/user/SiteMediaHero.js +43 -0
- package/dist/components/user/detail/ArticleDetailHero.d.ts +30 -0
- package/dist/components/user/detail/ArticleDetailHero.d.ts.map +1 -0
- package/dist/components/user/detail/ArticleDetailHero.js +29 -0
- package/dist/components/user/detail/ArticleRailDetails.d.ts +24 -0
- package/dist/components/user/detail/ArticleRailDetails.d.ts.map +1 -0
- package/dist/components/user/detail/ArticleRailDetails.js +12 -0
- package/dist/components/user/detail/BackButton.d.ts +7 -0
- package/dist/components/user/detail/BackButton.d.ts.map +1 -0
- package/dist/components/user/detail/BackButton.js +18 -0
- package/dist/components/user/detail/CommentSection.d.ts +28 -0
- package/dist/components/user/detail/CommentSection.d.ts.map +1 -0
- package/dist/components/user/detail/CommentSection.js +68 -0
- package/dist/components/user/detail/HeroFadeSlide.d.ts +12 -0
- package/dist/components/user/detail/HeroFadeSlide.d.ts.map +1 -0
- package/dist/components/user/detail/HeroFadeSlide.js +5 -0
- package/dist/components/user/detail/ReadingProgress.d.ts +2 -0
- package/dist/components/user/detail/ReadingProgress.d.ts.map +1 -0
- package/dist/components/user/detail/ReadingProgress.js +20 -0
- package/dist/components/user/detail/ShareRow.d.ts +7 -0
- package/dist/components/user/detail/ShareRow.d.ts.map +1 -0
- package/dist/components/user/detail/ShareRow.js +7 -0
- package/dist/components/user/detail/toc.d.ts +14 -0
- package/dist/components/user/detail/toc.d.ts.map +1 -0
- package/dist/components/user/detail/toc.js +106 -0
- package/dist/components/user/index.d.ts +14 -0
- package/dist/components/user/index.d.ts.map +1 -0
- package/dist/components/user/index.js +13 -0
- package/dist/components/user/internal/States.d.ts +18 -0
- package/dist/components/user/internal/States.d.ts.map +1 -0
- package/dist/components/user/internal/States.js +21 -0
- package/dist/constants/index.d.ts +4 -0
- package/dist/constants/index.d.ts.map +1 -0
- package/dist/constants/index.js +3 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/useAsync.d.ts +23 -0
- package/dist/hooks/useAsync.d.ts.map +1 -0
- package/dist/hooks/useAsync.js +40 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/lib/access.d.ts +64 -0
- package/dist/lib/access.d.ts.map +1 -0
- package/dist/lib/access.js +127 -0
- package/dist/lib/canonical.d.ts +15 -0
- package/dist/lib/canonical.d.ts.map +1 -0
- package/dist/lib/canonical.js +34 -0
- package/dist/lib/comments.d.ts +9 -0
- package/dist/lib/comments.d.ts.map +1 -0
- package/dist/lib/comments.js +23 -0
- package/dist/lib/dashboard.d.ts +39 -0
- package/dist/lib/dashboard.d.ts.map +1 -0
- package/dist/lib/dashboard.js +157 -0
- package/dist/lib/data-transfer.d.ts +23 -0
- package/dist/lib/data-transfer.d.ts.map +1 -0
- package/dist/lib/data-transfer.js +436 -0
- package/dist/lib/default-author.d.ts +12 -0
- package/dist/lib/default-author.d.ts.map +1 -0
- package/dist/lib/default-author.js +57 -0
- package/dist/lib/format-media.d.ts +6 -0
- package/dist/lib/format-media.d.ts.map +1 -0
- package/dist/lib/format-media.js +18 -0
- package/dist/lib/format.d.ts +7 -0
- package/dist/lib/format.d.ts.map +1 -0
- package/dist/lib/format.js +43 -0
- package/dist/lib/hero-post.d.ts +24 -0
- package/dist/lib/hero-post.d.ts.map +1 -0
- package/dist/lib/hero-post.js +95 -0
- package/dist/lib/lexical-build.d.ts +30 -0
- package/dist/lib/lexical-build.d.ts.map +1 -0
- package/dist/lib/lexical-build.js +57 -0
- package/dist/lib/lexical-doc.d.ts +88 -0
- package/dist/lib/lexical-doc.d.ts.map +1 -0
- package/dist/lib/lexical-doc.js +385 -0
- package/dist/lib/lexical-dom.d.ts +19 -0
- package/dist/lib/lexical-dom.d.ts.map +1 -0
- package/dist/lib/lexical-dom.js +181 -0
- package/dist/lib/lexical.d.ts +31 -0
- package/dist/lib/lexical.d.ts.map +1 -0
- package/dist/lib/lexical.js +59 -0
- package/dist/lib/post-categories.d.ts +11 -0
- package/dist/lib/post-categories.d.ts.map +1 -0
- package/dist/lib/post-categories.js +27 -0
- package/dist/lib/post-format.d.ts +39 -0
- package/dist/lib/post-format.d.ts.map +1 -0
- package/dist/lib/post-format.js +82 -0
- package/dist/lib/publishing.d.ts +3 -0
- package/dist/lib/publishing.d.ts.map +1 -0
- package/dist/lib/publishing.js +1 -0
- package/dist/lib/queries.d.ts +49 -0
- package/dist/lib/queries.d.ts.map +1 -0
- package/dist/lib/queries.js +340 -0
- package/dist/lib/redirect-analytics.d.ts +27 -0
- package/dist/lib/redirect-analytics.d.ts.map +1 -0
- package/dist/lib/redirect-analytics.js +147 -0
- package/dist/lib/redirects.d.ts +39 -0
- package/dist/lib/redirects.d.ts.map +1 -0
- package/dist/lib/redirects.js +96 -0
- package/dist/lib/revalidate.d.ts +30 -0
- package/dist/lib/revalidate.d.ts.map +1 -0
- package/dist/lib/revalidate.js +91 -0
- package/dist/lib/robots.d.ts +19 -0
- package/dist/lib/robots.d.ts.map +1 -0
- package/dist/lib/robots.js +38 -0
- package/dist/lib/seo-analysis.d.ts +28 -0
- package/dist/lib/seo-analysis.d.ts.map +1 -0
- package/dist/lib/seo-analysis.js +153 -0
- package/dist/lib/seo-limits.d.ts +19 -0
- package/dist/lib/seo-limits.d.ts.map +1 -0
- package/dist/lib/seo-limits.js +39 -0
- package/dist/lib/seo.d.ts +50 -0
- package/dist/lib/seo.d.ts.map +1 -0
- package/dist/lib/seo.js +238 -0
- package/dist/lib/slug.d.ts +3 -0
- package/dist/lib/slug.d.ts.map +1 -0
- package/dist/lib/slug.js +9 -0
- package/dist/lib/stats.d.ts +71 -0
- package/dist/lib/stats.d.ts.map +1 -0
- package/dist/lib/stats.js +207 -0
- package/dist/lib/tenant-host.d.ts +9 -0
- package/dist/lib/tenant-host.d.ts.map +1 -0
- package/dist/lib/tenant-host.js +15 -0
- package/dist/lib/tenant.d.ts +41 -0
- package/dist/lib/tenant.d.ts.map +1 -0
- package/dist/lib/tenant.js +140 -0
- package/dist/lib/toc.d.ts +16 -0
- package/dist/lib/toc.d.ts.map +1 -0
- package/dist/lib/toc.js +28 -0
- package/dist/lib/yoast-snippet.d.ts +25 -0
- package/dist/lib/yoast-snippet.d.ts.map +1 -0
- package/dist/lib/yoast-snippet.js +79 -0
- package/dist/pages/admin/BlogAdmin.d.ts +9 -0
- package/dist/pages/admin/BlogAdmin.d.ts.map +1 -0
- package/dist/pages/admin/BlogAdmin.js +234 -0
- package/dist/pages/admin/index.d.ts +2 -0
- package/dist/pages/admin/index.d.ts.map +1 -0
- package/dist/pages/admin/index.js +1 -0
- package/dist/pages/index.d.ts +3 -0
- package/dist/pages/index.d.ts.map +1 -0
- package/dist/pages/index.js +2 -0
- package/dist/pages/user/UserBlogPage.d.ts +10 -0
- package/dist/pages/user/UserBlogPage.d.ts.map +1 -0
- package/dist/pages/user/UserBlogPage.js +15 -0
- package/dist/pages/user/index.d.ts +2 -0
- package/dist/pages/user/index.d.ts.map +1 -0
- package/dist/pages/user/index.js +1 -0
- package/dist/services/admin-client.d.ts +33 -0
- package/dist/services/admin-client.d.ts.map +1 -0
- package/dist/services/admin-client.js +154 -0
- package/dist/services/admin-sdk-client.d.ts +285 -0
- package/dist/services/admin-sdk-client.d.ts.map +1 -0
- package/dist/services/admin-sdk-client.js +242 -0
- package/dist/services/errors.d.ts +14 -0
- package/dist/services/errors.d.ts.map +1 -0
- package/dist/services/errors.js +26 -0
- package/dist/services/http.d.ts +24 -0
- package/dist/services/http.d.ts.map +1 -0
- package/dist/services/http.js +159 -0
- package/dist/services/index.d.ts +8 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/index.js +7 -0
- package/dist/services/pagination.d.ts +4 -0
- package/dist/services/pagination.d.ts.map +1 -0
- package/dist/services/pagination.js +32 -0
- package/dist/services/public-client.d.ts +23 -0
- package/dist/services/public-client.d.ts.map +1 -0
- package/dist/services/public-client.js +94 -0
- package/dist/services/types.d.ts +124 -0
- package/dist/services/types.d.ts.map +1 -0
- package/dist/services/types.js +1 -0
- package/dist/style.css +3105 -0
- package/dist/styles/adminTheme.d.ts +6 -0
- package/dist/styles/adminTheme.d.ts.map +1 -0
- package/dist/styles/adminTheme.js +52 -0
- package/dist/styles/index.d.ts +3 -0
- package/dist/styles/index.d.ts.map +1 -0
- package/dist/styles/index.js +2 -0
- package/dist/styles/userTheme.d.ts +8 -0
- package/dist/styles/userTheme.d.ts.map +1 -0
- package/dist/styles/userTheme.js +60 -0
- package/dist/types/admin.d.ts +28 -0
- package/dist/types/admin.d.ts.map +1 -0
- package/dist/types/admin.js +1 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/user.d.ts +41 -0
- package/dist/types/user.d.ts.map +1 -0
- package/dist/types/user.js +1 -0
- package/dist/user/components/BlogCard.d.ts +15 -0
- package/dist/user/components/BlogCard.d.ts.map +1 -0
- package/dist/user/components/BlogCard.js +31 -0
- package/dist/user/components/BlogCategories.d.ts +6 -0
- package/dist/user/components/BlogCategories.d.ts.map +1 -0
- package/dist/user/components/BlogCategories.js +11 -0
- package/dist/user/components/BlogDetail.d.ts +7 -0
- package/dist/user/components/BlogDetail.d.ts.map +1 -0
- package/dist/user/components/BlogDetail.js +19 -0
- package/dist/user/components/BlogList.d.ts +8 -0
- package/dist/user/components/BlogList.d.ts.map +1 -0
- package/dist/user/components/BlogList.js +18 -0
- package/dist/user/components/BlogSearch.d.ts +8 -0
- package/dist/user/components/BlogSearch.d.ts.map +1 -0
- package/dist/user/components/BlogSearch.js +19 -0
- package/dist/user/components/BlogTags.d.ts +6 -0
- package/dist/user/components/BlogTags.d.ts.map +1 -0
- package/dist/user/components/BlogTags.js +11 -0
- package/dist/user/components/FeaturedBlogs.d.ts +8 -0
- package/dist/user/components/FeaturedBlogs.d.ts.map +1 -0
- package/dist/user/components/FeaturedBlogs.js +12 -0
- package/dist/user/components/RelatedBlogs.d.ts +9 -0
- package/dist/user/components/RelatedBlogs.d.ts.map +1 -0
- package/dist/user/components/RelatedBlogs.js +12 -0
- package/dist/user/components/internal/States.d.ts +18 -0
- package/dist/user/components/internal/States.d.ts.map +1 -0
- package/dist/user/components/internal/States.js +16 -0
- package/dist/user/hooks/useAsync.d.ts +21 -0
- package/dist/user/hooks/useAsync.d.ts.map +1 -0
- package/dist/user/hooks/useAsync.js +40 -0
- package/dist/user/index.d.ts +11 -0
- package/dist/user/index.d.ts.map +1 -0
- package/dist/user/index.js +10 -0
- package/dist/user/sanitize.d.ts +2 -0
- package/dist/user/sanitize.d.ts.map +1 -0
- package/dist/user/sanitize.js +120 -0
- package/dist/user/theme.d.ts +8 -0
- package/dist/user/theme.d.ts.map +1 -0
- package/dist/user/theme.js +60 -0
- package/dist/user/types.d.ts +41 -0
- package/dist/user/types.d.ts.map +1 -0
- package/dist/user/types.js +1 -0
- package/dist/utils/env.d.ts +16 -0
- package/dist/utils/env.d.ts.map +1 -0
- package/dist/utils/env.js +57 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +2 -0
- package/dist/utils/sanitize.d.ts +2 -0
- package/dist/utils/sanitize.d.ts.map +1 -0
- package/dist/utils/sanitize.js +120 -0
- package/package.json +63 -0
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback, useEffect, useRef, useState, useTransition } from 'react';
|
|
4
|
+
import { deleteMedia, listMedia, updateMedia } from '../../app/(dashboard)/_actions/library';
|
|
5
|
+
import { uploadImages } from './upload';
|
|
6
|
+
const kb = (n) => (n ? `${Math.round(n / 1024)} KB` : '—');
|
|
7
|
+
export const MediaLibrary = ({ tenant, tenantName, total }) => {
|
|
8
|
+
const [items, setItems] = useState([]);
|
|
9
|
+
const [count, setCount] = useState(total);
|
|
10
|
+
const [query, setQuery] = useState('');
|
|
11
|
+
const [page, setPage] = useState(1);
|
|
12
|
+
const [hasMore, setHasMore] = useState(false);
|
|
13
|
+
const [loading, setLoading] = useState(true);
|
|
14
|
+
const [uploading, setUploading] = useState(null);
|
|
15
|
+
const [dragging, setDragging] = useState(false);
|
|
16
|
+
const [error, setError] = useState(null);
|
|
17
|
+
const [open, setOpen] = useState(null);
|
|
18
|
+
const [meta, setMeta] = useState({ alt: '', caption: '', credit: '' });
|
|
19
|
+
const [saving, startSaving] = useTransition();
|
|
20
|
+
const [saved, setSaved] = useState(false);
|
|
21
|
+
const fileRef = useRef(null);
|
|
22
|
+
const load = useCallback(async (nextPage, q, append) => {
|
|
23
|
+
setLoading(true);
|
|
24
|
+
const res = await listMedia(tenant, q, nextPage);
|
|
25
|
+
setItems((prev) => (append ? [...prev, ...res.items] : res.items));
|
|
26
|
+
setHasMore(res.hasMore);
|
|
27
|
+
setCount(res.total);
|
|
28
|
+
setLoading(false);
|
|
29
|
+
}, [tenant]);
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
void load(1, '', false);
|
|
32
|
+
}, [load]);
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
const id = setTimeout(() => {
|
|
35
|
+
setPage(1);
|
|
36
|
+
void load(1, query, false);
|
|
37
|
+
}, 250);
|
|
38
|
+
return () => clearTimeout(id);
|
|
39
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
40
|
+
}, [query]);
|
|
41
|
+
const upload = async (files) => {
|
|
42
|
+
const total = Array.from(files).length;
|
|
43
|
+
setError(null);
|
|
44
|
+
setUploading({ done: 0, total });
|
|
45
|
+
const res = await uploadImages(files, tenant, (done) => setUploading({ done, total }));
|
|
46
|
+
setUploading(null);
|
|
47
|
+
if (!res.ok)
|
|
48
|
+
setError(res.error);
|
|
49
|
+
setPage(1);
|
|
50
|
+
await load(1, query, false);
|
|
51
|
+
const first = res.images[0];
|
|
52
|
+
if (first) {
|
|
53
|
+
openDetail({
|
|
54
|
+
id: first.id,
|
|
55
|
+
url: first.url,
|
|
56
|
+
thumbUrl: first.thumbnailUrl || first.url,
|
|
57
|
+
alt: first.alt,
|
|
58
|
+
filename: '',
|
|
59
|
+
width: first.width,
|
|
60
|
+
height: first.height,
|
|
61
|
+
filesize: first.filesize,
|
|
62
|
+
createdAt: new Date().toISOString(),
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
const openDetail = (item) => {
|
|
67
|
+
setOpen(item);
|
|
68
|
+
setSaved(false);
|
|
69
|
+
setError(null);
|
|
70
|
+
setMeta({ alt: item.alt, caption: '', credit: '' });
|
|
71
|
+
};
|
|
72
|
+
const saveMeta = () => {
|
|
73
|
+
if (!open)
|
|
74
|
+
return;
|
|
75
|
+
setError(null);
|
|
76
|
+
startSaving(async () => {
|
|
77
|
+
const res = await updateMedia(open.id, meta);
|
|
78
|
+
if (!res.ok) {
|
|
79
|
+
setError(res.error);
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
setSaved(true);
|
|
83
|
+
setItems((list) => list.map((m) => (m.id === open.id ? { ...m, alt: meta.alt } : m)));
|
|
84
|
+
setOpen((o) => (o ? { ...o, alt: meta.alt } : o));
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
const removeImage = () => {
|
|
88
|
+
if (!open)
|
|
89
|
+
return;
|
|
90
|
+
if (!window.confirm('Delete this image? It is removed from the library and from disk.'))
|
|
91
|
+
return;
|
|
92
|
+
setError(null);
|
|
93
|
+
startSaving(async () => {
|
|
94
|
+
const res = await deleteMedia(open.id);
|
|
95
|
+
if (!res.ok) {
|
|
96
|
+
setError(res.error);
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
setItems((list) => list.filter((m) => m.id !== open.id));
|
|
100
|
+
setCount((c) => Math.max(0, c - 1));
|
|
101
|
+
setOpen(null);
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "filterbar", children: [_jsx("input", { className: "fld", type: "search", value: query, placeholder: "Search alt text or filename\u2026", "aria-label": "Search images", onChange: (e) => setQuery(e.target.value) }), _jsx("button", { className: "btn btn-primary", onClick: () => fileRef.current?.click(), disabled: !!uploading, children: uploading ? `Uploading ${uploading.done}/${uploading.total}…` : '+ Upload images' }), _jsxs("span", { className: "note", children: [count, " image", count === 1 ? '' : 's', " \u00B7 ", tenant ? tenantName : 'all brands'] })] }), _jsx("input", { ref: fileRef, type: "file", accept: "image/jpeg,image/png,image/webp,image/avif,image/gif", multiple: true, hidden: true, onChange: (e) => {
|
|
105
|
+
if (e.target.files?.length)
|
|
106
|
+
void upload(e.target.files);
|
|
107
|
+
e.target.value = '';
|
|
108
|
+
} }), error ? _jsx("p", { className: "form-error", role: "alert", children: error }) : null, _jsxs("p", { className: "explain", children: ["Every upload is ", _jsx("b", { children: "re-encoded by the server" }), " and stripped of EXIF, then stored in four sizes. That is what makes an uploaded file harmless: the bytes on disk are Sharp\u2019s output, never the bytes that arrived."] }), _jsxs("section", { className: `panel dropzone${dragging ? ' is-dragging' : ''}`, onDragOver: (e) => {
|
|
109
|
+
e.preventDefault();
|
|
110
|
+
setDragging(true);
|
|
111
|
+
}, onDragLeave: () => setDragging(false), onDrop: (e) => {
|
|
112
|
+
e.preventDefault();
|
|
113
|
+
setDragging(false);
|
|
114
|
+
if (e.dataTransfer.files?.length)
|
|
115
|
+
void upload(e.dataTransfer.files);
|
|
116
|
+
}, children: [items.length === 0 && !loading ? (_jsx("p", { className: "d-empty", children: "Nothing here yet \u2014 drop images anywhere on this panel to upload." })) : (_jsx("div", { className: "media-grid", children: items.map((item) => (_jsxs("button", { type: "button", className: "media-card", onClick: () => openDetail(item), children: [item.thumbUrl ? _jsx("img", { src: item.thumbUrl, alt: "", loading: "lazy" }) : _jsx("span", { className: "pick-blank" }), _jsxs("span", { className: "media-meta", children: [_jsx("span", { className: "media-alt", children: item.alt || item.filename || 'Image' }), _jsxs("span", { className: "media-sub", children: [item.width && item.height ? `${item.width}×${item.height}` : '—', " \u00B7 ", kb(item.filesize)] })] })] }, item.id))) })), hasMore ? (_jsx("div", { className: "modal-more", children: _jsx("button", { className: "btn", disabled: loading, onClick: () => {
|
|
117
|
+
const next = page + 1;
|
|
118
|
+
setPage(next);
|
|
119
|
+
void load(next, query, true);
|
|
120
|
+
}, children: loading ? 'Loading…' : 'Load more' }) })) : null] }), open ? (_jsx("div", { className: "modal-backdrop", onMouseDown: () => setOpen(null), children: _jsxs("div", { className: "modal", role: "dialog", "aria-modal": "true", "aria-label": "Image details", onMouseDown: (e) => e.stopPropagation(), children: [_jsxs("header", { className: "modal-head", children: [_jsx("h2", { children: "Image details" }), _jsx("button", { className: "icon-btn", onClick: () => setOpen(null), "aria-label": "Close", children: "\u2715" })] }), _jsxs("div", { className: "modal-body detail", children: [_jsx("img", { className: "detail-img", src: open.url || open.thumbUrl, alt: open.alt }), _jsxs("div", { className: "stack", children: [_jsxs("label", { className: "fld-row", children: [_jsx("span", { className: "fld-lbl", children: "Alt text \u2014 what a screen reader reads out" }), _jsx("textarea", { className: "fld", rows: 2, value: meta.alt, onChange: (e) => {
|
|
121
|
+
setMeta((m) => ({ ...m, alt: e.target.value }));
|
|
122
|
+
setSaved(false);
|
|
123
|
+
} })] }), _jsxs("label", { className: "fld-row", children: [_jsx("span", { className: "fld-lbl", children: "Caption" }), _jsx("input", { className: "fld", value: meta.caption, onChange: (e) => setMeta((m) => ({ ...m, caption: e.target.value })) })] }), _jsxs("label", { className: "fld-row", children: [_jsx("span", { className: "fld-lbl", children: "Credit" }), _jsx("input", { className: "fld", value: meta.credit, onChange: (e) => setMeta((m) => ({ ...m, credit: e.target.value })) })] }), _jsxs("dl", { className: "facts", children: [_jsxs("div", { children: [_jsx("dt", { children: "Dimensions" }), _jsx("dd", { children: open.width && open.height ? `${open.width}×${open.height}` : '—' })] }), _jsxs("div", { children: [_jsx("dt", { children: "Size" }), _jsx("dd", { children: kb(open.filesize) })] }), _jsxs("div", { children: [_jsx("dt", { children: "File" }), _jsx("dd", { className: "mono trunc", children: open.url })] })] })] })] }), _jsxs("footer", { className: "modal-foot", children: [_jsx("button", { className: "btn-danger-link", onClick: removeImage, disabled: saving, children: "Delete image" }), _jsxs("div", { className: "modal-foot-actions", children: [saved ? _jsx("span", { className: "form-ok inline", children: "Saved" }) : null, _jsx("button", { className: "btn", onClick: () => setOpen(null), children: "Close" }), _jsx("button", { className: "btn btn-primary", onClick: saveMeta, disabled: saving || !meta.alt.trim(), children: saving ? 'Saving…' : 'Save details' })] })] })] }) })) : null] }));
|
|
124
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type MediaHit } from '../../app/(dashboard)/_actions/library';
|
|
2
|
+
/**
|
|
3
|
+
* One image chooser, used everywhere an image is chosen: the featured image box,
|
|
4
|
+
* the social share image, and the editor's insert-image button.
|
|
5
|
+
*
|
|
6
|
+
* Upload goes through /api/dashboard/upload rather than a server action, because
|
|
7
|
+
* that is the one request in the dashboard measured in megabytes. Everything the
|
|
8
|
+
* collection guarantees — mime allowlist, Sharp re-encode, four derivative sizes,
|
|
9
|
+
* required alt text — applies regardless of which of those callers is asking.
|
|
10
|
+
*/
|
|
11
|
+
export type MediaPickerProps = {
|
|
12
|
+
open: boolean;
|
|
13
|
+
tenant: string | null;
|
|
14
|
+
onClose: () => void;
|
|
15
|
+
onSelect: (item: MediaHit) => void;
|
|
16
|
+
title?: string;
|
|
17
|
+
};
|
|
18
|
+
export declare const MediaPicker: ({ open, tenant, onClose, onSelect, title }: MediaPickerProps) => import("react").JSX.Element | null;
|
|
19
|
+
//# sourceMappingURL=MediaPicker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MediaPicker.d.ts","sourceRoot":"","sources":["../../../../app/components/BlogUploader/dashboard/MediaPicker.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,wCAAwC,CAAA;AAGjF;;;;;;;;GAQG;AAEH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,OAAO,CAAA;IACb,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,QAAQ,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,IAAI,CAAA;IAClC,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAID,eAAO,MAAM,WAAW,GAAI,4CAAgE,gBAAgB,uCAmM3G,CAAA"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
4
|
+
import { listMedia } from '../../app/(dashboard)/_actions/library';
|
|
5
|
+
import { uploadImages } from './upload';
|
|
6
|
+
const kb = (n) => (n ? `${Math.round(n / 1024)} KB` : '—');
|
|
7
|
+
export const MediaPicker = ({ open, tenant, onClose, onSelect, title = 'Choose an image' }) => {
|
|
8
|
+
const [items, setItems] = useState([]);
|
|
9
|
+
const [query, setQuery] = useState('');
|
|
10
|
+
const [page, setPage] = useState(1);
|
|
11
|
+
const [total, setTotal] = useState(0);
|
|
12
|
+
const [hasMore, setHasMore] = useState(false);
|
|
13
|
+
const [loading, setLoading] = useState(false);
|
|
14
|
+
const [uploading, setUploading] = useState(false);
|
|
15
|
+
const [error, setError] = useState(null);
|
|
16
|
+
const [dragging, setDragging] = useState(false);
|
|
17
|
+
const [selected, setSelected] = useState(null);
|
|
18
|
+
const fileRef = useRef(null);
|
|
19
|
+
const load = useCallback(async (nextPage, q, append) => {
|
|
20
|
+
setLoading(true);
|
|
21
|
+
const res = await listMedia(tenant, q, nextPage);
|
|
22
|
+
setItems((prev) => (append ? [...prev, ...res.items] : res.items));
|
|
23
|
+
setHasMore(res.hasMore);
|
|
24
|
+
setTotal(res.total);
|
|
25
|
+
setLoading(false);
|
|
26
|
+
}, [tenant]);
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if (!open)
|
|
29
|
+
return;
|
|
30
|
+
setPage(1);
|
|
31
|
+
setSelected(null);
|
|
32
|
+
void load(1, query, false);
|
|
33
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
34
|
+
}, [open, tenant]);
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
if (!open)
|
|
37
|
+
return;
|
|
38
|
+
const id = setTimeout(() => {
|
|
39
|
+
setPage(1);
|
|
40
|
+
void load(1, query, false);
|
|
41
|
+
}, 250);
|
|
42
|
+
return () => clearTimeout(id);
|
|
43
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
44
|
+
}, [query]);
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
if (!open)
|
|
47
|
+
return;
|
|
48
|
+
const onKey = (e) => {
|
|
49
|
+
if (e.key === 'Escape')
|
|
50
|
+
onClose();
|
|
51
|
+
};
|
|
52
|
+
document.addEventListener('keydown', onKey);
|
|
53
|
+
return () => document.removeEventListener('keydown', onKey);
|
|
54
|
+
}, [open, onClose]);
|
|
55
|
+
const upload = async (files) => {
|
|
56
|
+
setError(null);
|
|
57
|
+
setUploading(true);
|
|
58
|
+
const res = await uploadImages(files, tenant);
|
|
59
|
+
setUploading(false);
|
|
60
|
+
if (!res.ok)
|
|
61
|
+
setError(res.error);
|
|
62
|
+
await load(1, query, false);
|
|
63
|
+
setPage(1);
|
|
64
|
+
// Uploading is almost always "I want this one", so it lands pre-selected.
|
|
65
|
+
const last = res.images[res.images.length - 1];
|
|
66
|
+
if (last) {
|
|
67
|
+
setSelected({
|
|
68
|
+
id: last.id,
|
|
69
|
+
url: last.url,
|
|
70
|
+
thumbUrl: last.thumbnailUrl || last.url,
|
|
71
|
+
alt: last.alt,
|
|
72
|
+
filename: '',
|
|
73
|
+
width: last.width,
|
|
74
|
+
height: last.height,
|
|
75
|
+
filesize: last.filesize,
|
|
76
|
+
createdAt: new Date().toISOString(),
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
if (!open)
|
|
81
|
+
return null;
|
|
82
|
+
return (_jsx("div", { className: "modal-backdrop", onMouseDown: onClose, children: _jsxs("div", { className: "modal modal-wide", role: "dialog", "aria-modal": "true", "aria-label": title, onMouseDown: (e) => e.stopPropagation(), children: [_jsxs("header", { className: "modal-head", children: [_jsx("h2", { children: title }), _jsxs("div", { className: "modal-head-actions", children: [_jsx("input", { className: "fld", type: "search", placeholder: "Search alt text or filename\u2026", value: query, onChange: (e) => setQuery(e.target.value) }), _jsx("button", { type: "button", className: "btn", onClick: () => fileRef.current?.click(), disabled: uploading, children: uploading ? 'Uploading…' : 'Upload' }), _jsx("button", { type: "button", className: "icon-btn", onClick: onClose, "aria-label": "Close", children: "\u2715" })] })] }), _jsx("input", { ref: fileRef, type: "file", accept: "image/jpeg,image/png,image/webp,image/avif,image/gif", multiple: true, hidden: true, onChange: (e) => {
|
|
83
|
+
if (e.target.files?.length)
|
|
84
|
+
void upload(e.target.files);
|
|
85
|
+
e.target.value = '';
|
|
86
|
+
} }), error ? _jsx("p", { className: "form-error", role: "alert", children: error }) : null, _jsxs("div", { className: `modal-body dropzone${dragging ? ' is-dragging' : ''}`, onDragOver: (e) => {
|
|
87
|
+
e.preventDefault();
|
|
88
|
+
setDragging(true);
|
|
89
|
+
}, onDragLeave: () => setDragging(false), onDrop: (e) => {
|
|
90
|
+
e.preventDefault();
|
|
91
|
+
setDragging(false);
|
|
92
|
+
if (e.dataTransfer.files?.length)
|
|
93
|
+
void upload(e.dataTransfer.files);
|
|
94
|
+
}, children: [items.length === 0 && !loading ? (_jsx("p", { className: "d-empty", children: "Nothing in the library yet. Drop an image here, or press Upload." })) : (_jsx("div", { className: "pick-grid", children: items.map((item) => (_jsxs("button", { type: "button", className: `pick${selected?.id === item.id ? ' is-picked' : ''}`, onClick: () => setSelected(item), onDoubleClick: () => onSelect(item), children: [item.thumbUrl ? _jsx("img", { src: item.thumbUrl, alt: "", loading: "lazy" }) : _jsx("span", { className: "pick-blank" }), _jsxs("span", { className: "pick-meta", children: [_jsx("span", { className: `pick-alt${item.alt ? '' : ' is-missing'}`, children: item.alt || 'Image' }), _jsxs("span", { className: "pick-sub", children: [item.width && item.height ? `${item.width}×${item.height}` : '—', " \u00B7 ", kb(item.filesize)] })] })] }, item.id))) })), hasMore ? (_jsx("div", { className: "modal-more", children: _jsx("button", { type: "button", className: "btn", disabled: loading, onClick: () => {
|
|
95
|
+
const next = page + 1;
|
|
96
|
+
setPage(next);
|
|
97
|
+
void load(next, query, true);
|
|
98
|
+
}, children: loading ? 'Loading…' : 'Load more' }) })) : null] }), _jsxs("footer", { className: "modal-foot", children: [_jsxs("span", { className: "note", children: [total, " image", total === 1 ? '' : 's', " \u00B7 drag files anywhere in this window to upload"] }), _jsxs("div", { className: "modal-foot-actions", children: [_jsx("button", { type: "button", className: "btn", onClick: onClose, children: "Cancel" }), _jsx("button", { type: "button", className: "btn btn-primary", disabled: !selected, onClick: () => selected && onSelect(selected), children: "Use this image" })] })] })] }) }));
|
|
99
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The posts list.
|
|
3
|
+
*
|
|
4
|
+
* The shape is the one editors already have muscle memory for: a checkbox
|
|
5
|
+
* column, a bulk-action bar, and per-row actions that appear on hover. What it
|
|
6
|
+
* adds is that the row tells the truth about *why* a post is not live — the
|
|
7
|
+
* blockers under the title come from the same function the publish gate throws
|
|
8
|
+
* on, so a row never says "ready" while the server says otherwise.
|
|
9
|
+
*
|
|
10
|
+
* Every action goes through a server action with `overrideAccess: false`, so the
|
|
11
|
+
* buttons shown here are a convenience, not a permission: an author pressing
|
|
12
|
+
* Publish is refused by the collection hook, and the refusal is shown verbatim.
|
|
13
|
+
*/
|
|
14
|
+
export type PostRow = {
|
|
15
|
+
id: string;
|
|
16
|
+
title: string;
|
|
17
|
+
slug: string;
|
|
18
|
+
status: 'draft' | 'published';
|
|
19
|
+
reviewState: string;
|
|
20
|
+
scheduledFor: string | null;
|
|
21
|
+
publishedAt: string | null;
|
|
22
|
+
updatedAt: string;
|
|
23
|
+
trashed: boolean;
|
|
24
|
+
categoryIds: string[];
|
|
25
|
+
categoryNames: string[];
|
|
26
|
+
tagNames: string[];
|
|
27
|
+
authorNames: string[];
|
|
28
|
+
brandName: string | null;
|
|
29
|
+
brandSlug: string | null;
|
|
30
|
+
blockers: string[];
|
|
31
|
+
readingMinutes: number | null;
|
|
32
|
+
views: number | null;
|
|
33
|
+
canPublish: boolean;
|
|
34
|
+
};
|
|
35
|
+
type Props = {
|
|
36
|
+
rows: PostRow[];
|
|
37
|
+
categories: {
|
|
38
|
+
id: string;
|
|
39
|
+
name: string;
|
|
40
|
+
}[];
|
|
41
|
+
state: string;
|
|
42
|
+
showBrand: boolean;
|
|
43
|
+
};
|
|
44
|
+
export declare const PostsTable: ({ rows, categories, state, showBrand }: Props) => import("react").JSX.Element;
|
|
45
|
+
export {};
|
|
46
|
+
//# sourceMappingURL=PostsTable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PostsTable.d.ts","sourceRoot":"","sources":["../../../../app/components/BlogUploader/dashboard/PostsTable.tsx"],"names":[],"mappings":"AAqBA;;;;;;;;;;;;GAYG;AAEH,MAAM,MAAM,OAAO,GAAG;IACpB,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,OAAO,GAAG,WAAW,CAAA;IAC7B,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,OAAO,CAAA;IAChB,WAAW,EAAE,MAAM,EAAE,CAAA;IACrB,aAAa,EAAE,MAAM,EAAE,CAAA;IACvB,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,WAAW,EAAE,MAAM,EAAE,CAAA;IACrB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,UAAU,EAAE,OAAO,CAAA;CACpB,CAAA;AAED,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,OAAO,EAAE,CAAA;IACf,UAAU,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;IAC1C,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,EAAE,OAAO,CAAA;CACnB,CAAA;AAuBD,eAAO,MAAM,UAAU,GAAI,wCAAwC,KAAK,gCA2YvE,CAAA"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Fragment, useMemo, useState, useTransition } from 'react';
|
|
4
|
+
import Link from 'next/link';
|
|
5
|
+
import { useRouter } from 'next/navigation';
|
|
6
|
+
import { approve, bulkPostAction, duplicatePost, publishNow, quickEditPost, schedulePost, sendBack, submitForReview, unpublish, } from '../../app/(dashboard)/_actions/posts';
|
|
7
|
+
import { REVIEW_LABELS } from '../../lib/publishing';
|
|
8
|
+
import { formatDateTime, formatShortDate } from '../../lib/format';
|
|
9
|
+
import { postPath } from '../../lib/slug';
|
|
10
|
+
const fmtDate = formatShortDate;
|
|
11
|
+
const fmtDateTime = formatDateTime;
|
|
12
|
+
const toLocalInput = (iso) => {
|
|
13
|
+
if (!iso)
|
|
14
|
+
return '';
|
|
15
|
+
const d = new Date(iso);
|
|
16
|
+
const pad = (n) => String(n).padStart(2, '0');
|
|
17
|
+
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}T${pad(d.getHours())}:${pad(d.getMinutes())}`;
|
|
18
|
+
};
|
|
19
|
+
const StateChip = ({ row }) => {
|
|
20
|
+
if (row.trashed)
|
|
21
|
+
return _jsx("span", { className: "chip chip-blocked", children: "Trashed" });
|
|
22
|
+
if (row.status === 'published')
|
|
23
|
+
return _jsx("span", { className: "chip chip-live", children: "Live" });
|
|
24
|
+
if (row.scheduledFor && row.status === 'draft') {
|
|
25
|
+
return _jsx("span", { className: "chip chip-approved", children: "Scheduled" });
|
|
26
|
+
}
|
|
27
|
+
const rs = row.reviewState;
|
|
28
|
+
const cls = rs === 'in-review' ? 'chip-review' : rs === 'approved' ? 'chip-approved' : 'chip-writing';
|
|
29
|
+
return _jsx("span", { className: `chip ${cls}`, children: REVIEW_LABELS[rs] ?? 'Draft' });
|
|
30
|
+
};
|
|
31
|
+
export const PostsTable = ({ rows, categories, state, showBrand }) => {
|
|
32
|
+
const router = useRouter();
|
|
33
|
+
const [pending, start] = useTransition();
|
|
34
|
+
const [selected, setSelected] = useState([]);
|
|
35
|
+
const [bulk, setBulk] = useState('');
|
|
36
|
+
const [error, setError] = useState(null);
|
|
37
|
+
const [flash, setFlash] = useState(null);
|
|
38
|
+
const [editing, setEditing] = useState(null);
|
|
39
|
+
const [scheduling, setScheduling] = useState(null);
|
|
40
|
+
const [when, setWhen] = useState('');
|
|
41
|
+
const isTrash = state === 'trash';
|
|
42
|
+
const allChecked = rows.length > 0 && selected.length === rows.length;
|
|
43
|
+
const editRow = useMemo(() => rows.find((r) => r.id === editing) ?? null, [rows, editing]);
|
|
44
|
+
const [draft, setDraft] = useState({
|
|
45
|
+
title: '',
|
|
46
|
+
slug: '',
|
|
47
|
+
category: [],
|
|
48
|
+
date: '',
|
|
49
|
+
status: 'draft',
|
|
50
|
+
});
|
|
51
|
+
const run = (fn, message) => {
|
|
52
|
+
setError(null);
|
|
53
|
+
setFlash(null);
|
|
54
|
+
start(async () => {
|
|
55
|
+
const res = await fn();
|
|
56
|
+
if (!res.ok) {
|
|
57
|
+
setError(res.error);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
if (message)
|
|
61
|
+
setFlash(message);
|
|
62
|
+
setSelected([]);
|
|
63
|
+
setEditing(null);
|
|
64
|
+
setScheduling(null);
|
|
65
|
+
router.refresh();
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
const openQuickEdit = (row) => {
|
|
69
|
+
setEditing(row.id);
|
|
70
|
+
setError(null);
|
|
71
|
+
setDraft({
|
|
72
|
+
title: row.title,
|
|
73
|
+
slug: row.slug,
|
|
74
|
+
category: row.categoryIds,
|
|
75
|
+
date: toLocalInput(row.publishedAt),
|
|
76
|
+
status: row.status,
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
const toggleDraftCategory = (id) => {
|
|
80
|
+
setDraft((d) => ({
|
|
81
|
+
...d,
|
|
82
|
+
category: d.category.includes(id) ? d.category.filter((c) => c !== id) : [...d.category, id],
|
|
83
|
+
}));
|
|
84
|
+
};
|
|
85
|
+
const applyBulk = () => {
|
|
86
|
+
if (!bulk || !selected.length)
|
|
87
|
+
return;
|
|
88
|
+
if (bulk === 'delete' && !window.confirm(`Permanently delete ${selected.length} post(s)? This cannot be undone.`)) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
run(() => bulkPostAction(selected, bulk), `${selected.length} post(s) updated.`);
|
|
92
|
+
};
|
|
93
|
+
return (_jsxs("div", { className: "list", children: [_jsxs("div", { className: "list-bar", children: [_jsxs("div", { className: "bulk", children: [_jsxs("select", { className: "fld fld-sm", value: bulk, onChange: (e) => setBulk(e.target.value), "aria-label": "Bulk action", children: [_jsx("option", { value: "", children: "Bulk actions\u2026" }), isTrash ? (_jsxs(_Fragment, { children: [_jsx("option", { value: "restore", children: "Restore" }), _jsx("option", { value: "delete", children: "Delete permanently" })] })) : (_jsxs(_Fragment, { children: [_jsx("option", { value: "submit", children: "Submit for review" }), _jsx("option", { value: "approve", children: "Approve" }), _jsx("option", { value: "send-back", children: "Send back to writing" }), _jsx("option", { value: "publish", children: "Publish" }), _jsx("option", { value: "draft", children: "Switch to draft" }), _jsx("option", { value: "trash", children: "Move to trash" })] }))] }), _jsx("button", { className: "btn", disabled: !bulk || !selected.length || pending, onClick: applyBulk, children: "Apply" }), _jsx("span", { className: "note", children: selected.length ? `${selected.length} selected` : `${rows.length} shown` })] }), pending ? _jsx("span", { className: "note", children: "Working\u2026" }) : null] }), error ? _jsx("p", { className: "form-error", role: "alert", children: error }) : null, flash ? _jsx("p", { className: "form-ok", role: "status", children: flash }) : null, _jsx("div", { className: "tw", children: _jsxs("table", { className: "tbl tbl-list", children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { className: "col-check", children: _jsx("input", { type: "checkbox", checked: allChecked, "aria-label": "Select all posts", onChange: (e) => setSelected(e.target.checked ? rows.map((r) => r.id) : []) }) }), _jsx("th", { children: "Title" }), showBrand ? _jsx("th", { className: "col-narrow", children: "Brand" }) : null, _jsx("th", { className: "col-narrow", children: "Byline" }), _jsx("th", { className: "col-narrow", children: "Category" }), _jsx("th", { className: "col-narrow", children: "Date" }), _jsx("th", { className: "col-narrow num", children: "Views 30d" }), _jsx("th", { className: "col-narrow", children: "Status" })] }) }), _jsxs("tbody", { children: [rows.length === 0 ? (_jsx("tr", { children: _jsx("td", { colSpan: showBrand ? 8 : 7, children: _jsx("p", { className: "d-empty", children: "No posts match this view." }) }) })) : null, rows.map((row) => (_jsxs(Fragment, { children: [_jsxs("tr", { className: selected.includes(row.id) ? 'is-selected' : undefined, children: [_jsx("td", { className: "col-check", children: _jsx("input", { type: "checkbox", checked: selected.includes(row.id), "aria-label": `Select ${row.title}`, onChange: (e) => setSelected((list) => e.target.checked ? [...list, row.id] : list.filter((id) => id !== row.id)) }) }), _jsxs("td", { className: "col-title", children: [_jsx(Link, { className: "row-title", href: `/admin/posts/${row.id}`, children: row.title || '(no title)' }), row.blockers.length && row.status !== 'published' && !row.trashed ? (_jsx("ul", { className: "blockers", children: row.blockers.map((b) => (_jsxs("li", { children: ["needs ", b] }, b))) })) : null, _jsx("div", { className: "row-actions", children: isTrash ? (_jsxs(_Fragment, { children: [_jsx("button", { onClick: () => run(() => bulkPostAction([row.id], 'restore'), 'Restored.'), children: "Restore" }), _jsx("button", { className: "danger", onClick: () => {
|
|
94
|
+
if (window.confirm('Delete this post permanently? This cannot be undone.')) {
|
|
95
|
+
run(() => bulkPostAction([row.id], 'delete'), 'Deleted.');
|
|
96
|
+
}
|
|
97
|
+
}, children: "Delete permanently" })] })) : (_jsxs(_Fragment, { children: [_jsx(Link, { href: `/admin/posts/${row.id}`, children: "Edit" }), _jsx("button", { onClick: () => openQuickEdit(row), children: "Quick edit" }), row.status !== 'published' && row.reviewState === 'writing' ? (_jsx("button", { onClick: () => run(() => submitForReview(row.id), 'Sent for review.'), children: "Submit" })) : null, row.status !== 'published' && row.reviewState === 'in-review' && row.canPublish ? (_jsxs(_Fragment, { children: [_jsx("button", { onClick: () => run(() => approve(row.id), 'Approved.'), children: "Approve" }), _jsx("button", { onClick: () => run(() => sendBack(row.id), 'Sent back.'), children: "Send back" })] })) : null, row.status !== 'published' && row.reviewState === 'approved' && row.canPublish ? (_jsxs(_Fragment, { children: [_jsx("button", { disabled: row.blockers.length > 0, title: row.blockers.length ? 'Fix what is listed above first' : undefined, onClick: () => run(() => publishNow(row.id), 'Published.'), children: "Publish" }), _jsx("button", { onClick: () => {
|
|
98
|
+
setScheduling(row.id);
|
|
99
|
+
setWhen(toLocalInput(row.scheduledFor) || toLocalInput(new Date(Date.now() + 3600000).toISOString()));
|
|
100
|
+
}, children: "Schedule" })] })) : null, row.status === 'published' && row.canPublish ? (_jsx("button", { onClick: () => run(() => unpublish(row.id), 'Switched to draft.'), children: "Unpublish" })) : null, _jsx("button", { onClick: () => run(() => duplicatePost(row.id), 'Copied as a new draft.'), children: "Duplicate" }), _jsx("button", { className: "danger", onClick: () => run(() => bulkPostAction([row.id], 'trash'), 'Moved to trash.'), children: "Trash" }), row.status === 'published' ? (_jsx("a", { href: postPath(row.slug, row.brandSlug), target: "_blank", rel: "noreferrer", children: "View \u2197" })) : null] })) }), scheduling === row.id ? (_jsxs("div", { className: "inline-form", children: [_jsx("input", { type: "datetime-local", className: "fld fld-sm", value: when, onChange: (e) => setWhen(e.target.value), "aria-label": "Publish date and time" }), _jsx("button", { className: "btn btn-primary btn-tiny", onClick: () => run(() => schedulePost(row.id, new Date(when).toISOString()), 'Scheduled.'), children: "Confirm" }), _jsx("button", { className: "btn btn-tiny", onClick: () => setScheduling(null), children: "Cancel" })] })) : null] }), showBrand ? _jsx("td", { className: "col-narrow muted", children: row.brandName ?? '—' }) : null, _jsx("td", { className: "col-narrow muted", children: row.authorNames.join(', ') || '—' }), _jsx("td", { className: "col-narrow muted", children: row.categoryNames.join(', ') || '—' }), _jsx("td", { className: "col-narrow muted", children: row.status === 'published' ? (_jsxs(_Fragment, { children: [_jsx("span", { className: "cell-lbl", children: "Published" }), fmtDate(row.publishedAt)] })) : row.scheduledFor ? (_jsxs(_Fragment, { children: [_jsx("span", { className: "cell-lbl", children: "Scheduled" }), fmtDateTime(row.scheduledFor)] })) : (_jsxs(_Fragment, { children: [_jsx("span", { className: "cell-lbl", children: "Edited" }), fmtDate(row.updatedAt)] })) }), _jsx("td", { className: "col-narrow num", children: row.views == null ? '—' : row.views }), _jsx("td", { className: "col-narrow", children: _jsx(StateChip, { row: row }) })] }), editing === row.id && editRow ? (_jsx("tr", { className: "quick-row", children: _jsx("td", { colSpan: showBrand ? 8 : 7, children: _jsxs("div", { className: "quick", children: [_jsx("p", { className: "quick-head", children: "Quick edit \u2014 metadata only, the body stays untouched" }), _jsxs("div", { className: "quick-grid", children: [_jsxs("label", { children: [_jsx("span", { children: "Title" }), _jsx("input", { className: "fld", value: draft.title, onChange: (e) => setDraft((d) => ({ ...d, title: e.target.value })) })] }), _jsxs("label", { children: [_jsx("span", { children: "Slug" }), _jsx("input", { className: "fld mono", value: draft.slug, onChange: (e) => setDraft((d) => ({ ...d, slug: e.target.value })) })] }), _jsxs("div", { className: "span-2", children: [_jsx("span", { className: "fld-lbl", style: { display: 'block', marginBottom: 6 }, children: "Categories" }), _jsx("div", { className: "pick-list pick-list-compact", children: categories.length === 0 ? (_jsx("p", { className: "note", children: "No categories." })) : (categories.map((c) => (_jsxs("label", { className: "pick-row", children: [_jsx("input", { type: "checkbox", checked: draft.category.includes(c.id), onChange: () => toggleDraftCategory(c.id) }), c.name] }, c.id)))) })] }), _jsxs("label", { children: [_jsx("span", { children: "Published date" }), _jsx("input", { type: "datetime-local", className: "fld", value: draft.date, onChange: (e) => setDraft((d) => ({ ...d, date: e.target.value })) })] }), _jsxs("label", { children: [_jsx("span", { children: "Status" }), _jsxs("select", { className: "fld", value: draft.status, disabled: !row.canPublish, onChange: (e) => setDraft((d) => ({ ...d, status: e.target.value })), children: [_jsx("option", { value: "draft", children: "Draft" }), _jsx("option", { value: "published", children: "Published" })] })] })] }), _jsxs("div", { className: "btn-row", children: [_jsx("button", { className: "btn btn-primary", disabled: pending, onClick: () => run(() => quickEditPost({
|
|
101
|
+
id: row.id,
|
|
102
|
+
title: draft.title,
|
|
103
|
+
slug: draft.slug,
|
|
104
|
+
category: draft.category,
|
|
105
|
+
publishedAt: draft.date ? new Date(draft.date).toISOString() : null,
|
|
106
|
+
scheduledFor: row.scheduledFor,
|
|
107
|
+
status: draft.status,
|
|
108
|
+
}), 'Saved.'), children: "Save" }), _jsx("button", { className: "btn", onClick: () => setEditing(null), children: "Cancel" }), _jsx("span", { className: "note", children: "Changing the slug of a live post writes a 301 from the old URL automatically." })] })] }) }) })) : null] }, row.id)))] })] }) })] }));
|
|
109
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { ShellData } from '../../lib/dashboard';
|
|
3
|
+
/**
|
|
4
|
+
* The one app shell.
|
|
5
|
+
*
|
|
6
|
+
* Every screen renders inside it and hands it a title and its own actions, so
|
|
7
|
+
* the header, the brand switcher and the navigation cannot drift apart from one
|
|
8
|
+
* page to the next. Writing, reviewing, scheduling, images, taxonomy and people
|
|
9
|
+
* all live here — the CMS admin at the bottom is a labelled destination for the
|
|
10
|
+
* rare structural job, not the place routine work bounces to.
|
|
11
|
+
*
|
|
12
|
+
* The brand list arrives already filtered by access control, so the switcher can
|
|
13
|
+
* only ever offer brands this account may actually see.
|
|
14
|
+
*/
|
|
15
|
+
export type NavKey = 'overview' | 'posts' | 'posts-all' | 'posts-new' | 'attention' | 'scheduled' | 'trash' | 'categories' | 'tags' | 'authors' | 'media' | 'comments' | 'redirects' | 'redirects-all' | 'redirects-new' | 'robots' | 'sitemap' | 'analytics' | 'search-console' | 'users' | 'settings' | 'brands' | 'profile' | 'tools' | 'tools-export' | 'tools-import';
|
|
16
|
+
export declare const Shell: ({ children, active, shell, title, subtitle, actions, wide, }: {
|
|
17
|
+
children: ReactNode;
|
|
18
|
+
active: NavKey;
|
|
19
|
+
shell: ShellData;
|
|
20
|
+
title: string;
|
|
21
|
+
subtitle?: ReactNode;
|
|
22
|
+
actions?: ReactNode;
|
|
23
|
+
wide?: boolean;
|
|
24
|
+
}) => import("react").JSX.Element;
|
|
25
|
+
//# sourceMappingURL=Shell.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Shell.d.ts","sourceRoot":"","sources":["../../../../app/components/BlogUploader/dashboard/Shell.tsx"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAEhD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAEpD;;;;;;;;;;;GAWG;AAEH,MAAM,MAAM,MAAM,GACd,UAAU,GACV,OAAO,GACP,WAAW,GACX,WAAW,GACX,WAAW,GACX,WAAW,GACX,OAAO,GACP,YAAY,GACZ,MAAM,GACN,SAAS,GACT,OAAO,GACP,UAAU,GACV,WAAW,GACX,eAAe,GACf,eAAe,GACf,QAAQ,GACR,SAAS,GACT,WAAW,GACX,gBAAgB,GAChB,OAAO,GACP,UAAU,GACV,QAAQ,GACR,SAAS,GACT,OAAO,GACP,cAAc,GACd,cAAc,CAAA;AAsHlB,eAAO,MAAM,KAAK,GAAI,8DAQnB;IACD,QAAQ,EAAE,SAAS,CAAA;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,SAAS,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,OAAO,CAAC,EAAE,SAAS,CAAA;IACnB,IAAI,CAAC,EAAE,OAAO,CAAA;CACf,gCAuHA,CAAA"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import Link from 'next/link';
|
|
3
|
+
import { Suspense } from 'react';
|
|
4
|
+
import { BrandSwitcher } from './BrandSwitcher';
|
|
5
|
+
const Icon = ({ path }) => (_jsx("svg", { viewBox: "0 0 20 20", className: "nav-icon", "aria-hidden": "true", fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round", children: _jsx("path", { d: path }) }));
|
|
6
|
+
const ICONS = {
|
|
7
|
+
overview: 'M3 10.5 10 4l7 6.5M5 9.5V16h10V9.5',
|
|
8
|
+
posts: 'M6 3h8l2.5 2.5V17H6zM8 8h6M8 11h6M8 14h4',
|
|
9
|
+
media: 'M3.5 5h13v10h-13zM3.5 12.5l3.5-3 3 2.5 2.5-2 3.5 3M7 8.2h.01',
|
|
10
|
+
taxonomy: 'M4 5.5h12M4 10h12M4 14.5h7',
|
|
11
|
+
tags: 'M10.5 3.5H16V9l-6.5 6.5L4 10z M13 6.5h.01',
|
|
12
|
+
authors: 'M10 10.5a3 3 0 1 0 0-6 3 3 0 0 0 0 6ZM4 16.5c.8-2.6 3.1-4 6-4s5.2 1.4 6 4',
|
|
13
|
+
comments: 'M4 5.5h12v8.5H9.5L6 17v-3H4z',
|
|
14
|
+
redirects: 'M4 7.5h9l-2.2-2.2M16 12.5H7l2.2 2.2',
|
|
15
|
+
robots: 'M6 7.5h8v2.5H6zM4.5 12.5h11M7 15.5h6M10 4.5v3',
|
|
16
|
+
sitemap: 'M10 3.5v4M6 7.5h8M6 7.5v4.5h3V15M14 7.5v4.5h-3V15',
|
|
17
|
+
analytics: 'M4 15.5V9.5M8 15.5V6.5M12 15.5v-5M16 15.5V4.5',
|
|
18
|
+
'search-console': 'M4.5 5.5h11v9h-11zM7 12.5l2-2.5 2 1.5 2.5-3',
|
|
19
|
+
users: 'M8 10a2.6 2.6 0 1 0 0-5.2A2.6 2.6 0 0 0 8 10ZM2.8 16c.7-2.3 2.7-3.5 5.2-3.5s4.5 1.2 5.2 3.5M14 5.2a2.4 2.4 0 0 1 0 4.6M15.5 12.6c1.2.5 2 1.5 2.4 2.9',
|
|
20
|
+
settings: 'M10 12.4a2.4 2.4 0 1 0 0-4.8 2.4 2.4 0 0 0 0 4.8Z M10 2.8l1 1.9 2.1-.4.9 1.6-1.3 1.7.9 1.9-1.9.9.4 2.1-1.6.9-1.7-1.3-1.9.9-.9-1.9-2.1.4-.9-1.6L4.3 9 3.4 7.1l1.9-.9L4.9 4l1.6-.9L8.2 4.4Z',
|
|
21
|
+
brands: 'M4 16V8.5L10 4l6 4.5V16zM8 16v-4h4v4',
|
|
22
|
+
profile: 'M10 10a3 3 0 1 0 0-6 3 3 0 0 0 0 6ZM4 16.5c.8-2.6 3.1-4 6-4s5.2 1.4 6 4',
|
|
23
|
+
tools: 'M12.5 3.5l4 4-7.2 7.2H5.3v-4.1L12.5 3.5zM4.5 15.5h11',
|
|
24
|
+
};
|
|
25
|
+
const NAV = [
|
|
26
|
+
{
|
|
27
|
+
title: 'Editorial',
|
|
28
|
+
items: [
|
|
29
|
+
{ key: 'overview', label: 'Dashboard', href: '/admin', icon: 'overview' },
|
|
30
|
+
{
|
|
31
|
+
key: 'posts',
|
|
32
|
+
label: 'Posts',
|
|
33
|
+
href: '/admin/posts',
|
|
34
|
+
icon: 'posts',
|
|
35
|
+
badge: 'attention',
|
|
36
|
+
children: [
|
|
37
|
+
{ key: 'posts-all', label: 'All Posts', href: '/admin/posts' },
|
|
38
|
+
{ key: 'posts-new', label: 'Add Post', href: '/admin/posts/new' },
|
|
39
|
+
{ key: 'attention', label: 'Needs attention', href: '/admin/posts?state=attention', badge: 'attention' },
|
|
40
|
+
{ key: 'scheduled', label: 'Scheduled', href: '/admin/posts?state=scheduled', badge: 'scheduled' },
|
|
41
|
+
{ key: 'trash', label: 'Trash', href: '/admin/posts?state=trash', badge: 'trash' },
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
{ key: 'media', label: 'Media', href: '/admin/media', icon: 'media' },
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
title: 'Organise',
|
|
49
|
+
items: [
|
|
50
|
+
{ key: 'categories', label: 'Categories', href: '/admin/categories', icon: 'taxonomy' },
|
|
51
|
+
{ key: 'tags', label: 'Tags', href: '/admin/tags', icon: 'tags' },
|
|
52
|
+
{ key: 'authors', label: 'Authors', href: '/admin/authors', icon: 'authors' },
|
|
53
|
+
{ key: 'comments', label: 'Comments', href: '/admin/comments', icon: 'comments' },
|
|
54
|
+
],
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
title: 'SEO & Discovery',
|
|
58
|
+
items: [
|
|
59
|
+
{
|
|
60
|
+
key: 'redirects',
|
|
61
|
+
label: 'Redirect Analytics',
|
|
62
|
+
href: '/admin/redirects',
|
|
63
|
+
icon: 'redirects',
|
|
64
|
+
children: [
|
|
65
|
+
{ key: 'redirects-all', label: 'All redirects', href: '/admin/redirects' },
|
|
66
|
+
{ key: 'redirects-new', label: 'Add redirect', href: '/admin/redirects/new' },
|
|
67
|
+
],
|
|
68
|
+
},
|
|
69
|
+
{ key: 'robots', label: 'Robots.txt', href: '/admin/robots', icon: 'robots' },
|
|
70
|
+
{ key: 'sitemap', label: 'XML Sitemap', href: '/admin/sitemap', icon: 'sitemap' },
|
|
71
|
+
{ key: 'analytics', label: 'Google Analytics', href: '/admin/analytics', icon: 'analytics' },
|
|
72
|
+
{ key: 'search-console', label: 'Search Console', href: '/admin/search-console', icon: 'search-console' },
|
|
73
|
+
],
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
title: 'Tools',
|
|
77
|
+
items: [
|
|
78
|
+
{
|
|
79
|
+
key: 'tools',
|
|
80
|
+
label: 'Tools',
|
|
81
|
+
href: '/admin/tools',
|
|
82
|
+
icon: 'tools',
|
|
83
|
+
children: [
|
|
84
|
+
{ key: 'tools', label: 'Available Tools', href: '/admin/tools' },
|
|
85
|
+
{ key: 'tools-export', label: 'Export', href: '/admin/tools/export' },
|
|
86
|
+
{ key: 'tools-import', label: 'Import', href: '/admin/tools/import' },
|
|
87
|
+
],
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
title: 'Administration',
|
|
93
|
+
items: [
|
|
94
|
+
{ key: 'brands', label: 'Brands', href: '/admin/brands', icon: 'brands' },
|
|
95
|
+
{ key: 'users', label: 'People', href: '/admin/users', icon: 'users', adminOnly: true },
|
|
96
|
+
{ key: 'settings', label: 'Settings', href: '/admin/settings', icon: 'settings' },
|
|
97
|
+
],
|
|
98
|
+
},
|
|
99
|
+
];
|
|
100
|
+
const POSTS_KEYS = ['posts', 'posts-all', 'posts-new', 'attention', 'scheduled', 'trash'];
|
|
101
|
+
const REDIRECTS_KEYS = ['redirects', 'redirects-all', 'redirects-new'];
|
|
102
|
+
const TOOLS_KEYS = ['tools', 'tools-export', 'tools-import'];
|
|
103
|
+
export const Shell = ({ children, active, shell, title, subtitle, actions, wide, }) => {
|
|
104
|
+
const { tenants, activeBrand, attentionCount, scheduledCount, trashCount, userName, userRole, userAvatarUrl, isAdmin } = shell;
|
|
105
|
+
const withBrand = (href) => {
|
|
106
|
+
// New post keeps a clean URL — brand is chosen in the editor, not the query string.
|
|
107
|
+
if (href === '/admin/posts/new' || href.startsWith('/admin/posts/new?')) {
|
|
108
|
+
return '/admin/posts/new';
|
|
109
|
+
}
|
|
110
|
+
if (!activeBrand)
|
|
111
|
+
return href;
|
|
112
|
+
return href.includes('?') ? `${href}&brand=${activeBrand.slug}` : `${href}?brand=${activeBrand.slug}`;
|
|
113
|
+
};
|
|
114
|
+
const badgeValue = (badge) => badge === 'attention' ? attentionCount : badge === 'scheduled' ? scheduledCount : badge === 'trash' ? trashCount : 0;
|
|
115
|
+
return (_jsxs("div", { className: "shell", children: [_jsxs("aside", { className: "side", children: [_jsxs("div", { className: "side-brand", children: [_jsx("div", { className: "side-mark", "aria-hidden": "true", children: "B" }), _jsxs("div", { children: [_jsx("div", { className: "side-name", children: "Blog Portal" }), _jsx("div", { className: "side-role", children: activeBrand ? activeBrand.name : `${tenants.length} brands` })] })] }), _jsxs(Link, { className: "side-new", href: withBrand('/admin/posts/new'), children: [_jsx("span", { "aria-hidden": "true", children: "\uFF0B" }), " New post"] }), _jsx("div", { className: "side-scroll", children: NAV.map((section) => (_jsxs("div", { className: "side-group", children: [_jsx("p", { className: "side-sect", children: section.title }), _jsx("nav", { className: "side-nav", children: section.items
|
|
116
|
+
.filter((item) => !item.adminOnly || isAdmin)
|
|
117
|
+
.map((item) => {
|
|
118
|
+
const isActive = active === item.key ||
|
|
119
|
+
(item.key === 'posts' && POSTS_KEYS.includes(active)) ||
|
|
120
|
+
(item.key === 'redirects' && REDIRECTS_KEYS.includes(active)) ||
|
|
121
|
+
(item.key === 'tools' && TOOLS_KEYS.includes(active));
|
|
122
|
+
const badge = badgeValue(item.badge);
|
|
123
|
+
return (_jsxs("div", { children: [_jsxs(Link, { href: withBrand(item.href), prefetch: false, "aria-current": active === item.key ? 'page' : undefined, className: isActive ? 'is-open' : undefined, children: [_jsx(Icon, { path: ICONS[item.icon] }), item.label, badge ? _jsx("span", { className: "badge", children: badge }) : null] }), item.children && isActive ? (_jsx("div", { className: "side-sub", children: item.children.map((child) => {
|
|
124
|
+
const childBadge = badgeValue(child.badge);
|
|
125
|
+
return (_jsxs(Link, { href: withBrand(child.href), prefetch: false, "aria-current": active === child.key ? 'page' : undefined, children: [child.label, childBadge ? _jsx("span", { className: "badge", children: childBadge }) : null] }, child.key));
|
|
126
|
+
}) })) : null] }, item.key));
|
|
127
|
+
}) })] }, section.title))) }), _jsx("div", { className: "side-foot", children: _jsxs(Link, { href: "/admin/profile", className: `side-user-card${active === 'profile' ? ' is-active' : ''}`, "aria-current": active === 'profile' ? 'page' : undefined, children: [userAvatarUrl ? (_jsx("img", { className: "side-user-avatar", src: userAvatarUrl, alt: "", width: 36, height: 36 })) : (_jsx("span", { className: "side-user-avatar side-user-avatar-fallback", "aria-hidden": "true", children: userName.slice(0, 1).toUpperCase() })), _jsxs("span", { className: "side-user-meta", children: [_jsx("span", { className: "side-user-name", children: userName }), _jsx("span", { className: "side-user-role", children: userRole })] })] }) })] }), _jsxs("main", { className: "main", children: [_jsxs("header", { className: "top", children: [_jsxs("div", { className: "top-title", children: [_jsx("h1", { children: title }), subtitle ? _jsx("p", { className: "sub", children: subtitle }) : null] }), _jsxs("div", { className: "top-actions", children: [_jsx(Suspense, { fallback: null, children: _jsx(BrandSwitcher, { tenants: tenants, activeBrand: activeBrand }) }), actions] })] }), _jsx("div", { className: wide ? 'body body-wide' : 'body', children: children })] })] }));
|
|
128
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type TermCollection } from '../../app/(dashboard)/_actions/library';
|
|
2
|
+
/**
|
|
3
|
+
* Categories, tags and authors share one screen because they are the same shape
|
|
4
|
+
* of job: a short form on the left, the existing list on the right, editing in
|
|
5
|
+
* place. Three near-identical screens would be three places to fix a bug.
|
|
6
|
+
*
|
|
7
|
+
* Deleting is where they differ, and the difference is enforced on the server:
|
|
8
|
+
* a category or author still in use refuses to go, while a tag detaches itself
|
|
9
|
+
* from its posts first. See _actions/library.ts.
|
|
10
|
+
*/
|
|
11
|
+
export type TermRow = {
|
|
12
|
+
id: string;
|
|
13
|
+
name: string;
|
|
14
|
+
slug: string;
|
|
15
|
+
description: string;
|
|
16
|
+
jobTitle: string;
|
|
17
|
+
bio: string;
|
|
18
|
+
count: number;
|
|
19
|
+
};
|
|
20
|
+
type Props = {
|
|
21
|
+
collection: TermCollection;
|
|
22
|
+
rows: TermRow[];
|
|
23
|
+
tenant: string | null;
|
|
24
|
+
tenantName: string;
|
|
25
|
+
brandSlug?: string;
|
|
26
|
+
};
|
|
27
|
+
export declare const TermManager: ({ collection, rows, tenant, tenantName, brandSlug }: Props) => import("react").JSX.Element;
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=TermManager.d.ts.map
|