mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-21 14:20:42 +08:00
Refactor search logic
- type events that are handed between components
- simplify the `resolve` function interface
- before we had return values and exceptions, now just a single union
type as return value
- move navigation to the Search component to reduce its
responsibilities
- flatten and simplify multi-level branching
- shuffle around code
- move the `resolve` function to the `Search` component module,
because it's only used there
Signed-off-by: Rūdolfs Ošiņš <rudolfs@osins.org>
This commit is contained in:
@@ -6,10 +6,10 @@
|
||||
import Address from "@app/Address.svelte";
|
||||
import Button from "@app/Button.svelte";
|
||||
import { createEventDispatcher } from "svelte";
|
||||
import type { ResolvedSearch } from "@app/resolver";
|
||||
import type { ProjectsAndProfiles } from "@app/Search.svelte";
|
||||
|
||||
export let query: string;
|
||||
export let results: ResolvedSearch;
|
||||
export let results: ProjectsAndProfiles;
|
||||
export let config: Config;
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
@@ -63,10 +63,10 @@
|
||||
{/each}
|
||||
</ul>
|
||||
{/if}
|
||||
{#if results.ens.length > 0}
|
||||
{#if results.profiles.length > 0}
|
||||
<p class="highlight txt-medium">ENS names</p>
|
||||
<ul>
|
||||
{#each results.ens as profile}
|
||||
{#each results.profiles as profile}
|
||||
<li>
|
||||
<Address address={profile.address} {profile} {config} resolve />
|
||||
</li>
|
||||
|
||||
Reference in New Issue
Block a user