mirror of
https://github.com/hoornet/vega.git
synced 2026-07-29 03:08:10 -07:00
Add new account age badge on notes (< 60 days)
This commit is contained in:
@@ -34,6 +34,8 @@ export const NoteCard = memo(function NoteCard({ event, focused, onReplyInThread
|
||||
const nip05 = typeof profile?.nip05 === "string" ? profile.nip05 : null;
|
||||
const verified = useNip05Verified(event.pubkey, nip05);
|
||||
const time = event.created_at ? timeAgo(event.created_at) : "";
|
||||
const profileCreatedAt = typeof profile?._createdAt === "number" ? profile._createdAt : null;
|
||||
const isNewAccount = profileCreatedAt !== null && (Date.now() / 1000 - profileCreatedAt) < 60 * 24 * 3600;
|
||||
|
||||
const loggedIn = useUserStore((s) => s.loggedIn);
|
||||
const ownPubkey = useUserStore((s) => s.pubkey);
|
||||
@@ -108,6 +110,9 @@ export const NoteCard = memo(function NoteCard({ event, focused, onReplyInThread
|
||||
</span>
|
||||
)}
|
||||
<span className="text-text-dim text-[11px] shrink-0">{time}</span>
|
||||
{isNewAccount && (
|
||||
<span title="Account created less than 60 days ago" className="text-[9px] px-1 py-0.5 border border-warning/40 text-warning/70 shrink-0 leading-none">new</span>
|
||||
)}
|
||||
{/* Context menu — hidden until card hover, not shown for own notes */}
|
||||
{loggedIn && event.pubkey !== ownPubkey && (
|
||||
<div className="relative ml-auto">
|
||||
|
||||
@@ -172,11 +172,11 @@ export function SearchView() {
|
||||
...s,
|
||||
profile: p ? {
|
||||
pubkey: s.pubkey,
|
||||
name: (p as Record<string, string>).name || "",
|
||||
displayName: (p as Record<string, string>).display_name || (p as Record<string, string>).name || "",
|
||||
picture: (p as Record<string, string>).picture || "",
|
||||
nip05: (p as Record<string, string>).nip05 || "",
|
||||
about: (p as Record<string, string>).about || "",
|
||||
name: (p as Record<string, unknown>).name as string || "",
|
||||
displayName: (p as Record<string, unknown>).display_name as string || (p as Record<string, unknown>).name as string || "",
|
||||
picture: (p as Record<string, unknown>).picture as string || "",
|
||||
nip05: (p as Record<string, unknown>).nip05 as string || "",
|
||||
about: (p as Record<string, unknown>).about as string || "",
|
||||
} : null,
|
||||
};
|
||||
} catch {
|
||||
|
||||
Reference in New Issue
Block a user