From ff3078e93411c3467d797258744a7f17a7dbdf0a Mon Sep 17 00:00:00 2001 From: polwex Date: Wed, 16 Jul 2025 10:07:06 +0700 Subject: m --- app/src/components/cat/Entry.tsx | 214 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 214 insertions(+) create mode 100644 app/src/components/cat/Entry.tsx (limited to 'app/src/components/cat/Entry.tsx') diff --git a/app/src/components/cat/Entry.tsx b/app/src/components/cat/Entry.tsx new file mode 100644 index 0000000..1ded145 --- /dev/null +++ b/app/src/components/cat/Entry.tsx @@ -0,0 +1,214 @@ +import { + CategorizationResponse, + userCategories, +} from "../../lib/categorization"; +import { TwitterApiService, TwitterBookmark } from "../../lib/twitter-api"; + +export default function ({ + bookmark, + categorization, + currentIndex, + totalCount, +}: { + bookmark: TwitterBookmark; + categorization: CategorizationResponse; + currentIndex: number; + totalCount: number; +}) { + async function processEntry() { + "use server"; + const cookie = Bun.env.TWATTER_COKI; + const api = new TwitterApiService(cookie!); + await api.removeBookmark(bookmark.id); + } + + return ( +
+ {/* Bookmark Content */} +
+
+ {bookmark.author.name} +
+

+ {bookmark.author.name} +

+

@{bookmark.author.username}

+

+ {new Date(bookmark.createdAt).toLocaleDateString()} +

+
+
+ +
+

{bookmark.text}

+
+ + {bookmark.media.pics.length > 0 && ( +
+

Images

+
+ {bookmark.media.pics.map((url, index) => ( + {`Bookmark + ))} +
+
+ )} + +
+ {bookmark.hashtags.map((tag) => ( + + #{tag} + + ))} +
+
+ + {/* LLM Analysis */} +
+

AI Analysis

+

{categorization.summary}

+ +
+

Key Topics

+
+ {categorization.keyTopics.map((topic) => ( + + {topic} + + ))} +
+
+ +
+

Suggested Categories

+ {categorization.suggestedCategories.map((suggestion, index) => ( +
+
+ + {suggestion.categories.join(", ")} + + + {(suggestion.confidence * 100).toFixed(0)}% + +
+

{suggestion.reasoning}

+
+ ))} +
+
+ + {/* Category Selection */} +
+
+

Select Categories

+ +
+

User Categories

+
+ {userCategories.map((category) => ( + + ))} +
+
+ + {categorization.newCategories.length > 0 && ( +
+

+ New Category Suggestions +

+
+ {categorization.newCategories.map((category) => ( + + ))} +
+
+ )} + +
+ + +
+ + + + +
+ {currentIndex > 0 && ( + + Previous + + )} + + {currentIndex + 1 < totalCount && ( + + Skip + + )} +
+
+
+
+ ); +} -- cgit v1.2.3