@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,60 @@
|
|
|
1
|
+
import { buildTree, type ForumNode, keepVisibleSubtrees } from '@meith/forums'
|
|
2
|
+
import type { Translator } from '@meith/i18n'
|
|
3
|
+
import type { ForumJumpModel, ForumJumpOption } from '@meith/theme-kit'
|
|
4
|
+
|
|
5
|
+
import { untranslated } from './time'
|
|
6
|
+
|
|
7
|
+
export interface ForumJumpRow {
|
|
8
|
+
readonly id: number
|
|
9
|
+
readonly parentId: number | null
|
|
10
|
+
readonly displayOrder: number
|
|
11
|
+
readonly type: string
|
|
12
|
+
readonly title: string
|
|
13
|
+
readonly slug: string
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface ForumJumpInput {
|
|
17
|
+
readonly rows: readonly ForumJumpRow[]
|
|
18
|
+
readonly visibleForumIds: ReadonlySet<number>
|
|
19
|
+
readonly currentForumId?: number | null
|
|
20
|
+
readonly action?: string
|
|
21
|
+
readonly field?: string
|
|
22
|
+
readonly t?: Translator
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const JUMP_ACTION = '/jump'
|
|
26
|
+
export const JUMP_FIELD = 'forum'
|
|
27
|
+
|
|
28
|
+
export function parseJumpTarget(raw: string | readonly string[] | undefined): number | null {
|
|
29
|
+
const first = Array.isArray(raw) ? raw[0] : (raw as string | undefined)
|
|
30
|
+
if (first === undefined || !/^\d+$/.test(first)) return null
|
|
31
|
+
return Number(first)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function buildForumJumpModel(input: ForumJumpInput): ForumJumpModel {
|
|
35
|
+
const t = input.t ?? untranslated()
|
|
36
|
+
const visible = keepVisibleSubtrees(input.rows, (row) => input.visibleForumIds.has(row.id))
|
|
37
|
+
|
|
38
|
+
const forums: ForumJumpOption[] = []
|
|
39
|
+
|
|
40
|
+
const walk = (node: ForumNode<ForumJumpRow>, depth: number): void => {
|
|
41
|
+
forums.push({
|
|
42
|
+
value: String(node.id),
|
|
43
|
+
label: node.title,
|
|
44
|
+
depth,
|
|
45
|
+
isCategory: node.type === 'category',
|
|
46
|
+
isSelected: node.id === (input.currentForumId ?? null),
|
|
47
|
+
})
|
|
48
|
+
for (const child of node.children) walk(child, depth + 1)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
for (const root of buildTree(visible)) walk(root, 0)
|
|
52
|
+
|
|
53
|
+
return {
|
|
54
|
+
action: input.action ?? JUMP_ACTION,
|
|
55
|
+
field: input.field ?? JUMP_FIELD,
|
|
56
|
+
forums,
|
|
57
|
+
submitLabel: t.t('forumJump.go'),
|
|
58
|
+
label: t.t('forumJump.label'),
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Translator } from '@meith/i18n'
|
|
2
|
+
|
|
3
|
+
import { inlineOutcomeNotice } from './inline-moderation'
|
|
4
|
+
import { untranslated } from './time'
|
|
5
|
+
|
|
6
|
+
export interface ForumNoticeQuery {
|
|
7
|
+
readonly posted?: string | undefined
|
|
8
|
+
readonly thread?: string | undefined
|
|
9
|
+
readonly did?: string | undefined
|
|
10
|
+
readonly n?: string | undefined
|
|
11
|
+
readonly refused?: string | undefined
|
|
12
|
+
readonly gone?: string | undefined
|
|
13
|
+
readonly skipped?: string | undefined
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function forumNotice(
|
|
17
|
+
query: ForumNoticeQuery,
|
|
18
|
+
t: Translator = untranslated(),
|
|
19
|
+
): string | null {
|
|
20
|
+
if (query.posted === 'moderated') return t.t('forum.threadHeld')
|
|
21
|
+
if (query.thread === 'deleted') return t.t('forum.threadDeleted')
|
|
22
|
+
|
|
23
|
+
return inlineOutcomeNotice(query)
|
|
24
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { InlineTool } from '@meith/moderation'
|
|
2
|
+
import type { SelectionModel } from '@meith/theme-kit'
|
|
3
|
+
|
|
4
|
+
export const INLINE_FORM_ID = 'inline-moderation'
|
|
5
|
+
|
|
6
|
+
export interface InlineToolAvailability {
|
|
7
|
+
readonly approve: boolean
|
|
8
|
+
readonly lock: boolean
|
|
9
|
+
readonly stick: boolean
|
|
10
|
+
readonly move: boolean
|
|
11
|
+
readonly delete: boolean
|
|
12
|
+
readonly restore: boolean
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const NO_INLINE_TOOLS: InlineToolAvailability = {
|
|
16
|
+
approve: false,
|
|
17
|
+
lock: false,
|
|
18
|
+
stick: false,
|
|
19
|
+
move: false,
|
|
20
|
+
delete: false,
|
|
21
|
+
restore: false,
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function anyInlineTool(available: InlineToolAvailability): boolean {
|
|
25
|
+
return (
|
|
26
|
+
available.approve ||
|
|
27
|
+
available.lock ||
|
|
28
|
+
available.stick ||
|
|
29
|
+
available.move ||
|
|
30
|
+
available.delete ||
|
|
31
|
+
available.restore
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function selectionFor(
|
|
36
|
+
kind: 'thread' | 'post',
|
|
37
|
+
id: number,
|
|
38
|
+
label: string,
|
|
39
|
+
offered: boolean,
|
|
40
|
+
): SelectionModel | null {
|
|
41
|
+
if (!offered) return null
|
|
42
|
+
return {
|
|
43
|
+
name: 'item',
|
|
44
|
+
value: `${kind}:${id}`,
|
|
45
|
+
formId: INLINE_FORM_ID,
|
|
46
|
+
label: `Select ${label} for moderation`,
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function inlineOutcomeNotice(query: {
|
|
51
|
+
readonly did?: string | undefined
|
|
52
|
+
readonly n?: string | undefined
|
|
53
|
+
readonly refused?: string | undefined
|
|
54
|
+
readonly gone?: string | undefined
|
|
55
|
+
readonly skipped?: string | undefined
|
|
56
|
+
}): string | null {
|
|
57
|
+
const tool = query.did
|
|
58
|
+
if (tool === undefined) return null
|
|
59
|
+
const applied = count(query.n)
|
|
60
|
+
const parts = [`${applied} ${applied === 1 ? 'item' : 'items'} ${PAST_TENSE[tool] ?? tool}.`]
|
|
61
|
+
|
|
62
|
+
const refused = count(query.refused)
|
|
63
|
+
if (refused > 0) parts.push(`${refused} refused — you cannot do that there.`)
|
|
64
|
+
const gone = count(query.gone)
|
|
65
|
+
if (gone > 0) parts.push(`${gone} no longer available.`)
|
|
66
|
+
const skipped = count(query.skipped)
|
|
67
|
+
if (skipped > 0) parts.push(`${skipped} already in that state.`)
|
|
68
|
+
|
|
69
|
+
return parts.join(' ')
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function count(value: string | undefined): number {
|
|
73
|
+
if (value === undefined || !/^\d+$/.test(value)) return 0
|
|
74
|
+
const n = Number(value)
|
|
75
|
+
return Number.isSafeInteger(n) ? n : 0
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const PAST_TENSE: Readonly<Record<string, string>> = {
|
|
79
|
+
approve: 'approved',
|
|
80
|
+
delete: 'deleted',
|
|
81
|
+
restore: 'restored',
|
|
82
|
+
lock: 'locked',
|
|
83
|
+
unlock: 'unlocked',
|
|
84
|
+
stick: 'pinned',
|
|
85
|
+
unstick: 'unpinned',
|
|
86
|
+
move: 'moved',
|
|
87
|
+
} satisfies Readonly<Record<InlineTool, string>>
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type { Translator } from '@meith/i18n'
|
|
2
|
+
|
|
3
|
+
import { copyFor, patternCopy, splitAround } from './copy'
|
|
4
|
+
import { untranslated } from './time'
|
|
5
|
+
|
|
6
|
+
export function installFormCopy(
|
|
7
|
+
reservedUsernames: readonly string[],
|
|
8
|
+
t: Translator = untranslated(),
|
|
9
|
+
): Readonly<Record<string, string>> {
|
|
10
|
+
const [urlFromEnvLead, urlFromEnvTail] = splitAround(t, 'install.urlFromEnv', 'name')
|
|
11
|
+
const [mailFromEnvLead, mailFromEnvTail] = splitAround(t, 'install.mailFromEnv', 'name')
|
|
12
|
+
const [testNoteLead, testNoteTail] = splitAround(t, 'install.mail.testNote', 'before')
|
|
13
|
+
return {
|
|
14
|
+
...copyFor(
|
|
15
|
+
[
|
|
16
|
+
'install.board.title',
|
|
17
|
+
'install.board.hint',
|
|
18
|
+
'install.boardName.label',
|
|
19
|
+
'install.boardName.hint',
|
|
20
|
+
'install.boardUrl.label',
|
|
21
|
+
'install.boardUrl.hint',
|
|
22
|
+
'install.account.title',
|
|
23
|
+
'install.account.hint',
|
|
24
|
+
'install.username.label',
|
|
25
|
+
'install.email.label',
|
|
26
|
+
'install.email.hint',
|
|
27
|
+
'install.password.label',
|
|
28
|
+
'install.password.hint',
|
|
29
|
+
'install.mail.title',
|
|
30
|
+
'install.mail.envHint',
|
|
31
|
+
'install.mail.optionalHint',
|
|
32
|
+
'install.mail.testNoteBefore',
|
|
33
|
+
'install.mail.how',
|
|
34
|
+
'install.mail.skip',
|
|
35
|
+
'install.mail.needs',
|
|
36
|
+
'install.mail.serverDetails',
|
|
37
|
+
'install.mailFrom.label',
|
|
38
|
+
'install.mailFrom.hint',
|
|
39
|
+
'install.mailUsername.label',
|
|
40
|
+
'install.mailUsername.hint',
|
|
41
|
+
'install.mailSecret.label',
|
|
42
|
+
'install.mailSecret.hint',
|
|
43
|
+
'install.mailHost.label',
|
|
44
|
+
'install.mailHost.hint',
|
|
45
|
+
'install.mailPort.label',
|
|
46
|
+
'install.mailSecurity.label',
|
|
47
|
+
'install.mailSecurity.default',
|
|
48
|
+
'install.mailSecurity.starttls',
|
|
49
|
+
'install.mailSecurity.tls',
|
|
50
|
+
'install.mailSecurity.none',
|
|
51
|
+
'install.mailEndpoint.label',
|
|
52
|
+
'install.mailEndpoint.hint',
|
|
53
|
+
'install.submit.installing',
|
|
54
|
+
'install.submit.tryAgain',
|
|
55
|
+
'install.submit.install',
|
|
56
|
+
'install.submit.pendingNote',
|
|
57
|
+
'install.submit.idleNote',
|
|
58
|
+
'install.steps.howFar',
|
|
59
|
+
'install.steps.what',
|
|
60
|
+
'install.steps.done',
|
|
61
|
+
'install.steps.failed',
|
|
62
|
+
'install.steps.notRun',
|
|
63
|
+
'install.outcome.oneAnswer',
|
|
64
|
+
'install.outcome.passwords',
|
|
65
|
+
'install.field.boardName',
|
|
66
|
+
'install.field.boardUrl',
|
|
67
|
+
'install.field.username',
|
|
68
|
+
'install.field.email',
|
|
69
|
+
'install.field.password',
|
|
70
|
+
'install.field.mailPreset',
|
|
71
|
+
'install.field.mailFrom',
|
|
72
|
+
'install.field.mailUsername',
|
|
73
|
+
'install.field.mailSecret',
|
|
74
|
+
'install.field.mailHost',
|
|
75
|
+
'install.field.mailPort',
|
|
76
|
+
'install.field.mailSecurity',
|
|
77
|
+
'install.field.mailEndpoint',
|
|
78
|
+
],
|
|
79
|
+
t,
|
|
80
|
+
),
|
|
81
|
+
...patternCopy(
|
|
82
|
+
['install.steps.count', 'install.outcome.didNotFinish', 'install.outcome.answers'],
|
|
83
|
+
t,
|
|
84
|
+
),
|
|
85
|
+
'install.username.hint': t.t('install.username.hint', {
|
|
86
|
+
names: reservedUsernames.join(', '),
|
|
87
|
+
}),
|
|
88
|
+
'install.urlFromEnvLead': urlFromEnvLead,
|
|
89
|
+
'install.urlFromEnvTail': urlFromEnvTail,
|
|
90
|
+
'install.mailFromEnvLead': mailFromEnvLead,
|
|
91
|
+
'install.mailFromEnvTail': mailFromEnvTail,
|
|
92
|
+
'install.mail.testNoteLead': testNoteLead,
|
|
93
|
+
'install.mail.testNoteTail': testNoteTail,
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { Translator } from '@meith/i18n'
|
|
2
|
+
import type { LinkModel } from '@meith/theme-kit'
|
|
3
|
+
|
|
4
|
+
import { untranslated } from './time'
|
|
5
|
+
|
|
6
|
+
export type LegalSlug = 'terms' | 'privacy' | 'rules'
|
|
7
|
+
|
|
8
|
+
export interface LegalPage {
|
|
9
|
+
readonly slug: LegalSlug
|
|
10
|
+
readonly settingKey: 'legal.terms' | 'legal.privacy' | 'legal.rules'
|
|
11
|
+
readonly titleKey: string
|
|
12
|
+
readonly href: string
|
|
13
|
+
readonly footerLabelKey: string
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const LEGAL_PAGES: readonly LegalPage[] = [
|
|
17
|
+
{
|
|
18
|
+
slug: 'terms',
|
|
19
|
+
settingKey: 'legal.terms',
|
|
20
|
+
titleKey: 'legal.page.terms.title',
|
|
21
|
+
href: '/terms',
|
|
22
|
+
footerLabelKey: 'legal.page.terms.footer',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
slug: 'privacy',
|
|
26
|
+
settingKey: 'legal.privacy',
|
|
27
|
+
titleKey: 'legal.page.privacy.title',
|
|
28
|
+
href: '/privacy',
|
|
29
|
+
footerLabelKey: 'legal.page.privacy.footer',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
slug: 'rules',
|
|
33
|
+
settingKey: 'legal.rules',
|
|
34
|
+
titleKey: 'legal.page.rules.title',
|
|
35
|
+
href: '/rules',
|
|
36
|
+
footerLabelKey: 'legal.page.rules.footer',
|
|
37
|
+
},
|
|
38
|
+
]
|
|
39
|
+
|
|
40
|
+
export const TERMS_PAGE: LegalPage = LEGAL_PAGES[0]!
|
|
41
|
+
|
|
42
|
+
export function legalPage(slug: string): LegalPage | null {
|
|
43
|
+
return LEGAL_PAGES.find((page) => page.slug === slug) ?? null
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function isPublished(body: string): boolean {
|
|
47
|
+
return body.trim() !== ''
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function buildLegalLinks(
|
|
51
|
+
bodyOf: (page: LegalPage) => string,
|
|
52
|
+
t: Translator = untranslated(),
|
|
53
|
+
): readonly LinkModel[] {
|
|
54
|
+
return LEGAL_PAGES.filter((page) => isPublished(bodyOf(page))).map((page) => ({
|
|
55
|
+
label: t.t(page.footerLabelKey),
|
|
56
|
+
href: page.href,
|
|
57
|
+
}))
|
|
58
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { AUTOMATIC_LOCALE } from '@meith/accounts'
|
|
2
|
+
import { type Locale, negotiateLocale, normaliseLocale, parseAcceptLanguage } from '@meith/i18n'
|
|
3
|
+
|
|
4
|
+
export interface ResolvedLocale {
|
|
5
|
+
readonly locale: Locale
|
|
6
|
+
readonly isAutomatic: boolean
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function resolveLocale(input: {
|
|
10
|
+
readonly stored?: string | null | undefined
|
|
11
|
+
readonly accepted?: string | null | undefined
|
|
12
|
+
readonly boardDefault?: string | null | undefined
|
|
13
|
+
readonly supported: readonly Locale[]
|
|
14
|
+
}): ResolvedLocale {
|
|
15
|
+
const fallback = normaliseLocale(input.boardDefault) ?? 'en'
|
|
16
|
+
const stored = input.stored ?? null
|
|
17
|
+
|
|
18
|
+
if (stored !== null && stored !== AUTOMATIC_LOCALE) {
|
|
19
|
+
const chosen = normaliseLocale(stored)
|
|
20
|
+
if (chosen !== null) {
|
|
21
|
+
return {
|
|
22
|
+
locale: negotiateLocale({
|
|
23
|
+
requested: [chosen],
|
|
24
|
+
supported: input.supported,
|
|
25
|
+
fallback,
|
|
26
|
+
}),
|
|
27
|
+
isAutomatic: false,
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
locale: negotiateLocale({
|
|
34
|
+
requested: parseAcceptLanguage(input.accepted).map((entry) => entry.locale),
|
|
35
|
+
supported: input.supported,
|
|
36
|
+
fallback,
|
|
37
|
+
}),
|
|
38
|
+
isAutomatic: true,
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { Translator } from '@meith/i18n'
|
|
2
|
+
import type { ListingStatus } from '@meith/marketplace'
|
|
3
|
+
|
|
4
|
+
import type { ViewTab } from '@/components/shell/view-tabs'
|
|
5
|
+
|
|
6
|
+
export type StatusTone = 'active' | 'muted' | 'warning' | 'destructive'
|
|
7
|
+
|
|
8
|
+
export interface StatusBadge {
|
|
9
|
+
readonly label: string
|
|
10
|
+
readonly tone: StatusTone
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const STATUS_KEYS: Readonly<Record<ListingStatus, string>> = {
|
|
14
|
+
active: 'adminMarketplace.status.active',
|
|
15
|
+
'installed-disabled': 'adminMarketplace.status.installedDisabled',
|
|
16
|
+
'not-installed': 'adminMarketplace.status.notInstalled',
|
|
17
|
+
'update-available': 'adminMarketplace.status.updateAvailable',
|
|
18
|
+
incompatible: 'adminMarketplace.status.incompatible',
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const STATUS_TONES: Readonly<Record<ListingStatus, StatusTone>> = {
|
|
22
|
+
active: 'active',
|
|
23
|
+
'installed-disabled': 'muted',
|
|
24
|
+
'not-installed': 'muted',
|
|
25
|
+
'update-available': 'warning',
|
|
26
|
+
incompatible: 'destructive',
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function statusBadge(status: ListingStatus, t: Translator): StatusBadge {
|
|
30
|
+
return { label: t.t(STATUS_KEYS[status]), tone: STATUS_TONES[status] }
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function catalogTabs(input: {
|
|
34
|
+
readonly installedHref: string
|
|
35
|
+
readonly browseHref: string
|
|
36
|
+
readonly current: 'installed' | 'browse'
|
|
37
|
+
readonly t: Translator
|
|
38
|
+
}): readonly ViewTab[] {
|
|
39
|
+
return [
|
|
40
|
+
{
|
|
41
|
+
href: input.installedHref,
|
|
42
|
+
label: input.t.t('adminMarketplace.tab.installed'),
|
|
43
|
+
isCurrent: input.current === 'installed',
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
href: input.browseHref,
|
|
47
|
+
label: input.t.t('adminMarketplace.tab.browse'),
|
|
48
|
+
isCurrent: input.current === 'browse',
|
|
49
|
+
},
|
|
50
|
+
]
|
|
51
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface MemberIdentity {
|
|
2
|
+
readonly groupId: number
|
|
3
|
+
readonly title: string
|
|
4
|
+
readonly nameClass: string | null
|
|
5
|
+
readonly badge: {
|
|
6
|
+
readonly src: string
|
|
7
|
+
readonly darkSrc: string | null
|
|
8
|
+
readonly alt: string
|
|
9
|
+
} | null
|
|
10
|
+
readonly reputation: number
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function nameClassOf(
|
|
14
|
+
identities: ReadonlyMap<number, MemberIdentity> | undefined,
|
|
15
|
+
userId: number | null,
|
|
16
|
+
): string | null {
|
|
17
|
+
if (identities === undefined || userId === null) return null
|
|
18
|
+
return identities.get(userId)?.nameClass ?? null
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function distinctUserIds(ids: readonly (number | null)[]): readonly number[] {
|
|
22
|
+
return [...new Set(ids.filter((id): id is number => id !== null))]
|
|
23
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { MemberProfileRecord } from '@meith/accounts'
|
|
2
|
+
import type { Translator } from '@meith/i18n'
|
|
3
|
+
import type { MemberProfileModel } from '@meith/theme-kit'
|
|
4
|
+
|
|
5
|
+
import { count } from './count'
|
|
6
|
+
import { formatDate, formatTime, untranslated } from './time'
|
|
7
|
+
|
|
8
|
+
export function memberHref(userId: number): string {
|
|
9
|
+
return `/member/${userId}`
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function buildMemberProfileView(
|
|
13
|
+
profile: MemberProfileRecord,
|
|
14
|
+
now: Date,
|
|
15
|
+
options: {
|
|
16
|
+
readonly canWarn?: boolean
|
|
17
|
+
readonly t?: Translator
|
|
18
|
+
readonly customFields?: readonly { readonly label: string; readonly value: string }[]
|
|
19
|
+
readonly canMessage?: boolean
|
|
20
|
+
readonly avatarUrl?: string | null
|
|
21
|
+
readonly nameClass?: string | null
|
|
22
|
+
} = {},
|
|
23
|
+
): MemberProfileModel {
|
|
24
|
+
const {
|
|
25
|
+
canWarn = false,
|
|
26
|
+
canMessage = false,
|
|
27
|
+
t = untranslated(),
|
|
28
|
+
customFields = [],
|
|
29
|
+
avatarUrl = null,
|
|
30
|
+
nameClass = null,
|
|
31
|
+
} = options
|
|
32
|
+
return {
|
|
33
|
+
user: {
|
|
34
|
+
userId: profile.id,
|
|
35
|
+
username: profile.username,
|
|
36
|
+
profileHref: memberHref(profile.id),
|
|
37
|
+
nameClass,
|
|
38
|
+
},
|
|
39
|
+
avatarUrl,
|
|
40
|
+
title: profile.title,
|
|
41
|
+
joinedAt: formatDate(profile.createdAt, t),
|
|
42
|
+
lastVisitAt: profile.lastActiveAt === null ? null : formatTime(profile.lastActiveAt, now, t),
|
|
43
|
+
postCount: count(profile.postCount, t),
|
|
44
|
+
signatureHtml: null,
|
|
45
|
+
fields: [
|
|
46
|
+
profile.location === null ? null : { label: 'Location', value: profile.location },
|
|
47
|
+
profile.website === null ? null : { label: 'Website', value: profile.website },
|
|
48
|
+
profile.bio === null ? null : { label: 'About', value: profile.bio },
|
|
49
|
+
...customFields,
|
|
50
|
+
].filter((field): field is { label: string; value: string } => field !== null),
|
|
51
|
+
actions: [
|
|
52
|
+
...(canMessage
|
|
53
|
+
? [
|
|
54
|
+
{
|
|
55
|
+
label: t.t('profile.sendMessage'),
|
|
56
|
+
href: `/messages/compose?to=${encodeURIComponent(profile.username)}`,
|
|
57
|
+
},
|
|
58
|
+
]
|
|
59
|
+
: []),
|
|
60
|
+
...(canWarn
|
|
61
|
+
? [{ label: t.t('profile.warnMember'), href: `/moderation/warn?user=${profile.id}` }]
|
|
62
|
+
: []),
|
|
63
|
+
],
|
|
64
|
+
}
|
|
65
|
+
}
|