Fix more stuff, particularly event handlers

This commit is contained in:
Jon Staab
2025-02-03 17:21:46 -08:00
parent 8d3433b167
commit 24045a7e2a
150 changed files with 424 additions and 392 deletions
+2 -2
View File
@@ -79,9 +79,9 @@
dropSession($session.pubkey)
}
let {children} = $props()
const {children} = $props()
let ready = $state(defer<void>())
const ready = $state(defer<void>())
onMount(async () => {
Object.assign(window, {
+3 -3
View File
@@ -19,7 +19,7 @@
children?: import("svelte").Snippet
}
let {children}: Props = $props()
const {children}: Props = $props()
const startChat = () => pushModal(ChatStart)
@@ -30,14 +30,14 @@
let term = $state("")
let chats = $derived($chatSearch.searchOptions(term))
const chats = $derived($chatSearch.searchOptions(term))
</script>
<SecondaryNav>
<SecondaryNavSection>
<SecondaryNavHeader>
Chats
<Button on:click={startChat}>
<Button onclick={startChat}>
<Icon icon="add-circle" />
</Button>
</SecondaryNavHeader>
+4 -4
View File
@@ -17,7 +17,7 @@
const openMenu = () => pushModal(ChatMenuMobile)
let chats = $derived($chatSearch.searchOptions(term))
const chats = $derived($chatSearch.searchOptions(term))
onDestroy(() => {
setChecked($page.url.pathname)
@@ -31,7 +31,7 @@
No conversation selected.
</p>
<p>
Click on a conversation in the sidebar, or <Button class="link" on:click={startChat}
Click on a conversation in the sidebar, or <Button class="link" onclick={startChat}
>start a new one</Button
>.
</p>
@@ -49,7 +49,7 @@
type="text"
placeholder="Search for conversations..." />
</label>
<Button class="btn btn-primary" on:click={openMenu}>
<Button class="btn btn-primary" onclick={openMenu}>
<Icon icon="menu-dots" />
</Button>
</div>
@@ -61,7 +61,7 @@
{:else}
<div class="py-20 max-w-sm col-4 items-center m-auto text-center">
<p>No chats found! Try starting one up.</p>
<Button class="btn btn-primary" on:click={startChat}>
<Button class="btn btn-primary" onclick={startChat}>
<Icon icon="add-circle" />
Start a Chat
</Button>
+1 -1
View File
@@ -89,7 +89,7 @@
{#each relaySearch.searchOptions(term).slice(0, limit) as relay (relay.url)}
<Button
class="card2 bg-alt col-4 text-left shadow-xl transition-all hover:shadow-2xl hover:brightness-[1.1]"
on:click={() => openSpace(relay.url)}>
onclick={() => openSpace(relay.url)}>
<div class="col-2">
<div class="relative flex gap-4">
<div class="relative">
+2 -2
View File
@@ -29,7 +29,7 @@
<h1 class="text-center text-5xl">Welcome to</h1>
<h1 class="mb-4 text-center text-5xl font-bold uppercase">{PLATFORM_NAME}</h1>
<div class="col-3">
<Button on:click={addSpace}>
<Button onclick={addSpace}>
<CardButton>
{#snippet icon()}
<div><Icon icon="add-circle" size={7} /></div>
@@ -55,7 +55,7 @@
{/snippet}
</CardButton>
</Link>
<Button on:click={startChat}>
<Button onclick={startChat}>
<CardButton>
{#snippet icon()}
<div><Icon icon="chat-round" size={7} /></div>
+1 -1
View File
@@ -14,7 +14,7 @@
let limit = $state(10)
let element: Element | undefined = $state()
let pubkeys = $derived(term ? $profileSearch.searchValues(term) : defaultPubkeys)
const pubkeys = $derived(term ? $profileSearch.searchValues(term) : defaultPubkeys)
onMount(() => {
const scroller = createScroller({
+2 -2
View File
@@ -11,7 +11,7 @@
children?: import("svelte").Snippet
}
let {children}: Props = $props()
const {children}: Props = $props()
const logout = () => pushModal(LogOut)
</script>
@@ -39,7 +39,7 @@
</SecondaryNavItem>
</div>
<div in:fly|local={{delay: 200}}>
<SecondaryNavItem class="text-error hover:text-error" on:click={logout}>
<SecondaryNavItem class="text-error hover:text-error" onclick={logout}>
<Icon icon="exit" /> Log Out
</SecondaryNavItem>
</div>
+1 -1
View File
@@ -123,7 +123,7 @@
{/snippet}
</Field>
<div class="mt-4 flex flex-row items-center justify-between gap-4">
<Button class="btn btn-neutral" on:click={reset}>Discard Changes</Button>
<Button class="btn btn-neutral" onclick={reset}>Discard Changes</Button>
<Button type="submit" class="btn btn-primary">Save Changes</Button>
</div>
</div>
+1 -1
View File
@@ -41,7 +41,7 @@
<p class="text-sm">
Built with 💜 by
<span class="text-primary">
@<Button on:click={openProfile} class="link">hodlbod</Button>
@<Button onclick={openProfile} class="link">hodlbod</Button>
</span>
</p>
<p class="text-xs">
+4 -4
View File
@@ -45,7 +45,7 @@
</div>
</div>
</div>
<Button class="center btn btn-circle btn-neutral -mr-4 -mt-4 h-12 w-12" on:click={startEdit}>
<Button class="center btn btn-circle btn-neutral -mr-4 -mt-4 h-12 w-12" onclick={startEdit}>
<Icon icon="pen-new-square" />
</Button>
</div>
@@ -68,7 +68,7 @@
{#snippet info()}
<p>
Your email and password can only be used to log into {PLATFORM_NAME}.
<Button class="link" on:click={startEject}>Start holding your own keys</Button>
<Button class="link" onclick={startEject}>Start holding your own keys</Button>
</p>
{/snippet}
</FieldInline>
@@ -85,7 +85,7 @@
<Icon icon="link-round" />
<input readonly class="ellipsize flex-grow" value={$session?.pubkey} />
</div>
<Button class="flex items-center" on:click={copyNpub}>
<Button class="flex items-center" onclick={copyNpub}>
<Icon icon="copy" />
</Button>
</label>
@@ -106,7 +106,7 @@
<label class="input input-bordered flex w-full items-center gap-2">
<Icon icon="link-round" />
<input readonly value={$session.secret} class="grow" type="password" />
<Button class="flex items-center" on:click={copyNsec}>
<Button class="flex items-center" onclick={copyNsec}>
<Icon icon="copy" />
</Button>
</label>
+6 -6
View File
@@ -72,14 +72,14 @@
<Button
class="tooltip flex items-center"
data-tip="Stop using this relay"
on:click={() => removeWriteRelay(url)}>
onclick={() => removeWriteRelay(url)}>
<Icon icon="close-circle" />
</Button>
</RelayItem>
{:else}
<p class="text-center text-sm">No relays found</p>
{/each}
<Button class="btn btn-primary mt-2" on:click={addWriteRelay}>
<Button class="btn btn-primary mt-2" onclick={addWriteRelay}>
<Icon icon="add-circle" />
Add Relay
</Button>
@@ -104,14 +104,14 @@
<Button
class="tooltip flex items-center"
data-tip="Stop using this relay"
on:click={() => removeReadRelay(url)}>
onclick={() => removeReadRelay(url)}>
<Icon icon="close-circle" />
</Button>
</RelayItem>
{:else}
<p class="text-center text-sm">No relays found</p>
{/each}
<Button class="btn btn-primary mt-2" on:click={addReadRelay}>
<Button class="btn btn-primary mt-2" onclick={addReadRelay}>
<Icon icon="add-circle" />
Add Relay
</Button>
@@ -137,14 +137,14 @@
<Button
class="tooltip flex items-center"
data-tip="Stop using this relay"
on:click={() => removeInboxRelay(url)}>
onclick={() => removeInboxRelay(url)}>
<Icon icon="close-circle" />
</Button>
</RelayItem>
{:else}
<p class="text-center text-sm">No relays found</p>
{/each}
<Button class="btn btn-primary mt-2" on:click={addInboxRelay}>
<Button class="btn btn-primary mt-2" onclick={addInboxRelay}>
<Icon icon="add-circle" />
Add Relay
</Button>
+1 -1
View File
@@ -4,7 +4,7 @@
children?: import("svelte").Snippet
}
let {children}: Props = $props()
const {children}: Props = $props()
</script>
{#key $page.params.relay}
+1 -1
View File
@@ -21,7 +21,7 @@
children?: import("svelte").Snippet
}
let {children}: Props = $props()
const {children}: Props = $props()
const url = decodeRelay($page.params.relay)
+3 -3
View File
@@ -41,7 +41,7 @@
let relayAdminEvents: TrustedEvent[] = $state([])
let pubkey = $derived($relay?.profile?.pubkey)
const pubkey = $derived($relay?.profile?.pubkey)
</script>
<div class="relative flex flex-col">
@@ -57,7 +57,7 @@
{#snippet action()}
<div class="row-2">
{#if !$userRoomsByUrl.has(url)}
<Button class="btn btn-primary btn-sm" on:click={joinSpace}>
<Button class="btn btn-primary btn-sm" onclick={joinSpace}>
<Icon icon="login-2" />
Join Space
</Button>
@@ -166,7 +166,7 @@
</div>
</Link>
{/each}
<Button on:click={addRoom} class="btn btn-neutral whitespace-nowrap">
<Button onclick={addRoom} class="btn btn-neutral whitespace-nowrap">
<Icon icon="add-circle" />
Create
</Button>
@@ -208,12 +208,12 @@
<div class="row-2">
{#if room !== GENERAL}
{#if $userRoomsByUrl.get(url)?.has(room)}
<Button class="btn btn-neutral btn-sm" on:click={leaveRoom}>
<Button class="btn btn-neutral btn-sm" onclick={leaveRoom}>
<Icon icon="arrows-a-logout-2" />
Leave Room
</Button>
{:else}
<Button class="btn btn-neutral btn-sm" on:click={joinRoom}>
<Button class="btn btn-neutral btn-sm" onclick={joinRoom}>
<Icon icon="login-2" />
Join Room
</Button>
@@ -256,7 +256,7 @@
{#if showFixedNewMessages}
<div class="relative z-feature flex justify-center">
<div transition:fly={{duration: 200}} class="fixed top-12">
<Button class="btn btn-primary btn-xs rounded-full" on:click={scrollToNewMessages}>
<Button class="btn btn-primary btn-xs rounded-full" onclick={scrollToNewMessages}>
New Messages
</Button>
</div>
@@ -272,7 +272,7 @@
{#if showScrollButton}
<div in:fade class="fixed bottom-14 right-4">
<Button class="btn btn-circle btn-neutral" on:click={scrollToBottom}>
<Button class="btn btn-circle btn-neutral" onclick={scrollToBottom}>
<Icon icon="alt-arrow-down" />
</Button>
</div>
@@ -37,7 +37,7 @@
dateDisplay?: string
}
let items = $derived(
const items = $derived(
sortBy(e => -getStart(e), $events)
.reduce<Item[]>((r, event) => {
const end = getEnd(event)
@@ -108,7 +108,7 @@
<Button
class="tooltip tooltip-left fixed bottom-16 right-2 z-feature p-1 md:bottom-4 md:right-4"
data-tip="Create an Event"
on:click={createEvent}>
onclick={createEvent}>
<div class="btn btn-circle btn-primary flex h-12 w-12 items-center justify-center">
<Icon icon="calendar-add" />
</div>
@@ -2,7 +2,7 @@
import {onMount} from "svelte"
import {derived} from "svelte/store"
import {page} from "$app/stores"
import {sortBy, min, nthEq, sleep} from "@welshman/lib"
import {sortBy, min, nthEq} from "@welshman/lib"
import {THREAD, COMMENT, getListTags, getPubkeyTagValues} from "@welshman/util"
import {throttled} from "@welshman/store"
import {feedFromFilters, makeIntersectionFeed, makeRelayFeed} from "@welshman/feeds"
@@ -96,7 +96,7 @@
{/snippet}
{#snippet action()}
<div class="row-2">
<Button class="btn btn-primary btn-sm" on:click={createThread}>
<Button class="btn btn-primary btn-sm" onclick={createThread}>
<Icon icon="notes-minimalistic" />
Create a Thread
</Button>
@@ -1,8 +1,8 @@
<script lang="ts">
import {onMount} from "svelte"
import {page} from "$app/stores"
import {sortBy, nthEq, sleep} from "@welshman/lib"
import {COMMENT} from "@welshman/util"
import {sortBy, sleep} from "@welshman/lib"
import {COMMENT, getTagValue} from "@welshman/util"
import {repository, subscribe} from "@welshman/app"
import {deriveEvents} from "@welshman/store"
import Icon from "@lib/components/Icon.svelte"
@@ -40,8 +40,6 @@
let showAll = $state(false)
let showReply = $state(false)
let title = $derived($event?.tags.find(nthEq(0, "title"))?.[1] || "")
onMount(() => {
const sub = subscribe({relays: [url], filters})
@@ -57,7 +55,7 @@
{#if $event}
{#if !showReply}
<div class="flex justify-end px-2 pb-2">
<Button class="btn btn-primary" on:click={openReply}>
<Button class="btn btn-primary" onclick={openReply}>
<Icon icon="reply" />
Reply to thread
</Button>
@@ -73,7 +71,7 @@
{/each}
{#if !showAll && $replies.length > 4}
<div class="flex justify-center">
<Button class="btn btn-link" on:click={expand}>
<Button class="btn btn-link" onclick={expand}>
<Icon icon="sort-vertical" />
Show all {$replies.length} replies
</Button>
@@ -95,14 +93,14 @@
<PageBar class="mx-0">
{#snippet icon()}
<div>
<Button class="btn btn-neutral btn-sm" on:click={back}>
<Button class="btn btn-neutral btn-sm" onclick={back}>
<Icon icon="alt-arrow-left" />
Go back
</Button>
</div>
{/snippet}
{#snippet title()}
<h1 class="text-xl">{title}</h1>
<h1 class="text-xl">{getTagValue("title", $event?.tags || []) || ""}</h1>
{/snippet}
{#snippet action()}
<div>