diff --git a/CLAUDE.md b/CLAUDE.md index b85fab5..5b890de 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -717,7 +717,7 @@ VITE_WEBSOCKET_ENABLED=true ## Payment Rails Pattern Shared primitives for modules that mix Lightning + fiat (and, future, -cash / internal-wallet) payment rails. Activities is the first +cash / internal-wallet) payment rails. Events is the first consumer; restaurant + marketplace will adopt the same primitives as their backends gain fiat support. @@ -784,7 +784,7 @@ type PaymentMethod = { ``` Module usage: -- **Activities** passes `[lightning, ...one entry per organizer provider]`. +- **Events** passes `[lightning, ...one entry per organizer provider]`. - **Restaurant** (future) passes the subset of `[lightning, cash, internal, ...fiat providers]` enabled by the restaurant's `accepts_*` flags. diff --git a/docs/nostr-patterns/README.md b/docs/nostr-patterns/README.md index b69da5a..237b681 100644 --- a/docs/nostr-patterns/README.md +++ b/docs/nostr-patterns/README.md @@ -1,7 +1,7 @@ # Nostr patterns Living reference for reusable Nostr patterns that show up across modules -(activities, forum, market, chat, tasks, base, nostr-feed). +(events, forum, market, chat, tasks, base, nostr-feed). **Read before writing any new Nostr code in this repo.** **Update whenever you introduce, refine, or correct a pattern.** Each section has a "Canonical diff --git a/docs/nostr-patterns/publishing.md b/docs/nostr-patterns/publishing.md index 3fa9f4a..b0dbccb 100644 --- a/docs/nostr-patterns/publishing.md +++ b/docs/nostr-patterns/publishing.md @@ -2,7 +2,7 @@ ## Treat `result.success === 0` as failure, not success -**Canonical:** `src/modules/activities/composables/useRSVP.ts` — +**Canonical:** `src/modules/events/composables/useRSVP.ts` — `if (!result || result.success <= 0) return null`. ```ts @@ -23,7 +23,7 @@ composable. Don't write code that silently treats both as success. ## Optimistic-on-success, not optimistic-on-click -**Canonical:** `src/modules/activities/composables/useRSVP.ts` — local +**Canonical:** `src/modules/events/composables/useRSVP.ts` — local cache update after the `await` resolves with `success > 0`, before the relay echoes the event back through the subscription. @@ -39,7 +39,7 @@ button flip twice. ## Pending-coord debounce: disable the button during in-flight publish -**Canonical:** `src/modules/activities/composables/useRSVP.ts` — +**Canonical:** `src/modules/events/composables/useRSVP.ts` — `pendingCoords: ref>` + `isPending(...)` predicate + `try { … } finally { pendingCoords.value.delete(coord) }`. @@ -66,7 +66,7 @@ while a previous publish on activity B is still flying. A global ## Sign with `nostr-tools.finalizeEvent`, take privkey as bytes -**Canonical:** `src/modules/activities/composables/useRSVP.ts` — +**Canonical:** `src/modules/events/composables/useRSVP.ts` — `hexToUint8Array` helper + `finalizeEvent(template, signingKey)`. `finalizeEvent` expects a `Uint8Array`, not a hex string. Several composables diff --git a/docs/nostr-patterns/replaceable-events.md b/docs/nostr-patterns/replaceable-events.md index 602a623..0cad379 100644 --- a/docs/nostr-patterns/replaceable-events.md +++ b/docs/nostr-patterns/replaceable-events.md @@ -7,7 +7,7 @@ in this file follows from that single fact. ## Strictly-monotonic `created_at` per coord -**Canonical:** `src/modules/activities/composables/useRSVP.ts` — +**Canonical:** `src/modules/events/composables/useRSVP.ts` — `lastPublishAt` map + the `Math.max(now, previous + 1)` line. ```ts @@ -31,7 +31,7 @@ than the last click on the same coord. ## Per-pubkey latest-wins state for derived counts -**Canonical:** `src/modules/activities/composables/useRSVP.ts` — +**Canonical:** `src/modules/events/composables/useRSVP.ts` — `rsvpStates: ref>>` + `upsertRSVPState` + `getRSVPCount` (count entries where status === 'accepted'). @@ -51,7 +51,7 @@ any "who's currently in state X" question. ## Replaceable list, full-rewrite on toggle -**Canonical:** `src/modules/activities/composables/useBookmarks.ts` — +**Canonical:** `src/modules/events/composables/useBookmarks.ts` — NIP-51 kind 10003 bookmark list. For replaceable lists (10003 bookmarks, 10000 mute list, 10006 communities, @@ -66,7 +66,7 @@ diverges on next refresh. ## Vue 3 reactivity for nested `ref` -**Canonical:** `src/modules/activities/composables/useRSVP.ts` — +**Canonical:** `src/modules/events/composables/useRSVP.ts` — `upsertRSVPState` (the `rsvpStates.value.set(coord, inner)` after mutating `inner`). diff --git a/docs/nostr-patterns/subscriptions.md b/docs/nostr-patterns/subscriptions.md index 5921351..3dcb1cd 100644 --- a/docs/nostr-patterns/subscriptions.md +++ b/docs/nostr-patterns/subscriptions.md @@ -2,7 +2,7 @@ ## Subscribe, store the unsubscribe handle, clean up on unmount -**Canonical:** `src/modules/activities/composables/useRSVP.ts` — +**Canonical:** `src/modules/events/composables/useRSVP.ts` — `loadRSVPs()` (subscribe block) + the matching `onUnmounted(() => unsubscribe?.())`. ```ts @@ -33,7 +33,7 @@ session-long vs view-long), not by accident. ## EOSE means "backfill done", not "all events delivered" -**Canonical:** `src/modules/activities/composables/useRSVP.ts` — +**Canonical:** `src/modules/events/composables/useRSVP.ts` — `onEose: () => { isLoaded.value = true }`. `onEose` fires once, after the relay flushes everything stored that matches