@commonpub/layer 0.1.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 +661 -0
- package/app.vue +7 -0
- package/components/AnnouncementBand.vue +117 -0
- package/components/AppToast.vue +108 -0
- package/components/AuthorCard.vue +119 -0
- package/components/AuthorRow.vue +81 -0
- package/components/CommentSection.vue +330 -0
- package/components/ContentCard.vue +340 -0
- package/components/ContentPicker.vue +240 -0
- package/components/ContentStarterForm.vue +214 -0
- package/components/ContentTypeBadge.vue +46 -0
- package/components/CountdownTimer.vue +68 -0
- package/components/CpubEditor.vue +87 -0
- package/components/DiscussionItem.vue +191 -0
- package/components/EditorPropertiesPanel.vue +393 -0
- package/components/EngagementBar.vue +131 -0
- package/components/FederatedContentCard.vue +291 -0
- package/components/FeedItem.vue +283 -0
- package/components/FilterChip.vue +21 -0
- package/components/HeatmapGrid.vue +92 -0
- package/components/ImageUpload.vue +219 -0
- package/components/MemberCard.vue +163 -0
- package/components/MessageThread.vue +120 -0
- package/components/NotificationItem.vue +103 -0
- package/components/ProgressTracker.vue +41 -0
- package/components/PublishErrorsModal.vue +116 -0
- package/components/RemoteActorCard.vue +206 -0
- package/components/RemoteUserSearch.vue +117 -0
- package/components/SearchFilters.vue +188 -0
- package/components/SearchSidebar.vue +181 -0
- package/components/SectionHeader.vue +17 -0
- package/components/ShareToHubModal.vue +189 -0
- package/components/SiteLogo.vue +21 -0
- package/components/SkillBar.vue +57 -0
- package/components/SortSelect.vue +30 -0
- package/components/StatBar.vue +14 -0
- package/components/TOCNav.vue +69 -0
- package/components/TimelineItem.vue +82 -0
- package/components/VideoCard.vue +106 -0
- package/components/blocks/BlockBuildStepView.vue +92 -0
- package/components/blocks/BlockCalloutView.vue +82 -0
- package/components/blocks/BlockCheckpointView.vue +50 -0
- package/components/blocks/BlockCodeView.vue +212 -0
- package/components/blocks/BlockContentRenderer.vue +143 -0
- package/components/blocks/BlockDividerView.vue +11 -0
- package/components/blocks/BlockDownloadsView.vue +126 -0
- package/components/blocks/BlockEmbedView.vue +61 -0
- package/components/blocks/BlockGalleryView.vue +57 -0
- package/components/blocks/BlockHeadingView.vue +29 -0
- package/components/blocks/BlockImageView.vue +34 -0
- package/components/blocks/BlockMarkdownView.vue +118 -0
- package/components/blocks/BlockMathView.vue +45 -0
- package/components/blocks/BlockPartsListView.vue +104 -0
- package/components/blocks/BlockQuizView.vue +239 -0
- package/components/blocks/BlockQuoteView.vue +41 -0
- package/components/blocks/BlockSectionHeaderView.vue +58 -0
- package/components/blocks/BlockSliderView.vue +236 -0
- package/components/blocks/BlockTextView.vue +41 -0
- package/components/blocks/BlockToolListView.vue +87 -0
- package/components/blocks/BlockVideoView.vue +89 -0
- package/components/editors/ArticleEditor.vue +545 -0
- package/components/editors/BlockCanvas.vue +487 -0
- package/components/editors/BlockInsertZone.vue +84 -0
- package/components/editors/BlockPicker.vue +285 -0
- package/components/editors/BlockWrapper.vue +192 -0
- package/components/editors/BlogEditor.vue +567 -0
- package/components/editors/EditorBlocks.vue +248 -0
- package/components/editors/EditorSection.vue +81 -0
- package/components/editors/EditorShell.vue +168 -0
- package/components/editors/EditorTagInput.vue +114 -0
- package/components/editors/EditorVisibility.vue +110 -0
- package/components/editors/ExplainerEditor.vue +503 -0
- package/components/editors/MarkdownImportDialog.vue +249 -0
- package/components/editors/ProjectEditor.vue +446 -0
- package/components/editors/blocks/BuildStepBlock.vue +102 -0
- package/components/editors/blocks/CalloutBlock.vue +122 -0
- package/components/editors/blocks/CheckpointBlock.vue +27 -0
- package/components/editors/blocks/CodeBlock.vue +177 -0
- package/components/editors/blocks/DividerBlock.vue +22 -0
- package/components/editors/blocks/DownloadsBlock.vue +41 -0
- package/components/editors/blocks/EmbedBlock.vue +20 -0
- package/components/editors/blocks/GalleryBlock.vue +236 -0
- package/components/editors/blocks/HeadingBlock.vue +96 -0
- package/components/editors/blocks/ImageBlock.vue +271 -0
- package/components/editors/blocks/MarkdownBlock.vue +258 -0
- package/components/editors/blocks/MathBlock.vue +37 -0
- package/components/editors/blocks/PartsListBlock.vue +358 -0
- package/components/editors/blocks/QuizBlock.vue +47 -0
- package/components/editors/blocks/QuoteBlock.vue +101 -0
- package/components/editors/blocks/SectionHeaderBlock.vue +130 -0
- package/components/editors/blocks/SliderBlock.vue +318 -0
- package/components/editors/blocks/TextBlock.vue +201 -0
- package/components/editors/blocks/ToolListBlock.vue +70 -0
- package/components/editors/blocks/VideoBlock.vue +22 -0
- package/components/hub/HubDiscussions.vue +47 -0
- package/components/hub/HubFeed.vue +199 -0
- package/components/hub/HubHero.vue +185 -0
- package/components/hub/HubLayout.vue +103 -0
- package/components/hub/HubMembers.vue +40 -0
- package/components/hub/HubProducts.vue +93 -0
- package/components/hub/HubProjects.vue +207 -0
- package/components/hub/HubSidebar.vue +12 -0
- package/components/hub/HubSidebarCard.vue +35 -0
- package/components/views/ArticleView.vue +771 -0
- package/components/views/BlogView.vue +667 -0
- package/components/views/ExplainerView.vue +688 -0
- package/components/views/ProjectView.vue +1500 -0
- package/composables/useApiError.ts +39 -0
- package/composables/useAuth.ts +87 -0
- package/composables/useBlockEditor.ts +187 -0
- package/composables/useContentSave.ts +253 -0
- package/composables/useContentTypes.ts +37 -0
- package/composables/useEngagement.ts +196 -0
- package/composables/useFeatures.ts +33 -0
- package/composables/useFederation.ts +72 -0
- package/composables/useJsonLd.ts +183 -0
- package/composables/useMarkdownImport.ts +77 -0
- package/composables/useMirrorContent.ts +105 -0
- package/composables/useNotifications.ts +73 -0
- package/composables/usePublishValidation.ts +65 -0
- package/composables/useSanitize.ts +34 -0
- package/composables/useSiteName.ts +4 -0
- package/composables/useTheme.ts +34 -0
- package/composables/useToast.ts +35 -0
- package/error.vue +129 -0
- package/layouts/admin.vue +213 -0
- package/layouts/auth.vue +63 -0
- package/layouts/default.vue +269 -0
- package/layouts/editor.vue +129 -0
- package/middleware/auth.ts +6 -0
- package/nuxt.config.ts +83 -0
- package/package.json +59 -0
- package/pages/[type]/[slug]/edit.vue +676 -0
- package/pages/[type]/[slug]/index.vue +313 -0
- package/pages/[type]/index.vue +118 -0
- package/pages/about.vue +100 -0
- package/pages/admin/audit.vue +66 -0
- package/pages/admin/content.vue +116 -0
- package/pages/admin/federation.vue +446 -0
- package/pages/admin/index.vue +62 -0
- package/pages/admin/reports.vue +88 -0
- package/pages/admin/settings.vue +167 -0
- package/pages/admin/users.vue +145 -0
- package/pages/auth/forgot-password.vue +103 -0
- package/pages/auth/login.vue +216 -0
- package/pages/auth/oauth/authorize.vue +178 -0
- package/pages/auth/register.vue +246 -0
- package/pages/auth/reset-password.vue +124 -0
- package/pages/auth/verify-email.vue +80 -0
- package/pages/cert/[code].vue +154 -0
- package/pages/contests/[slug]/edit.vue +153 -0
- package/pages/contests/[slug]/index.vue +556 -0
- package/pages/contests/[slug]/judge.vue +160 -0
- package/pages/contests/create.vue +192 -0
- package/pages/contests/index.vue +69 -0
- package/pages/create.vue +219 -0
- package/pages/dashboard.vue +521 -0
- package/pages/docs/[siteSlug]/[...pagePath].vue +704 -0
- package/pages/docs/[siteSlug]/edit.vue +480 -0
- package/pages/docs/[siteSlug]/index.vue +380 -0
- package/pages/docs/create.vue +60 -0
- package/pages/docs/index.vue +181 -0
- package/pages/explore.vue +422 -0
- package/pages/federated-hubs/[id]/index.vue +385 -0
- package/pages/federated-hubs/[id]/posts/[postId].vue +309 -0
- package/pages/federation/index.vue +157 -0
- package/pages/federation/search.vue +43 -0
- package/pages/federation/users/[handle].vue +221 -0
- package/pages/feed.vue +135 -0
- package/pages/hubs/[slug]/index.vue +513 -0
- package/pages/hubs/[slug]/members.vue +134 -0
- package/pages/hubs/[slug]/posts/[postId].vue +352 -0
- package/pages/hubs/[slug]/settings.vue +254 -0
- package/pages/hubs/create.vue +201 -0
- package/pages/hubs/index.vue +207 -0
- package/pages/index.vue +1005 -0
- package/pages/learn/[slug]/[lessonSlug]/edit.vue +413 -0
- package/pages/learn/[slug]/[lessonSlug]/index.vue +438 -0
- package/pages/learn/[slug]/edit.vue +414 -0
- package/pages/learn/[slug]/index.vue +341 -0
- package/pages/learn/create.vue +71 -0
- package/pages/learn/index.vue +360 -0
- package/pages/messages/[conversationId].vue +113 -0
- package/pages/messages/index.vue +303 -0
- package/pages/mirror/[id].vue +115 -0
- package/pages/notifications.vue +91 -0
- package/pages/products/[slug].vue +128 -0
- package/pages/products/index.vue +122 -0
- package/pages/search.vue +692 -0
- package/pages/settings/account.vue +170 -0
- package/pages/settings/appearance.vue +80 -0
- package/pages/settings/index.vue +81 -0
- package/pages/settings/notifications.vue +68 -0
- package/pages/settings/profile.vue +838 -0
- package/pages/tags/[slug].vue +111 -0
- package/pages/tags/index.vue +73 -0
- package/pages/u/[username]/followers.vue +86 -0
- package/pages/u/[username]/following.vue +94 -0
- package/pages/u/[username]/index.vue +837 -0
- package/pages/videos/[id].vue +212 -0
- package/pages/videos/index.vue +327 -0
- package/pages/videos/submit.vue +112 -0
- package/plugins/auth.ts +23 -0
- package/server/api/admin/audit.get.ts +17 -0
- package/server/api/admin/content/[id].delete.ts +15 -0
- package/server/api/admin/content/[id].patch.ts +37 -0
- package/server/api/admin/federation/activity.get.ts +31 -0
- package/server/api/admin/federation/clients.get.ts +9 -0
- package/server/api/admin/federation/clients.post.ts +16 -0
- package/server/api/admin/federation/hub-mirrors/index.get.ts +10 -0
- package/server/api/admin/federation/hub-mirrors/index.post.ts +42 -0
- package/server/api/admin/federation/mirrors/[id]/backfill.post.ts +39 -0
- package/server/api/admin/federation/mirrors/[id].delete.ts +11 -0
- package/server/api/admin/federation/mirrors/[id].get.ts +15 -0
- package/server/api/admin/federation/mirrors/[id].put.ts +22 -0
- package/server/api/admin/federation/mirrors/index.get.ts +9 -0
- package/server/api/admin/federation/mirrors/index.post.ts +30 -0
- package/server/api/admin/federation/pending.get.ts +22 -0
- package/server/api/admin/federation/refederate.post.ts +92 -0
- package/server/api/admin/federation/repair-types.post.ts +57 -0
- package/server/api/admin/federation/retry.post.ts +41 -0
- package/server/api/admin/federation/stats.get.ts +26 -0
- package/server/api/admin/reports/[id]/resolve.post.ts +12 -0
- package/server/api/admin/reports.get.ts +17 -0
- package/server/api/admin/settings.get.ts +22 -0
- package/server/api/admin/settings.put.ts +11 -0
- package/server/api/admin/stats.get.ts +9 -0
- package/server/api/admin/users/[id]/role.put.ts +12 -0
- package/server/api/admin/users/[id]/status.put.ts +12 -0
- package/server/api/admin/users/[id].delete.ts +10 -0
- package/server/api/admin/users.get.ts +18 -0
- package/server/api/auth/federated/callback.get.ts +67 -0
- package/server/api/auth/federated/login.post.ts +60 -0
- package/server/api/auth/oauth2/authorize.get.ts +30 -0
- package/server/api/auth/oauth2/authorize.post.ts +51 -0
- package/server/api/auth/oauth2/register.post.ts +41 -0
- package/server/api/auth/oauth2/token.post.ts +48 -0
- package/server/api/cert/[code].get.ts +13 -0
- package/server/api/content/[id]/build.post.ts +9 -0
- package/server/api/content/[id]/fork.post.ts +10 -0
- package/server/api/content/[id]/index.delete.ts +18 -0
- package/server/api/content/[id]/index.get.ts +15 -0
- package/server/api/content/[id]/index.put.ts +23 -0
- package/server/api/content/[id]/products/[productId].delete.ts +28 -0
- package/server/api/content/[id]/products-sync.post.ts +29 -0
- package/server/api/content/[id]/products.get.ts +9 -0
- package/server/api/content/[id]/products.post.ts +31 -0
- package/server/api/content/[id]/publish.post.ts +17 -0
- package/server/api/content/[id]/report.post.ts +17 -0
- package/server/api/content/[id]/versions.get.ts +9 -0
- package/server/api/content/[id]/view.post.ts +34 -0
- package/server/api/content/index.get.ts +23 -0
- package/server/api/content/index.post.ts +11 -0
- package/server/api/contests/[slug]/entries.get.ts +18 -0
- package/server/api/contests/[slug]/entries.post.ts +23 -0
- package/server/api/contests/[slug]/index.delete.ts +21 -0
- package/server/api/contests/[slug]/index.get.ts +11 -0
- package/server/api/contests/[slug]/index.put.ts +15 -0
- package/server/api/contests/[slug]/judge.post.ts +12 -0
- package/server/api/contests/[slug]/transition.post.ts +24 -0
- package/server/api/contests/index.get.ts +10 -0
- package/server/api/contests/index.post.ts +28 -0
- package/server/api/docs/[siteSlug]/index.delete.ts +14 -0
- package/server/api/docs/[siteSlug]/index.get.ts +17 -0
- package/server/api/docs/[siteSlug]/index.put.ts +20 -0
- package/server/api/docs/[siteSlug]/nav.get.ts +26 -0
- package/server/api/docs/[siteSlug]/pages/[pageId].delete.ts +14 -0
- package/server/api/docs/[siteSlug]/pages/[pageId].get.ts +31 -0
- package/server/api/docs/[siteSlug]/pages/[pageId].put.ts +15 -0
- package/server/api/docs/[siteSlug]/pages/index.get.ts +34 -0
- package/server/api/docs/[siteSlug]/pages/index.post.ts +28 -0
- package/server/api/docs/[siteSlug]/pages/reorder.post.ts +26 -0
- package/server/api/docs/[siteSlug]/search.get.ts +20 -0
- package/server/api/docs/[siteSlug]/versions.post.ts +11 -0
- package/server/api/docs/index.get.ts +6 -0
- package/server/api/docs/index.post.ts +10 -0
- package/server/api/federated-hubs/[id]/posts/[postId].get.ts +16 -0
- package/server/api/federated-hubs/[id]/posts.get.ts +15 -0
- package/server/api/federated-hubs/[id].get.ts +16 -0
- package/server/api/federation/boost.post.ts +21 -0
- package/server/api/federation/content/[id].get.ts +15 -0
- package/server/api/federation/follow.post.ts +16 -0
- package/server/api/federation/health.get.ts +56 -0
- package/server/api/federation/hub-follow.post.ts +27 -0
- package/server/api/federation/hub-post-like.post.ts +115 -0
- package/server/api/federation/hub-post-likes.get.ts +24 -0
- package/server/api/federation/hub-post-reply.post.ts +42 -0
- package/server/api/federation/hub-post.post.ts +33 -0
- package/server/api/federation/like.post.ts +21 -0
- package/server/api/federation/remote-actor.get.ts +22 -0
- package/server/api/federation/reply.post.ts +22 -0
- package/server/api/federation/search.post.ts +17 -0
- package/server/api/federation/timeline.get.ts +22 -0
- package/server/api/federation/unfollow.post.ts +17 -0
- package/server/api/files/[id].delete.ts +35 -0
- package/server/api/files/mine.get.ts +31 -0
- package/server/api/files/upload-from-url.post.ts +68 -0
- package/server/api/files/upload.post.ts +105 -0
- package/server/api/health.get.ts +4 -0
- package/server/api/hubs/[slug]/bans/[userId].delete.ts +13 -0
- package/server/api/hubs/[slug]/bans.get.ts +20 -0
- package/server/api/hubs/[slug]/bans.post.ts +23 -0
- package/server/api/hubs/[slug]/feed.xml.get.ts +60 -0
- package/server/api/hubs/[slug]/gallery.get.ts +21 -0
- package/server/api/hubs/[slug]/index.delete.ts +18 -0
- package/server/api/hubs/[slug]/index.get.ts +14 -0
- package/server/api/hubs/[slug]/index.put.ts +22 -0
- package/server/api/hubs/[slug]/invites.get.ts +20 -0
- package/server/api/hubs/[slug]/invites.post.ts +27 -0
- package/server/api/hubs/[slug]/join.post.ts +17 -0
- package/server/api/hubs/[slug]/leave.post.ts +13 -0
- package/server/api/hubs/[slug]/members/[userId].delete.ts +13 -0
- package/server/api/hubs/[slug]/members/[userId].put.ts +16 -0
- package/server/api/hubs/[slug]/members.get.ts +20 -0
- package/server/api/hubs/[slug]/posts/[postId]/like.post.ts +21 -0
- package/server/api/hubs/[slug]/posts/[postId]/lock.post.ts +17 -0
- package/server/api/hubs/[slug]/posts/[postId]/pin.post.ts +17 -0
- package/server/api/hubs/[slug]/posts/[postId]/replies.get.ts +16 -0
- package/server/api/hubs/[slug]/posts/[postId]/replies.post.ts +21 -0
- package/server/api/hubs/[slug]/posts/[postId].delete.ts +23 -0
- package/server/api/hubs/[slug]/posts/[postId].get.ts +16 -0
- package/server/api/hubs/[slug]/posts/index.get.ts +16 -0
- package/server/api/hubs/[slug]/posts/index.post.ts +36 -0
- package/server/api/hubs/[slug]/products.get.ts +26 -0
- package/server/api/hubs/[slug]/products.post.ts +18 -0
- package/server/api/hubs/[slug]/share.post.ts +39 -0
- package/server/api/hubs/index.get.ts +15 -0
- package/server/api/hubs/index.post.ts +11 -0
- package/server/api/image-proxy.get.ts +91 -0
- package/server/api/learn/[slug]/[lessonSlug]/complete.post.ts +13 -0
- package/server/api/learn/[slug]/[lessonSlug]/index.get.ts +68 -0
- package/server/api/learn/[slug]/enroll.post.ts +12 -0
- package/server/api/learn/[slug]/index.delete.ts +12 -0
- package/server/api/learn/[slug]/index.get.ts +14 -0
- package/server/api/learn/[slug]/index.put.ts +19 -0
- package/server/api/learn/[slug]/lessons/[lessonId].delete.ts +14 -0
- package/server/api/learn/[slug]/lessons/[lessonId].put.ts +24 -0
- package/server/api/learn/[slug]/lessons.post.ts +10 -0
- package/server/api/learn/[slug]/modules/[moduleId].delete.ts +14 -0
- package/server/api/learn/[slug]/modules/[moduleId].put.ts +15 -0
- package/server/api/learn/[slug]/modules.post.ts +14 -0
- package/server/api/learn/[slug]/publish.post.ts +13 -0
- package/server/api/learn/[slug]/unenroll.post.ts +12 -0
- package/server/api/learn/certificates.get.ts +9 -0
- package/server/api/learn/enrollments.get.ts +9 -0
- package/server/api/learn/index.get.ts +17 -0
- package/server/api/learn/index.post.ts +11 -0
- package/server/api/me.get.ts +13 -0
- package/server/api/messages/[conversationId]/info.get.ts +43 -0
- package/server/api/messages/[conversationId]/stream.get.ts +73 -0
- package/server/api/messages/[conversationId].get.ts +13 -0
- package/server/api/messages/[conversationId].post.ts +12 -0
- package/server/api/messages/index.get.ts +39 -0
- package/server/api/messages/index.post.ts +58 -0
- package/server/api/notifications/[id].delete.ts +11 -0
- package/server/api/notifications/count.get.ts +10 -0
- package/server/api/notifications/index.get.ts +24 -0
- package/server/api/notifications/read.post.ts +15 -0
- package/server/api/notifications/stream.get.ts +59 -0
- package/server/api/openapi.get.ts +5 -0
- package/server/api/products/[id].delete.ts +15 -0
- package/server/api/products/[id].put.ts +18 -0
- package/server/api/products/[slug]/content.get.ts +21 -0
- package/server/api/products/[slug].get.ts +16 -0
- package/server/api/products/index.get.ts +28 -0
- package/server/api/profile.get.ts +15 -0
- package/server/api/profile.put.ts +24 -0
- package/server/api/resolve-identity.post.ts +34 -0
- package/server/api/search/index.get.ts +24 -0
- package/server/api/search/trending.get.ts +22 -0
- package/server/api/social/bookmark.get.ts +16 -0
- package/server/api/social/bookmark.post.ts +15 -0
- package/server/api/social/bookmarks.get.ts +16 -0
- package/server/api/social/comments/[id].delete.ts +13 -0
- package/server/api/social/comments.get.ts +18 -0
- package/server/api/social/comments.post.ts +11 -0
- package/server/api/social/like.get.ts +17 -0
- package/server/api/social/like.post.ts +35 -0
- package/server/api/stats.get.ts +8 -0
- package/server/api/user/hubs.get.ts +22 -0
- package/server/api/users/[username]/content.get.ts +21 -0
- package/server/api/users/[username]/feed.xml.get.ts +65 -0
- package/server/api/users/[username]/follow.delete.ts +15 -0
- package/server/api/users/[username]/follow.post.ts +15 -0
- package/server/api/users/[username]/followers.get.ts +22 -0
- package/server/api/users/[username]/following.get.ts +22 -0
- package/server/api/users/[username]/learning.get.ts +18 -0
- package/server/api/users/[username].get.ts +25 -0
- package/server/api/users/index.get.ts +78 -0
- package/server/api/videos/[id].get.ts +18 -0
- package/server/api/videos/categories/[id].delete.ts +15 -0
- package/server/api/videos/categories/[id].put.ts +17 -0
- package/server/api/videos/categories.get.ts +7 -0
- package/server/api/videos/categories.post.ts +11 -0
- package/server/api/videos/index.get.ts +20 -0
- package/server/api/videos/index.post.ts +11 -0
- package/server/middleware/auth.ts +180 -0
- package/server/middleware/features.ts +31 -0
- package/server/middleware/security.ts +54 -0
- package/server/plugins/auto-admin.ts +69 -0
- package/server/plugins/federation-delivery.ts +74 -0
- package/server/routes/.well-known/nodeinfo.ts +15 -0
- package/server/routes/.well-known/webfinger.ts +86 -0
- package/server/routes/actor/followers.ts +34 -0
- package/server/routes/actor/following.ts +34 -0
- package/server/routes/actor/outbox.ts +31 -0
- package/server/routes/actor.ts +30 -0
- package/server/routes/feed.xml.ts +59 -0
- package/server/routes/hubs/[slug]/followers.ts +39 -0
- package/server/routes/hubs/[slug]/inbox.ts +35 -0
- package/server/routes/hubs/[slug]/outbox.ts +43 -0
- package/server/routes/hubs/[slug]/posts/[postId].ts +63 -0
- package/server/routes/hubs/[slug].ts +29 -0
- package/server/routes/inbox.ts +34 -0
- package/server/routes/nodeinfo/2.1.ts +27 -0
- package/server/routes/robots.txt.ts +19 -0
- package/server/routes/sitemap.xml.ts +105 -0
- package/server/routes/users/[username]/followers.ts +33 -0
- package/server/routes/users/[username]/following.ts +33 -0
- package/server/routes/users/[username]/inbox.ts +34 -0
- package/server/routes/users/[username]/outbox.ts +35 -0
- package/server/routes/users/[username].ts +62 -0
- package/server/utils/auth.ts +36 -0
- package/server/utils/db.ts +34 -0
- package/server/utils/errors.ts +24 -0
- package/server/utils/inbox.ts +122 -0
- package/server/utils/validate.ts +82 -0
- package/theme/base.css +283 -0
- package/theme/components.css +322 -0
- package/theme/dark.css +87 -0
- package/theme/editor-panels.css +63 -0
- package/theme/forms.css +216 -0
- package/theme/generics.css +68 -0
- package/theme/layouts.css +415 -0
- package/theme/prose.css +342 -0
- package/types/hub.ts +61 -0
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
useSeoMeta({ title: `Messages — ${useSiteName()}` });
|
|
3
|
+
definePageMeta({ middleware: 'auth' });
|
|
4
|
+
|
|
5
|
+
interface ParticipantRef {
|
|
6
|
+
username: string;
|
|
7
|
+
displayName: string | null;
|
|
8
|
+
avatarUrl: string | null;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface ConversationItem {
|
|
12
|
+
id: string;
|
|
13
|
+
participants: ParticipantRef[];
|
|
14
|
+
lastMessage: string | null;
|
|
15
|
+
lastMessageAt: string;
|
|
16
|
+
createdAt: string;
|
|
17
|
+
unread?: boolean;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const { data: conversations, refresh } = await useFetch<ConversationItem[]>('/api/messages', {
|
|
21
|
+
default: () => [] as ConversationItem[],
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const showNewDialog = ref(false);
|
|
25
|
+
const newRecipient = ref('');
|
|
26
|
+
const newMessage = ref('');
|
|
27
|
+
|
|
28
|
+
const msgError = ref('');
|
|
29
|
+
|
|
30
|
+
async function startConversation(): Promise<void> {
|
|
31
|
+
if (!newRecipient.value.trim()) return;
|
|
32
|
+
msgError.value = '';
|
|
33
|
+
try {
|
|
34
|
+
const conv = await $fetch<{ id: string }>('/api/messages', {
|
|
35
|
+
method: 'POST',
|
|
36
|
+
body: { participants: [newRecipient.value.trim()] },
|
|
37
|
+
});
|
|
38
|
+
if (newMessage.value.trim()) {
|
|
39
|
+
await $fetch(`/api/messages/${conv.id}`, {
|
|
40
|
+
method: 'POST',
|
|
41
|
+
body: { body: newMessage.value.trim() },
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
showNewDialog.value = false;
|
|
45
|
+
newRecipient.value = '';
|
|
46
|
+
newMessage.value = '';
|
|
47
|
+
await navigateTo(`/messages/${conv.id}`);
|
|
48
|
+
} catch (err: unknown) {
|
|
49
|
+
const fetchErr = err as { data?: { statusMessage?: string }; message?: string };
|
|
50
|
+
msgError.value = fetchErr?.data?.statusMessage || fetchErr?.message || 'Failed to start conversation';
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
</script>
|
|
54
|
+
|
|
55
|
+
<template>
|
|
56
|
+
<div class="cpub-messages-page">
|
|
57
|
+
<div class="cpub-messages-header">
|
|
58
|
+
<h1 class="cpub-section-title-lg">Messages</h1>
|
|
59
|
+
<button class="cpub-btn cpub-btn-sm cpub-btn-primary" @click="showNewDialog = true">
|
|
60
|
+
<i class="fa-solid fa-pen"></i> New Message
|
|
61
|
+
</button>
|
|
62
|
+
</div>
|
|
63
|
+
|
|
64
|
+
<!-- New conversation dialog -->
|
|
65
|
+
<div v-if="showNewDialog" class="cpub-new-msg-overlay" @click.self="showNewDialog = false">
|
|
66
|
+
<div class="cpub-new-msg-dialog" role="dialog" aria-label="New message">
|
|
67
|
+
<div class="cpub-new-msg-header">
|
|
68
|
+
<h2 class="cpub-new-msg-title">New Conversation</h2>
|
|
69
|
+
<button class="cpub-new-msg-close" @click="showNewDialog = false" aria-label="Close">
|
|
70
|
+
<i class="fa-solid fa-times"></i>
|
|
71
|
+
</button>
|
|
72
|
+
</div>
|
|
73
|
+
<div class="cpub-new-msg-body">
|
|
74
|
+
<div class="cpub-new-msg-field">
|
|
75
|
+
<label class="cpub-new-msg-label">Recipient username</label>
|
|
76
|
+
<input v-model="newRecipient" type="text" class="cpub-new-msg-input" placeholder="username or @user@remote-instance.com" />
|
|
77
|
+
</div>
|
|
78
|
+
<div class="cpub-new-msg-field">
|
|
79
|
+
<label class="cpub-new-msg-label">Message (optional)</label>
|
|
80
|
+
<textarea v-model="newMessage" class="cpub-new-msg-textarea" rows="3" placeholder="Write a message..." />
|
|
81
|
+
</div>
|
|
82
|
+
</div>
|
|
83
|
+
<div class="cpub-new-msg-footer">
|
|
84
|
+
<button class="cpub-btn cpub-btn-sm" @click="showNewDialog = false">Cancel</button>
|
|
85
|
+
<button
|
|
86
|
+
class="cpub-btn cpub-btn-sm cpub-btn-primary"
|
|
87
|
+
:disabled="!newRecipient.trim()"
|
|
88
|
+
@click="startConversation"
|
|
89
|
+
>
|
|
90
|
+
Start Conversation
|
|
91
|
+
</button>
|
|
92
|
+
</div>
|
|
93
|
+
</div>
|
|
94
|
+
</div>
|
|
95
|
+
|
|
96
|
+
<div class="cpub-conversation-list">
|
|
97
|
+
<NuxtLink
|
|
98
|
+
v-for="conv in conversations"
|
|
99
|
+
:key="conv.id"
|
|
100
|
+
:to="`/messages/${conv.id}`"
|
|
101
|
+
class="cpub-conversation-item"
|
|
102
|
+
:class="{ unread: conv.unread }"
|
|
103
|
+
>
|
|
104
|
+
<div class="cpub-conv-avatar">
|
|
105
|
+
<img v-if="conv.participants?.[0]?.avatarUrl" :src="conv.participants[0].avatarUrl" :alt="conv.participants[0].displayName || conv.participants[0].username" class="cpub-conv-avatar-img" />
|
|
106
|
+
<span v-else>{{ (conv.participants?.[0]?.displayName || conv.participants?.[0]?.username || '?').charAt(0).toUpperCase() }}</span>
|
|
107
|
+
</div>
|
|
108
|
+
<div class="cpub-conv-info">
|
|
109
|
+
<div class="cpub-conv-name">{{ conv.participants?.map(p => p.displayName || p.username).join(', ') ?? 'Unknown' }}</div>
|
|
110
|
+
<div class="cpub-conv-preview">{{ conv.lastMessage ?? 'No messages yet' }}</div>
|
|
111
|
+
</div>
|
|
112
|
+
<time class="cpub-conv-time">
|
|
113
|
+
{{ new Date(conv.lastMessageAt).toLocaleDateString('en-US', { month: 'short', day: 'numeric' }) }}
|
|
114
|
+
</time>
|
|
115
|
+
</NuxtLink>
|
|
116
|
+
|
|
117
|
+
<div v-if="!conversations.length" class="cpub-empty-state">
|
|
118
|
+
<div class="cpub-empty-state-icon"><i class="fa-solid fa-envelope"></i></div>
|
|
119
|
+
<p class="cpub-empty-state-title">No messages</p>
|
|
120
|
+
<p class="cpub-empty-state-desc">Start a conversation with someone!</p>
|
|
121
|
+
</div>
|
|
122
|
+
</div>
|
|
123
|
+
</div>
|
|
124
|
+
</template>
|
|
125
|
+
|
|
126
|
+
<style scoped>
|
|
127
|
+
.cpub-messages-page {
|
|
128
|
+
max-width: var(--content-max-width, 960px);
|
|
129
|
+
margin: 0 auto;
|
|
130
|
+
padding: var(--space-8) var(--space-6);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.cpub-messages-header {
|
|
134
|
+
display: flex;
|
|
135
|
+
align-items: center;
|
|
136
|
+
justify-content: space-between;
|
|
137
|
+
margin-bottom: var(--space-4);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.cpub-conversation-list {
|
|
141
|
+
border: var(--border-width-default) solid var(--border);
|
|
142
|
+
background: var(--surface);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.cpub-conversation-item {
|
|
146
|
+
display: flex;
|
|
147
|
+
align-items: center;
|
|
148
|
+
gap: 12px;
|
|
149
|
+
padding: 12px 16px;
|
|
150
|
+
text-decoration: none;
|
|
151
|
+
border-bottom: var(--border-width-default) solid var(--border2);
|
|
152
|
+
transition: background 0.1s;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.cpub-conversation-item:hover {
|
|
156
|
+
background: var(--surface2);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.cpub-conversation-item.unread {
|
|
160
|
+
background: var(--accent-bg);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.cpub-conv-avatar {
|
|
164
|
+
width: 36px;
|
|
165
|
+
height: 36px;
|
|
166
|
+
border-radius: 50%;
|
|
167
|
+
background: var(--surface3);
|
|
168
|
+
border: var(--border-width-default) solid var(--border);
|
|
169
|
+
display: flex;
|
|
170
|
+
align-items: center;
|
|
171
|
+
justify-content: center;
|
|
172
|
+
font-family: var(--font-mono);
|
|
173
|
+
font-size: 12px;
|
|
174
|
+
font-weight: 600;
|
|
175
|
+
color: var(--text-dim);
|
|
176
|
+
flex-shrink: 0;
|
|
177
|
+
overflow: hidden;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.cpub-conv-avatar-img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
|
|
181
|
+
|
|
182
|
+
.cpub-conv-info {
|
|
183
|
+
flex: 1;
|
|
184
|
+
min-width: 0;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.cpub-conv-name {
|
|
188
|
+
font-size: 13px;
|
|
189
|
+
font-weight: 600;
|
|
190
|
+
color: var(--text);
|
|
191
|
+
margin-bottom: 2px;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.cpub-conv-preview {
|
|
195
|
+
font-size: 12px;
|
|
196
|
+
color: var(--text-dim);
|
|
197
|
+
overflow: hidden;
|
|
198
|
+
text-overflow: ellipsis;
|
|
199
|
+
white-space: nowrap;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.cpub-conv-time {
|
|
203
|
+
font-size: 10px;
|
|
204
|
+
color: var(--text-faint);
|
|
205
|
+
font-family: var(--font-mono);
|
|
206
|
+
flex-shrink: 0;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/* New message dialog */
|
|
210
|
+
.cpub-new-msg-overlay {
|
|
211
|
+
position: fixed;
|
|
212
|
+
inset: 0;
|
|
213
|
+
z-index: 200;
|
|
214
|
+
background: var(--overlay-bg, var(--color-surface-overlay-light));
|
|
215
|
+
display: flex;
|
|
216
|
+
align-items: center;
|
|
217
|
+
justify-content: center;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.cpub-new-msg-dialog {
|
|
221
|
+
background: var(--surface);
|
|
222
|
+
border: var(--border-width-default) solid var(--border);
|
|
223
|
+
box-shadow: var(--shadow-xl);
|
|
224
|
+
width: 400px;
|
|
225
|
+
max-width: 90vw;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.cpub-new-msg-header {
|
|
229
|
+
display: flex;
|
|
230
|
+
align-items: center;
|
|
231
|
+
justify-content: space-between;
|
|
232
|
+
padding: 14px 16px;
|
|
233
|
+
border-bottom: var(--border-width-default) solid var(--border);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
.cpub-new-msg-title {
|
|
237
|
+
font-size: 14px;
|
|
238
|
+
font-weight: 600;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.cpub-new-msg-close {
|
|
242
|
+
background: none;
|
|
243
|
+
border: none;
|
|
244
|
+
color: var(--text-faint);
|
|
245
|
+
cursor: pointer;
|
|
246
|
+
font-size: 12px;
|
|
247
|
+
padding: 4px;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.cpub-new-msg-close:hover {
|
|
251
|
+
color: var(--text);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.cpub-new-msg-body {
|
|
255
|
+
padding: 16px;
|
|
256
|
+
display: flex;
|
|
257
|
+
flex-direction: column;
|
|
258
|
+
gap: 12px;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
.cpub-new-msg-field {
|
|
262
|
+
display: flex;
|
|
263
|
+
flex-direction: column;
|
|
264
|
+
gap: 4px;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
.cpub-new-msg-label {
|
|
268
|
+
font-size: 10px;
|
|
269
|
+
font-family: var(--font-mono);
|
|
270
|
+
color: var(--text-faint);
|
|
271
|
+
letter-spacing: 0.06em;
|
|
272
|
+
text-transform: uppercase;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
.cpub-new-msg-input,
|
|
276
|
+
.cpub-new-msg-textarea {
|
|
277
|
+
font-family: var(--font-sans);
|
|
278
|
+
font-size: 13px;
|
|
279
|
+
padding: 8px 10px;
|
|
280
|
+
border: var(--border-width-default) solid var(--border);
|
|
281
|
+
background: var(--surface);
|
|
282
|
+
color: var(--text);
|
|
283
|
+
outline: none;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
.cpub-new-msg-input:focus,
|
|
287
|
+
.cpub-new-msg-textarea:focus {
|
|
288
|
+
border-color: var(--accent);
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
.cpub-new-msg-footer {
|
|
292
|
+
display: flex;
|
|
293
|
+
justify-content: flex-end;
|
|
294
|
+
gap: 8px;
|
|
295
|
+
padding: 12px 16px;
|
|
296
|
+
border-top: var(--border-width-default) solid var(--border);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
@media (max-width: 768px) {
|
|
300
|
+
.cpub-messages-page { padding: 16px; }
|
|
301
|
+
.cpub-conversation-item { padding: 10px 12px; }
|
|
302
|
+
}
|
|
303
|
+
</style>
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
definePageMeta({ layout: 'default' });
|
|
3
|
+
|
|
4
|
+
const route = useRoute();
|
|
5
|
+
const id = route.params.id as string;
|
|
6
|
+
|
|
7
|
+
const { data: fedContent, error, pending } = await useFetch<Record<string, unknown>>(`/api/federation/content/${id}`);
|
|
8
|
+
|
|
9
|
+
const {
|
|
10
|
+
transformedContent,
|
|
11
|
+
viewComponent,
|
|
12
|
+
originDomain,
|
|
13
|
+
originUrl,
|
|
14
|
+
authorHandle,
|
|
15
|
+
} = useMirrorContent(fedContent);
|
|
16
|
+
|
|
17
|
+
// SEO
|
|
18
|
+
if (originUrl.value) {
|
|
19
|
+
useHead({
|
|
20
|
+
link: [{ rel: 'canonical', href: originUrl.value }],
|
|
21
|
+
meta: [{ name: 'robots', content: 'noindex, follow' }],
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
useSeoMeta({
|
|
26
|
+
title: transformedContent.value?.title ?? 'Mirrored Content',
|
|
27
|
+
description: transformedContent.value?.description ?? '',
|
|
28
|
+
});
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<template>
|
|
32
|
+
<div v-if="pending" class="cpub-loading" style="padding: 64px 24px; text-align: center">Loading content...</div>
|
|
33
|
+
<div v-else-if="error" class="cpub-not-found">
|
|
34
|
+
<h1>Content not found</h1>
|
|
35
|
+
<p>This mirrored content may have been removed or is unavailable.</p>
|
|
36
|
+
<NuxtLink to="/">Back to home</NuxtLink>
|
|
37
|
+
</div>
|
|
38
|
+
|
|
39
|
+
<template v-else-if="transformedContent">
|
|
40
|
+
<!-- Federation banner -->
|
|
41
|
+
<div class="cpub-fed-banner">
|
|
42
|
+
<div class="cpub-fed-banner-inner">
|
|
43
|
+
<i class="fa-solid fa-globe"></i>
|
|
44
|
+
<span>
|
|
45
|
+
Federated from <strong>{{ originDomain }}</strong>
|
|
46
|
+
<span v-if="authorHandle" class="cpub-fed-banner-handle">{{ authorHandle }}</span>
|
|
47
|
+
</span>
|
|
48
|
+
<a v-if="originUrl" :href="originUrl" target="_blank" rel="noopener noreferrer" class="cpub-fed-banner-link">
|
|
49
|
+
View Original <i class="fa-solid fa-arrow-up-right-from-square"></i>
|
|
50
|
+
</a>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
|
|
54
|
+
<!-- Reuse existing content view component -->
|
|
55
|
+
<component
|
|
56
|
+
v-if="viewComponent && typeof viewComponent !== 'string'"
|
|
57
|
+
:is="viewComponent"
|
|
58
|
+
:content="transformedContent"
|
|
59
|
+
:federated-id="id"
|
|
60
|
+
/>
|
|
61
|
+
|
|
62
|
+
<!-- Fallback for non-CommonPub content -->
|
|
63
|
+
<article v-else class="cpub-mirror-fallback">
|
|
64
|
+
<div class="cpub-mirror-container">
|
|
65
|
+
<img v-if="transformedContent.coverImageUrl" :src="transformedContent.coverImageUrl" :alt="transformedContent.title" class="cpub-mirror-cover" />
|
|
66
|
+
<h1 class="cpub-mirror-title">{{ transformedContent.title }}</h1>
|
|
67
|
+
<p v-if="transformedContent.description" class="cpub-mirror-desc">{{ transformedContent.description }}</p>
|
|
68
|
+
<div class="cpub-mirror-author">
|
|
69
|
+
<strong>{{ transformedContent.author.displayName }}</strong>
|
|
70
|
+
<span v-if="authorHandle" class="cpub-mirror-handle">{{ authorHandle }}</span>
|
|
71
|
+
</div>
|
|
72
|
+
<div v-if="typeof transformedContent.content === 'string'" class="cpub-mirror-body prose" v-html="transformedContent.content" />
|
|
73
|
+
<div v-if="transformedContent.tags?.length" class="cpub-mirror-tags">
|
|
74
|
+
<span v-for="tag in transformedContent.tags" :key="tag.name" class="cpub-mirror-tag">{{ tag.name }}</span>
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
|
+
</article>
|
|
78
|
+
</template>
|
|
79
|
+
</template>
|
|
80
|
+
|
|
81
|
+
<style scoped>
|
|
82
|
+
.cpub-fed-banner {
|
|
83
|
+
background: var(--accent-bg); border-bottom: 1px solid var(--accent-border);
|
|
84
|
+
}
|
|
85
|
+
.cpub-fed-banner-inner {
|
|
86
|
+
max-width: 1200px; margin: 0 auto; padding: 8px 24px;
|
|
87
|
+
display: flex; align-items: center; gap: 8px;
|
|
88
|
+
font-size: 12px; color: var(--text-dim);
|
|
89
|
+
}
|
|
90
|
+
.cpub-fed-banner-inner > i { color: var(--accent); flex-shrink: 0; }
|
|
91
|
+
.cpub-fed-banner-handle { color: var(--text-faint); margin-left: 4px; }
|
|
92
|
+
.cpub-fed-banner-link {
|
|
93
|
+
margin-left: auto; color: var(--accent); font-weight: 600;
|
|
94
|
+
text-decoration: none; white-space: nowrap;
|
|
95
|
+
display: flex; align-items: center; gap: 4px; font-size: 11px;
|
|
96
|
+
}
|
|
97
|
+
.cpub-fed-banner-link:hover { text-decoration: underline; }
|
|
98
|
+
|
|
99
|
+
/* Fallback for non-CommonPub content */
|
|
100
|
+
.cpub-mirror-fallback { max-width: 780px; margin: 0 auto; padding: 32px 16px 60px; }
|
|
101
|
+
.cpub-mirror-cover { width: 100%; max-height: 400px; object-fit: cover; margin-bottom: 20px; }
|
|
102
|
+
.cpub-mirror-title { font-size: 2rem; font-weight: 800; line-height: 1.2; margin-bottom: 12px; }
|
|
103
|
+
.cpub-mirror-desc { font-size: 1.0625rem; color: var(--text-dim); line-height: 1.6; margin-bottom: 16px; }
|
|
104
|
+
.cpub-mirror-author { font-size: 0.875rem; color: var(--text-dim); margin-bottom: 24px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
|
|
105
|
+
.cpub-mirror-handle { color: var(--text-faint); margin-left: 6px; }
|
|
106
|
+
.cpub-mirror-body { font-size: 1rem; line-height: 1.75; margin-bottom: 32px; }
|
|
107
|
+
.cpub-mirror-body :deep(img) { max-width: 100%; }
|
|
108
|
+
.cpub-mirror-body :deep(a) { color: var(--accent); }
|
|
109
|
+
.cpub-mirror-body :deep(pre) { background: var(--surface2); padding: 12px; overflow-x: auto; }
|
|
110
|
+
.cpub-mirror-tags { display: flex; flex-wrap: wrap; gap: 6px; }
|
|
111
|
+
.cpub-mirror-tag { font-size: 0.75rem; padding: 3px 8px; background: var(--surface2); color: var(--text-dim); }
|
|
112
|
+
|
|
113
|
+
.cpub-not-found { text-align: center; padding: 60px 20px; color: var(--text-dim); }
|
|
114
|
+
.cpub-not-found h1 { font-size: 1.5rem; color: var(--text); margin-bottom: 8px; }
|
|
115
|
+
</style>
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
useSeoMeta({ title: `Notifications — ${useSiteName()}` });
|
|
3
|
+
definePageMeta({ middleware: 'auth' });
|
|
4
|
+
|
|
5
|
+
const activeTab = ref('all');
|
|
6
|
+
const tabs = ['all', 'likes', 'comments', 'follows', 'system'];
|
|
7
|
+
|
|
8
|
+
const notifQuery = computed(() => ({
|
|
9
|
+
type: activeTab.value === 'all' ? undefined : activeTab.value === 'likes' ? 'like' : activeTab.value === 'comments' ? 'comment' : activeTab.value === 'follows' ? 'follow' : 'system',
|
|
10
|
+
limit: 50,
|
|
11
|
+
}));
|
|
12
|
+
|
|
13
|
+
const { data: notifData, refresh } = await useFetch('/api/notifications', {
|
|
14
|
+
query: notifQuery,
|
|
15
|
+
watch: [notifQuery],
|
|
16
|
+
default: () => ({ items: [], total: 0 }),
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const filteredNotifications = computed(() => notifData.value?.items ?? []);
|
|
20
|
+
|
|
21
|
+
async function markAllRead(): Promise<void> {
|
|
22
|
+
await $fetch('/api/notifications/read', { method: 'POST', body: {} });
|
|
23
|
+
refresh();
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async function deleteNotification(id: string): Promise<void> {
|
|
27
|
+
await $fetch(`/api/notifications/${id}`, { method: 'DELETE' });
|
|
28
|
+
refresh();
|
|
29
|
+
}
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<template>
|
|
33
|
+
<div class="cpub-notifications-page">
|
|
34
|
+
<div class="cpub-notif-header">
|
|
35
|
+
<h1 class="cpub-section-title-lg">Notifications</h1>
|
|
36
|
+
<button class="cpub-btn cpub-btn-sm cpub-btn-ghost" @click="markAllRead">
|
|
37
|
+
<i class="fa-solid fa-check-double"></i> Mark all read
|
|
38
|
+
</button>
|
|
39
|
+
</div>
|
|
40
|
+
|
|
41
|
+
<div class="cpub-tab-bar" style="position: static">
|
|
42
|
+
<button
|
|
43
|
+
v-for="tab in tabs"
|
|
44
|
+
:key="tab"
|
|
45
|
+
class="cpub-tab"
|
|
46
|
+
:class="{ active: activeTab === tab }"
|
|
47
|
+
@click="activeTab = tab"
|
|
48
|
+
>
|
|
49
|
+
{{ tab }}
|
|
50
|
+
</button>
|
|
51
|
+
</div>
|
|
52
|
+
|
|
53
|
+
<div class="cpub-notif-list">
|
|
54
|
+
<NotificationItem
|
|
55
|
+
v-for="n in filteredNotifications"
|
|
56
|
+
:key="n.id"
|
|
57
|
+
:notification="n"
|
|
58
|
+
/>
|
|
59
|
+
<div v-if="!filteredNotifications.length" class="cpub-empty-state">
|
|
60
|
+
<div class="cpub-empty-state-icon"><i class="fa-solid fa-bell-slash"></i></div>
|
|
61
|
+
<p class="cpub-empty-state-title">No notifications</p>
|
|
62
|
+
<p class="cpub-empty-state-desc">You're all caught up!</p>
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
</template>
|
|
67
|
+
|
|
68
|
+
<style scoped>
|
|
69
|
+
.cpub-notifications-page {
|
|
70
|
+
max-width: var(--content-max-width, 960px);
|
|
71
|
+
margin: 0 auto;
|
|
72
|
+
padding: var(--space-8) var(--space-6);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.cpub-notif-header {
|
|
76
|
+
display: flex;
|
|
77
|
+
align-items: center;
|
|
78
|
+
justify-content: space-between;
|
|
79
|
+
margin-bottom: var(--space-4);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.cpub-notif-list {
|
|
83
|
+
border: var(--border-width-default) solid var(--border);
|
|
84
|
+
background: var(--surface);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
@media (max-width: 768px) {
|
|
88
|
+
.cpub-notifications-page { padding: 16px 12px; }
|
|
89
|
+
.cpub-notif-header { flex-wrap: wrap; gap: 8px; }
|
|
90
|
+
}
|
|
91
|
+
</style>
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
const route = useRoute();
|
|
3
|
+
const slug = route.params.slug as string;
|
|
4
|
+
|
|
5
|
+
const { data: product } = useLazyFetch(`/api/products/${slug}`) as { data: Ref<Record<string, any> | null> };
|
|
6
|
+
const { data: projectsUsing } = useLazyFetch(`/api/products/${slug}/content`) as { data: Ref<any[] | null> };
|
|
7
|
+
|
|
8
|
+
useSeoMeta({
|
|
9
|
+
title: () => product.value ? `${product.value.name} — ${useSiteName()}` : `Product — ${useSiteName()}`,
|
|
10
|
+
description: () => product.value?.description ?? '',
|
|
11
|
+
});
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<div v-if="product" class="product-detail">
|
|
16
|
+
<NuxtLink to="/products" class="cpub-back-link"><i class="fa-solid fa-arrow-left"></i> Products</NuxtLink>
|
|
17
|
+
|
|
18
|
+
<div class="product-layout">
|
|
19
|
+
<!-- Main -->
|
|
20
|
+
<div class="product-main">
|
|
21
|
+
<div class="product-header">
|
|
22
|
+
<div class="product-icon"><i class="fa-solid fa-microchip"></i></div>
|
|
23
|
+
<div>
|
|
24
|
+
<h1 class="product-name">{{ product.name }}</h1>
|
|
25
|
+
<span v-if="product.category" class="product-category">{{ product.category }}</span>
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
<p v-if="product.description" class="product-desc">{{ product.description }}</p>
|
|
30
|
+
|
|
31
|
+
<!-- Specs -->
|
|
32
|
+
<div v-if="product.specs && Object.keys(product.specs).length" class="product-specs">
|
|
33
|
+
<h2 class="product-section-title">Specifications</h2>
|
|
34
|
+
<div class="specs-grid">
|
|
35
|
+
<div v-for="(val, key) in product.specs" :key="key" class="spec-item">
|
|
36
|
+
<span class="spec-key">{{ key }}</span>
|
|
37
|
+
<span class="spec-val">{{ val }}</span>
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
<!-- Links -->
|
|
43
|
+
<div class="product-links">
|
|
44
|
+
<a v-if="product.purchaseUrl" :href="product.purchaseUrl" target="_blank" rel="noopener" class="product-link-btn">
|
|
45
|
+
<i class="fa-solid fa-cart-shopping"></i> Purchase
|
|
46
|
+
</a>
|
|
47
|
+
<a v-if="product.datasheetUrl" :href="product.datasheetUrl" target="_blank" rel="noopener" class="product-link-btn">
|
|
48
|
+
<i class="fa-solid fa-file-pdf"></i> Datasheet
|
|
49
|
+
</a>
|
|
50
|
+
</div>
|
|
51
|
+
|
|
52
|
+
<!-- Projects using this product -->
|
|
53
|
+
<div v-if="projectsUsing?.length" class="product-projects">
|
|
54
|
+
<h2 class="product-section-title">Projects Using This</h2>
|
|
55
|
+
<div class="product-projects-grid">
|
|
56
|
+
<ContentCard v-for="item in projectsUsing" :key="item.id" :item="item" />
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
<div v-else class="product-projects-empty">
|
|
60
|
+
<p>No projects using this product yet.</p>
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
|
|
64
|
+
<!-- Sidebar -->
|
|
65
|
+
<aside class="product-sidebar">
|
|
66
|
+
<div class="product-sb-card">
|
|
67
|
+
<h3 class="product-sb-label">Details</h3>
|
|
68
|
+
<div class="product-sb-row" v-if="product.category">
|
|
69
|
+
<span>Category</span>
|
|
70
|
+
<span class="product-sb-val">{{ product.category }}</span>
|
|
71
|
+
</div>
|
|
72
|
+
<div class="product-sb-row" v-if="product.pricing">
|
|
73
|
+
<span>Price</span>
|
|
74
|
+
<span class="product-sb-val">{{ product.pricing }}</span>
|
|
75
|
+
</div>
|
|
76
|
+
<div class="product-sb-row" v-if="product.hub">
|
|
77
|
+
<span>Hub</span>
|
|
78
|
+
<NuxtLink :to="`/hubs/${product.hub.slug}`" class="product-sb-link">{{ product.hub.name }}</NuxtLink>
|
|
79
|
+
</div>
|
|
80
|
+
</div>
|
|
81
|
+
</aside>
|
|
82
|
+
</div>
|
|
83
|
+
</div>
|
|
84
|
+
<div v-else class="product-not-found">
|
|
85
|
+
<h1>Product not found</h1>
|
|
86
|
+
</div>
|
|
87
|
+
</template>
|
|
88
|
+
|
|
89
|
+
<style scoped>
|
|
90
|
+
.product-detail { max-width: 1080px; margin: 0 auto; padding: 32px; }
|
|
91
|
+
.cpub-back-link { font-size: 11px; font-family: var(--font-mono); color: var(--text-faint); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; margin-bottom: 20px; }
|
|
92
|
+
.cpub-back-link:hover { color: var(--accent); }
|
|
93
|
+
|
|
94
|
+
.product-layout { display: grid; grid-template-columns: 1fr 280px; gap: 32px; }
|
|
95
|
+
|
|
96
|
+
.product-header { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
|
|
97
|
+
.product-icon { width: 56px; height: 56px; border: var(--border-width-default) solid var(--border); background: var(--accent-bg); display: flex; align-items: center; justify-content: center; font-size: 24px; color: var(--accent); }
|
|
98
|
+
.product-name { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
|
|
99
|
+
.product-category { font-size: 11px; font-family: var(--font-mono); color: var(--text-faint); text-transform: capitalize; }
|
|
100
|
+
.product-desc { font-size: 14px; color: var(--text-dim); line-height: 1.7; margin-bottom: 24px; }
|
|
101
|
+
|
|
102
|
+
.product-section-title { font-size: 16px; font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
|
|
103
|
+
|
|
104
|
+
.specs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; margin-bottom: 24px; }
|
|
105
|
+
.spec-item { display: flex; justify-content: space-between; padding: 8px 12px; border: var(--border-width-default) solid var(--border2); background: var(--surface); font-size: 12px; }
|
|
106
|
+
.spec-key { color: var(--text-dim); font-family: var(--font-mono); font-size: 11px; }
|
|
107
|
+
.spec-val { font-weight: 500; }
|
|
108
|
+
|
|
109
|
+
.product-links { display: flex; gap: 8px; margin-bottom: 32px; }
|
|
110
|
+
.product-link-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border: var(--border-width-default) solid var(--border); background: var(--surface); color: var(--text); text-decoration: none; font-size: 13px; font-weight: 500; box-shadow: var(--shadow-md); }
|
|
111
|
+
.product-link-btn:hover { box-shadow: var(--shadow-sm); transform: translate(1px, 1px); }
|
|
112
|
+
|
|
113
|
+
.product-projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
|
|
114
|
+
.product-projects-empty { color: var(--text-faint); font-size: 13px; padding: 24px 0; }
|
|
115
|
+
|
|
116
|
+
.product-sidebar { display: flex; flex-direction: column; gap: 16px; }
|
|
117
|
+
.product-sb-card { padding: 16px; border: var(--border-width-default) solid var(--border); background: var(--surface); box-shadow: var(--shadow-md); }
|
|
118
|
+
.product-sb-label { font-family: var(--font-mono); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-faint); margin-bottom: 12px; }
|
|
119
|
+
.product-sb-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: var(--border-width-default) solid var(--border2); font-size: 13px; color: var(--text-dim); }
|
|
120
|
+
.product-sb-row:last-child { border-bottom: none; }
|
|
121
|
+
.product-sb-val { font-weight: 500; color: var(--text); }
|
|
122
|
+
.product-sb-link { color: var(--accent); text-decoration: none; font-weight: 500; }
|
|
123
|
+
.product-sb-link:hover { text-decoration: underline; }
|
|
124
|
+
|
|
125
|
+
.product-not-found { text-align: center; padding: 64px 0; color: var(--text-dim); }
|
|
126
|
+
|
|
127
|
+
@media (max-width: 768px) { .product-layout { grid-template-columns: 1fr; } }
|
|
128
|
+
</style>
|