refactor: extract components and utilities to keep files under 210 lines

- Extract types to src/types/bookmarks.ts
- Extract utility functions to src/utils/bookmarkUtils.tsx
- Extract BookmarkItem component to src/components/BookmarkItem.tsx
- Extract BookmarkList component to src/components/BookmarkList.tsx
- Extract bookmark fetching logic to src/services/bookmarkService.ts
- Reduce main Bookmarks component from 416 to 100 lines
- Maintain all functionality while improving code organization
- Pass all linting and type checking
This commit is contained in:
Gigi
2025-10-02 09:19:44 +02:00
parent 15d155c565
commit 2253172e04
6 changed files with 383 additions and 328 deletions

43
src/types/bookmarks.ts Normal file
View File

@@ -0,0 +1,43 @@
export interface ParsedNode {
type: string
value?: string
url?: string
encoded?: string
children?: ParsedNode[]
}
export interface ParsedContent {
type: string
children: ParsedNode[]
}
export interface Bookmark {
id: string
title: string
url: string
content: string
created_at: number
tags: string[][]
bookmarkCount?: number
eventReferences?: string[]
articleReferences?: string[]
urlReferences?: string[]
parsedContent?: ParsedContent
individualBookmarks?: IndividualBookmark[]
}
export interface IndividualBookmark {
id: string
content: string
created_at: number
pubkey: string
kind: number
tags: string[][]
parsedContent?: ParsedContent
author?: string
type: 'event' | 'article'
}
export interface ActiveAccount {
pubkey: string
}