@meith/web 0.16.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/LICENSE.md +165 -0
- package/app/(auth)/layout.tsx +6 -0
- package/app/(auth)/login/page.tsx +106 -0
- package/app/(auth)/login/verify/page.tsx +55 -0
- package/app/(auth)/register/page.tsx +83 -0
- package/app/(auth)/reset/confirm/page.tsx +45 -0
- package/app/(auth)/reset/page.tsx +22 -0
- package/app/(auth)/verify/page.tsx +44 -0
- package/app/(auth)/verify/resend/page.tsx +51 -0
- package/app/(board)/[slug]/feed.xml/route.ts +48 -0
- package/app/(board)/[slug]/new/page.tsx +112 -0
- package/app/(board)/[slug]/page.tsx +403 -0
- package/app/(board)/discover/[view]/page.tsx +115 -0
- package/app/(board)/discover/page.tsx +5 -0
- package/app/(board)/layout.tsx +22 -0
- package/app/(board)/member/[id]/page.tsx +187 -0
- package/app/(board)/member/[id]/reputation/page.tsx +195 -0
- package/app/(board)/member/by-name/[name]/page.tsx +32 -0
- package/app/(board)/messages/[id]/page.tsx +103 -0
- package/app/(board)/messages/compose/page.tsx +60 -0
- package/app/(board)/messages/layout.tsx +5 -0
- package/app/(board)/messages/page.tsx +179 -0
- package/app/(board)/modcp/forums/page.tsx +59 -0
- package/app/(board)/modcp/ip/page.tsx +158 -0
- package/app/(board)/modcp/layout.tsx +5 -0
- package/app/(board)/modcp/log/page.tsx +98 -0
- package/app/(board)/modcp/page.tsx +112 -0
- package/app/(board)/moderation/layout.tsx +5 -0
- package/app/(board)/moderation/page.tsx +111 -0
- package/app/(board)/moderation/reports/page.tsx +193 -0
- package/app/(board)/moderation/warn/page.tsx +158 -0
- package/app/(board)/notifications/layout.tsx +5 -0
- package/app/(board)/notifications/page.tsx +144 -0
- package/app/(board)/notifications/preferences/page.tsx +65 -0
- package/app/(board)/online/page.tsx +119 -0
- package/app/(board)/page.tsx +195 -0
- package/app/(board)/plugins/[key]/[[...path]]/page.tsx +72 -0
- package/app/(board)/privacy/page.tsx +12 -0
- package/app/(board)/report/page.tsx +71 -0
- package/app/(board)/rules/page.tsx +12 -0
- package/app/(board)/search/[token]/page.tsx +130 -0
- package/app/(board)/search/page.tsx +289 -0
- package/app/(board)/stats/page.tsx +202 -0
- package/app/(board)/subscriptions/layout.tsx +5 -0
- package/app/(board)/subscriptions/page.tsx +142 -0
- package/app/(board)/terms/page.tsx +12 -0
- package/app/(board)/thread/[slug]/edit/page.tsx +107 -0
- package/app/(board)/thread/[slug]/feed.xml/route.ts +42 -0
- package/app/(board)/thread/[slug]/page.tsx +707 -0
- package/app/(board)/thread/[slug]/poll/page.tsx +41 -0
- package/app/(board)/thread/[slug]/post/[postId]/history/page.tsx +160 -0
- package/app/(board)/thread/[slug]/reply/page.tsx +136 -0
- package/app/(board)/unsubscribe/page.tsx +73 -0
- package/app/(board)/usercp/avatar/page.tsx +56 -0
- package/app/(board)/usercp/contacts/page.tsx +141 -0
- package/app/(board)/usercp/email/confirm/page.tsx +52 -0
- package/app/(board)/usercp/layout.tsx +23 -0
- package/app/(board)/usercp/options/page.tsx +56 -0
- package/app/(board)/usercp/page.tsx +71 -0
- package/app/(board)/usercp/profile/page.tsx +81 -0
- package/app/(board)/usercp/security/page.tsx +238 -0
- package/app/(board)/usercp/security/verify/page.tsx +92 -0
- package/app/(board)/usercp/signature/page.tsx +67 -0
- package/app/admin/antispam/page.tsx +155 -0
- package/app/admin/api/marketplace/screenshot/route.ts +68 -0
- package/app/admin/api/plugins/[key]/[...path]/route.ts +27 -0
- package/app/admin/api-tokens/page.tsx +129 -0
- package/app/admin/content/announcements/page.tsx +110 -0
- package/app/admin/content/attachments/page.tsx +199 -0
- package/app/admin/content/navigation/page.tsx +123 -0
- package/app/admin/content/page.tsx +170 -0
- package/app/admin/forums/[id]/page.tsx +96 -0
- package/app/admin/forums/[id]/permissions/page.tsx +108 -0
- package/app/admin/forums/page.tsx +45 -0
- package/app/admin/groups/[id]/page.tsx +133 -0
- package/app/admin/groups/memberships/page.tsx +56 -0
- package/app/admin/groups/page.tsx +104 -0
- package/app/admin/groups/promotions/page.tsx +143 -0
- package/app/admin/layout.tsx +86 -0
- package/app/admin/log/page.tsx +116 -0
- package/app/admin/page.tsx +206 -0
- package/app/admin/plugins/[key]/[[...path]]/page.tsx +276 -0
- package/app/admin/plugins/browse/page.tsx +70 -0
- package/app/admin/plugins/page.tsx +165 -0
- package/app/admin/security/page.tsx +124 -0
- package/app/admin/settings/page.tsx +190 -0
- package/app/admin/system/page.tsx +303 -0
- package/app/admin/themes/[key]/page.tsx +110 -0
- package/app/admin/themes/browse/page.tsx +70 -0
- package/app/admin/themes/page.tsx +163 -0
- package/app/admin/users/[id]/merge/page.tsx +136 -0
- package/app/admin/users/[id]/page.tsx +208 -0
- package/app/admin/users/mail/page.tsx +68 -0
- package/app/admin/users/page.tsx +260 -0
- package/app/admin/users/prune/page.tsx +186 -0
- package/app/api/health/route.ts +11 -0
- package/app/api/metrics/route.ts +66 -0
- package/app/api/plugins/[key]/[...path]/route.ts +27 -0
- package/app/api/read/all/route.ts +15 -0
- package/app/api/read/forum/[id]/route.ts +29 -0
- package/app/api/read/thread/[id]/route.ts +40 -0
- package/app/api/ready/route.ts +63 -0
- package/app/api/system/tick/route.ts +77 -0
- package/app/api/v1/[...path]/route.ts +208 -0
- package/app/api/v1/openapi.json/route.ts +12 -0
- package/app/apple-icon.ts +11 -0
- package/app/atom.xml/route.ts +7 -0
- package/app/attachment/[id]/route.ts +10 -0
- package/app/attachment/[id]/thumb/route.ts +10 -0
- package/app/auth/passkey/options/route.ts +145 -0
- package/app/auth/passkey/verify/route.ts +241 -0
- package/app/auth/resume/route.ts +55 -0
- package/app/auth/sso/[provider]/callback/route.ts +173 -0
- package/app/auth/sso/[provider]/go/route.ts +57 -0
- package/app/auth/sso/[provider]/route.ts +105 -0
- package/app/avatar/[id]/route.ts +31 -0
- package/app/brand/icon-192.png/route.ts +7 -0
- package/app/brand/icon-512.png/route.ts +7 -0
- package/app/brand/icon-maskable.png/route.ts +7 -0
- package/app/demo/stripe/[[...path]]/route.ts +27 -0
- package/app/error.tsx +15 -0
- package/app/feed.xml/route.ts +7 -0
- package/app/forumdisplay.php/page.tsx +11 -0
- package/app/group/[id]/badge/[scheme]/route.ts +26 -0
- package/app/icon.ts +13 -0
- package/app/install/page.tsx +221 -0
- package/app/jump/page.tsx +28 -0
- package/app/layout.tsx +124 -0
- package/app/logo/[scheme]/route.ts +24 -0
- package/app/manifest.ts +43 -0
- package/app/member.php/page.tsx +11 -0
- package/app/memberlist.php/page.tsx +11 -0
- package/app/not-found.tsx +14 -0
- package/app/opengraph-image.ts +11 -0
- package/app/redirect/page.tsx +44 -0
- package/app/robots.txt/route.ts +35 -0
- package/app/showthread.php/page.tsx +11 -0
- package/app/sitemap/[page]/route.ts +64 -0
- package/app/sitemap.xml/route.ts +31 -0
- package/app/twitter-image.ts +11 -0
- package/app/viewforum.php/page.tsx +11 -0
- package/app/viewtopic.php/page.tsx +11 -0
- package/bin/forum-web.mjs +241 -0
- package/components.json +21 -0
- package/instrumentation.ts +18 -0
- package/next.config.mjs +182 -0
- package/package.json +99 -0
- package/postcss.config.mjs +7 -0
- package/proxy.ts +160 -0
- package/src/components/account/active-sessions.tsx +87 -0
- package/src/components/account/avatar-form.tsx +119 -0
- package/src/components/account/credential-proof-form.tsx +76 -0
- package/src/components/account/logout-form.tsx +14 -0
- package/src/components/account/notification-forms.tsx +157 -0
- package/src/components/account/passkey-enrol.tsx +81 -0
- package/src/components/account/passkey-proof-button.tsx +47 -0
- package/src/components/account/push-device-form.tsx +193 -0
- package/src/components/account/relation-forms.tsx +69 -0
- package/src/components/account/reputation-forms.tsx +124 -0
- package/src/components/account/security-activity.tsx +46 -0
- package/src/components/account/sign-in-methods.tsx +166 -0
- package/src/components/account/subscription-forms.tsx +151 -0
- package/src/components/account/two-factor-forms.tsx +226 -0
- package/src/components/account/usercp-forms.tsx +387 -0
- package/src/components/account/usercp-nav.tsx +14 -0
- package/src/components/account/usercp-shell.tsx +34 -0
- package/src/components/admin/admin-forms.tsx +92 -0
- package/src/components/admin/admin-nav.tsx +52 -0
- package/src/components/admin/admin-undo.tsx +32 -0
- package/src/components/admin/api-token-forms.tsx +89 -0
- package/src/components/admin/badge-forms.tsx +97 -0
- package/src/components/admin/branding-forms.tsx +102 -0
- package/src/components/admin/content-forms.tsx +712 -0
- package/src/components/admin/form-bits.tsx +11 -0
- package/src/components/admin/forum-forms.tsx +524 -0
- package/src/components/admin/forum-tree.tsx +454 -0
- package/src/components/admin/group-forms.tsx +646 -0
- package/src/components/admin/mail-test-card.tsx +90 -0
- package/src/components/admin/marketplace-forms.tsx +30 -0
- package/src/components/admin/marketplace-listing.tsx +123 -0
- package/src/components/admin/navigation-forms.tsx +229 -0
- package/src/components/admin/navigation-tree.tsx +442 -0
- package/src/components/admin/oklch-picker.tsx +180 -0
- package/src/components/admin/plugin-forms.tsx +225 -0
- package/src/components/admin/settings-form.tsx +148 -0
- package/src/components/admin/system-forms.tsx +169 -0
- package/src/components/admin/theme-changes.tsx +354 -0
- package/src/components/admin/theme-forms.tsx +636 -0
- package/src/components/admin/theme-palette.tsx +119 -0
- package/src/components/admin/theme-preview.tsx +461 -0
- package/src/components/admin/user-bulk-toolbar.tsx +99 -0
- package/src/components/admin/user-forms.tsx +488 -0
- package/src/components/auth/auth-page.tsx +45 -0
- package/src/components/auth/form-controls.tsx +117 -0
- package/src/components/auth/login-form.tsx +47 -0
- package/src/components/auth/passkey-client.ts +171 -0
- package/src/components/auth/passkey-second-factor.tsx +69 -0
- package/src/components/auth/passkey-sign-in.tsx +61 -0
- package/src/components/auth/register-form.tsx +136 -0
- package/src/components/auth/resend-verification-form.tsx +34 -0
- package/src/components/auth/reset-confirm-form.tsx +43 -0
- package/src/components/auth/reset-request-form.tsx +35 -0
- package/src/components/auth/second-factor-form.tsx +51 -0
- package/src/components/auth/sso-buttons.tsx +47 -0
- package/src/components/board/live-region.tsx +74 -0
- package/src/components/board/search-off-notice.tsx +18 -0
- package/src/components/board/section-page.tsx +114 -0
- package/src/components/content/attachment-field.tsx +51 -0
- package/src/components/content/composer-field.ts +31 -0
- package/src/components/content/composer-ids.ts +6 -0
- package/src/components/content/composer-intents.tsx +27 -0
- package/src/components/content/composer-recovery.tsx +215 -0
- package/src/components/content/edit-post-form.tsx +121 -0
- package/src/components/content/markdown-editor.tsx +590 -0
- package/src/components/content/markdown-syntax.ts +53 -0
- package/src/components/content/mention-token.ts +23 -0
- package/src/components/content/multiquote-button.tsx +32 -0
- package/src/components/content/multiquote-selection.tsx +105 -0
- package/src/components/content/multiquote.ts +125 -0
- package/src/components/content/new-thread-form.tsx +169 -0
- package/src/components/content/poll-edit-form.tsx +96 -0
- package/src/components/content/poll.tsx +89 -0
- package/src/components/content/quote-in-place.tsx +51 -0
- package/src/components/content/reply-form.tsx +113 -0
- package/src/components/content/thanks-button.tsx +65 -0
- package/src/components/content/thread-rating.tsx +143 -0
- package/src/components/install/install-form.tsx +497 -0
- package/src/components/legal/legal-document.tsx +22 -0
- package/src/components/messages/message-forms.tsx +152 -0
- package/src/components/moderation/inline-moderation-form.tsx +158 -0
- package/src/components/moderation/modcp-nav.tsx +15 -0
- package/src/components/moderation/modcp-shell.tsx +41 -0
- package/src/components/moderation/queue-form.tsx +96 -0
- package/src/components/moderation/report-forms.tsx +120 -0
- package/src/components/moderation/signature-lock-form.tsx +83 -0
- package/src/components/moderation/thread-surgery-form.tsx +96 -0
- package/src/components/moderation/thread-tools-form.tsx +137 -0
- package/src/components/moderation/warning-forms.tsx +125 -0
- package/src/components/profile/custom-field.tsx +79 -0
- package/src/components/shell/appearance-icons.tsx +35 -0
- package/src/components/shell/board-notice.tsx +21 -0
- package/src/components/shell/copy-record.ts +20 -0
- package/src/components/shell/copy.tsx +17 -0
- package/src/components/shell/crash-notice.tsx +86 -0
- package/src/components/shell/demo-banner.tsx +49 -0
- package/src/components/shell/group-name-style.tsx +6 -0
- package/src/components/shell/measure.ts +1 -0
- package/src/components/shell/notification-menu.tsx +361 -0
- package/src/components/shell/offline-notice.tsx +29 -0
- package/src/components/shell/onboarding-banner.tsx +39 -0
- package/src/components/shell/page-shell.tsx +167 -0
- package/src/components/shell/panel-list.tsx +95 -0
- package/src/components/shell/panel-nav.tsx +40 -0
- package/src/components/shell/panel-overview.tsx +81 -0
- package/src/components/shell/panel-page.tsx +96 -0
- package/src/components/shell/panel-pagination.tsx +28 -0
- package/src/components/shell/panel-shell.tsx +31 -0
- package/src/components/shell/theme-runtime-style.tsx +6 -0
- package/src/components/shell/theme-switcher.tsx +97 -0
- package/src/components/shell/timezone-probe.tsx +45 -0
- package/src/components/shell/view-tabs.tsx +60 -0
- package/src/config.ts +13 -0
- package/src/server/absent-services.ts +29 -0
- package/src/server/admin-actions.ts +171 -0
- package/src/server/admin-settings-actions.ts +83 -0
- package/src/server/admin-undo-actions.ts +70 -0
- package/src/server/admin-undo.ts +75 -0
- package/src/server/admin.ts +112 -0
- package/src/server/announcements.ts +82 -0
- package/src/server/antispam.ts +310 -0
- package/src/server/api/content.ts +486 -0
- package/src/server/api/http.ts +119 -0
- package/src/server/api/members.ts +109 -0
- package/src/server/api/messages.ts +113 -0
- package/src/server/api/registry.ts +30 -0
- package/src/server/api/search.ts +98 -0
- package/src/server/api/subscriptions.ts +106 -0
- package/src/server/api-auth.ts +66 -0
- package/src/server/api-token-actions.ts +85 -0
- package/src/server/api-tokens-admin.ts +95 -0
- package/src/server/appearance-actions.ts +39 -0
- package/src/server/attachment-download.ts +43 -0
- package/src/server/attachment-embed.ts +63 -0
- package/src/server/attachment-upload-actions.ts +92 -0
- package/src/server/attachments.ts +257 -0
- package/src/server/auth-actions.ts +479 -0
- package/src/server/auth-config.ts +61 -0
- package/src/server/auth-events.ts +92 -0
- package/src/server/auth-form-state.ts +14 -0
- package/src/server/auth-mail.ts +104 -0
- package/src/server/avatars.ts +83 -0
- package/src/server/board-latest-actions.ts +7 -0
- package/src/server/board-latest.tsx +103 -0
- package/src/server/board-offline.ts +23 -0
- package/src/server/board-url.ts +14 -0
- package/src/server/brand-assets.ts +151 -0
- package/src/server/brand-mark.tsx +110 -0
- package/src/server/branding-actions.ts +53 -0
- package/src/server/branding.ts +101 -0
- package/src/server/cache-targets.ts +13 -0
- package/src/server/code-highlighting.ts +33 -0
- package/src/server/container.ts +402 -0
- package/src/server/content-actions.ts +459 -0
- package/src/server/content-admin-actions.ts +492 -0
- package/src/server/content-admin.ts +95 -0
- package/src/server/content-security-policy.ts +35 -0
- package/src/server/context.ts +32 -0
- package/src/server/cookies.ts +139 -0
- package/src/server/credential-proof-actions.ts +42 -0
- package/src/server/credential-proof.ts +35 -0
- package/src/server/current-location.ts +19 -0
- package/src/server/demo-stripe.ts +104 -0
- package/src/server/demo-uploads.ts +28 -0
- package/src/server/demo.ts +80 -0
- package/src/server/discovery.ts +104 -0
- package/src/server/embeds.ts +113 -0
- package/src/server/error-notice.tsx +41 -0
- package/src/server/federation-actions.ts +113 -0
- package/src/server/federation.ts +138 -0
- package/src/server/feed-builder.ts +72 -0
- package/src/server/feed-routes.ts +122 -0
- package/src/server/fixture-actor-source.ts +62 -0
- package/src/server/fixture-forum-repo.ts +59 -0
- package/src/server/fixture-member-profile-repo.ts +30 -0
- package/src/server/fixture-post-repo.ts +108 -0
- package/src/server/fixture-thread-repo.ts +98 -0
- package/src/server/form-state-reporter.ts +34 -0
- package/src/server/form-values.ts +23 -0
- package/src/server/forum-admin-actions.ts +353 -0
- package/src/server/forum-admin.ts +98 -0
- package/src/server/group-admin-actions.ts +341 -0
- package/src/server/group-admin.ts +98 -0
- package/src/server/group-badge-actions.ts +61 -0
- package/src/server/group-badge.ts +62 -0
- package/src/server/group-identity.ts +104 -0
- package/src/server/i18n-catalogs.ts +42 -0
- package/src/server/i18n.ts +69 -0
- package/src/server/image-upload.ts +109 -0
- package/src/server/inline-moderation-actions.ts +129 -0
- package/src/server/install-actions.ts +124 -0
- package/src/server/install.ts +281 -0
- package/src/server/legacy-redirect.ts +83 -0
- package/src/server/legal.ts +43 -0
- package/src/server/location-header.ts +37 -0
- package/src/server/mail-brand.ts +43 -0
- package/src/server/mail-health.ts +41 -0
- package/src/server/mail-send.ts +44 -0
- package/src/server/mail-test-actions.ts +67 -0
- package/src/server/mail-test.ts +56 -0
- package/src/server/markdown-pipeline.ts +31 -0
- package/src/server/marketplace-actions.ts +47 -0
- package/src/server/marketplace-admin.ts +260 -0
- package/src/server/mention-actions.ts +21 -0
- package/src/server/mention-search.ts +35 -0
- package/src/server/message-actions.ts +110 -0
- package/src/server/messages.ts +141 -0
- package/src/server/modcp.ts +125 -0
- package/src/server/moderation-actions.ts +165 -0
- package/src/server/navigation-admin-actions.ts +217 -0
- package/src/server/navigation.ts +112 -0
- package/src/server/nonce.ts +13 -0
- package/src/server/notification-actions.ts +84 -0
- package/src/server/notification-audience.ts +10 -0
- package/src/server/notification-menu-actions.ts +82 -0
- package/src/server/notification-menu.ts +96 -0
- package/src/server/notifications.ts +93 -0
- package/src/server/onboarding-actions.ts +27 -0
- package/src/server/onboarding.ts +89 -0
- package/src/server/page-metadata.ts +14 -0
- package/src/server/passkey-challenge.ts +42 -0
- package/src/server/plugin-admin-actions.ts +232 -0
- package/src/server/plugin-admin.ts +276 -0
- package/src/server/plugin-host.ts +143 -0
- package/src/server/plugin-pages.ts +192 -0
- package/src/server/plugin-panel.ts +49 -0
- package/src/server/plugin-routes.ts +298 -0
- package/src/server/plugin-view.tsx +58 -0
- package/src/server/poll-actions.ts +104 -0
- package/src/server/poll-scope.ts +52 -0
- package/src/server/post-notifications.ts +71 -0
- package/src/server/post-scope.ts +86 -0
- package/src/server/presence.ts +177 -0
- package/src/server/profile-fields.ts +112 -0
- package/src/server/push-actions.ts +113 -0
- package/src/server/push.ts +40 -0
- package/src/server/redirect-back.ts +15 -0
- package/src/server/registration.ts +7 -0
- package/src/server/relation-actions.ts +89 -0
- package/src/server/relations.ts +45 -0
- package/src/server/reply-core.ts +173 -0
- package/src/server/report-actions.ts +165 -0
- package/src/server/report-scope.ts +21 -0
- package/src/server/reputation-actions.ts +146 -0
- package/src/server/reputation-target.ts +49 -0
- package/src/server/reputation.ts +70 -0
- package/src/server/request-fingerprint.ts +65 -0
- package/src/server/safe-path.ts +16 -0
- package/src/server/same-origin.ts +45 -0
- package/src/server/search-page.ts +313 -0
- package/src/server/search.ts +45 -0
- package/src/server/secret-auth.ts +20 -0
- package/src/server/see-other.ts +11 -0
- package/src/server/seed-board.ts +417 -0
- package/src/server/session-actions.ts +78 -0
- package/src/server/session-cookies.ts +124 -0
- package/src/server/session-key.ts +17 -0
- package/src/server/settings.ts +47 -0
- package/src/server/signatures.ts +62 -0
- package/src/server/sso-handshake.ts +79 -0
- package/src/server/stats.ts +63 -0
- package/src/server/subscription-actions.ts +161 -0
- package/src/server/surgery-actions.ts +180 -0
- package/src/server/syndication.ts +77 -0
- package/src/server/system-admin-actions.ts +134 -0
- package/src/server/system-admin.ts +90 -0
- package/src/server/test-container.ts +114 -0
- package/src/server/theme-admin-actions.ts +242 -0
- package/src/server/theme-admin.ts +203 -0
- package/src/server/theme-runtime.ts +89 -0
- package/src/server/theme-style.ts +279 -0
- package/src/server/theme.ts +52 -0
- package/src/server/thread-core.ts +207 -0
- package/src/server/thread-rating-actions.ts +55 -0
- package/src/server/thread-tool-actions.ts +154 -0
- package/src/server/two-factor-actions.ts +178 -0
- package/src/server/two-factor.ts +86 -0
- package/src/server/upgrade-notice.ts +41 -0
- package/src/server/user-admin-actions.ts +572 -0
- package/src/server/user-admin.ts +165 -0
- package/src/server/usercp-actions.ts +263 -0
- package/src/server/usercp-mail.ts +120 -0
- package/src/server/viewer-preferences.ts +64 -0
- package/src/server/warning-actions.ts +122 -0
- package/src/styles/globals.css +969 -0
- package/src/theme/contract.fixture.ts +793 -0
- package/src/view/account-copy.ts +351 -0
- package/src/view/admin-content-copy.ts +66 -0
- package/src/view/admin-copy.ts +106 -0
- package/src/view/admin-forum-tree-copy.ts +40 -0
- package/src/view/admin-group-copy.ts +80 -0
- package/src/view/admin-log.ts +58 -0
- package/src/view/admin-nav.ts +164 -0
- package/src/view/admin-navigation-copy.ts +58 -0
- package/src/view/admin-panel-copy.ts +194 -0
- package/src/view/admin-settings.ts +173 -0
- package/src/view/admin-theme-copy.ts +229 -0
- package/src/view/admin-user-copy.ts +96 -0
- package/src/view/attachments.ts +51 -0
- package/src/view/auth-copy.ts +147 -0
- package/src/view/board-index.ts +167 -0
- package/src/view/board-latest.ts +101 -0
- package/src/view/breadcrumb.ts +50 -0
- package/src/view/contacts.ts +85 -0
- package/src/view/content-copy.ts +118 -0
- package/src/view/contrast.ts +286 -0
- package/src/view/copy.ts +101 -0
- package/src/view/count.ts +8 -0
- package/src/view/discovery-view.ts +74 -0
- package/src/view/editor-toolbar.ts +84 -0
- package/src/view/error-notice.ts +52 -0
- package/src/view/feed.ts +130 -0
- package/src/view/forum-cursor.ts +54 -0
- package/src/view/forum-display.ts +152 -0
- package/src/view/forum-jump.ts +60 -0
- package/src/view/forum-notice.ts +24 -0
- package/src/view/inline-moderation.ts +87 -0
- package/src/view/install-copy.ts +95 -0
- package/src/view/legal.ts +58 -0
- package/src/view/locale.ts +40 -0
- package/src/view/marketplace-panel.ts +51 -0
- package/src/view/member-identity.ts +23 -0
- package/src/view/member-profile.ts +65 -0
- package/src/view/messages.ts +222 -0
- package/src/view/metadata.ts +75 -0
- package/src/view/modcp-nav.ts +76 -0
- package/src/view/moderation-copy.ts +84 -0
- package/src/view/moderation-queue.ts +67 -0
- package/src/view/navigation-arrange.ts +188 -0
- package/src/view/navigation.ts +173 -0
- package/src/view/notification-menu.ts +202 -0
- package/src/view/notifications.ts +84 -0
- package/src/view/onboarding.ts +26 -0
- package/src/view/pager.ts +191 -0
- package/src/view/panel-nav.ts +203 -0
- package/src/view/plugin-panel.ts +42 -0
- package/src/view/post-form.ts +61 -0
- package/src/view/post-link.ts +29 -0
- package/src/view/presence.ts +99 -0
- package/src/view/promotion-rules.ts +52 -0
- package/src/view/redirect-notice.ts +21 -0
- package/src/view/reputation.ts +107 -0
- package/src/view/search-controls.ts +103 -0
- package/src/view/search-results.ts +291 -0
- package/src/view/security-activity.ts +73 -0
- package/src/view/setting-groups.ts +43 -0
- package/src/view/shell.ts +164 -0
- package/src/view/slug-id.ts +12 -0
- package/src/view/sso-hand-off.ts +44 -0
- package/src/view/sso-notices.ts +48 -0
- package/src/view/subscriptions.ts +76 -0
- package/src/view/theme-draft.ts +167 -0
- package/src/view/theme-preference.ts +30 -0
- package/src/view/theme-tokens.ts +333 -0
- package/src/view/thread-view.ts +280 -0
- package/src/view/time.ts +31 -0
- package/src/view/timezone.ts +35 -0
- package/src/view/two-factor.ts +6 -0
- package/src/view/usercp-nav.ts +103 -0
- package/src/view/usercp.ts +196 -0
- package/src/view/warnings.ts +128 -0
- package/src/view/word-filter.ts +5 -0
|
@@ -0,0 +1,636 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import { useActionState, useEffect, useState } from 'react'
|
|
4
|
+
|
|
5
|
+
import { EMPTY_STATE } from '@/server/auth-form-state'
|
|
6
|
+
import {
|
|
7
|
+
importThemeAction,
|
|
8
|
+
resetThemeAction,
|
|
9
|
+
setDefaultThemeAction,
|
|
10
|
+
setThemeEnabledAction,
|
|
11
|
+
themeEditorAction,
|
|
12
|
+
} from '@/server/theme-admin-actions'
|
|
13
|
+
import { type ContrastCheck, contrastChecksFor, formatRatio } from '@/view/contrast'
|
|
14
|
+
import {
|
|
15
|
+
changeCounts,
|
|
16
|
+
cssVariables,
|
|
17
|
+
type Draft,
|
|
18
|
+
draftValue,
|
|
19
|
+
type EditableToken,
|
|
20
|
+
effectiveValues,
|
|
21
|
+
type FieldScheme,
|
|
22
|
+
fieldName,
|
|
23
|
+
initialDraft,
|
|
24
|
+
matchesQuery,
|
|
25
|
+
savedValue,
|
|
26
|
+
schemesFor,
|
|
27
|
+
shippedValue,
|
|
28
|
+
tokenChanges,
|
|
29
|
+
} from '@/view/theme-draft'
|
|
30
|
+
import { BRAND_PRESETS, groupTokens } from '@/view/theme-tokens'
|
|
31
|
+
|
|
32
|
+
import { FormError, SubmitButton } from '../auth/form-controls'
|
|
33
|
+
import { type Copy, formatFromCopy, fromCopy } from '../shell/copy'
|
|
34
|
+
import { Saved } from './form-bits'
|
|
35
|
+
import { OklchPicker } from './oklch-picker'
|
|
36
|
+
import { ChangeSummary, LegibilityReport } from './theme-changes'
|
|
37
|
+
import { type CellState, PaletteGrid } from './theme-palette'
|
|
38
|
+
import { ThemePreview, ValidatedSample } from './theme-preview'
|
|
39
|
+
|
|
40
|
+
const INPUT =
|
|
41
|
+
'w-full rounded-md border border-border bg-background px-3 py-2 font-mono text-xs focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring'
|
|
42
|
+
|
|
43
|
+
const GHOST_BUTTON =
|
|
44
|
+
'inline-flex h-8 items-center justify-center rounded-md border border-border px-3 text-xs font-medium hover:bg-accent hover:text-accent-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring'
|
|
45
|
+
|
|
46
|
+
const LINK =
|
|
47
|
+
'text-xs font-medium underline decoration-border underline-offset-2 hover:decoration-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring'
|
|
48
|
+
|
|
49
|
+
export type TokenValue = EditableToken
|
|
50
|
+
|
|
51
|
+
function useHydrated(): boolean {
|
|
52
|
+
const [hydrated, setHydrated] = useState(false)
|
|
53
|
+
useEffect(() => setHydrated(true), [])
|
|
54
|
+
return hydrated
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function schemeLabel(copy: Copy, scheme: FieldScheme): string {
|
|
58
|
+
return scheme === 'both'
|
|
59
|
+
? fromCopy(copy, 'adminTheme.scheme.both')
|
|
60
|
+
: scheme === 'dark'
|
|
61
|
+
? fromCopy(copy, 'adminTheme.scheme.dark')
|
|
62
|
+
: fromCopy(copy, 'adminTheme.scheme.light')
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function ContrastNotes({ checks, copy }: { checks: readonly ContrastCheck[]; copy: Copy }) {
|
|
66
|
+
const failing = checks.filter((check) => check.state === 'fail')
|
|
67
|
+
const tightest = [...checks]
|
|
68
|
+
.filter((check) => check.state === 'pass')
|
|
69
|
+
.sort((a, b) => (a.ratio ?? 0) - (b.ratio ?? 0))[0]
|
|
70
|
+
|
|
71
|
+
const shown = failing.length > 0 ? failing : tightest === undefined ? [] : [tightest]
|
|
72
|
+
if (shown.length === 0) return null
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
<ul className="flex flex-col gap-0.5">
|
|
76
|
+
{shown.map((check) => (
|
|
77
|
+
<li
|
|
78
|
+
key={`${check.pair.foreground}/${check.pair.background}`}
|
|
79
|
+
className={`text-[0.6875rem] ${
|
|
80
|
+
check.state === 'fail' ? 'font-medium text-destructive' : 'text-muted-foreground'
|
|
81
|
+
}`}
|
|
82
|
+
>
|
|
83
|
+
{formatFromCopy(
|
|
84
|
+
copy,
|
|
85
|
+
check.state === 'fail'
|
|
86
|
+
? 'adminTheme.contrast.failIntro'
|
|
87
|
+
: 'adminTheme.contrast.okIntro',
|
|
88
|
+
{ pair: fromCopy(copy, check.pair.labelKey) },
|
|
89
|
+
)}{' '}
|
|
90
|
+
<span className="font-mono tabular-nums">
|
|
91
|
+
{check.ratio === null ? '—' : formatRatio(check.ratio)}
|
|
92
|
+
</span>
|
|
93
|
+
{check.state === 'fail' &&
|
|
94
|
+
formatFromCopy(copy, 'adminTheme.contrast.needs', { required: check.required })}
|
|
95
|
+
</li>
|
|
96
|
+
))}
|
|
97
|
+
</ul>
|
|
98
|
+
)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function TokenRow({
|
|
102
|
+
copy,
|
|
103
|
+
token,
|
|
104
|
+
draft,
|
|
105
|
+
values,
|
|
106
|
+
hidden,
|
|
107
|
+
onChange,
|
|
108
|
+
onClose,
|
|
109
|
+
}: {
|
|
110
|
+
copy: Copy
|
|
111
|
+
token: EditableToken
|
|
112
|
+
draft: Draft
|
|
113
|
+
values: { light: Record<string, string>; dark: Record<string, string> }
|
|
114
|
+
hidden: boolean
|
|
115
|
+
onChange: (name: string, value: string) => void
|
|
116
|
+
onClose?: (() => void) | undefined
|
|
117
|
+
}) {
|
|
118
|
+
const overridden = schemesFor(token).some((scheme) => draftValue(draft, token, scheme) !== '')
|
|
119
|
+
const dirty = schemesFor(token).some(
|
|
120
|
+
(scheme) => draftValue(draft, token, scheme) !== savedValue(token, scheme),
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
return (
|
|
124
|
+
<div
|
|
125
|
+
id={`token-${token.name}`}
|
|
126
|
+
hidden={hidden}
|
|
127
|
+
className="flex scroll-mt-6 flex-col gap-2 py-3"
|
|
128
|
+
>
|
|
129
|
+
<div className="flex flex-wrap items-baseline justify-between gap-x-3 gap-y-1">
|
|
130
|
+
<span className="flex flex-wrap items-baseline gap-2">
|
|
131
|
+
<span className="text-sm font-medium">{token.label}</span>
|
|
132
|
+
{dirty && (
|
|
133
|
+
<span className="rounded-full border border-primary px-2 py-0.5 text-[0.6875rem] font-medium text-primary">
|
|
134
|
+
{fromCopy(copy, 'adminTheme.token.unsaved')}
|
|
135
|
+
</span>
|
|
136
|
+
)}
|
|
137
|
+
</span>
|
|
138
|
+
<span className="font-mono text-xs text-muted-foreground">{token.name}</span>
|
|
139
|
+
</div>
|
|
140
|
+
{token.hint !== '' && <p className="text-xs text-muted-foreground">{token.hint}</p>}
|
|
141
|
+
|
|
142
|
+
<div className="flex flex-col gap-3 @md:flex-row">
|
|
143
|
+
{schemesFor(token).map((scheme) => {
|
|
144
|
+
const name = fieldName(token.name, scheme)
|
|
145
|
+
const value = draft[name] ?? ''
|
|
146
|
+
const shipped = shippedValue(token, scheme)
|
|
147
|
+
const palette = scheme === 'dark' ? values.dark : values.light
|
|
148
|
+
|
|
149
|
+
return (
|
|
150
|
+
<div key={scheme} className="flex min-w-0 flex-1 flex-col gap-1">
|
|
151
|
+
{/* biome-ignore lint/a11y/noLabelWithoutControl: the control is OklchPicker, or the text input on the other side of the branch */}
|
|
152
|
+
<label className="flex min-w-0 flex-col gap-1">
|
|
153
|
+
<span className="text-xs text-muted-foreground">{schemeLabel(copy, scheme)}</span>
|
|
154
|
+
{token.kind === 'colour' ? (
|
|
155
|
+
<OklchPicker
|
|
156
|
+
name={name}
|
|
157
|
+
describes={formatFromCopy(copy, 'adminTheme.token.describes', {
|
|
158
|
+
label: token.label,
|
|
159
|
+
scheme: schemeLabel(copy, scheme).toLowerCase(),
|
|
160
|
+
})}
|
|
161
|
+
copy={copy}
|
|
162
|
+
value={value}
|
|
163
|
+
shipped={shipped}
|
|
164
|
+
onChange={(next) => onChange(name, next)}
|
|
165
|
+
/>
|
|
166
|
+
) : (
|
|
167
|
+
<input
|
|
168
|
+
name={name}
|
|
169
|
+
value={value}
|
|
170
|
+
onChange={(event) => onChange(name, event.target.value)}
|
|
171
|
+
placeholder={shipped}
|
|
172
|
+
className={INPUT}
|
|
173
|
+
/>
|
|
174
|
+
)}
|
|
175
|
+
</label>
|
|
176
|
+
|
|
177
|
+
<p className="truncate font-mono text-[0.6875rem] text-muted-foreground">
|
|
178
|
+
{formatFromCopy(
|
|
179
|
+
copy,
|
|
180
|
+
value === '' ? 'adminTheme.token.themesOwn' : 'adminTheme.token.replaces',
|
|
181
|
+
{ value: shipped },
|
|
182
|
+
)}
|
|
183
|
+
</p>
|
|
184
|
+
|
|
185
|
+
{token.kind === 'colour' && (
|
|
186
|
+
<ContrastNotes checks={contrastChecksFor(token.name, palette)} copy={copy} />
|
|
187
|
+
)}
|
|
188
|
+
</div>
|
|
189
|
+
)
|
|
190
|
+
})}
|
|
191
|
+
</div>
|
|
192
|
+
|
|
193
|
+
<div className="flex flex-wrap items-center gap-3">
|
|
194
|
+
<span className="text-xs text-muted-foreground">
|
|
195
|
+
{overridden
|
|
196
|
+
? fromCopy(copy, 'adminTheme.token.overridden')
|
|
197
|
+
: fromCopy(copy, 'adminTheme.token.usingOwn')}
|
|
198
|
+
</span>
|
|
199
|
+
{overridden && (
|
|
200
|
+
<button
|
|
201
|
+
type="button"
|
|
202
|
+
onClick={() => {
|
|
203
|
+
for (const scheme of schemesFor(token)) onChange(fieldName(token.name, scheme), '')
|
|
204
|
+
}}
|
|
205
|
+
className={LINK}
|
|
206
|
+
>
|
|
207
|
+
{fromCopy(copy, 'adminTheme.useThemesValue')}
|
|
208
|
+
</button>
|
|
209
|
+
)}
|
|
210
|
+
{onClose !== undefined && (
|
|
211
|
+
<button type="button" onClick={onClose} className={LINK}>
|
|
212
|
+
{fromCopy(copy, 'adminTheme.close')}
|
|
213
|
+
</button>
|
|
214
|
+
)}
|
|
215
|
+
</div>
|
|
216
|
+
</div>
|
|
217
|
+
)
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
export function ThemeEditorForm({
|
|
221
|
+
themeKey,
|
|
222
|
+
tokens,
|
|
223
|
+
customCss,
|
|
224
|
+
isDefault,
|
|
225
|
+
copy,
|
|
226
|
+
}: {
|
|
227
|
+
themeKey: string
|
|
228
|
+
tokens: readonly EditableToken[]
|
|
229
|
+
customCss: string
|
|
230
|
+
isDefault: boolean
|
|
231
|
+
copy: Copy
|
|
232
|
+
}) {
|
|
233
|
+
const [state, action] = useActionState(themeEditorAction, EMPTY_STATE)
|
|
234
|
+
const hydrated = useHydrated()
|
|
235
|
+
|
|
236
|
+
const [draft, setDraft] = useState<Draft>(() => initialDraft(tokens, state.values))
|
|
237
|
+
const [css, setCss] = useState(state.values?.customCss ?? customCss)
|
|
238
|
+
const [query, setQuery] = useState('')
|
|
239
|
+
const [changedOnly, setChangedOnly] = useState(false)
|
|
240
|
+
|
|
241
|
+
const groups = groupTokens(tokens)
|
|
242
|
+
|
|
243
|
+
const [selected, setSelected] = useState<string | null>(null)
|
|
244
|
+
|
|
245
|
+
const set = (name: string, value: string): void =>
|
|
246
|
+
setDraft((current) => ({ ...current, [name]: value }))
|
|
247
|
+
|
|
248
|
+
const applyPreset = (preset: (typeof BRAND_PRESETS)[number]): void =>
|
|
249
|
+
setDraft((current) => {
|
|
250
|
+
const next = { ...current }
|
|
251
|
+
for (const [name, value] of Object.entries(preset.light)) {
|
|
252
|
+
next[fieldName(name, 'light')] = value
|
|
253
|
+
}
|
|
254
|
+
for (const [name, value] of Object.entries(preset.dark)) {
|
|
255
|
+
next[fieldName(name, 'dark')] = value
|
|
256
|
+
}
|
|
257
|
+
return next
|
|
258
|
+
})
|
|
259
|
+
|
|
260
|
+
const changes = tokenChanges(tokens, draft)
|
|
261
|
+
const counts = changeCounts(changes)
|
|
262
|
+
const customCssChanged = css.trim() !== customCss.trim()
|
|
263
|
+
const unsaved = counts.unsaved + (customCssChanged ? 1 : 0)
|
|
264
|
+
|
|
265
|
+
const values = {
|
|
266
|
+
light: effectiveValues(tokens, draft, 'light'),
|
|
267
|
+
dark: effectiveValues(tokens, draft, 'dark'),
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
const changedNames = new Set(changes.filter((c) => c.draft !== '').map((c) => c.token.name))
|
|
271
|
+
const visible = (token: EditableToken): boolean =>
|
|
272
|
+
(!hydrated || matchesQuery(token, query)) &&
|
|
273
|
+
(!hydrated || !changedOnly || changedNames.has(token.name))
|
|
274
|
+
|
|
275
|
+
const shown = tokens.filter(visible).length
|
|
276
|
+
|
|
277
|
+
const cellState = (token: EditableToken): CellState => {
|
|
278
|
+
const fields = schemesFor(token)
|
|
279
|
+
if (fields.some((scheme) => draftValue(draft, token, scheme) !== savedValue(token, scheme))) {
|
|
280
|
+
return 'unsaved'
|
|
281
|
+
}
|
|
282
|
+
return fields.some((scheme) => draftValue(draft, token, scheme) !== '') ? 'saved' : 'clean'
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
const select = (name: string): void => {
|
|
286
|
+
setSelected(name)
|
|
287
|
+
requestAnimationFrame(() => {
|
|
288
|
+
const row = document.getElementById(`token-${name}`)
|
|
289
|
+
row?.scrollIntoView({ block: 'nearest' })
|
|
290
|
+
row?.querySelector<HTMLInputElement>('input')?.focus({ preventScroll: true })
|
|
291
|
+
})
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
const undo = (name: string, scheme: FieldScheme, to: string): void =>
|
|
295
|
+
set(fieldName(name, scheme), to)
|
|
296
|
+
|
|
297
|
+
const discardAll = (): void => {
|
|
298
|
+
setDraft(initialDraft(tokens, undefined))
|
|
299
|
+
setCss(customCss)
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
return (
|
|
303
|
+
<div className="flex flex-col gap-6 xl:grid xl:grid-cols-[minmax(0,1fr)_minmax(0,22rem)] xl:items-start">
|
|
304
|
+
<div className="@container flex min-w-0 flex-col gap-6">
|
|
305
|
+
<FormError message={state.error} />
|
|
306
|
+
<Saved when={state.notice === 'saved'}>{fromCopy(copy, 'adminTheme.editor.saved')}</Saved>
|
|
307
|
+
|
|
308
|
+
<form action={action} className="flex flex-col gap-6" noValidate>
|
|
309
|
+
<input type="hidden" name="key" value={themeKey} />
|
|
310
|
+
|
|
311
|
+
<fieldset className="flex flex-col gap-3">
|
|
312
|
+
<legend className="text-sm font-medium">
|
|
313
|
+
{fromCopy(copy, 'adminTheme.presets.title')}
|
|
314
|
+
</legend>
|
|
315
|
+
<p className="text-xs text-muted-foreground">
|
|
316
|
+
{copy['adminTheme.presets.blurbLead']}
|
|
317
|
+
<span className="font-medium">{fromCopy(copy, 'themeToken.preset.meith')}</span>
|
|
318
|
+
{copy['adminTheme.presets.blurbTail']}
|
|
319
|
+
</p>
|
|
320
|
+
<div className="flex flex-wrap gap-2">
|
|
321
|
+
{BRAND_PRESETS.map((preset) => (
|
|
322
|
+
<button
|
|
323
|
+
key={preset.key}
|
|
324
|
+
type="button"
|
|
325
|
+
onClick={() => applyPreset(preset)}
|
|
326
|
+
className={GHOST_BUTTON}
|
|
327
|
+
>
|
|
328
|
+
<span
|
|
329
|
+
aria-hidden
|
|
330
|
+
className="mr-2 inline-block size-3 rounded-full border border-border"
|
|
331
|
+
style={{ background: preset.light.primary }}
|
|
332
|
+
/>
|
|
333
|
+
{copy[preset.titleKey]}
|
|
334
|
+
</button>
|
|
335
|
+
))}
|
|
336
|
+
</div>
|
|
337
|
+
</fieldset>
|
|
338
|
+
|
|
339
|
+
{hydrated && (
|
|
340
|
+
<div className="flex flex-col gap-2 rounded-md border border-border p-3">
|
|
341
|
+
<label className="flex flex-col gap-1">
|
|
342
|
+
<span className="text-xs font-medium">
|
|
343
|
+
{fromCopy(copy, 'adminTheme.find.label')}
|
|
344
|
+
</span>
|
|
345
|
+
<input
|
|
346
|
+
type="search"
|
|
347
|
+
value={query}
|
|
348
|
+
onChange={(event) => setQuery(event.target.value)}
|
|
349
|
+
placeholder={fromCopy(copy, 'adminTheme.find.placeholder')}
|
|
350
|
+
className="w-full rounded-md border border-border bg-background px-3 py-2 text-xs focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring"
|
|
351
|
+
/>
|
|
352
|
+
</label>
|
|
353
|
+
|
|
354
|
+
<div className="flex flex-wrap items-center justify-between gap-3">
|
|
355
|
+
{counts.tokens > 0 ? (
|
|
356
|
+
<label className="flex items-center gap-2 text-xs">
|
|
357
|
+
<input
|
|
358
|
+
type="checkbox"
|
|
359
|
+
checked={changedOnly}
|
|
360
|
+
onChange={(event) => setChangedOnly(event.target.checked)}
|
|
361
|
+
className="size-4 accent-primary"
|
|
362
|
+
/>
|
|
363
|
+
{formatFromCopy(copy, 'adminTheme.find.changedOnly', { count: counts.tokens })}
|
|
364
|
+
</label>
|
|
365
|
+
) : (
|
|
366
|
+
<span className="text-xs text-muted-foreground">
|
|
367
|
+
{fromCopy(copy, 'adminTheme.find.nothingOverridden')}
|
|
368
|
+
</span>
|
|
369
|
+
)}
|
|
370
|
+
<span className="text-xs text-muted-foreground">
|
|
371
|
+
{formatFromCopy(copy, 'adminTheme.find.shownCount', {
|
|
372
|
+
shown,
|
|
373
|
+
total: tokens.length,
|
|
374
|
+
})}
|
|
375
|
+
</span>
|
|
376
|
+
</div>
|
|
377
|
+
</div>
|
|
378
|
+
)}
|
|
379
|
+
|
|
380
|
+
{groups.map((group) => {
|
|
381
|
+
const matches = group.tokens.filter(visible).length
|
|
382
|
+
const changed = group.tokens.filter((token) => changedNames.has(token.name)).length
|
|
383
|
+
|
|
384
|
+
return (
|
|
385
|
+
<fieldset
|
|
386
|
+
key={group.titleKey}
|
|
387
|
+
hidden={hydrated && matches === 0}
|
|
388
|
+
className="flex flex-col gap-2 rounded-md border border-border p-3"
|
|
389
|
+
>
|
|
390
|
+
<legend className="flex flex-wrap items-baseline gap-x-3 gap-y-1 px-1">
|
|
391
|
+
<span className="text-sm font-medium">{copy[group.titleKey]}</span>
|
|
392
|
+
<span className="text-xs text-muted-foreground">
|
|
393
|
+
{changed > 0 && (
|
|
394
|
+
<span className="mr-2 font-medium text-primary">
|
|
395
|
+
{formatFromCopy(copy, 'adminTheme.group.changedCount', { count: changed })}
|
|
396
|
+
</span>
|
|
397
|
+
)}
|
|
398
|
+
{formatFromCopy(copy, 'adminTheme.group.tokenCount', {
|
|
399
|
+
count: group.tokens.length,
|
|
400
|
+
})}
|
|
401
|
+
</span>
|
|
402
|
+
</legend>
|
|
403
|
+
|
|
404
|
+
<p className="text-xs text-muted-foreground">{copy[group.blurbKey]}</p>
|
|
405
|
+
|
|
406
|
+
{hydrated && (
|
|
407
|
+
<PaletteGrid
|
|
408
|
+
copy={copy}
|
|
409
|
+
cells={group.tokens.map((token) => ({
|
|
410
|
+
token,
|
|
411
|
+
light: values.light[token.name] ?? '',
|
|
412
|
+
dark: values.dark[token.name] ?? '',
|
|
413
|
+
state: cellState(token),
|
|
414
|
+
visible: visible(token),
|
|
415
|
+
}))}
|
|
416
|
+
selected={selected}
|
|
417
|
+
onSelect={(name) => (selected === name ? setSelected(null) : select(name))}
|
|
418
|
+
/>
|
|
419
|
+
)}
|
|
420
|
+
|
|
421
|
+
<div className="flex flex-col divide-y divide-border">
|
|
422
|
+
{group.tokens.map((token) => (
|
|
423
|
+
<TokenRow
|
|
424
|
+
key={token.name}
|
|
425
|
+
copy={copy}
|
|
426
|
+
token={token}
|
|
427
|
+
draft={draft}
|
|
428
|
+
values={values}
|
|
429
|
+
hidden={hydrated && (selected !== token.name || !visible(token))}
|
|
430
|
+
onChange={set}
|
|
431
|
+
onClose={hydrated ? () => setSelected(null) : undefined}
|
|
432
|
+
/>
|
|
433
|
+
))}
|
|
434
|
+
</div>
|
|
435
|
+
</fieldset>
|
|
436
|
+
)
|
|
437
|
+
})}
|
|
438
|
+
|
|
439
|
+
<label className="flex flex-col gap-1 text-sm">
|
|
440
|
+
<span className="font-medium">{fromCopy(copy, 'adminTheme.css.label')}</span>
|
|
441
|
+
<textarea
|
|
442
|
+
name="customCss"
|
|
443
|
+
rows={10}
|
|
444
|
+
value={css}
|
|
445
|
+
onChange={(event) => setCss(event.target.value)}
|
|
446
|
+
className={INPUT}
|
|
447
|
+
/>
|
|
448
|
+
<span className="text-xs text-muted-foreground">
|
|
449
|
+
{copy['adminTheme.css.hintLead']}
|
|
450
|
+
<code>@import</code>
|
|
451
|
+
{copy['adminTheme.css.hintMid']}
|
|
452
|
+
<code>url(</code>
|
|
453
|
+
{copy['adminTheme.css.hintTail']}{' '}
|
|
454
|
+
{isDefault ? (
|
|
455
|
+
fromCopy(copy, 'adminTheme.css.hintDefault')
|
|
456
|
+
) : (
|
|
457
|
+
<>
|
|
458
|
+
{copy['adminTheme.css.hintScopedLead']}
|
|
459
|
+
<code>:root</code>
|
|
460
|
+
{copy['adminTheme.css.hintScopedMid']}
|
|
461
|
+
<code>body</code>
|
|
462
|
+
{copy['adminTheme.css.hintScopedTail']}
|
|
463
|
+
</>
|
|
464
|
+
)}
|
|
465
|
+
</span>
|
|
466
|
+
</label>
|
|
467
|
+
|
|
468
|
+
<div className="sticky bottom-0 z-10 -mx-1 flex flex-wrap items-center gap-3 border-t border-border bg-background px-1 py-3">
|
|
469
|
+
<span className="min-w-40">
|
|
470
|
+
<SubmitButton>
|
|
471
|
+
{unsaved === 0
|
|
472
|
+
? fromCopy(copy, 'adminTheme.save')
|
|
473
|
+
: formatFromCopy(copy, 'adminTheme.saveChanges', { count: unsaved })}
|
|
474
|
+
</SubmitButton>
|
|
475
|
+
</span>
|
|
476
|
+
<button
|
|
477
|
+
type="submit"
|
|
478
|
+
name="intent"
|
|
479
|
+
value="preview"
|
|
480
|
+
className="inline-flex h-10 items-center justify-center rounded-md border border-border px-4 text-sm"
|
|
481
|
+
>
|
|
482
|
+
{fromCopy(copy, 'adminTheme.previewWithoutSaving')}
|
|
483
|
+
</button>
|
|
484
|
+
<span className="text-xs text-muted-foreground">
|
|
485
|
+
{unsaved === 0
|
|
486
|
+
? fromCopy(copy, 'adminTheme.nothingToSave')
|
|
487
|
+
: formatFromCopy(copy, 'adminTheme.unsavedChanges', { count: unsaved })}
|
|
488
|
+
</span>
|
|
489
|
+
</div>
|
|
490
|
+
</form>
|
|
491
|
+
</div>
|
|
492
|
+
|
|
493
|
+
<aside className="flex min-w-0 flex-col gap-6 xl:sticky xl:top-4 xl:max-h-[calc(100vh-2rem)] xl:overflow-y-auto xl:pr-1">
|
|
494
|
+
<ThemePreview
|
|
495
|
+
copy={copy}
|
|
496
|
+
light={cssVariables(values.light) as React.CSSProperties}
|
|
497
|
+
dark={cssVariables(values.dark) as React.CSSProperties}
|
|
498
|
+
hydrated={hydrated}
|
|
499
|
+
onPick={hydrated ? select : undefined}
|
|
500
|
+
/>
|
|
501
|
+
|
|
502
|
+
{state.preview !== undefined && (
|
|
503
|
+
<section className="flex flex-col gap-3">
|
|
504
|
+
<h3 className="text-base font-semibold tracking-tight">
|
|
505
|
+
{fromCopy(copy, 'adminTheme.validated.title')}
|
|
506
|
+
</h3>
|
|
507
|
+
<p className="text-xs text-muted-foreground">
|
|
508
|
+
{fromCopy(copy, 'adminTheme.validated.blurb')}
|
|
509
|
+
</p>
|
|
510
|
+
<style dangerouslySetInnerHTML={{ __html: state.preview }} />
|
|
511
|
+
<ValidatedSample copy={copy} />
|
|
512
|
+
</section>
|
|
513
|
+
)}
|
|
514
|
+
|
|
515
|
+
<ChangeSummary
|
|
516
|
+
copy={copy}
|
|
517
|
+
changes={changes}
|
|
518
|
+
customCssChanged={customCssChanged}
|
|
519
|
+
hydrated={hydrated}
|
|
520
|
+
onUndo={(change) => undo(change.token.name, change.scheme, change.saved)}
|
|
521
|
+
onClear={(change) => undo(change.token.name, change.scheme, '')}
|
|
522
|
+
onDiscardAll={discardAll}
|
|
523
|
+
/>
|
|
524
|
+
|
|
525
|
+
<LegibilityReport tokens={tokens} draft={draft} copy={copy} />
|
|
526
|
+
</aside>
|
|
527
|
+
</div>
|
|
528
|
+
)
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
export function ResetThemeForm({ themeKey, copy }: { themeKey: string; copy: Copy }) {
|
|
532
|
+
const [state, action] = useActionState(resetThemeAction, EMPTY_STATE)
|
|
533
|
+
|
|
534
|
+
return (
|
|
535
|
+
<form action={action} className="flex flex-col gap-3">
|
|
536
|
+
<FormError message={state.error} />
|
|
537
|
+
<Saved when={state.notice === 'reset'}>{fromCopy(copy, 'adminTheme.reset.done')}</Saved>
|
|
538
|
+
<input type="hidden" name="key" value={themeKey} />
|
|
539
|
+
<div>
|
|
540
|
+
<SubmitButton>{fromCopy(copy, 'adminTheme.reset.submit')}</SubmitButton>
|
|
541
|
+
</div>
|
|
542
|
+
</form>
|
|
543
|
+
)
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
export function ImportThemeForm({ themeKey, copy }: { themeKey: string; copy: Copy }) {
|
|
547
|
+
const [state, action] = useActionState(importThemeAction, EMPTY_STATE)
|
|
548
|
+
|
|
549
|
+
return (
|
|
550
|
+
<form action={action} className="flex flex-col gap-3" noValidate>
|
|
551
|
+
<FormError message={state.error} />
|
|
552
|
+
<Saved when={state.notice === 'imported'}>{fromCopy(copy, 'adminTheme.import.done')}</Saved>
|
|
553
|
+
<input type="hidden" name="key" value={themeKey} />
|
|
554
|
+
|
|
555
|
+
<label className="flex flex-col gap-1 text-sm">
|
|
556
|
+
<span className="font-medium">{fromCopy(copy, 'adminTheme.import.label')}</span>
|
|
557
|
+
<textarea name="document" rows={8} className={INPUT} required />
|
|
558
|
+
<span className="text-xs text-muted-foreground">
|
|
559
|
+
{fromCopy(copy, 'adminTheme.import.hint')}
|
|
560
|
+
</span>
|
|
561
|
+
</label>
|
|
562
|
+
|
|
563
|
+
<div>
|
|
564
|
+
<SubmitButton>{fromCopy(copy, 'adminTheme.import.submit')}</SubmitButton>
|
|
565
|
+
</div>
|
|
566
|
+
</form>
|
|
567
|
+
)
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
export function ThemeStateForms({
|
|
571
|
+
themeKey,
|
|
572
|
+
title,
|
|
573
|
+
enabled,
|
|
574
|
+
isDefault,
|
|
575
|
+
isBuildTheme,
|
|
576
|
+
copy,
|
|
577
|
+
}: {
|
|
578
|
+
themeKey: string
|
|
579
|
+
title: string
|
|
580
|
+
enabled: boolean
|
|
581
|
+
isDefault: boolean
|
|
582
|
+
isBuildTheme: boolean
|
|
583
|
+
copy: Copy
|
|
584
|
+
}) {
|
|
585
|
+
const [enabledState, enabledAction] = useActionState(setThemeEnabledAction, EMPTY_STATE)
|
|
586
|
+
const [defaultState, defaultAction] = useActionState(setDefaultThemeAction, EMPTY_STATE)
|
|
587
|
+
|
|
588
|
+
return (
|
|
589
|
+
<div className="flex shrink-0 flex-col items-end gap-2">
|
|
590
|
+
<FormError message={enabledState.error ?? defaultState.error} />
|
|
591
|
+
|
|
592
|
+
<div className="flex flex-wrap items-center justify-end gap-2">
|
|
593
|
+
{!isDefault && enabled && (
|
|
594
|
+
<form action={defaultAction}>
|
|
595
|
+
<input type="hidden" name="key" value={themeKey} />
|
|
596
|
+
<button
|
|
597
|
+
type="submit"
|
|
598
|
+
aria-label={formatFromCopy(copy, 'adminTheme.state.makeDefaultFor', { title })}
|
|
599
|
+
className={GHOST_BUTTON}
|
|
600
|
+
>
|
|
601
|
+
{fromCopy(copy, 'adminTheme.state.makeDefault')}
|
|
602
|
+
</button>
|
|
603
|
+
</form>
|
|
604
|
+
)}
|
|
605
|
+
|
|
606
|
+
{!isBuildTheme && !isDefault && (
|
|
607
|
+
<form action={enabledAction}>
|
|
608
|
+
<input type="hidden" name="key" value={themeKey} />
|
|
609
|
+
<input type="hidden" name="enabled" value={enabled ? 'false' : 'true'} />
|
|
610
|
+
<button
|
|
611
|
+
type="submit"
|
|
612
|
+
aria-label={formatFromCopy(
|
|
613
|
+
copy,
|
|
614
|
+
enabled ? 'adminTheme.state.turnOffFor' : 'adminTheme.state.turnOnFor',
|
|
615
|
+
{ title },
|
|
616
|
+
)}
|
|
617
|
+
className={GHOST_BUTTON}
|
|
618
|
+
>
|
|
619
|
+
{enabled
|
|
620
|
+
? fromCopy(copy, 'adminTheme.state.turnOff')
|
|
621
|
+
: fromCopy(copy, 'adminTheme.state.turnOn')}
|
|
622
|
+
</button>
|
|
623
|
+
</form>
|
|
624
|
+
)}
|
|
625
|
+
|
|
626
|
+
<a
|
|
627
|
+
href={`/admin/themes/${themeKey}`}
|
|
628
|
+
aria-label={formatFromCopy(copy, 'adminTheme.state.customiseFor', { title })}
|
|
629
|
+
className="inline-flex h-8 items-center justify-center rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground"
|
|
630
|
+
>
|
|
631
|
+
{fromCopy(copy, 'adminTheme.state.customise')}
|
|
632
|
+
</a>
|
|
633
|
+
</div>
|
|
634
|
+
</div>
|
|
635
|
+
)
|
|
636
|
+
}
|