mirror of
https://github.com/hoornet/vega.git
synced 2026-05-10 22:29:11 -07:00
Note rendering + login system
- Rich note content parser: clickable links, inline images, videos - URL shortening for display, trailing punctuation cleanup - nostr: mention parsing (npub, note, nevent, nprofile) - Hashtag highlighting - NIP-05 display on note cards - Login modal with nsec (full access) and npub (read-only) modes - User store with Zustand, NDK signer integration - Sidebar shows logged-in user avatar/name + logout - Login state persisted via localStorage (pubkey only, never nsec)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { NDKEvent } from "@nostr-dev-kit/ndk";
|
||||
import { useProfile } from "../../hooks/useProfile";
|
||||
import { timeAgo, shortenPubkey } from "../../lib/utils";
|
||||
import { NoteContent } from "./NoteContent";
|
||||
|
||||
interface NoteCardProps {
|
||||
event: NDKEvent;
|
||||
@@ -10,6 +11,7 @@ export function NoteCard({ event }: NoteCardProps) {
|
||||
const profile = useProfile(event.pubkey);
|
||||
const name = profile?.displayName || profile?.name || shortenPubkey(event.pubkey);
|
||||
const avatar = profile?.picture;
|
||||
const nip05 = profile?.nip05;
|
||||
const time = event.created_at ? timeAgo(event.created_at) : "";
|
||||
|
||||
return (
|
||||
@@ -40,11 +42,14 @@ export function NoteCard({ event }: NoteCardProps) {
|
||||
<span className="text-text font-medium truncate text-[13px]">
|
||||
{name}
|
||||
</span>
|
||||
{nip05 && (
|
||||
<span className="text-text-dim text-[10px] truncate max-w-40">
|
||||
{nip05}
|
||||
</span>
|
||||
)}
|
||||
<span className="text-text-dim text-[11px] shrink-0">{time}</span>
|
||||
</div>
|
||||
<div className="note-content text-text text-[13px] break-words whitespace-pre-wrap">
|
||||
{event.content}
|
||||
</div>
|
||||
<NoteContent content={event.content} />
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
|
||||
Reference in New Issue
Block a user