@cossackframework/cms 0.0.0 → 0.9.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/LICENSE +21 -0
- package/README.md +145 -2
- package/agent-docs.json +259 -0
- package/app/README.md +78 -0
- package/app/cossack-recipe.json +43 -0
- package/app/src/auth-bot-check.ts +32 -0
- package/app/src/auth-bot-token.ts +11 -0
- package/app/src/auth-input.ts +35 -0
- package/app/src/auth-options.ts +21 -0
- package/app/src/auth-providers.ts +16 -0
- package/app/src/auth.ts +1082 -0
- package/app/src/brand.ts +68 -0
- package/app/src/cms/ai.ts +54 -0
- package/app/src/cms/analytics.ts +33 -0
- package/app/src/cms/block-errors.ts +55 -0
- package/app/src/cms/block-inserter.ts +111 -0
- package/app/src/cms/block-panel.ts +68 -0
- package/app/src/cms/block-rows.ts +44 -0
- package/app/src/cms/block-tree.ts +585 -0
- package/app/src/cms/blocks.css +709 -0
- package/app/src/cms/builder.ts +126 -0
- package/app/src/cms/cache.ts +44 -0
- package/app/src/cms/carousel.client.ts +52 -0
- package/app/src/cms/collab/presence.ts +69 -0
- package/app/src/cms/collab/rich-text-collab.client.ts +197 -0
- package/app/src/cms/collab/rich-text-notes.client.ts +138 -0
- package/app/src/cms/collab/room.ts +881 -0
- package/app/src/cms/compare.client.ts +47 -0
- package/app/src/cms/condition-control.ts +109 -0
- package/app/src/cms/content-api.ts +143 -0
- package/app/src/cms/content.ts +524 -0
- package/app/src/cms/countdown.client.ts +37 -0
- package/app/src/cms/editor-layout-editor.ts +260 -0
- package/app/src/cms/editor-layout-view.ts +37 -0
- package/app/src/cms/editor.ts +381 -0
- package/app/src/cms/entry.ts +26 -0
- package/app/src/cms/feeds.ts +145 -0
- package/app/src/cms/field-controls.ts +222 -0
- package/app/src/cms/field-group-editor.ts +105 -0
- package/app/src/cms/field-group-view.ts +211 -0
- package/app/src/cms/form-view.ts +203 -0
- package/app/src/cms/form.client.ts +203 -0
- package/app/src/cms/guards.ts +27 -0
- package/app/src/cms/handoff.ts +202 -0
- package/app/src/cms/headings.ts +51 -0
- package/app/src/cms/icons.ts +80 -0
- package/app/src/cms/import.client.ts +16 -0
- package/app/src/cms/index.ts +191 -0
- package/app/src/cms/lightbox.client.ts +114 -0
- package/app/src/cms/machine.ts +118 -0
- package/app/src/cms/maintenance.ts +97 -0
- package/app/src/cms/manage.ts +1236 -0
- package/app/src/cms/mcp-tools.ts +388 -0
- package/app/src/cms/mcp.ts +242 -0
- package/app/src/cms/media-chooser.ts +123 -0
- package/app/src/cms/media-usage.ts +57 -0
- package/app/src/cms/middleware.ts +199 -0
- package/app/src/cms/middlewares.ts +13 -0
- package/app/src/cms/network-ui.ts +36 -0
- package/app/src/cms/network-view.ts +38 -0
- package/app/src/cms/notes-announce.ts +65 -0
- package/app/src/cms/notes-rail.ts +207 -0
- package/app/src/cms/notification-rules.ts +66 -0
- package/app/src/cms/recovery.ts +82 -0
- package/app/src/cms/replace.ts +63 -0
- package/app/src/cms/reserved-paths.ts +19 -0
- package/app/src/cms/rich-text-field.ts +325 -0
- package/app/src/cms/rich-text-schema.ts +91 -0
- package/app/src/cms/rich-text.client.ts +255 -0
- package/app/src/cms/search.client.ts +116 -0
- package/app/src/cms/seo-head.ts +78 -0
- package/app/src/cms/seo.ts +241 -0
- package/app/src/cms/settings-draft.ts +218 -0
- package/app/src/cms/settings-file.ts +127 -0
- package/app/src/cms/settings-form.ts +180 -0
- package/app/src/cms/settings-languages.ts +125 -0
- package/app/src/cms/settings-nav.ts +102 -0
- package/app/src/cms/settings-network.ts +151 -0
- package/app/src/cms/settings-permalinks.ts +114 -0
- package/app/src/cms/settings-scroll.ts +10 -0
- package/app/src/cms/settings-search.ts +77 -0
- package/app/src/cms/settings-section.ts +38 -0
- package/app/src/cms/share.client.ts +27 -0
- package/app/src/cms/site-editing.ts +219 -0
- package/app/src/cms/site-editor.client.ts +1008 -0
- package/app/src/cms/site-editor.ts +99 -0
- package/app/src/cms/site-export.ts +60 -0
- package/app/src/cms/site-forms.ts +143 -0
- package/app/src/cms/site-import.ts +28 -0
- package/app/src/cms/site-session.ts +36 -0
- package/app/src/cms/site-taskbar.ts +77 -0
- package/app/src/cms/site-view.ts +1014 -0
- package/app/src/cms/site.ts +1322 -0
- package/app/src/cms/sitemaps.ts +131 -0
- package/app/src/cms/stat.client.ts +56 -0
- package/app/src/cms/style-controls.ts +252 -0
- package/app/src/cms/tabs.client.ts +36 -0
- package/app/src/cms/taskbar.ts +134 -0
- package/app/src/cms/term-icons.ts +10 -0
- package/app/src/cms/traffic.ts +26 -0
- package/app/src/cms/ui.ts +170 -0
- package/app/src/cms/updates.ts +124 -0
- package/app/src/cms/uploads.ts +26 -0
- package/app/src/cms/worker.ts +13 -0
- package/app/src/config/auth.ts +30 -0
- package/app/src/config/cms.ts +18 -0
- package/app/src/dashboard/access.ts +344 -0
- package/app/src/dashboard/agent-icons.ts +44 -0
- package/app/src/dashboard/app-passwords.ts +62 -0
- package/app/src/dashboard/avatar-field.ts +58 -0
- package/app/src/dashboard/bulk.ts +22 -0
- package/app/src/dashboard/head.ts +29 -0
- package/app/src/dashboard/icons.ts +15 -0
- package/app/src/dashboard/list-table.ts +28 -0
- package/app/src/dashboard/modules/roles.ts +15 -0
- package/app/src/dashboard/modules/sessions.ts +15 -0
- package/app/src/dashboard/modules/settings.ts +15 -0
- package/app/src/dashboard/modules/users.ts +18 -0
- package/app/src/dashboard/page.ts +67 -0
- package/app/src/dashboard/registry.ts +18 -0
- package/app/src/dashboard/session-list.ts +98 -0
- package/app/src/dashboard/tabs.ts +2 -0
- package/app/src/dashboard/time-ago.ts +16 -0
- package/app/src/dashboard/types.ts +43 -0
- package/app/src/dashboard/user-sections.ts +172 -0
- package/app/src/lib/permissions.ts +84 -0
- package/app/src/middlewares/auth.ts +117 -0
- package/app/src/pages/(site)/[...path]/index.ts +609 -0
- package/app/src/pages/(site)/feed/[...rest]/index.ts +13 -0
- package/app/src/pages/(site)/feed/index.ts +12 -0
- package/app/src/pages/(site)/index.ts +11 -0
- package/app/src/pages/(site)/indexnow/[file]/index.ts +18 -0
- package/app/src/pages/(site)/layout.ts +219 -0
- package/app/src/pages/(site)/llms.txt/index.ts +23 -0
- package/app/src/pages/(site)/manifest.webmanifest/index.ts +29 -0
- package/app/src/pages/(site)/media/[id]/[name]/index.ts +59 -0
- package/app/src/pages/(site)/preview/[collection]/[id]/index.ts +115 -0
- package/app/src/pages/(site)/robots.txt/index.ts +29 -0
- package/app/src/pages/(site)/search/index.ts +36 -0
- package/app/src/pages/(site)/sitemap.xml/index.ts +26 -0
- package/app/src/pages/(site)/sitemaps/[file]/index.ts +33 -0
- package/app/src/pages/api/auth/session.ts +48 -0
- package/app/src/pages/api/cms/appearance/areas/[name].ts +12 -0
- package/app/src/pages/api/cms/appearance/areas/index.ts +6 -0
- package/app/src/pages/api/cms/appearance/locations/[location].ts +6 -0
- package/app/src/pages/api/cms/appearance/locations/index.ts +6 -0
- package/app/src/pages/api/cms/appearance/menus/[id].ts +12 -0
- package/app/src/pages/api/cms/appearance/menus/index.ts +13 -0
- package/app/src/pages/api/cms/appearance/themes/[name]/activate.ts +6 -0
- package/app/src/pages/api/cms/appearance/themes/index.ts +6 -0
- package/app/src/pages/api/cms/cache/purge.ts +6 -0
- package/app/src/pages/api/cms/collections/index.ts +6 -0
- package/app/src/pages/api/cms/commands/[plugin]/[command].ts +26 -0
- package/app/src/pages/api/cms/comments/[id].ts +9 -0
- package/app/src/pages/api/cms/comments/index.ts +126 -0
- package/app/src/pages/api/cms/comments/queue.ts +6 -0
- package/app/src/pages/api/cms/content/[collection]/[entry]/autosave.ts +27 -0
- package/app/src/pages/api/cms/content/[collection]/[entry]/blocks/[block].ts +16 -0
- package/app/src/pages/api/cms/content/[collection]/[entry]/notes.ts +18 -0
- package/app/src/pages/api/cms/content/[collection]/[entry]/publish.ts +11 -0
- package/app/src/pages/api/cms/content/[collection]/[entry]/revisions/[revision]/index.ts +6 -0
- package/app/src/pages/api/cms/content/[collection]/[entry]/revisions/[revision]/restore.ts +6 -0
- package/app/src/pages/api/cms/content/[collection]/[entry]/revisions/index.ts +6 -0
- package/app/src/pages/api/cms/content/[collection]/[entry]/unpublish.ts +6 -0
- package/app/src/pages/api/cms/content/[collection]/[entry].ts +42 -0
- package/app/src/pages/api/cms/content/[collection]/index.ts +24 -0
- package/app/src/pages/api/cms/export/[collection].ts +37 -0
- package/app/src/pages/api/cms/forms/[slug]/index.ts +173 -0
- package/app/src/pages/api/cms/forms/[slug]/submissions/[submission]/files/[file].ts +25 -0
- package/app/src/pages/api/cms/forms/[slug]/submissions/export.ts +34 -0
- package/app/src/pages/api/cms/forms/[slug]/submissions/index.ts +24 -0
- package/app/src/pages/api/cms/import/[collection].ts +23 -0
- package/app/src/pages/api/cms/mcp.ts +29 -0
- package/app/src/pages/api/cms/me/index.ts +6 -0
- package/app/src/pages/api/cms/me/recent-blocks.ts +37 -0
- package/app/src/pages/api/cms/me/tokens/[id].ts +6 -0
- package/app/src/pages/api/cms/me/tokens/index.ts +13 -0
- package/app/src/pages/api/cms/media/[id].ts +6 -0
- package/app/src/pages/api/cms/media.ts +26 -0
- package/app/src/pages/api/cms/menus/[location].ts +14 -0
- package/app/src/pages/api/cms/network/sites/[id]/export.ts +15 -0
- package/app/src/pages/api/cms/network/sites/[id]/index.ts +9 -0
- package/app/src/pages/api/cms/network/sites/index.ts +14 -0
- package/app/src/pages/api/cms/notes/[id].ts +13 -0
- package/app/src/pages/api/cms/notes/index.ts +6 -0
- package/app/src/pages/api/cms/payments/webhook.ts +28 -0
- package/app/src/pages/api/cms/plugins/[name]/grant.ts +6 -0
- package/app/src/pages/api/cms/plugins/[name]/revoke.ts +6 -0
- package/app/src/pages/api/cms/plugins/index.ts +6 -0
- package/app/src/pages/api/cms/recovery.ts +29 -0
- package/app/src/pages/api/cms/redirects/index.ts +9 -0
- package/app/src/pages/api/cms/roles/index.ts +6 -0
- package/app/src/pages/api/cms/schema/[collection].ts +13 -0
- package/app/src/pages/api/cms/search.ts +16 -0
- package/app/src/pages/api/cms/settings/[group].ts +9 -0
- package/app/src/pages/api/cms/settings/index.ts +9 -0
- package/app/src/pages/api/cms/site-export.ts +34 -0
- package/app/src/pages/api/cms/taxonomies/index.ts +6 -0
- package/app/src/pages/api/cms/terms/[taxonomy]/[id].ts +12 -0
- package/app/src/pages/api/cms/terms/[taxonomy]/index.ts +9 -0
- package/app/src/pages/api/cms/uploads/[id]/complete.ts +15 -0
- package/app/src/pages/api/cms/uploads/[id]/index.ts +15 -0
- package/app/src/pages/api/cms/uploads/index.ts +26 -0
- package/app/src/pages/api/cms/users/[id]/index.ts +12 -0
- package/app/src/pages/api/cms/users/[id]/meta.ts +40 -0
- package/app/src/pages/api/cms/users/index.ts +12 -0
- package/app/src/pages/api/cms/webhooks/[id].ts +6 -0
- package/app/src/pages/api/cms/webhooks/index.ts +9 -0
- package/app/src/pages/auth/[provider]/callback.ts +11 -0
- package/app/src/pages/auth/[provider]/redirect.ts +9 -0
- package/app/src/pages/auth/forgot-password/index.ts +82 -0
- package/app/src/pages/auth/layout.ts +32 -0
- package/app/src/pages/auth/login/index.ts +205 -0
- package/app/src/pages/auth/magic/index.ts +68 -0
- package/app/src/pages/auth/register/index.ts +124 -0
- package/app/src/pages/auth/reset-password/index.ts +74 -0
- package/app/src/pages/auth/setup/index.ts +194 -0
- package/app/src/pages/auth/two-factor/index.ts +69 -0
- package/app/src/pages/auth/verify/index.ts +62 -0
- package/app/src/pages/dashboard/(cms)/appearance/customize/index.ts +263 -0
- package/app/src/pages/dashboard/(cms)/appearance/dashboard-menu/index.ts +241 -0
- package/app/src/pages/dashboard/(cms)/appearance/index.ts +89 -0
- package/app/src/pages/dashboard/(cms)/appearance/menus/[id]/index.ts +697 -0
- package/app/src/pages/dashboard/(cms)/appearance/menus/index.ts +145 -0
- package/app/src/pages/dashboard/(cms)/appearance/widgets/index.ts +279 -0
- package/app/src/pages/dashboard/(cms)/blocks/index.ts +84 -0
- package/app/src/pages/dashboard/(cms)/calendar/index.ts +92 -0
- package/app/src/pages/dashboard/(cms)/collections/[name]/index.ts +525 -0
- package/app/src/pages/dashboard/(cms)/collections/index.ts +72 -0
- package/app/src/pages/dashboard/(cms)/collections/new/index.ts +66 -0
- package/app/src/pages/dashboard/(cms)/comments/index.ts +237 -0
- package/app/src/pages/dashboard/(cms)/content/[collection]/[id]/index.ts +2382 -0
- package/app/src/pages/dashboard/(cms)/content/[collection]/[id]/revisions/index.ts +126 -0
- package/app/src/pages/dashboard/(cms)/content/[collection]/index.ts +693 -0
- package/app/src/pages/dashboard/(cms)/field-groups/[id]/index.ts +193 -0
- package/app/src/pages/dashboard/(cms)/field-groups/index.ts +65 -0
- package/app/src/pages/dashboard/(cms)/forms/[id]/submissions/[submission]/index.ts +279 -0
- package/app/src/pages/dashboard/(cms)/forms/[id]/submissions/index.ts +170 -0
- package/app/src/pages/dashboard/(cms)/forms/index.ts +171 -0
- package/app/src/pages/dashboard/(cms)/media/[id]/index.ts +317 -0
- package/app/src/pages/dashboard/(cms)/media/index.ts +156 -0
- package/app/src/pages/dashboard/(cms)/media/new/index.ts +9 -0
- package/app/src/pages/dashboard/(cms)/media/summary/index.ts +74 -0
- package/app/src/pages/dashboard/(cms)/my-sites/index.ts +63 -0
- package/app/src/pages/dashboard/(cms)/network/index.ts +53 -0
- package/app/src/pages/dashboard/(cms)/network/plugins/index.ts +110 -0
- package/app/src/pages/dashboard/(cms)/network/sites/[id]/index.ts +243 -0
- package/app/src/pages/dashboard/(cms)/network/sites/index.ts +186 -0
- package/app/src/pages/dashboard/(cms)/network/sites/new/index.ts +77 -0
- package/app/src/pages/dashboard/(cms)/network/themes/index.ts +82 -0
- package/app/src/pages/dashboard/(cms)/network/updates/index.ts +48 -0
- package/app/src/pages/dashboard/(cms)/network/users/[id]/index.ts +176 -0
- package/app/src/pages/dashboard/(cms)/network/users/index.ts +174 -0
- package/app/src/pages/dashboard/(cms)/network/users/new/index.ts +66 -0
- package/app/src/pages/dashboard/(cms)/plugins/index.ts +172 -0
- package/app/src/pages/dashboard/(cms)/profile/public/index.ts +105 -0
- package/app/src/pages/dashboard/(cms)/registrations/index.ts +70 -0
- package/app/src/pages/dashboard/(cms)/settings/index.ts +359 -0
- package/app/src/pages/dashboard/(cms)/settings/json/index.ts +202 -0
- package/app/src/pages/dashboard/(cms)/settings/layout.ts +67 -0
- package/app/src/pages/dashboard/(cms)/taxonomies/[name]/index.ts +85 -0
- package/app/src/pages/dashboard/(cms)/taxonomies/index.ts +98 -0
- package/app/src/pages/dashboard/(cms)/terms/[taxonomy]/[id]/index.ts +244 -0
- package/app/src/pages/dashboard/(cms)/terms/[taxonomy]/index.ts +148 -0
- package/app/src/pages/dashboard/(cms)/tools/activity/index.ts +94 -0
- package/app/src/pages/dashboard/(cms)/tools/automations/index.ts +131 -0
- package/app/src/pages/dashboard/(cms)/tools/cache/index.ts +92 -0
- package/app/src/pages/dashboard/(cms)/tools/export/index.ts +99 -0
- package/app/src/pages/dashboard/(cms)/tools/health/index.ts +189 -0
- package/app/src/pages/dashboard/(cms)/tools/jobs/index.ts +93 -0
- package/app/src/pages/dashboard/(cms)/tools/links/index.ts +115 -0
- package/app/src/pages/dashboard/(cms)/tools/redirects/index.ts +161 -0
- package/app/src/pages/dashboard/(cms)/tools/replace/index.ts +124 -0
- package/app/src/pages/dashboard/(cms)/tools/schema/index.ts +54 -0
- package/app/src/pages/dashboard/(cms)/tools/seo/index.ts +156 -0
- package/app/src/pages/dashboard/(cms)/tools/updates/index.ts +114 -0
- package/app/src/pages/dashboard/(cms)/tools/webhooks/index.ts +183 -0
- package/app/src/pages/dashboard/index.ts +214 -0
- package/app/src/pages/dashboard/layout.ts +227 -0
- package/app/src/pages/dashboard/profile/index.ts +211 -0
- package/app/src/pages/dashboard/profile/security/index.ts +249 -0
- package/app/src/pages/dashboard/roles/[id]/index.ts +116 -0
- package/app/src/pages/dashboard/roles/index.ts +134 -0
- package/app/src/pages/dashboard/roles/new/index.ts +95 -0
- package/app/src/pages/dashboard/sessions/index.ts +105 -0
- package/app/src/pages/dashboard/users/[id]/index.ts +472 -0
- package/app/src/pages/dashboard/users/index.ts +299 -0
- package/app/src/pages/dashboard/users/new/index.ts +123 -0
- package/app/src/passkeys.client.ts +18 -0
- package/app/src/plugins/default-theme/assets/cover.svg +31 -0
- package/app/src/plugins/default-theme/assets/logo.svg +8 -0
- package/app/src/plugins/default-theme/parts/comments.ts +66 -0
- package/app/src/plugins/default-theme/parts/list.ts +38 -0
- package/app/src/plugins/default-theme/parts/media.ts +15 -0
- package/app/src/plugins/default-theme/parts/options.ts +45 -0
- package/app/src/plugins/default-theme/plugin.json +275 -0
- package/app/src/plugins/default-theme/templates/archive.ts +14 -0
- package/app/src/plugins/default-theme/templates/entry-blank.ts +13 -0
- package/app/src/plugins/default-theme/templates/entry.ts +27 -0
- package/app/src/plugins/default-theme/templates/home.ts +8 -0
- package/app/src/plugins/default-theme/templates/layout.ts +40 -0
- package/app/src/plugins/default-theme/templates/not-found.ts +10 -0
- package/app/src/plugins/default-theme/templates/search.ts +32 -0
- package/app/src/services/rbac.ts +65 -0
- package/app/src/services/roles.ts +89 -0
- package/app/src/services/users.ts +173 -0
- package/package.json +114 -2
- package/src/automations.ts +95 -0
- package/src/bindings.ts +138 -0
- package/src/block-references.ts +239 -0
- package/src/block-shape.ts +155 -0
- package/src/blocks.ts +1157 -0
- package/src/cache.ts +54 -0
- package/src/checks.ts +198 -0
- package/src/cloudflare-workers.d.ts +13 -0
- package/src/cloudflare.ts +61 -0
- package/src/collab.ts +372 -0
- package/src/collections.ts +421 -0
- package/src/comments.ts +46 -0
- package/src/cron.ts +95 -0
- package/src/dashboard-menu.ts +105 -0
- package/src/diff.ts +113 -0
- package/src/editor-layout.ts +316 -0
- package/src/errors.ts +50 -0
- package/src/field-groups.ts +498 -0
- package/src/fields.ts +411 -0
- package/src/form-builder.ts +1053 -0
- package/src/forms.ts +109 -0
- package/src/highlight.ts +134 -0
- package/src/hooks.ts +510 -0
- package/src/icon-catalog.ts +55 -0
- package/src/icons.ts +128 -0
- package/src/images.ts +149 -0
- package/src/index.ts +100 -0
- package/src/isolate-core.ts +245 -0
- package/src/isolate.ts +19 -0
- package/src/isolation.ts +69 -0
- package/src/mail.ts +182 -0
- package/src/manifest.ts +476 -0
- package/src/media.ts +193 -0
- package/src/menus.ts +287 -0
- package/src/module.ts +32 -0
- package/src/modules/content.ts +64 -0
- package/src/modules/forms.ts +35 -0
- package/src/node.ts +66 -0
- package/src/notes.ts +237 -0
- package/src/permissions.ts +139 -0
- package/src/plugin-settings.ts +114 -0
- package/src/records.ts +56 -0
- package/src/redirects.ts +59 -0
- package/src/resource.ts +245 -0
- package/src/richtext.ts +402 -0
- package/src/schema-json.ts +112 -0
- package/src/search.ts +89 -0
- package/src/seo.ts +477 -0
- package/src/server/accounts.ts +418 -0
- package/src/server/ai.ts +33 -0
- package/src/server/api-tokens.ts +91 -0
- package/src/server/areas.ts +116 -0
- package/src/server/audit.ts +94 -0
- package/src/server/auth.ts +89 -0
- package/src/server/automations.ts +190 -0
- package/src/server/autosaves.ts +69 -0
- package/src/server/brand-icons.ts +50 -0
- package/src/server/brands.ts +86 -0
- package/src/server/budget.ts +97 -0
- package/src/server/cache.ts +104 -0
- package/src/server/capabilities.ts +333 -0
- package/src/server/cloudflare.ts +92 -0
- package/src/server/comments.ts +237 -0
- package/src/server/drafts.ts +176 -0
- package/src/server/field-groups.ts +88 -0
- package/src/server/files.ts +780 -0
- package/src/server/forms.ts +726 -0
- package/src/server/handoffs.ts +107 -0
- package/src/server/host-schema.ts +312 -0
- package/src/server/host.ts +2892 -0
- package/src/server/images.ts +34 -0
- package/src/server/index.ts +59 -0
- package/src/server/indexnow.ts +91 -0
- package/src/server/isolation.ts +183 -0
- package/src/server/locked.ts +45 -0
- package/src/server/mail.ts +93 -0
- package/src/server/markdown.ts +24 -0
- package/src/server/menus.ts +286 -0
- package/src/server/network-policy.ts +60 -0
- package/src/server/network.ts +665 -0
- package/src/server/notes.ts +275 -0
- package/src/server/outbox.ts +213 -0
- package/src/server/path-moves.ts +33 -0
- package/src/server/payments.ts +59 -0
- package/src/server/previews.ts +62 -0
- package/src/server/purge.ts +140 -0
- package/src/server/reconcile.ts +38 -0
- package/src/server/redirects.ts +183 -0
- package/src/server/repository.ts +1107 -0
- package/src/server/schedules.ts +105 -0
- package/src/server/schema.ts +562 -0
- package/src/server/security.ts +391 -0
- package/src/server/seed.ts +52 -0
- package/src/server/shared-fields.ts +34 -0
- package/src/server/site-export.ts +151 -0
- package/src/server/site-import.ts +482 -0
- package/src/server/site-search.ts +289 -0
- package/src/server/site-settings.ts +286 -0
- package/src/server/sites.ts +243 -0
- package/src/server/stores.ts +314 -0
- package/src/server/stripe.ts +173 -0
- package/src/server/taxonomies.ts +415 -0
- package/src/server/tokens.ts +25 -0
- package/src/server/traffic.ts +118 -0
- package/src/server/users.ts +653 -0
- package/src/server/webhooks.ts +245 -0
- package/src/settings-controls.ts +54 -0
- package/src/settings-document.ts +111 -0
- package/src/settings.ts +426 -0
- package/src/storage/cloudflare.ts +94 -0
- package/src/storage/index.ts +30 -0
- package/src/storage/node.ts +114 -0
- package/src/taxonomy.ts +51 -0
- package/src/theme.ts +1135 -0
- package/src/to-markdown.ts +179 -0
- package/src/updates.ts +126 -0
- package/src/version.ts +2 -0
- package/src/vite.d.ts +25 -0
- package/src/vite.js +199 -0
- package/src/webhooks.ts +107 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Cossack, Page, State, Server, Client, type HeadValue } from '@cossackframework/core';
|
|
2
|
+
import { input } from '@cossackframework/core/input';
|
|
3
|
+
import { Button, Card, CardBody, Field, IconPicker, Input, NativeSelect } from '@cossackframework/ui';
|
|
4
|
+
import { html, component } from '@cossackframework/renderer';
|
|
5
|
+
import { isCmsError, PERMISSIONS } from '@cossackframework/cms';
|
|
6
|
+
import { collectionName } from '#app/cms/builder';
|
|
7
|
+
import { requireAny } from '#app/cms/guards';
|
|
8
|
+
import { ICON_CATALOG } from '#app/cms/icons';
|
|
9
|
+
import { notice, pageHeader } from '#app/cms/ui';
|
|
10
|
+
|
|
11
|
+
/** A new collection: its names and icon; the builder takes over once it exists. */
|
|
12
|
+
@Page({ transport: 'http', middlewares: [requireAny(PERMISSIONS.manageCollections)] })
|
|
13
|
+
export default class NewCollectionPage extends Cossack {
|
|
14
|
+
@State() draft = { label: '', singular: '', icon: 'box' };
|
|
15
|
+
@State() error = '';
|
|
16
|
+
|
|
17
|
+
head(): HeadValue {
|
|
18
|
+
return { title: __('New collection') };
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@Client()
|
|
22
|
+
setDraft(name: 'label' | 'singular' | 'icon', value: string) {
|
|
23
|
+
this.draft = { ...this.draft, [name]: value };
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@Client()
|
|
27
|
+
async submit(event: Event) {
|
|
28
|
+
event.preventDefault();
|
|
29
|
+
await this.create(this.draft.label, this.draft.singular, this.draft.icon);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@Server({ input: input.args(input.string({ maxLength: 2000 }), input.string({ maxLength: 2000 }), input.string({ maxLength: 2000 })) })
|
|
33
|
+
async create(label: string, singular: string, iconName: string) {
|
|
34
|
+
this.error = '';
|
|
35
|
+
const name = collectionName(label);
|
|
36
|
+
try {
|
|
37
|
+
await this.c.get('cms').saveCollection({
|
|
38
|
+
name, label, singular: singular.trim() || label.trim().replace(/s$/i, ''), icon: iconName,
|
|
39
|
+
path: name.replaceAll('_', '-'), slug: true, publishable: true, features: { content: true }, fields: {},
|
|
40
|
+
}, this.c.get('principal'));
|
|
41
|
+
return this.redirect(`/dashboard/collections/${name}?created=1`);
|
|
42
|
+
} catch (error) {
|
|
43
|
+
this.error = isCmsError(error) ? error.message : __('The collection could not be created.');
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
render() {
|
|
48
|
+
return html`<div class="space-y-6">
|
|
49
|
+
${pageHeader(__('New collection'), {
|
|
50
|
+
description: __('A content type with its own list, editor and site URLs. Choose its features and attach field groups next.'),
|
|
51
|
+
actions: html`<a href="/dashboard/collections" class="text-sm text-muted-foreground hover:text-foreground">← ${__('Collections')}</a>`,
|
|
52
|
+
})}
|
|
53
|
+
${this.error ? notice(this.error, 'error') : null}
|
|
54
|
+
${component(Card, { class: 'max-w-xl' }, component(CardBody, {}, html`
|
|
55
|
+
<form class="space-y-4" @submit=${(event: Event) => this.submit(event)}>
|
|
56
|
+
${component(Field, { label: __('Plural name'), for: 'collection-label', hint: this.draft.label ? `${__('Stored as')} ${collectionName(this.draft.label) || '…'}` : __('Such as Products or Events.'),
|
|
57
|
+
control: attributes => component(Input, { ...attributes, '.value': this.draft.label, '@input': (event: Event) => this.setDraft('label', (event.target as HTMLInputElement).value) }) })}
|
|
58
|
+
${component(Field, { label: __('Singular name'), for: 'collection-singular', hint: __('Such as Product.'),
|
|
59
|
+
control: attributes => component(Input, { ...attributes, '.value': this.draft.singular, '@input': (event: Event) => this.setDraft('singular', (event.target as HTMLInputElement).value) }) })}
|
|
60
|
+
${component(Field, { label: __('Icon'), for: 'collection-icon-picker',
|
|
61
|
+
control: () => component(IconPicker, { id: 'collection-icon', value: this.draft.icon, icons: ICON_CATALOG, label: __('Icon'), allowEmpty: false, onChange: (name: string) => this.setDraft('icon', name) }) })}
|
|
62
|
+
${component(Button, { type: 'submit', disabled: !collectionName(this.draft.label) }, __('Create collection'))}
|
|
63
|
+
</form>`))}
|
|
64
|
+
</div>`;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import { Cossack, Page, State, Server, Client, type HeadValue } from '@cossackframework/core';
|
|
2
|
+
import { Avatar, Badge, Button, Card, CardBody, Checkbox, Input, NativeSelect, Pagination, Textarea } from '@cossackframework/ui';
|
|
3
|
+
import { html, component, type TemplateResult } from '@cossackframework/renderer';
|
|
4
|
+
import { CmsError, COMMENT_STATUSES, hasPermission, isCmsError, PERMISSIONS, recordTitle, type CommentStatus } from '@cossackframework/cms';
|
|
5
|
+
import { requireAny } from '#app/cms/guards';
|
|
6
|
+
import { notice, pageHeader, shortDate } from '#app/cms/ui';
|
|
7
|
+
|
|
8
|
+
const PAGE_SIZE = 20;
|
|
9
|
+
|
|
10
|
+
interface Row {
|
|
11
|
+
id: string;
|
|
12
|
+
status: CommentStatus;
|
|
13
|
+
author: string;
|
|
14
|
+
email: string;
|
|
15
|
+
url: string;
|
|
16
|
+
avatar: string | null;
|
|
17
|
+
content: string;
|
|
18
|
+
date: string;
|
|
19
|
+
entry: { title: string; edit: string; view: string | null } | null;
|
|
20
|
+
parentAuthor: string;
|
|
21
|
+
collection: string;
|
|
22
|
+
entryId: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Comments, as in WordPress: status tabs with counts, approve, reply, edit, spam and trash,
|
|
27
|
+
* one at a time or in bulk. Moderators' replies appear at once.
|
|
28
|
+
*/
|
|
29
|
+
@Page({ transport: 'http', middlewares: [requireAny(PERMISSIONS.moderateComments)] })
|
|
30
|
+
export default class CommentsPage extends Cossack {
|
|
31
|
+
@State() status: 'all' | CommentStatus = 'all';
|
|
32
|
+
@State() counts: Record<string, number> = {};
|
|
33
|
+
@State() rows: Row[] = [];
|
|
34
|
+
@State() total = 0;
|
|
35
|
+
@State() page = 1;
|
|
36
|
+
@State() search = '';
|
|
37
|
+
@State() entryFilter = { collection: '', entry: '', title: '' };
|
|
38
|
+
@State() selected: string[] = [];
|
|
39
|
+
@State() bulk = '';
|
|
40
|
+
@State() replying = '';
|
|
41
|
+
@State() replyText = '';
|
|
42
|
+
@State() editing: { id: string; content: string; authorName: string; authorEmail: string; authorUrl: string } | null = null;
|
|
43
|
+
@State() error = '';
|
|
44
|
+
/** What the last reply did. */
|
|
45
|
+
@State() message = '';
|
|
46
|
+
/** Settings → Discussion → Allow discussions; off hides comments on the site, and they can still be moderated here. */
|
|
47
|
+
@State() discussions = true;
|
|
48
|
+
|
|
49
|
+
head(): HeadValue {
|
|
50
|
+
return { title: __('Comments') };
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async init() {
|
|
54
|
+
this.discussions = await this.c.get('cms').settings.get('discussion.enabled');
|
|
55
|
+
const status = this.c.req.query('status') as CommentStatus | undefined;
|
|
56
|
+
this.status = status && COMMENT_STATUSES.includes(status) ? status : 'all';
|
|
57
|
+
this.search = (this.c.req.query('q') ?? '').slice(0, 100);
|
|
58
|
+
this.entryFilter = { collection: this.c.req.query('collection') ?? '', entry: this.c.req.query('entry') ?? '', title: '' };
|
|
59
|
+
const page = Number(this.c.req.query('page'));
|
|
60
|
+
this.page = Number.isSafeInteger(page) && page > 0 ? page : 1;
|
|
61
|
+
await this.load();
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
@Server()
|
|
65
|
+
private async load() {
|
|
66
|
+
const cms = this.c.get('cms');
|
|
67
|
+
const principal = this.c.get('principal');
|
|
68
|
+
const counts = await cms.comments.counts();
|
|
69
|
+
this.counts = { ...counts, all: counts.pending + counts.approved };
|
|
70
|
+
const resource = this.entryFilter.collection ? `cms/${this.entryFilter.collection}` : undefined;
|
|
71
|
+
const result = await cms.comments.list({
|
|
72
|
+
...(this.status === 'all' ? {} : { status: this.status }), ...(this.search ? { search: this.search } : {}),
|
|
73
|
+
...(resource && this.entryFilter.entry ? { resource, recordId: this.entryFilter.entry } : {}),
|
|
74
|
+
offset: (this.page - 1) * PAGE_SIZE, limit: PAGE_SIZE,
|
|
75
|
+
});
|
|
76
|
+
this.total = result.total;
|
|
77
|
+
// Entry titles and links, one read per collection.
|
|
78
|
+
const entries = new Map<string, { title: string; edit: string; view: string | null }>();
|
|
79
|
+
for (const name of new Set(result.items.map(item => item.resource))) {
|
|
80
|
+
if (!name.startsWith('cms/')) continue;
|
|
81
|
+
try {
|
|
82
|
+
const collection = cms.collection(name.slice(4));
|
|
83
|
+
const records = await cms.resource(name).getMany(result.items.filter(item => item.resource === name).map(item => item.recordId), { principal });
|
|
84
|
+
const urls = await cms.entryUrls(collection, [...records.values()]);
|
|
85
|
+
for (const record of records.values()) entries.set(`${name}:${record.id}`, { title: recordTitle(record, 'title'), edit: `/dashboard/content/${collection.name}/${record.id}`, view: record.status === 'published' ? urls.get(record.id) ?? null : null });
|
|
86
|
+
} catch (error) { if (!isCmsError(error)) throw error; }
|
|
87
|
+
}
|
|
88
|
+
if (resource && this.entryFilter.entry) this.entryFilter = { ...this.entryFilter, title: entries.get(`${resource}:${this.entryFilter.entry}`)?.title ?? '' };
|
|
89
|
+
const users = await cms.users.getMany(result.items.map(item => item.userId).filter((id): id is string => !!id));
|
|
90
|
+
const parents = await Promise.all(result.items.map(item => item.parentId ? cms.comments.get(item.parentId) : null));
|
|
91
|
+
this.rows = result.items.map((item, index) => ({
|
|
92
|
+
id: item.id, status: item.status, author: item.authorName || __('Anonymous'), email: item.authorEmail, url: item.authorUrl,
|
|
93
|
+
avatar: item.userId ? users.get(item.userId)?.avatar ?? null : null, content: item.content, date: shortDate(item.createdAt),
|
|
94
|
+
entry: entries.get(`${item.resource}:${item.recordId}`) ?? null, parentAuthor: parents[index]?.authorName ?? '',
|
|
95
|
+
collection: item.resource.slice(4), entryId: item.recordId,
|
|
96
|
+
}));
|
|
97
|
+
this.selected = [];
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
@Server()
|
|
101
|
+
async moderate(ids: string[], status: CommentStatus | 'delete') {
|
|
102
|
+
this.error = '';
|
|
103
|
+
this.message = '';
|
|
104
|
+
try {
|
|
105
|
+
await this.c.get('cms').moderateComments(ids, status, this.c.get('principal'));
|
|
106
|
+
} catch (error) { this.error = isCmsError(error) ? error.message : __('The comments could not be changed.'); }
|
|
107
|
+
await this.load();
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
@Client()
|
|
111
|
+
async applyBulk() {
|
|
112
|
+
if (!this.bulk || !this.selected.length) return;
|
|
113
|
+
await this.moderate(this.selected, this.bulk as CommentStatus | 'delete');
|
|
114
|
+
this.bulk = '';
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
@Server()
|
|
118
|
+
async reply(row: Row, content: string) {
|
|
119
|
+
this.error = '';
|
|
120
|
+
this.message = '';
|
|
121
|
+
try {
|
|
122
|
+
await this.c.get('cms').postComment({ collection: row.collection, entry: row.entryId, parent: row.id, content }, { principal: this.c.get('principal') });
|
|
123
|
+
this.replying = '';
|
|
124
|
+
this.replyText = '';
|
|
125
|
+
this.message = __('Reply posted.');
|
|
126
|
+
} catch (error) { this.error = isCmsError(error) ? error.message : __('The reply could not be posted.'); }
|
|
127
|
+
await this.load();
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
@Server()
|
|
131
|
+
async saveEdit(edit: { id: string; content: string; authorName: string; authorEmail: string; authorUrl: string }) {
|
|
132
|
+
this.error = '';
|
|
133
|
+
this.message = '';
|
|
134
|
+
try {
|
|
135
|
+
// The store's update takes no principal: the page's permission is checked here too.
|
|
136
|
+
if (!hasPermission(this.c.get('principal'), PERMISSIONS.moderateComments)) throw new CmsError('CMS_FORBIDDEN', __('You cannot edit comments.'));
|
|
137
|
+
const { comments } = this.c.get('cms');
|
|
138
|
+
await comments.update(edit.id, { content: edit.content, authorName: edit.authorName, authorEmail: edit.authorEmail, authorUrl: edit.authorUrl });
|
|
139
|
+
this.editing = null;
|
|
140
|
+
} catch (error) { this.error = isCmsError(error) ? error.message : __('The comment could not be saved.'); }
|
|
141
|
+
await this.load();
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
@Client()
|
|
145
|
+
toggle(id: string, checked: boolean) {
|
|
146
|
+
this.selected = checked ? [...new Set([...this.selected, id])] : this.selected.filter(entry => entry !== id);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
private href(changes: Record<string, string | number>) {
|
|
150
|
+
const next = { status: this.status === 'all' ? '' : this.status, q: this.search, collection: this.entryFilter.collection, entry: this.entryFilter.entry, page: this.page, ...changes };
|
|
151
|
+
const params = new URLSearchParams(Object.entries(next).filter(([key, value]) => value && !(key === 'page' && Number(value) <= 1)).map(([key, value]) => [key, String(value)]));
|
|
152
|
+
return `/dashboard/comments${params.size ? `?${params}` : ''}`;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
private actions(row: Row): TemplateResult {
|
|
156
|
+
const action = (label: string, run: () => void, danger = false) => html`<button type="button" class=${`bg-transparent border-none p-0 cursor-pointer hover:underline ${danger ? 'text-destructive' : 'text-primary'}`} @click=${run}>${label}</button>`;
|
|
157
|
+
const set = (status: CommentStatus | 'delete') => () => this.moderate([row.id], status);
|
|
158
|
+
const items = row.status === 'trash' || row.status === 'spam'
|
|
159
|
+
? [action(row.status === 'spam' ? __('Not spam') : __('Restore'), set('pending')), action(__('Delete permanently'), set('delete'), true)]
|
|
160
|
+
: [row.status === 'pending' ? action(__('Approve'), set('approved')) : action(__('Unapprove'), set('pending')),
|
|
161
|
+
...(row.status === 'approved' ? [action(__('Reply'), () => { this.replying = row.id; this.replyText = ''; })] : []),
|
|
162
|
+
action(__('Edit'), () => { this.editing = { id: row.id, content: row.content, authorName: row.author, authorEmail: row.email, authorUrl: row.url }; }),
|
|
163
|
+
action(__('Spam'), set('spam'), true), action(__('Trash'), set('trash'), true)];
|
|
164
|
+
return html`<div class="mt-1 flex flex-wrap gap-x-3 gap-y-1 text-xs">${items}</div>`;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
private row(row: Row): TemplateResult {
|
|
168
|
+
const editing = this.editing?.id === row.id ? this.editing : null;
|
|
169
|
+
return html`<tr class=${`border-b border-border last:border-0 align-top ${row.status === 'pending' ? 'bg-amber-500/5' : ''}`} data-comment=${row.id} data-status=${row.status}>
|
|
170
|
+
<td class="px-3 py-2">${component(Checkbox, { checked: this.selected.includes(row.id), 'aria-label': `${__('Select comment by')} ${row.author}`, '@change': (event: Event) => this.toggle(row.id, (event.target as HTMLInputElement).checked) })}</td>
|
|
171
|
+
<td class="px-3 py-2"><span class="flex items-start gap-2">${component(Avatar, { src: row.avatar ?? undefined, alt: row.author, size: 32 })}
|
|
172
|
+
<span class="min-w-0"><span class="block font-medium text-foreground">${row.author}</span>
|
|
173
|
+
${row.email ? html`<a href=${`mailto:${row.email}`} class="block truncate text-xs text-primary hover:underline">${row.email}</a>` : null}
|
|
174
|
+
${row.url ? html`<span class="block truncate text-xs text-muted-foreground">${row.url}</span>` : null}</span></span></td>
|
|
175
|
+
<td class="max-w-xl px-3 py-2">
|
|
176
|
+
${row.status !== 'approved' ? html`<span class="mb-1 inline-block">${component(Badge, { variant: row.status === 'pending' ? 'warning' : row.status === 'spam' ? 'destructive' : 'secondary' },
|
|
177
|
+
row.status === 'pending' ? __('Pending') : row.status === 'spam' ? __('Spam') : __('Trash'))}</span>` : null}
|
|
178
|
+
${row.parentAuthor ? html`<p class="text-xs text-muted-foreground">${__('In reply to')} ${row.parentAuthor}</p>` : null}
|
|
179
|
+
${editing ? html`<form class="space-y-2" @submit=${(event: Event) => { event.preventDefault(); void this.saveEdit(editing); }}>
|
|
180
|
+
<div class="grid gap-2 sm:grid-cols-3">
|
|
181
|
+
${component(Input, { size: 'sm', 'aria-label': __('Name'), placeholder: __('Name'), '.value': editing.authorName, '@input': (event: Event) => { this.editing = { ...editing, authorName: (event.target as HTMLInputElement).value }; } })}
|
|
182
|
+
${component(Input, { size: 'sm', type: 'email', 'aria-label': __('Email'), placeholder: __('Email'), '.value': editing.authorEmail, '@input': (event: Event) => { this.editing = { ...editing, authorEmail: (event.target as HTMLInputElement).value }; } })}
|
|
183
|
+
${component(Input, { size: 'sm', 'aria-label': __('Website'), placeholder: __('Website'), '.value': editing.authorUrl, '@input': (event: Event) => { this.editing = { ...editing, authorUrl: (event.target as HTMLInputElement).value }; } })}
|
|
184
|
+
</div>
|
|
185
|
+
${component(Textarea, { rows: 4, 'aria-label': __('Comment'), placeholder: __('Comment'), '.value': editing.content, '@input': (event: Event) => { this.editing = { ...editing, content: (event.target as HTMLTextAreaElement).value }; } })}
|
|
186
|
+
<div class="flex gap-2">${component(Button, { type: 'submit', size: 'sm' }, __('Update comment'))}${component(Button, { type: 'button', size: 'sm', variant: 'ghost', '@click': () => { this.editing = null; } }, __('Cancel'))}</div>
|
|
187
|
+
</form>` : html`<p class="whitespace-pre-wrap break-words text-sm text-foreground">${row.content}</p>${this.actions(row)}`}
|
|
188
|
+
${this.replying === row.id ? html`<form class="mt-3 space-y-2" @submit=${(event: Event) => { event.preventDefault(); void this.reply(row, this.replyText); }}>
|
|
189
|
+
${component(Textarea, { rows: 3, 'aria-label': __('Reply'), '.value': this.replyText, '@input': (event: Event) => { this.replyText = (event.target as HTMLTextAreaElement).value; } })}
|
|
190
|
+
<div class="flex gap-2">${component(Button, { type: 'submit', size: 'sm', disabled: !this.replyText.trim() }, __('Reply'))}${component(Button, { type: 'button', size: 'sm', variant: 'ghost', '@click': () => { this.replying = ''; } }, __('Cancel'))}</div>
|
|
191
|
+
</form>` : null}
|
|
192
|
+
</td>
|
|
193
|
+
<td class="px-3 py-2">${row.entry ? html`<a href=${row.entry.edit} class="font-medium text-foreground hover:text-primary">${row.entry.title}</a>
|
|
194
|
+
${row.entry.view ? html`<a href=${`${row.entry.view}#comment-${row.id}`} class="block text-xs text-primary hover:underline">${__('View')}</a>` : null}
|
|
195
|
+
<a href=${this.href({ collection: row.collection, entry: row.entryId, page: 1 })} class="block text-xs text-muted-foreground hover:text-foreground">${__('All comments on it')}</a>` : html`<span class="text-muted-foreground">—</span>`}</td>
|
|
196
|
+
<td class="px-3 py-2 text-xs text-muted-foreground">${row.date}</td>
|
|
197
|
+
</tr>`;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
render() {
|
|
201
|
+
const tabs: [string, string][] = [['all', __('All')], ['pending', __('Pending')], ['approved', __('Approved')], ['spam', __('Spam')], ['trash', __('Trash')]];
|
|
202
|
+
const totalPages = Math.max(1, Math.ceil(this.total / PAGE_SIZE));
|
|
203
|
+
return html`<div class="space-y-6">
|
|
204
|
+
${pageHeader(this.entryFilter.title ? `${__('Comments on')} “${this.entryFilter.title}”` : __('Comments'))}
|
|
205
|
+
${this.discussions ? null : notice(__('Discussions are turned off: the site shows no comments and takes no new ones. Turn them on under Settings → Discussion.'))}
|
|
206
|
+
${this.message ? notice(this.message, 'success') : null}
|
|
207
|
+
${this.error ? notice(this.error, 'error') : null}
|
|
208
|
+
<div class="flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between">
|
|
209
|
+
<nav aria-label=${__('Filter by status')} class="flex flex-wrap gap-x-3 gap-y-1 text-sm">${tabs.map(([key, label], index) => html`${index ? html`<span class="text-muted-foreground" aria-hidden="true">|</span>` : null}
|
|
210
|
+
<a href=${this.href({ status: key === 'all' ? '' : key, page: 1 })} aria-current=${this.status === key ? 'page' : 'false'}
|
|
211
|
+
class=${this.status === key ? 'font-semibold text-foreground no-underline' : 'text-primary no-underline hover:underline'}>${label} <span class="text-muted-foreground">(${this.counts[key] ?? 0})</span></a>`)}</nav>
|
|
212
|
+
<form method="get" class="flex flex-wrap gap-2" role="search">
|
|
213
|
+
${this.status !== 'all' ? html`<input type="hidden" name="status" value=${this.status}>` : null}
|
|
214
|
+
${component(Input, { type: 'search', name: 'q', size: 'sm', value: this.search, placeholder: __('Search comments'), 'aria-label': __('Search comments') })}
|
|
215
|
+
${component(Button, { type: 'submit', size: 'sm', variant: 'outline' }, __('Search'))}
|
|
216
|
+
</form>
|
|
217
|
+
</div>
|
|
218
|
+
<div class="flex items-center gap-2">
|
|
219
|
+
${component(NativeSelect, { size: 'sm', 'aria-label': __('Bulk actions'), '@change': (event: Event) => { this.bulk = (event.target as HTMLSelectElement).value; } }, html`
|
|
220
|
+
<option value="" ?selected=${!this.bulk}>${__('Bulk actions')}</option>
|
|
221
|
+
${this.status === 'trash' || this.status === 'spam' ? html`<option value="pending">${__('Restore')}</option><option value="delete">${__('Delete permanently')}</option>`
|
|
222
|
+
: html`<option value="approved">${__('Approve')}</option><option value="pending">${__('Unapprove')}</option><option value="spam">${__('Mark as spam')}</option><option value="trash">${__('Move to trash')}</option>`}`)}
|
|
223
|
+
${component(Button, { type: 'button', size: 'sm', variant: 'outline', disabled: !this.bulk || !this.selected.length, '@click': () => this.applyBulk() }, __('Apply'))}
|
|
224
|
+
${this.entryFilter.entry ? html`<a href="/dashboard/comments" class="ml-auto text-sm text-primary hover:underline">${__('Show all comments')}</a>` : null}
|
|
225
|
+
</div>
|
|
226
|
+
${component(Card, {}, component(CardBody, { class: 'p-0' }, html`<div class="overflow-x-auto"><table class="w-full text-sm">
|
|
227
|
+
<thead><tr class="border-b border-border text-left text-xs uppercase tracking-wide text-muted-foreground">
|
|
228
|
+
<th class="w-10 px-3 py-2"><span class="sr-only">${__('Select')}</span></th><th class="px-3 py-2 font-medium">${__('Author')}</th><th class="px-3 py-2 font-medium">${__('Comment')}</th>
|
|
229
|
+
<th class="px-3 py-2 font-medium">${__('In response to')}</th><th class="px-3 py-2 font-medium">${__('Submitted on')}</th>
|
|
230
|
+
</tr></thead>
|
|
231
|
+
<tbody>${this.rows.map(row => this.row(row))}</tbody></table>
|
|
232
|
+
${this.rows.length ? null : html`<p class="px-4 py-10 text-center text-sm text-muted-foreground">${__('No comments found.')}</p>`}</div>`))}
|
|
233
|
+
${totalPages > 1 ? component(Pagination, { page: this.page, totalPages, label: __('Pagination'), previousLabel: __('Previous page'), nextLabel: __('Next page'),
|
|
234
|
+
pageLabel: (page: number) => `${__('Page')} ${page}`, href: (page: number) => this.href({ page }) }) : null}
|
|
235
|
+
</div>`;
|
|
236
|
+
}
|
|
237
|
+
}
|