"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 && (
); }