diff --git a/src/app.ts b/src/app.ts index 459283e..ccfed43 100644 --- a/src/app.ts +++ b/src/app.ts @@ -63,6 +63,12 @@ export async function createAppInstance() { component: () => import('./pages/Login.vue'), meta: { requiresAuth: false } }, + { + path: '/link-aggregator-test', + name: 'link-aggregator-test', + component: () => import('./pages/LinkAggregatorTest.vue'), + meta: { requiresAuth: false } + }, // Pre-register module routes ...moduleRoutes ] diff --git a/src/modules/nostr-feed/components/SubmissionComment.vue b/src/modules/nostr-feed/components/SubmissionComment.vue index ab52a9e..9a5f6d4 100644 --- a/src/modules/nostr-feed/components/SubmissionComment.vue +++ b/src/modules/nostr-feed/components/SubmissionComment.vue @@ -6,7 +6,8 @@ import { computed, ref } from 'vue' import { formatDistanceToNow } from 'date-fns' -import { ChevronUp, ChevronDown, Reply, Flag, MoreHorizontal, Send } from 'lucide-vue-next' +import { ChevronUp, ChevronDown, Reply, Flag, MoreHorizontal, Send, X } from 'lucide-vue-next' +import VoteControls from './VoteControls.vue' import type { SubmissionComment as CommentType } from '../types/submission' interface Props { diff --git a/src/modules/nostr-feed/components/SubmissionDetail.vue b/src/modules/nostr-feed/components/SubmissionDetail.vue index 7fe5822..a4f2819 100644 --- a/src/modules/nostr-feed/components/SubmissionDetail.vue +++ b/src/modules/nostr-feed/components/SubmissionDetail.vue @@ -4,8 +4,8 @@ * Displays complete submission content and threaded comments */ -import { ref, computed, watch } from 'vue' -import { useRouter } from 'vue-router' +import { ref, computed } from 'vue' +import { useRoute, useRouter } from 'vue-router' import { formatDistanceToNow } from 'date-fns' import { ArrowLeft, @@ -17,6 +17,9 @@ import { Image as ImageIcon, FileText, Loader2, + ChevronUp, + ChevronDown, + Reply, Send } from 'lucide-vue-next' import { Badge } from '@/components/ui/badge' @@ -28,6 +31,7 @@ import { tryInjectService, SERVICE_TOKENS } from '@/core/di-container' import type { ProfileService } from '../services/ProfileService' import type { SubmissionService } from '../services/SubmissionService' import type { + SubmissionWithMeta, SubmissionComment as SubmissionCommentType, LinkSubmission, MediaSubmission, @@ -81,7 +85,9 @@ const currentUserPubkey = computed(() => authService?.user?.value?.pubkey || nul // Get display name for a pubkey function getDisplayName(pubkey: string): string { if (profileService) { - return profileService.getDisplayName(pubkey) + const profile = profileService.getProfile(pubkey) + if (profile?.display_name) return profile.display_name + if (profile?.name) return profile.name } return `${pubkey.slice(0, 8)}...` } @@ -197,7 +203,7 @@ async function submitComment() { await submissionService.createComment( props.submissionId, commentText.value.trim(), - undefined // Top-level comment + null // Top-level comment ) cancelReply() } catch (err: any) { @@ -241,37 +247,19 @@ function toggleCollapse(commentId: string) { collapsedComments.value = new Set(collapsedComments.value) } +// Count total replies +function countReplies(comment: SubmissionCommentType): number { + let count = comment.replies?.length || 0 + comment.replies?.forEach(reply => { + count += countReplies(reply) + }) + return count +} + // Go back function goBack() { router.back() } - -// Helper to collect all pubkeys from comments recursively -function collectCommentPubkeys(comments: SubmissionCommentType[]): string[] { - const pubkeys: string[] = [] - for (const comment of comments) { - pubkeys.push(comment.pubkey) - if (comment.replies?.length) { - pubkeys.push(...collectCommentPubkeys(comment.replies)) - } - } - return pubkeys -} - -// Fetch profiles when submission loads -watch(submission, (sub) => { - if (profileService && sub) { - profileService.fetchProfiles([sub.pubkey]) - } -}, { immediate: true }) - -// Fetch profiles when comments load -watch(comments, (newComments) => { - if (profileService && newComments.length > 0) { - const pubkeys = [...new Set(collectCommentPubkeys(newComments))] - profileService.fetchProfiles(pubkeys) - } -}, { immediate: true })