Wire up NIP-19 / NIP-21 navigation + hashtag search from notes

- Mention clicks (nostr:npub1, nostr:nprofile) open internal ProfileView
- njump.me links intercepted: npub/nprofile decoded and opened internally,
  note/nevent/naddr fall through to browser (no reader yet)
- Hashtag clicks navigate to SearchView and auto-run the search
- openSearch(query) action added to UIStore; pendingSearch consumed on mount

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Jure
2026-03-09 20:47:57 +01:00
parent 2cdf99b725
commit b7853a14e2
3 changed files with 65 additions and 6 deletions

View File

@@ -10,9 +10,11 @@ interface UIState {
selectedPubkey: string | null;
selectedNote: NDKEvent | null;
previousView: View;
pendingSearch: string | null;
setView: (view: View) => void;
openProfile: (pubkey: string) => void;
openThread: (note: NDKEvent, from: View) => void;
openSearch: (query: string) => void;
goBack: () => void;
toggleSidebar: () => void;
}
@@ -23,9 +25,11 @@ export const useUIStore = create<UIState>((set, _get) => ({
selectedPubkey: null,
selectedNote: null,
previousView: "feed",
pendingSearch: null,
setView: (currentView) => set({ currentView }),
openProfile: (pubkey) => set((s) => ({ currentView: "profile", selectedPubkey: pubkey, previousView: s.currentView as View })),
openThread: (note, from) => set({ currentView: "thread", selectedNote: note, previousView: from }),
openSearch: (query) => set({ currentView: "search", pendingSearch: query }),
goBack: () => set((s) => ({
currentView: s.previousView !== s.currentView ? s.previousView : "feed",
selectedNote: null,