From 4db147ddf332a310c29e7374839c2ed15b3bb16d Mon Sep 17 00:00:00 2001 From: Gigi Date: Thu, 2 Oct 2025 11:02:43 +0200 Subject: [PATCH] feat(ui): add copy-to-clipboard icons for event id and author pubkey --- src/components/BookmarkItem.tsx | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/components/BookmarkItem.tsx b/src/components/BookmarkItem.tsx index 6b47fc04..0b46561c 100644 --- a/src/components/BookmarkItem.tsx +++ b/src/components/BookmarkItem.tsx @@ -1,6 +1,6 @@ import React from 'react' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' -import { faLock, faGlobe } from '@fortawesome/free-solid-svg-icons' +import { faLock, faGlobe, faCopy } from '@fortawesome/free-solid-svg-icons' import { IndividualBookmark } from '../types/bookmarks' import { formatDate, renderParsedContent } from '../utils/bookmarkUtils' @@ -10,6 +10,12 @@ interface BookmarkItemProps { } export const BookmarkItem: React.FC = ({ bookmark, index }) => { + const copy = async (text: string) => { + try { await navigator.clipboard.writeText(text) } catch {} + } + + const short = (v: string) => `${v.slice(0, 8)}...${v.slice(-8)}` + return (
@@ -17,7 +23,12 @@ export const BookmarkItem: React.FC = ({ bookmark, index }) = {bookmark.type} - {bookmark.id.slice(0, 8)}...{bookmark.id.slice(-8)} + + {short(bookmark.id)} + + {formatDate(bookmark.created_at)}
@@ -33,7 +44,12 @@ export const BookmarkItem: React.FC = ({ bookmark, index }) =
Kind: {bookmark.kind} - Author: {bookmark.pubkey.slice(0, 8)}...{bookmark.pubkey.slice(-8)} + + Author: {short(bookmark.pubkey)} + +
)