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/bookmark-list.tsx | 109 +++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 app/src/components/bookmark-list.tsx (limited to 'app/src/components/bookmark-list.tsx') diff --git a/app/src/components/bookmark-list.tsx b/app/src/components/bookmark-list.tsx new file mode 100644 index 0000000..6138e31 --- /dev/null +++ b/app/src/components/bookmark-list.tsx @@ -0,0 +1,109 @@ +"use client"; + +import { useState } from "react"; + +import { BookmarkStorageService } from "../lib/bookmark-storage"; +import { TwitterBookmark } from "../lib/twitter-api"; + +interface BookmarkListProps { + bookmarks: TwitterBookmark[]; +} + +function formatDate(dateString: string): string { + const date = new Date(dateString); + return date.toLocaleDateString("en-US", { + year: "numeric", + month: "short", + day: "numeric", + hour: "2-digit", + minute: "2-digit", + }); +} + +function truncateText(text: string, maxLength: number = 200): string { + if (text.length <= maxLength) return text; + return text.substring(0, maxLength) + "..."; +} + +export function BookmarkList({ bookmarks }: BookmarkListProps) { + if (bookmarks.length === 0) { + return ( +
+ No bookmarks found. Click "Fetch Twitter Bookmarks" to load your + bookmarks. +
+ ); + } + + return ( +
+
+ Found {bookmarks.length} bookmark{bookmarks.length !== 1 ? "s" : ""} +
+ + {bookmarks.map((bookmark) => ( + + ))} +
+ ); +} + +function BookmarkEntry({ bookmark }: { bookmark: TwitterBookmark }) { + console.log({ bookmark }); + return ( +
+
+
+
+ + @{bookmark.author.username} + + + + {formatDate(bookmark.createdAt)} + +
+
+ {truncateText(bookmark.text)} +
+
+ {bookmark.media.pics.map((p) => ( + + ))} +
+ {bookmark.media.video.url && ( +
+
+
+ ); +} -- cgit v1.2.3