Fix some bugs

This commit is contained in:
Jon Staab 2024-02-06 04:54:37 -08:00
parent 8bbe09b4b1
commit d7b45b1d99
5 changed files with 16 additions and 8 deletions

View File

@ -245,8 +245,12 @@
}, },
}) })
router.register("/notifications", Notifications) router.register("/notifications", Notifications, {
router.register("/notifications/:activeTab", Notifications) requireUser: true,
})
router.register("/notifications/:activeTab", Notifications, {
requireUser: true,
})
router.register("/onboarding", Onboarding) router.register("/onboarding", Onboarding)

View File

@ -1,9 +1,9 @@
<script lang="ts"> <script lang="ts">
import Fuse from "fuse.js"
import {tryFunc} from "hurdak" import {tryFunc} from "hurdak"
import {fromNostrURI} from "paravel" import {fromNostrURI} from "paravel"
import {throttle} from "throttle-debounce" import {throttle} from "throttle-debounce"
import {nip05, nip19} from "nostr-tools" import {nip05, nip19} from "nostr-tools"
import {fuzzy} from "src/util/misc"
import {isHex} from "src/util/nostr" import {isHex} from "src/util/nostr"
import {router} from "src/app/router" import {router} from "src/app/router"
import type {Person, Topic} from "src/engine" import type {Person, Topic} from "src/engine"
@ -59,7 +59,7 @@
const searchTopics = topics const searchTopics = topics
.throttle(1000) .throttle(1000)
.derived($topics => new Fuse($topics, {keys: ["name"], threshold: 0.5, shouldSort: true})) .derived($topics => fuzzy($topics, {keys: ["name"], threshold: 0.5, shouldSort: true}))
const results = derived<{type: string; id: string; person?: Person; topic?: Topic}[]>( const results = derived<{type: string; id: string; person?: Person; topic?: Topic}[]>(
[term, searchTopics, searchPeople], [term, searchTopics, searchPeople],
@ -76,7 +76,11 @@
}, },
) )
$: loadPeople($term) $: {
if ($term) {
loadPeople($term)
}
}
primeWotCaches($pubkey) primeWotCaches($pubkey)
</script> </script>

View File

@ -15,7 +15,7 @@ export const getGroupNaddr = (group: Group) =>
export const getGroupId = (group: Group) => group.address.split(":").slice(2).join(":") export const getGroupId = (group: Group) => group.address.split(":").slice(2).join(":")
export const getGroupName = (group: Group) => group.meta?.name || group.id export const getGroupName = (group: Group) => group.meta?.name || group.id || ""
export const displayGroup = (group: Group) => ellipsize(group ? getGroupName(group) : "No name", 60) export const displayGroup = (group: Group) => ellipsize(group ? getGroupName(group) : "No name", 60)

View File

@ -5,7 +5,7 @@ import {topics} from "./state"
export const addTopic = (e, name) => { export const addTopic = (e, name) => {
if (name) { if (name) {
const topic = topics.key(name) const topic = topics.key(name.toLowerCase())
topic.merge({ topic.merge({
count: inc(topic.get()?.count || 0), count: inc(topic.get()?.count || 0),

View File

@ -384,7 +384,7 @@ export class Router {
$history.splice(0, 1) $history.splice(0, 1)
} }
globalHistory.navigate($history[0].path) globalHistory.navigate($history[0]?.path || "/")
return $history return $history
}) })