Skip to content

Commit 122909a

Browse files
author
Jon Staab
committed
Optimize handlers, update welshman
1 parent 4ba1261 commit 122909a

File tree

12 files changed

+188
-164
lines changed

12 files changed

+188
-164
lines changed

package.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,16 @@
4343
"@tsconfig/svelte": "^5.0.4",
4444
"@types/throttle-debounce": "^5.0.2",
4545
"@vite-pwa/assets-generator": "^0.2.6",
46-
"@welshman/app": "^0.6.1",
47-
"@welshman/content": "^0.6.1",
48-
"@welshman/editor": "^0.6.1",
49-
"@welshman/feeds": "^0.6.1",
50-
"@welshman/lib": "^0.6.1",
51-
"@welshman/net": "^0.6.1",
52-
"@welshman/router": "^0.6.1",
53-
"@welshman/signer": "^0.6.1",
54-
"@welshman/store": "^0.6.1",
55-
"@welshman/util": "^0.6.1",
46+
"@welshman/app": "^0.6.3",
47+
"@welshman/content": "^0.6.3",
48+
"@welshman/editor": "^0.6.3",
49+
"@welshman/feeds": "^0.6.3",
50+
"@welshman/lib": "^0.6.3",
51+
"@welshman/net": "^0.6.3",
52+
"@welshman/router": "^0.6.3",
53+
"@welshman/signer": "^0.6.3",
54+
"@welshman/store": "^0.6.3",
55+
"@welshman/util": "^0.6.3",
5656
"autoprefixer": "^10.4.21",
5757
"bowser": "^2.11.0",
5858
"classnames": "^2.5.1",

pnpm-lock.yaml

Lines changed: 76 additions & 76 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app/shared/HandlerSummary.svelte

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
import FlexColumn from "src/partials/FlexColumn.svelte"
55
import ImageCircle from "src/partials/ImageCircle.svelte"
66
import PeopleAction from "src/app/shared/PeopleAction.svelte"
7-
import {recommendationsByHandlerAddress} from "src/engine"
7+
import {deriveRecommendations} from "src/engine"
88
import {pluralize} from "src/util/misc"
99
1010
export let handler
1111
1212
const address = getAddress(handler.event)
13-
const recommendations = $recommendationsByHandlerAddress.get(address) || []
14-
const pubkeys = uniq(pluck("pubkey", recommendations))
13+
const recommendations = deriveRecommendations(address)
14+
const pubkeys = uniq(pluck("pubkey", $recommendations))
1515
const actionText = `${pluralize(pubkeys.length, "recommends", "recommend")} this app`
1616
</script>
1717

@@ -23,7 +23,7 @@
2323
<p class="text-tinted-200">{handler.about}</p>
2424
{/if}
2525
<slot />
26-
{#if recommendations.length > 0}
26+
{#if $recommendations.length > 0}
2727
<div class="text-tinted-200">
2828
<PeopleAction {pubkeys} {actionText} />
2929
</div>

src/app/shared/NoteInfo.svelte

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22
import * as nip19 from "nostr-tools/nip19"
33
import {tweened} from "svelte/motion"
44
import {derived} from "svelte/store"
5-
import {sum, pluck, spec, nthEq, remove, uniqBy, prop} from "@welshman/lib"
5+
import {sum, pluck, spec, remove, uniqBy, prop} from "@welshman/lib"
66
import {Router} from "@welshman/router"
77
import type {TrustedEvent, Handler} from "@welshman/util"
88
import {LOCAL_RELAY_URL} from "@welshman/net"
99
import {
1010
isReplaceable,
1111
Address,
1212
toNostrURI,
13+
getTag,
1314
getPubkeyTagValues,
1415
ZAP_RESPONSE,
1516
REACTION,
1617
} from "@welshman/util"
17-
import {repository} from "@welshman/app"
1818
import {fly} from "src/util/transition"
1919
import {copyToClipboard} from "src/util/html"
2020
import {replyKinds} from "src/util/nostr"
@@ -28,7 +28,7 @@
2828
import HandlerCard from "src/app/shared/HandlerCard.svelte"
2929
import RelayCard from "src/app/shared/RelayCard.svelte"
3030
import {deriveValidZaps} from "src/app/util"
31-
import {trackerStore, sortEventsDesc} from "src/engine"
31+
import {trackerStore, sortEventsDesc, deriveHandlerEvent} from "src/engine"
3232
import {getHandlerKey, readHandlers, displayHandler} from "src/domain"
3333
3434
export let event: TrustedEvent
@@ -43,8 +43,7 @@
4343
const likesCount = tweened(0, {interpolate})
4444
const zapsTotal = tweened(0, {interpolate})
4545
const repliesCount = tweened(0, {interpolate})
46-
const handlerId = String(event.tags.find(nthEq(0, "client"))?.[2] || "")
47-
const handlerEvent = handlerId ? repository.getEvent(handlerId) : null
46+
const handlerEvent = deriveHandlerEvent(getTag("client", event.tags)?.[2] || "")
4847
const seenOn = derived(trackerStore, $t =>
4948
remove(LOCAL_RELAY_URL, Array.from($t.getRelays(event.id))),
5049
)
@@ -111,10 +110,10 @@
111110
{/each}
112111
</div>
113112
{/if}
114-
{#if handlers.length > 0 || handlerEvent}
113+
{#if handlers.length > 0 || $handlerEvent}
115114
<h1 class="staatliches text-2xl">Apps</h1>
116-
{#if handlerEvent}
117-
{@const [handler] = readHandlers(handlerEvent)}
115+
{#if $handlerEvent}
116+
{@const [handler] = readHandlers($handlerEvent)}
118117
{#if handler}
119118
<p>This note was published using {displayHandler(handler)}.</p>
120119
<HandlerCard {handler} />

src/app/shared/RelayActions.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@
5858
})
5959
}
6060
61-
if ($relay?.profile?.contact) {
61+
if ($relay?.contact) {
6262
actions.push({
63-
onClick: () => window.open(ensureMailto($relay.profile.contact)),
63+
onClick: () => window.open(ensureMailto($relay.contact)),
6464
label: "Contact",
6565
icon: "envelope",
6666
})

0 commit comments

Comments
 (0)