mirror of
https://github.com/hoornet/vega.git
synced 2026-07-13 20:18:11 -07:00
Add follow/unfollow (NIP-02) from profile view
- publishContactList (kind 3) in nostr lib — replaces full follow list on each change - follow() and unfollow() actions in user store with optimistic UI update - Follow/Unfollow button in ProfileView header (visible when logged in, not own profile) - Button shows "unfollow" in muted style with danger hover when already following Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -191,6 +191,17 @@ export async function fetchUserNotes(pubkey: string, limit = 30): Promise<NDKEve
|
||||
return Array.from(events).sort((a, b) => (b.created_at ?? 0) - (a.created_at ?? 0));
|
||||
}
|
||||
|
||||
export async function publishContactList(pubkeys: string[]): Promise<void> {
|
||||
const instance = getNDK();
|
||||
if (!instance.signer) throw new Error("Not logged in");
|
||||
|
||||
const event = new NDKEvent(instance);
|
||||
event.kind = 3;
|
||||
event.content = "";
|
||||
event.tags = pubkeys.map((pk) => ["p", pk]);
|
||||
await event.publish();
|
||||
}
|
||||
|
||||
export async function fetchProfile(pubkey: string) {
|
||||
const instance = getNDK();
|
||||
const user = instance.getUser({ pubkey });
|
||||
|
||||
@@ -1 +1 @@
|
||||
export { getNDK, connectToRelays, fetchGlobalFeed, fetchFollowFeed, fetchReplies, publishNote, publishArticle, publishProfile, publishReaction, publishReply, fetchUserNotes, fetchProfile } from "./client";
|
||||
export { getNDK, connectToRelays, fetchGlobalFeed, fetchFollowFeed, fetchReplies, publishNote, publishArticle, publishProfile, publishReaction, publishReply, publishContactList, fetchUserNotes, fetchProfile } from "./client";
|
||||
|
||||
Reference in New Issue
Block a user