fix(nostr-feed): Fix TypeScript errors and remove unused imports
- Change SubmissionWithMeta from interface to type intersection - Fix UseSubmissionsReturn types to use proper Ref/ComputedRef - Remove unused imports across components and services 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
6e2df155c4
commit
4aa18a2705
8 changed files with 13 additions and 29 deletions
|
|
@ -6,8 +6,7 @@
|
||||||
|
|
||||||
import { computed, ref } from 'vue'
|
import { computed, ref } from 'vue'
|
||||||
import { formatDistanceToNow } from 'date-fns'
|
import { formatDistanceToNow } from 'date-fns'
|
||||||
import { ChevronUp, ChevronDown, Reply, Flag, MoreHorizontal, Send, X } from 'lucide-vue-next'
|
import { ChevronUp, ChevronDown, Reply, Flag, MoreHorizontal, Send } from 'lucide-vue-next'
|
||||||
import VoteControls from './VoteControls.vue'
|
|
||||||
import type { SubmissionComment as CommentType } from '../types/submission'
|
import type { SubmissionComment as CommentType } from '../types/submission'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ref, computed, watch } from 'vue'
|
import { ref, computed, watch } from 'vue'
|
||||||
import { useRoute, useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
import { formatDistanceToNow } from 'date-fns'
|
import { formatDistanceToNow } from 'date-fns'
|
||||||
import {
|
import {
|
||||||
ArrowLeft,
|
ArrowLeft,
|
||||||
|
|
@ -17,9 +17,6 @@ import {
|
||||||
Image as ImageIcon,
|
Image as ImageIcon,
|
||||||
FileText,
|
FileText,
|
||||||
Loader2,
|
Loader2,
|
||||||
ChevronUp,
|
|
||||||
ChevronDown,
|
|
||||||
Reply,
|
|
||||||
Send
|
Send
|
||||||
} from 'lucide-vue-next'
|
} from 'lucide-vue-next'
|
||||||
import { Badge } from '@/components/ui/badge'
|
import { Badge } from '@/components/ui/badge'
|
||||||
|
|
@ -31,7 +28,6 @@ import { tryInjectService, SERVICE_TOKENS } from '@/core/di-container'
|
||||||
import type { ProfileService } from '../services/ProfileService'
|
import type { ProfileService } from '../services/ProfileService'
|
||||||
import type { SubmissionService } from '../services/SubmissionService'
|
import type { SubmissionService } from '../services/SubmissionService'
|
||||||
import type {
|
import type {
|
||||||
SubmissionWithMeta,
|
|
||||||
SubmissionComment as SubmissionCommentType,
|
SubmissionComment as SubmissionCommentType,
|
||||||
LinkSubmission,
|
LinkSubmission,
|
||||||
MediaSubmission,
|
MediaSubmission,
|
||||||
|
|
@ -245,15 +241,6 @@ function toggleCollapse(commentId: string) {
|
||||||
collapsedComments.value = new Set(collapsedComments.value)
|
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
|
// Go back
|
||||||
function goBack() {
|
function goBack() {
|
||||||
router.back()
|
router.back()
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
* Includes sort tabs, submission rows, and loading states
|
* Includes sort tabs, submission rows, and loading states
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ref, computed, onMounted, watch } from 'vue'
|
import { computed, onMounted, watch } from 'vue'
|
||||||
import { Loader2 } from 'lucide-vue-next'
|
import { Loader2 } from 'lucide-vue-next'
|
||||||
import SortTabs from './SortTabs.vue'
|
import SortTabs from './SortTabs.vue'
|
||||||
import SubmissionRow from './SubmissionRow.vue'
|
import SubmissionRow from './SubmissionRow.vue'
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { computed } from 'vue'
|
import { computed } from 'vue'
|
||||||
import { Link, FileText, Image, Film, MessageSquare, ExternalLink } from 'lucide-vue-next'
|
import { FileText, Image, ExternalLink } from 'lucide-vue-next'
|
||||||
import type { SubmissionType } from '../types/submission'
|
import type { SubmissionType } from '../types/submission'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
* Provides reactive access to the SubmissionService for Reddit-style submissions.
|
* Provides reactive access to the SubmissionService for Reddit-style submissions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { computed, ref, onMounted, onUnmounted, watch } from 'vue'
|
import { computed, ref, onMounted, onUnmounted, watch, type Ref, type ComputedRef } from 'vue'
|
||||||
import { tryInjectService, SERVICE_TOKENS } from '@/core/di-container'
|
import { tryInjectService, SERVICE_TOKENS } from '@/core/di-container'
|
||||||
import type { SubmissionService } from '../services/SubmissionService'
|
import type { SubmissionService } from '../services/SubmissionService'
|
||||||
import type { LinkPreviewService } from '../services/LinkPreviewService'
|
import type { LinkPreviewService } from '../services/LinkPreviewService'
|
||||||
|
|
@ -31,13 +31,13 @@ export interface UseSubmissionsOptions {
|
||||||
|
|
||||||
export interface UseSubmissionsReturn {
|
export interface UseSubmissionsReturn {
|
||||||
// State
|
// State
|
||||||
submissions: ReturnType<typeof computed<SubmissionWithMeta[]>>
|
submissions: ComputedRef<SubmissionWithMeta[]>
|
||||||
isLoading: ReturnType<typeof computed<boolean>>
|
isLoading: ComputedRef<boolean>
|
||||||
error: ReturnType<typeof computed<string | null>>
|
error: ComputedRef<string | null>
|
||||||
|
|
||||||
// Sorting
|
// Sorting
|
||||||
currentSort: ReturnType<typeof ref<SortType>>
|
currentSort: Ref<SortType>
|
||||||
currentTimeRange: ReturnType<typeof ref<TimeRange>>
|
currentTimeRange: Ref<TimeRange>
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
subscribe: (config?: Partial<SubmissionFeedConfig>) => Promise<void>
|
subscribe: (config?: Partial<SubmissionFeedConfig>) => Promise<void>
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
* Used when creating link submissions to embed preview data.
|
* Used when creating link submissions to embed preview data.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ref, reactive } from 'vue'
|
import { reactive } from 'vue'
|
||||||
import { BaseService } from '@/core/base/BaseService'
|
import { BaseService } from '@/core/base/BaseService'
|
||||||
import type { LinkPreview } from '../types/submission'
|
import type { LinkPreview } from '../types/submission'
|
||||||
import { extractDomain } from '../types/submission'
|
import { extractDomain } from '../types/submission'
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,6 @@ import {
|
||||||
type SubmissionComment,
|
type SubmissionComment,
|
||||||
type LinkPreview,
|
type LinkPreview,
|
||||||
type MediaAttachment,
|
type MediaAttachment,
|
||||||
type CommunityRef,
|
|
||||||
parseCommunityRef,
|
parseCommunityRef,
|
||||||
formatCommunityRef,
|
formatCommunityRef,
|
||||||
extractDomain,
|
extractDomain,
|
||||||
|
|
@ -505,7 +504,7 @@ export class SubmissionService extends BaseService {
|
||||||
id: event.id,
|
id: event.id,
|
||||||
pubkey: event.pubkey,
|
pubkey: event.pubkey,
|
||||||
created_at: event.created_at,
|
created_at: event.created_at,
|
||||||
kind: SUBMISSION_KINDS.SUBMISSION as const,
|
kind: SUBMISSION_KINDS.SUBMISSION,
|
||||||
tags,
|
tags,
|
||||||
title,
|
title,
|
||||||
communityRef: this.extractCommunityRef(tags),
|
communityRef: this.extractCommunityRef(tags),
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@
|
||||||
* Submissions are kind 1111 events scoped to a community with structured metadata.
|
* Submissions are kind 1111 events scoped to a community with structured metadata.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { Event as NostrEvent } from 'nostr-tools'
|
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// Constants
|
// Constants
|
||||||
|
|
@ -193,7 +192,7 @@ export interface SubmissionRanking {
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
/** Complete submission with all associated data */
|
/** Complete submission with all associated data */
|
||||||
export interface SubmissionWithMeta extends Submission {
|
export type SubmissionWithMeta = Submission & {
|
||||||
/** Vote counts and user state */
|
/** Vote counts and user state */
|
||||||
votes: SubmissionVotes
|
votes: SubmissionVotes
|
||||||
/** Ranking scores */
|
/** Ranking scores */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue