+ Searching {spaces} + {spaces === 1 ? "space" : "spaces"}{#if extras > 0}, plus {extras} + extra {extras === 1 ? "relay" : "relays"} for people{/if}. +
+ +People
- {#each people as pubkey (pubkey)} -- {#if key === "day"} - Last 24 Hours - {:else if key === "week"} - Last 7 Days - {:else} - Older - {/if} -
- {#each events as event (event.id)} - + {#if term} + {#if people.length > 0} +People
+ {#each people as pubkey (pubkey)} ++ {#if key === "day"} + Last 24 Hours + {:else if key === "week"} + Last 7 Days + {:else} + Older + {/if} +
+ {#each events as event (event.id)} + + {/each} + {/each} + {/if} + {:else} + {@render empty?.()} {/if} diff --git a/src/app/core.ts b/src/app/core.ts index cd1d3c51..8fa48740 100644 --- a/src/app/core.ts +++ b/src/app/core.ts @@ -1,4 +1,4 @@ -import {derived, writable} from "svelte/store" +import {derived, readable, writable} from "svelte/store" import type {Readable} from "svelte/store" import {always} from "@welshman/lib" import type {Maybe} from "@welshman/lib" @@ -59,11 +59,7 @@ const makeApp = (user?: User) => { dufflepudUrl: DUFFLEPUD_URL, getDefaultRelays: always(DEFAULT_RELAYS), getIndexerRelays: always(INDEXER_RELAYS), - getSearchRelays: () => { - const urls = user ? instance.use(SearchRelayLists).urls(user.pubkey).get() : [] - - return urls.length > 0 ? urls : DEFAULT_SEARCH_RELAYS - }, + getSearchRelays: () => userSearchRelayUrls.get(), }, policies: appPolicies, }) @@ -164,6 +160,17 @@ export const thunks = usePlugin(Thunks) export const wot = usePlugin(Wot) export const wraps = usePlugin(Wraps) +// The relays profile search runs against, with a fallback so search still works before the user +// has chosen any of their own. +export const userSearchRelayUrls = withGetter( + derived( + fromApp($app => + $app.user ? $app.use(SearchRelayLists).urls($app.user.pubkey).$ : readable