2024-10-24 20:11:53 +00:00
|
|
|
<script lang="ts">
|
|
|
|
|
import {onMount} from "svelte"
|
2024-11-15 23:16:06 +00:00
|
|
|
import {createScroller, isMobile} from "@lib/html"
|
2024-10-24 20:11:53 +00:00
|
|
|
import {profileSearch} from "@welshman/app"
|
2025-09-10 22:26:39 +00:00
|
|
|
import Magnifier from "@assets/icons/magnifier.svg?dataurl"
|
2024-10-24 20:11:53 +00:00
|
|
|
import Icon from "@lib/components/Icon.svelte"
|
|
|
|
|
import Page from "@lib/components/Page.svelte"
|
|
|
|
|
import ContentSearch from "@lib/components/ContentSearch.svelte"
|
|
|
|
|
import PeopleItem from "@app/components/PeopleItem.svelte"
|
2025-09-06 00:20:12 +00:00
|
|
|
import {defaultPubkeys} from "@app/core/state"
|
2024-10-24 20:11:53 +00:00
|
|
|
|
2025-02-04 00:37:14 +00:00
|
|
|
let term = $state("")
|
|
|
|
|
let limit = $state(10)
|
|
|
|
|
let element: Element | undefined = $state()
|
2024-10-24 20:11:53 +00:00
|
|
|
|
2025-09-06 00:20:12 +00:00
|
|
|
const pubkeys = $derived(term ? $profileSearch.searchValues(term) : $defaultPubkeys)
|
2024-10-24 20:11:53 +00:00
|
|
|
|
|
|
|
|
onMount(() => {
|
|
|
|
|
const scroller = createScroller({
|
2025-02-04 00:37:14 +00:00
|
|
|
element: element!,
|
2024-10-24 20:11:53 +00:00
|
|
|
onScroll: () => {
|
|
|
|
|
limit += 10
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
return () => scroller.stop()
|
|
|
|
|
})
|
|
|
|
|
</script>
|
|
|
|
|
|
2025-05-13 17:14:20 +00:00
|
|
|
<Page class="cw-full">
|
2024-10-24 20:11:53 +00:00
|
|
|
<ContentSearch>
|
2025-02-04 00:37:14 +00:00
|
|
|
{#snippet input()}
|
|
|
|
|
<label class="row-2 input input-bordered">
|
2025-09-10 22:26:39 +00:00
|
|
|
<Icon icon={Magnifier} />
|
2025-02-04 00:37:14 +00:00
|
|
|
<!-- svelte-ignore a11y_autofocus -->
|
|
|
|
|
<input
|
|
|
|
|
autofocus={!isMobile}
|
|
|
|
|
bind:value={term}
|
|
|
|
|
class="grow"
|
|
|
|
|
type="text"
|
|
|
|
|
placeholder="Search for people..." />
|
|
|
|
|
</label>
|
|
|
|
|
{/snippet}
|
|
|
|
|
{#snippet content()}
|
2025-06-05 19:25:55 +00:00
|
|
|
<div class="col-2 h-full" bind:this={element}>
|
2025-02-04 00:37:14 +00:00
|
|
|
{#each pubkeys.slice(0, limit) as pubkey (pubkey)}
|
|
|
|
|
<PeopleItem {pubkey} />
|
|
|
|
|
{/each}
|
|
|
|
|
</div>
|
|
|
|
|
{/snippet}
|
2024-10-24 20:11:53 +00:00
|
|
|
</ContentSearch>
|
|
|
|
|
</Page>
|