Open Nostr event links from the search field #134

Merged
raucao merged 2 commits from feature/nostr_search into master 2026-11-28 16:36:55 +00:00
Owner

The full-text search field now detects anything the /e/ handler can open — raw 64-hex event ids, note1/nevent1/naddr1 codes, nostr: URIs, kind:pubkey:d coordinates and permalinks — and opens it instead of running a Photon or bookmark search.

As-you-type, a pasted reference is resolved through the event store while the field shows a spinner, and the popover offers a single result row labelled by its kind ("Place photo" / "Place review", or a generic "Nostr event") with a matching description. An event that isn't linked to a place says so, and one that can't be found shows the usual not-found toast. Submitting a reference, and direct /search?q=<ref> links, route straight to the /e/ handler.

Implementation notes:

  • nostrEventRouteParam() normalizes any accepted reference to the single URL-safe segment the /e/:event_id route needs (so pasted permalinks and nostr: URIs work).
  • nostrEventLabel() derives the row text from the resolved event's kind and its OSM i tag.
  • The inline lookup re-checks that the input still matches before applying its result, so cancellation or a later keystroke can't show a stale row or toast.

Tests: unit coverage for the new helpers, plus integration/acceptance coverage for the found, not-found, label, submit, refocus and cancel paths. pnpm lint and pnpm test (529 passing) are green.

The full-text search field now detects anything the `/e/` handler can open — raw 64-hex event ids, `note1`/`nevent1`/`naddr1` codes, `nostr:` URIs, `kind:pubkey:d` coordinates and permalinks — and opens it instead of running a Photon or bookmark search. As-you-type, a pasted reference is resolved through the event store while the field shows a spinner, and the popover offers a single result row labelled by its kind ("Place photo" / "Place review", or a generic "Nostr event") with a matching description. An event that isn't linked to a place says so, and one that can't be found shows the usual not-found toast. Submitting a reference, and direct `/search?q=<ref>` links, route straight to the `/e/` handler. Implementation notes: - `nostrEventRouteParam()` normalizes any accepted reference to the single URL-safe segment the `/e/:event_id` route needs (so pasted permalinks and `nostr:` URIs work). - `nostrEventLabel()` derives the row text from the resolved event's kind and its OSM `i` tag. - The inline lookup re-checks that the input still matches before applying its result, so cancellation or a later keystroke can't show a stale row or toast. Tests: unit coverage for the new helpers, plus integration/acceptance coverage for the found, not-found, label, submit, refocus and cancel paths. `pnpm lint` and `pnpm test` (529 passing) are green.
raucao added 1 commit 2026-11-28 15:36:41 +00:00
Open Nostr event links from the search field
CI / Lint (pull_request) Successful in 57s
CI / Test (pull_request) Failing after 1m9s
bba9a2a444
The full-text search field now detects anything the /e/ handler can open
(raw 64-hex ids, note1/nevent1/naddr1 codes, nostr: URIs, kind:pubkey:d
coordinates and permalinks) and opens it instead of running a Photon or
bookmark search.

As-you-type, a pasted reference resolves through the event store while the
field shows a spinner and the popover offers a single row labelled by kind
("Place photo" / "Place review", or a generic "Nostr event"). A reference
that cannot be found shows the usual not-found toast, and an unlinked event
is flagged as such. Submitting a reference, and direct /search?q=<ref>
links, route straight to the /e/ handler.
raucao added the featurenostrui/ux labels 2026-11-28 15:45:03 +00:00
raucao added 1 commit 2026-11-28 15:46:40 +00:00
Make the Nostr cancel test deterministic
CI / Lint (pull_request) Successful in 53s
CI / Test (pull_request) Successful in 58s
Release Drafter / Update release notes draft (pull_request) Successful in 15s
ad19c32719
The test's mock resolved on a fixed 200ms timer, racing the ~200ms
window between the spinner appearing and the lookup completing. On a
slower CI browser the lookup finished (and toasted) before the query
was shortened, so the assertion failed. Hold the lookup open with a
manually released promise so it is always pending when the query is
shortened.
raucao merged commit 723085cd43 into master 2026-11-28 16:36:55 +00:00
raucao deleted branch feature/nostr_search 2026-11-28 16:36:56 +00:00
Sign in to join this conversation.