mirror of
https://github.com/hoornet/vega.git
synced 2026-05-12 16:48:35 -07:00
Add thread view with replies
- Click note content to open thread view - ThreadView shows root note, reply composer, and replies - fetchReplies added to nostr lib (kind 1 #e filter) - UI store gains openThread, goBack, previousView for navigation history - Profile back button now returns to previous view correctly Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,21 +1,31 @@
|
||||
import { create } from "zustand";
|
||||
|
||||
type View = "feed" | "relays" | "settings" | "profile";
|
||||
import { NDKEvent } from "@nostr-dev-kit/ndk";
|
||||
|
||||
type View = "feed" | "relays" | "settings" | "profile" | "thread";
|
||||
|
||||
interface UIState {
|
||||
currentView: View;
|
||||
sidebarCollapsed: boolean;
|
||||
selectedPubkey: string | null;
|
||||
selectedNote: NDKEvent | null;
|
||||
previousView: View;
|
||||
setView: (view: View) => void;
|
||||
openProfile: (pubkey: string) => void;
|
||||
openThread: (note: NDKEvent, from: View) => void;
|
||||
goBack: () => void;
|
||||
toggleSidebar: () => void;
|
||||
}
|
||||
|
||||
export const useUIStore = create<UIState>((set) => ({
|
||||
export const useUIStore = create<UIState>((set, get) => ({
|
||||
currentView: "feed",
|
||||
sidebarCollapsed: false,
|
||||
selectedPubkey: null,
|
||||
selectedNote: null,
|
||||
previousView: "feed",
|
||||
setView: (currentView) => set({ currentView }),
|
||||
openProfile: (pubkey) => set({ currentView: "profile", selectedPubkey: pubkey }),
|
||||
openProfile: (pubkey) => set((s) => ({ currentView: "profile", selectedPubkey: pubkey, previousView: s.currentView as View })),
|
||||
openThread: (note, from) => set({ currentView: "thread", selectedNote: note, previousView: from }),
|
||||
goBack: () => set((s) => ({ currentView: s.previousView, selectedNote: null })),
|
||||
toggleSidebar: () => set((s) => ({ sidebarCollapsed: !s.sidebarCollapsed })),
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user