Fix some bugs with profile search
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@welshman/app",
|
"name": "@welshman/app",
|
||||||
"version": "0.2.4",
|
"version": "0.2.5",
|
||||||
"author": "hodlbod",
|
"author": "hodlbod",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"description": "A collection of svelte stores for use in building nostr client applications.",
|
"description": "A collection of svelte stores for use in building nostr client applications.",
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import Fuse, {IFuseOptions, FuseResult} from "fuse.js"
|
import Fuse, {IFuseOptions, FuseResult} from "fuse.js"
|
||||||
import {debounce} from "throttle-debounce"
|
import {debounce} from "throttle-debounce"
|
||||||
import {derived} from "svelte/store"
|
import {derived} from "svelte/store"
|
||||||
import {dec, sortBy} from "@welshman/lib"
|
import {dec, inc, sortBy} from "@welshman/lib"
|
||||||
import {PROFILE, PublishedProfile} from "@welshman/util"
|
import {PROFILE, PublishedProfile} from "@welshman/util"
|
||||||
import {load} from "@welshman/net"
|
import {load} from "@welshman/net"
|
||||||
import {throttled} from "@welshman/store"
|
import {throttled} from "@welshman/store"
|
||||||
import {Router} from "@welshman/router"
|
import {Router} from "@welshman/router"
|
||||||
import {wotGraph} from "./wot.js"
|
import {wotGraph, maxWot} from "./wot.js"
|
||||||
import {profiles} from "./profiles.js"
|
import {profiles} from "./profiles.js"
|
||||||
import {topics, Topic} from "./topics.js"
|
import {topics, Topic} from "./topics.js"
|
||||||
import {relays, Relay} from "./relays.js"
|
import {relays, Relay} from "./relays.js"
|
||||||
@@ -74,12 +74,10 @@ export const profileSearch = derived(
|
|||||||
return createSearch(options, {
|
return createSearch(options, {
|
||||||
onSearch: searchProfiles,
|
onSearch: searchProfiles,
|
||||||
getValue: (profile: PublishedProfile) => profile.event.pubkey,
|
getValue: (profile: PublishedProfile) => profile.event.pubkey,
|
||||||
sortFn: ({score, item}) => {
|
sortFn: ({score = 1, item}) => {
|
||||||
if (score && score > 0.1) return -score!
|
|
||||||
|
|
||||||
const wotScore = wotGraph.get().get(item.event.pubkey) || 0
|
const wotScore = wotGraph.get().get(item.event.pubkey) || 0
|
||||||
|
|
||||||
return score ? dec(score) * wotScore : -wotScore
|
return dec(score) * inc(wotScore / maxWot.get())
|
||||||
},
|
},
|
||||||
fuseOptions: {
|
fuseOptions: {
|
||||||
keys: [
|
keys: [
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@welshman/editor",
|
"name": "@welshman/editor",
|
||||||
"version": "0.2.1",
|
"version": "0.2.2",
|
||||||
"author": "hodlbod",
|
"author": "hodlbod",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"description": "A batteries-included nostr editor.",
|
"description": "A batteries-included nostr editor.",
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ export class DefaultSuggestionsWrapper implements ISuggestionsWrapper {
|
|||||||
const {term, search} = this.props
|
const {term, search} = this.props
|
||||||
|
|
||||||
this.items = search(term).slice(0, 5)
|
this.items = search(term).slice(0, 5)
|
||||||
|
this.render()
|
||||||
})
|
})
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|||||||
Reference in New Issue
Block a user