This commit is contained in:
Jon Staab
2024-10-17 16:03:50 -07:00
parent 2f561149fa
commit fd5b0a9af3
33 changed files with 129 additions and 140 deletions
+12 -14
View File
@@ -1,18 +1,13 @@
<script lang="ts">
import {readable, derived} from "svelte/store"
import {hash, sleep, ellipsize, uniqBy, groupBy, now} from "@welshman/lib"
import {readable} from "svelte/store"
import {hash, ellipsize, uniqBy, groupBy} from "@welshman/lib"
import type {TrustedEvent} from "@welshman/util"
import {deriveEvents, throttled} from "@welshman/store"
import {
deriveProfile,
deriveProfileDisplay,
formatTimestampAsTime,
pubkey,
} from "@welshman/app"
import {deriveEvents} from "@welshman/store"
import {deriveProfile, deriveProfileDisplay, formatTimestampAsTime, pubkey} from "@welshman/app"
import type {Thunk} from "@welshman/app"
import {REACTION, ZAP_RESPONSE, displayRelayUrl} from "@welshman/util"
import {REACTION, ZAP_RESPONSE} from "@welshman/util"
import {repository} from "@welshman/app"
import {slideAndFade, conditionalTransition} from '@lib/transition'
import {slideAndFade, conditionalTransition} from "@lib/transition"
import Icon from "@lib/components/Icon.svelte"
import Delay from "@lib/components/Delay.svelte"
import Avatar from "@lib/components/Avatar.svelte"
@@ -42,7 +37,7 @@
const rootId = rootTag?.[1]
const rootHints = [rootTag?.[2]].filter(Boolean) as string[]
const rootEvent = rootId ? deriveEvent(rootId, rootHints) : readable(null)
const [colorName, colorValue] = colors[parseInt(hash(event.pubkey)) % colors.length]
const [_, colorValue] = colors[parseInt(hash(event.pubkey)) % colors.length]
const transition = conditionalTransition(thunk, slideAndFade)
@@ -95,7 +90,10 @@
<div class="flex w-full gap-3">
{#if showPubkey}
<Button on:click={showProfile}>
<Avatar src={$profile?.picture} class="border border-solid border-base-content" size={10} />
<Avatar
src={$profile?.picture}
class="border border-solid border-base-content"
size={10} />
</Button>
{:else}
<div class="w-10 min-w-10 max-w-10" />
@@ -103,7 +101,7 @@
<div class="-mt-1 flex-grow pr-1">
{#if showPubkey}
<div class="flex items-center gap-2">
<Button class="font-bold text-sm" style="color: {colorValue}" on:click={showProfile}>
<Button class="text-sm font-bold" style="color: {colorValue}" on:click={showProfile}>
{$profileDisplay}
</Button>
<span class="text-xs opacity-50">{formatTimestampAsTime(event.created_at)}</span>
+4 -4
View File
@@ -1,11 +1,11 @@
<script lang="ts">
import {pubkey} from '@welshman/app'
import {pubkey} from "@welshman/app"
import Button from "@lib/components/Button.svelte"
import Icon from "@lib/components/Icon.svelte"
import Confirm from "@lib/components/Confirm.svelte"
import EventInfo from "@app/components/EventInfo.svelte"
import {publishDelete} from '@app/commands'
import {pushModal} from '@app/modal'
import {publishDelete} from "@app/commands"
import {pushModal} from "@app/modal"
export let url
export let event
@@ -33,7 +33,7 @@
}
</script>
<ul class="menu rounded-box bg-base-100 p-2 shadow-xl whitespace-nowrap">
<ul class="menu whitespace-nowrap rounded-box bg-base-100 p-2 shadow-xl">
<li>
<Button on:click={showInfo}>
<Icon size={4} icon="code-2" />
@@ -5,8 +5,6 @@
import Button from "@lib/components/Button.svelte"
import Tippy from "@lib/components/Tippy.svelte"
import ChannelMessageMenu from "@app/components/ChannelMessageMenu.svelte"
import {tagRoom} from "@app/state"
import {publishReaction} from "@app/commands"
export let url, room, event
+1 -1
View File
@@ -1,5 +1,5 @@
<script lang="ts">
import {writable} from 'svelte/store'
import {writable} from "svelte/store"
import {assoc, sortBy, append} from "@welshman/lib"
import {createEvent} from "@welshman/util"
import type {EventContent, TrustedEvent} from "@welshman/util"
+5 -12
View File
@@ -1,21 +1,14 @@
<script lang="ts">
import {derived} from "svelte/store"
import {type Instance} from "tippy.js"
import {hash, sleep, uniqBy, groupBy, now} from "@welshman/lib"
import {hash, uniqBy, groupBy} from "@welshman/lib"
import type {TrustedEvent} from "@welshman/util"
import {deriveEvents, throttled} from "@welshman/store"
import {
deriveProfile,
deriveProfileDisplay,
formatTimestampAsTime,
pubkey,
} from "@welshman/app"
import {deriveEvents} from "@welshman/store"
import {deriveProfile, deriveProfileDisplay, formatTimestampAsTime, pubkey} from "@welshman/app"
import type {MergedThunk} from "@welshman/app"
import {REACTION, ZAP_RESPONSE, displayRelayUrl} from "@welshman/util"
import {REACTION, ZAP_RESPONSE} from "@welshman/util"
import {repository} from "@welshman/app"
import Icon from "@lib/components/Icon.svelte"
import Tippy from "@lib/components/Tippy.svelte"
import Delay from "@lib/components/Delay.svelte"
import Avatar from "@lib/components/Avatar.svelte"
import Button from "@lib/components/Button.svelte"
import Content from "@app/components/Content.svelte"
@@ -95,7 +88,7 @@
<div class="-mt-1 flex-grow pr-1">
{#if showPubkey}
<div class="flex items-center gap-2">
<Button class="font-bold text-sm" style="color: {colorValue}" on:click={showProfile}>
<Button class="text-sm font-bold" style="color: {colorValue}" on:click={showProfile}>
{$profileDisplay}
</Button>
<span class="text-xs opacity-50">{formatTimestampAsTime(event.created_at)}</span>
@@ -1,10 +1,8 @@
<script lang="ts">
import {type Instance} from "tippy.js"
import type {NativeEmoji} from "emoji-picker-element/shared"
import {ctx, uniq, between} from "@welshman/lib"
import {Nip59} from "@welshman/signer"
import {between} from "@welshman/lib"
import type {TrustedEvent} from "@welshman/util"
import {signer, publishThunk} from "@welshman/app"
import Icon from "@lib/components/Icon.svelte"
import Button from "@lib/components/Button.svelte"
import Tippy from "@lib/components/Tippy.svelte"
+1 -2
View File
@@ -70,8 +70,7 @@
}
let warning =
$userSettings?.values.hide_sensitive &&
event.tags.find(nthEq(0, "content-warning"))?.[1]
$userSettings?.values.hide_sensitive && event.tags.find(nthEq(0, "content-warning"))?.[1]
$: shortContent = showEntire
? fullContent
+2 -3
View File
@@ -1,10 +1,9 @@
<script lang="ts">
import {ellipsize, postJson} from "@welshman/lib"
import {fade} from '@lib/transition'
import {dufflepud, imgproxy} from "@app/state"
import Link from "@lib/components/Link.svelte"
import ContentLinkDetail from '@app/components/ContentLinkDetail.svelte'
import {pushModal} from '@app/modal'
import ContentLinkDetail from "@app/components/ContentLinkDetail.svelte"
import {pushModal} from "@app/modal"
export let value
+3 -3
View File
@@ -1,5 +1,5 @@
<script lang="ts">
import Button from '@lib/components/Button.svelte'
import Button from "@lib/components/Button.svelte"
import {imgproxy} from "@app/state"
export let url
@@ -7,6 +7,6 @@
const back = () => history.back()
</script>
<Button class="m-auto h-screen w-screen p-4 cursor-pointer" on:click={back}>
<img alt="" src={imgproxy(url)} class="m-auto rounded-box max-w-full max-h-full" />
<Button class="m-auto h-screen w-screen cursor-pointer p-4" on:click={back}>
<img alt="" src={imgproxy(url)} class="m-auto max-h-full max-w-full rounded-box" />
</Button>
+2 -2
View File
@@ -1,5 +1,5 @@
<script lang="ts">
import {nip19} from 'nostr-tools'
import {nip19} from "nostr-tools"
import {getPubkey} from "@welshman/signer"
import {addSession} from "@welshman/app"
import Spinner from "@lib/components/Spinner.svelte"
@@ -18,7 +18,7 @@
const onSubmit = async () => {
let secret = key
if (secret.startsWith('nsec')) {
if (secret.startsWith("nsec")) {
secret = nip19.decode(secret).data as string
}
+2 -2
View File
@@ -24,10 +24,10 @@
<div class="flex flex-col gap-2 {$$props.class}">
{#if muted}
<div class="flex justify-between items-center">
<div class="flex items-center justify-between">
<div class="row-2 relative">
<Icon icon="danger" class="mt-1" />
<p>You have muted this person.<p>
<p>You have muted this person.</p>
</div>
<Button class="link ml-8" on:click={ignoreMute}>Show anyway</Button>
</div>
+1 -1
View File
@@ -33,7 +33,7 @@
<Icon icon="magnifer" />
<input bind:value={term} class="grow" type="text" placeholder="Search for relays..." />
</label>
<div class="column -m-6 mt-0 p-6 pt-2 h-[50vh] gap-2 overflow-auto" bind:this={element}>
<div class="column -m-6 mt-0 h-[50vh] gap-2 overflow-auto p-6 pt-2" bind:this={element}>
{#each $relaySearch
.searchValues(term)
.filter(url => !$relays.includes(url))
+3 -5
View File
@@ -1,17 +1,15 @@
<script lang="ts">
import {nip19} from 'nostr-tools'
import {goto} from '$app/navigation'
import {hexToBytes} from '@noble/hashes/utils'
import {nip19} from "nostr-tools"
import {goto} from "$app/navigation"
import {hexToBytes} from "@noble/hashes/utils"
import {getPubkey, makeSecret} from "@welshman/signer"
import {addSession} from "@welshman/app"
import Spinner from "@lib/components/Spinner.svelte"
import Button from "@lib/components/Button.svelte"
import Field from "@lib/components/Field.svelte"
import Icon from "@lib/components/Icon.svelte"
import ModalHeader from "@lib/components/ModalHeader.svelte"
import ModalFooter from "@lib/components/ModalFooter.svelte"
import InfoKeys from "@app/components/InfoKeys.svelte"
import {loadUserData} from "@app/commands"
import {pushModal, clearModals} from "@app/modal"
import {clip} from "@app/toast"
+7 -12
View File
@@ -1,19 +1,16 @@
<script lang="ts">
import {onMount} from 'svelte'
import {goto} from "$app/navigation"
import {onMount} from "svelte"
import {sleep, identity, nthEq} from "@welshman/lib"
import {load} from "@welshman/app"
import {displayRelayUrl, AUTH_INVITE} from "@welshman/util"
import type {TrustedEvent} from "@welshman/util"
import {slide} from '@lib/transition'
import {slide} from "@lib/transition"
import Spinner from "@lib/components/Spinner.svelte"
import Field from "@lib/components/Field.svelte"
import Button from "@lib/components/Button.svelte"
import Icon from "@lib/components/Icon.svelte"
import ModalHeader from "@lib/components/ModalHeader.svelte"
import ModalFooter from "@lib/components/ModalFooter.svelte"
import {pushModal} from '@app/modal'
import {clip} from '@app/toast'
import {clip} from "@app/toast"
export let url
@@ -32,16 +29,14 @@
sleep(2000),
])
claim = event?.tags.find(nthEq(0, 'claim'))?.[1] || ""
claim = event?.tags.find(nthEq(0, "claim"))?.[1] || ""
loading = false
})
</script>
<div class="col-4">
<ModalHeader>
<div slot="title">
Create an Invite
</div>
<div slot="title">Create an Invite</div>
<div slot="info">
Get a link that you can use to invite people to
<span class="text-primary">{displayRelayUrl(url)}</span>
@@ -65,8 +60,8 @@
<p slot="info">
This invite link can be used by clicking "Add Space" and pasting it there.
{#if !claim}
This space did not issue a claim for this link, so additional steps might be
required for people using this invite link.
This space did not issue a claim for this link, so additional steps might be required
for people using this invite link.
{/if}
</p>
</Field>
+6 -7
View File
@@ -1,17 +1,16 @@
<script lang="ts">
import {displayRelayUrl} from "@welshman/util"
import {PublishStatus} from "@welshman/net"
import {mergeThunks, publishThunk} from "@welshman/app"
import type {Thunk, MergedThunk} from "@welshman/app"
import {throttled} from "@welshman/store"
import Icon from '@lib/components/Icon.svelte'
import Icon from "@lib/components/Icon.svelte"
import Tippy from "@lib/components/Tippy.svelte"
import Button from '@lib/components/Button.svelte'
import ThunkStatusDetail from '@app/components/ThunkStatusDetail.svelte'
import Button from "@lib/components/Button.svelte"
import ThunkStatusDetail from "@app/components/ThunkStatusDetail.svelte"
export let thunk: Thunk | MergedThunk
const {Pending, Success, Failure, Timeout} = PublishStatus
const {Pending, Failure, Timeout} = PublishStatus
const abort = () => thunk.controller.abort()
@@ -30,7 +29,7 @@
</script>
{#if canCancel || isPending}
<span class="flex gap-1 mt-2 items-center">
<span class="mt-2 flex items-center gap-1">
<span class="loading loading-spinner mx-1 h-3 w-3 translate-y-px" />
<span class="opacity-50">Sending...</span>
{#if canCancel}
@@ -43,7 +42,7 @@
component={ThunkStatusDetail}
props={{url, message, status, retry}}
params={{interactive: true}}>
<span class="flex tooltip cursor-pointer gap-1 mt-2 items-center">
<span class="tooltip mt-2 flex cursor-pointer items-center gap-1">
<Icon icon="danger" size={3} />
<span class="opacity-50">Failed to send!</span>
</span>
+3 -3
View File
@@ -1,7 +1,7 @@
<script lang="ts">
import {PublishStatus} from '@welshman/net'
import {displayRelayUrl} from '@welshman/util'
import Button from '@lib/components/Button.svelte'
import {PublishStatus} from "@welshman/net"
import {displayRelayUrl} from "@welshman/util"
import Button from "@lib/components/Button.svelte"
export let url: string
export let status: string