mirror of
https://github.com/coracle-social/coracle.git
synced 2024-09-19 11:43:35 +00:00
Load people from the networking in EnsureData too
This commit is contained in:
parent
67d1162245
commit
c033b66b64
@ -1,5 +1,6 @@
|
||||
<script>
|
||||
import {nth} from "ramda"
|
||||
import {debounce} from "throttle-debounce"
|
||||
import Input from "src/partials/Input.svelte"
|
||||
import Spinner from "src/partials/Spinner.svelte"
|
||||
import PersonInfo from "src/app/shared/PersonInfo.svelte"
|
||||
@ -12,6 +13,19 @@
|
||||
|
||||
let q
|
||||
|
||||
const {petnames} = user
|
||||
|
||||
const loadPeople = debounce(500, search => {
|
||||
if (q.length > 2) {
|
||||
network.load({
|
||||
relays: getUserReadRelays(),
|
||||
filter: [{kinds: [0], search, limit: 10}],
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
$: loadPeople(q)
|
||||
|
||||
$: results = $searchPeople(q)
|
||||
.filter(person => {
|
||||
if (person.pubkey === user.getPubkey()) {
|
||||
@ -25,14 +39,6 @@
|
||||
return true
|
||||
})
|
||||
.slice(0, 50)
|
||||
|
||||
const {petnames} = user
|
||||
|
||||
// Prime our database, in case we don't have any people stored yet
|
||||
network.load({
|
||||
relays: getUserReadRelays(),
|
||||
filter: {kinds: [0], limit: 10},
|
||||
})
|
||||
</script>
|
||||
|
||||
<Input bind:value={q} placeholder="Search for people">
|
||||
|
@ -15,7 +15,21 @@
|
||||
|
||||
let q
|
||||
|
||||
$: searchPeople(q)
|
||||
const openTopic = topic => {
|
||||
modal.push({type: "topic/feed", topic})
|
||||
}
|
||||
|
||||
const loadPeople = debounce(500, search => {
|
||||
if (q.length > 2) {
|
||||
network.load({
|
||||
relays: getUserReadRelays(),
|
||||
filter: [{kinds: [0], search, limit: 10}],
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
$: loadPeople(q)
|
||||
|
||||
$: search = watch(["people", "topics"], (p, t) => {
|
||||
const topics = t
|
||||
.all()
|
||||
@ -33,19 +47,6 @@
|
||||
return fuzzy(sortBy(prop("id"), topics.concat(people)), {keys: ["text"]})
|
||||
})
|
||||
|
||||
const openTopic = topic => {
|
||||
modal.push({type: "topic/feed", topic})
|
||||
}
|
||||
|
||||
const searchPeople = debounce(500, search => {
|
||||
if (q.length > 2) {
|
||||
network.load({
|
||||
relays: getUserReadRelays(),
|
||||
filter: [{kinds: [0], search, limit: 10}],
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
document.title = "Search"
|
||||
</script>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user