diff --git a/src/app.css b/src/app.css index 31127951..62be0b25 100644 --- a/src/app.css +++ b/src/app.css @@ -43,11 +43,11 @@ } .card2 { - @apply p-6 bg-base-100 text-base-content rounded-box; + @apply rounded-box bg-base-100 p-6 text-base-content; } .card2.card2-sm { - @apply p-4 bg-base-100 text-base-content rounded-box; + @apply rounded-box bg-base-100 p-4 text-base-content; } .card2.card2-alt { @@ -93,11 +93,11 @@ /* tiptap */ .tiptap { - @apply rounded-box bg-base-300 px-4 p-2 max-h-[350px] overflow-y-auto; + @apply max-h-[350px] overflow-y-auto rounded-box bg-base-300 p-2 px-4; } .tiptap pre code { - @apply link-content w-full block; + @apply link-content block w-full; } .tiptap p code { @@ -105,7 +105,7 @@ } .link-content { - @apply text-sm rounded px-1 bg-neutral text-neutral-content no-underline; + @apply rounded bg-neutral px-1 text-sm text-neutral-content no-underline; } .link-content.link-content-selected { diff --git a/src/app/commands.ts b/src/app/commands.ts index 25961820..4ba551f4 100644 --- a/src/app/commands.ts +++ b/src/app/commands.ts @@ -2,21 +2,15 @@ import {uniqBy, uniq, now, choice} from "@welshman/lib" import { GROUPS, GROUP_JOIN, - asDecryptedEvent, getGroupTags, getRelayTagValues, - readList, - editList, - makeList, - createList, createEvent, displayProfile, } from "@welshman/util" import {PublishStatus} from "@welshman/net" -import {pk, signer, repository, INDEXER_RELAYS} from "@app/base" +import {pk, repository, INDEXER_RELAYS} from "@app/base" import { loadOne, - subscribe, getWriteRelayUrls, loadGroup, loadGroupMembership, @@ -27,7 +21,6 @@ import { loadRelaySelections, makeThunk, publishThunk, - ensurePlaintext, getProfilesByPubkey, } from "@app/state" @@ -48,11 +41,18 @@ export const getPubkeyPetname = (pubkey: string) => { return display } -export const makeMention = (pubkey: string, hints?: string[]) => - ["p", pubkey, choice(hints || getPubkeyHints(pubkey)), getPubkeyPetname(pubkey)] +export const makeMention = (pubkey: string, hints?: string[]) => [ + "p", + pubkey, + choice(hints || getPubkeyHints(pubkey)), + getPubkeyPetname(pubkey), +] -export const makeIMeta = (url: string, data: Record) => - ["imeta", `url ${url}`, ...Object.entries(data).map(([k, v]) => [k, v].join(' '))] +export const makeIMeta = (url: string, data: Record) => [ + "imeta", + `url ${url}`, + ...Object.entries(data).map(([k, v]) => [k, v].join(" ")), +] // Loaders @@ -83,7 +83,6 @@ export type ModifyTags = (tags: string[][]) => string[][] export const updateList = async (kind: number, modifyTags: ModifyTags) => { const $pk = pk.get()! - const $signer = signer.get()! const [prev] = repository.query([{kinds: [kind], authors: [$pk]}]) const relays = getWriteRelayUrls(getRelaySelectionsByPubkey().get($pk)) @@ -103,15 +102,18 @@ export const removeGroupMemberships = (noms: string[]) => export const sendJoinRequest = async (nom: string, url: string): Promise<[boolean, string]> => { const relays = [url] - const filters = [{kinds: [9000], '#h': [nom], '#p': [pk.get()!], since: now() - 30}] + const filters = [{kinds: [9000], "#h": [nom], "#p": [pk.get()!], since: now() - 30}] const event = createEvent(GROUP_JOIN, {tags: [["h", nom]]}) const statusData = await publishThunk(makeThunk({event, relays})) const {status, message} = statusData[url] - if (message.includes('already a member')) return [true, ""] + if (message.includes("already a member")) return [true, ""] if (status !== PublishStatus.Success) return [false, message] if (await loadOne({filters, relays})) return [true, ""] - return [false, "Your request was not automatically approved, but may be approved manually later. Please try again later or contact the group admin."] + return [ + false, + "Your request was not automatically approved, but may be approved manually later. Please try again later or contact the group admin.", + ] } diff --git a/src/app/components/GroupCompose.svelte b/src/app/components/GroupCompose.svelte index aa946958..34339769 100644 --- a/src/app/components/GroupCompose.svelte +++ b/src/app/components/GroupCompose.svelte @@ -1,45 +1,57 @@ -
- diff --git a/src/app/components/GroupComposeEvent.svelte b/src/app/components/GroupComposeEvent.svelte index 71385af0..6b21c760 100644 --- a/src/app/components/GroupComposeEvent.svelte +++ b/src/app/components/GroupComposeEvent.svelte @@ -1,15 +1,17 @@ - + {node.attrs.file.name} diff --git a/src/app/components/GroupComposeLink.svelte b/src/app/components/GroupComposeLink.svelte index 48409079..e25b6c86 100644 --- a/src/app/components/GroupComposeLink.svelte +++ b/src/app/components/GroupComposeLink.svelte @@ -1,19 +1,21 @@ - + {displayUrl(node.attrs.url)} - diff --git a/src/app/components/GroupComposeMention.svelte b/src/app/components/GroupComposeMention.svelte index 7a9bb4d1..93638fa6 100644 --- a/src/app/components/GroupComposeMention.svelte +++ b/src/app/components/GroupComposeMention.svelte @@ -1,19 +1,22 @@ - + @{displayProfile($profile)} diff --git a/src/app/components/GroupComposeProfileSuggestion.svelte b/src/app/components/GroupComposeProfileSuggestion.svelte index c60e3f83..4fa29c9d 100644 --- a/src/app/components/GroupComposeProfileSuggestion.svelte +++ b/src/app/components/GroupComposeProfileSuggestion.svelte @@ -1,5 +1,5 @@ - + #{node.attrs.name} diff --git a/src/app/components/GroupComposeVideo.svelte b/src/app/components/GroupComposeVideo.svelte index 4a0487b7..eef6bbe3 100644 --- a/src/app/components/GroupComposeVideo.svelte +++ b/src/app/components/GroupComposeVideo.svelte @@ -1,13 +1,12 @@ - + {node.attrs.file.name} diff --git a/src/app/components/GroupNote.svelte b/src/app/components/GroupNote.svelte index f4564d9a..6c9c8f0b 100644 --- a/src/app/components/GroupNote.svelte +++ b/src/app/components/GroupNote.svelte @@ -5,13 +5,19 @@ import type {TrustedEvent} from "@welshman/util" import {deriveEvents} from "@welshman/store" import {PublishStatus} from "@welshman/net" - import {GROUP_REPLY, REACTION, ZAP_RESPONSE, displayRelayUrl, getAncestorTags, displayPubkey} from "@welshman/util" - import {fly, fade} from "@lib/transition" - import {formatTimestampAsTime} from '@lib/util' + import { + GROUP_REPLY, + REACTION, + ZAP_RESPONSE, + displayRelayUrl, + getAncestorTags, + } from "@welshman/util" + import {fly} from "@lib/transition" + import {formatTimestampAsTime} from "@lib/util" import Icon from "@lib/components/Icon.svelte" import Button from "@lib/components/Button.svelte" import Avatar from "@lib/components/Avatar.svelte" - import {repository} from '@app/base' + import {repository} from "@app/base" import type {PublishStatusData} from "@app/state" import {deriveProfile, deriveProfileDisplay, deriveEvent, publishStatusData} from "@app/state" @@ -19,31 +25,31 @@ export let showPubkey: boolean const colors = [ - ['amber', twColors.amber[600]], - ['blue', twColors.blue[600]], - ['cyan', twColors.cyan[600]], - ['emerald', twColors.emerald[600]], - ['fuchsia', twColors.fuchsia[600]], - ['green', twColors.green[600]], - ['indigo', twColors.indigo[600]], - ['sky', twColors.sky[600]], - ['lime', twColors.lime[600]], - ['orange', twColors.orange[600]], - ['pink', twColors.pink[600]], - ['purple', twColors.purple[600]], - ['red', twColors.red[600]], - ['rose', twColors.rose[600]], - ['sky', twColors.sky[600]], - ['teal', twColors.teal[600]], - ['violet', twColors.violet[600]], - ['yellow', twColors.yellow[600]], - ['zinc', twColors.zinc[600]], + ["amber", twColors.amber[600]], + ["blue", twColors.blue[600]], + ["cyan", twColors.cyan[600]], + ["emerald", twColors.emerald[600]], + ["fuchsia", twColors.fuchsia[600]], + ["green", twColors.green[600]], + ["indigo", twColors.indigo[600]], + ["sky", twColors.sky[600]], + ["lime", twColors.lime[600]], + ["orange", twColors.orange[600]], + ["pink", twColors.pink[600]], + ["purple", twColors.purple[600]], + ["red", twColors.red[600]], + ["rose", twColors.rose[600]], + ["sky", twColors.sky[600]], + ["teal", twColors.teal[600]], + ["violet", twColors.violet[600]], + ["yellow", twColors.yellow[600]], + ["zinc", twColors.zinc[600]], ] const profile = deriveProfile(event.pubkey) const profileDisplay = deriveProfileDisplay(event.pubkey) - const reactions = deriveEvents(repository, {filters: [{kinds: [REACTION], '#e': [event.id]}]}) - const zaps = deriveEvents(repository, {filters: [{kinds: [ZAP_RESPONSE], '#e': [event.id]}]}) + const reactions = deriveEvents(repository, {filters: [{kinds: [REACTION], "#e": [event.id]}]}) + const zaps = deriveEvents(repository, {filters: [{kinds: [ZAP_RESPONSE], "#e": [event.id]}]}) const {replies} = getAncestorTags(event.tags) const parentId = replies[0]?.[1] const parentHints = [replies[0]?.[2]].filter(Boolean) @@ -52,8 +58,8 @@ const ps = derived(publishStatusData, $m => Object.values($m[event.id] || {})) const displayReaction = (content: string) => { - if (content === '+') return "❤️" - if (content === '-') return "👎" + if (content === "+") return "❤️" + if (content === "-") return "👎" return content } @@ -65,7 +71,8 @@ $: parentProfileDisplay = deriveProfileDisplay(parentPubkey) $: isPublished = findStatus($ps, [PublishStatus.Success]) $: isPending = findStatus($ps, [PublishStatus.Pending]) && event.created_at > now() - 30 - $: failure = !isPending && !isPublished && findStatus($ps, [PublishStatus.Failure, PublishStatus.Timeout]) + $: failure = + !isPending && !isPublished && findStatus($ps, [PublishStatus.Failure, PublishStatus.Timeout])
@@ -86,25 +93,26 @@ {#if showPubkey} {:else} -
+
{/if}
{#if showPubkey} -
- {$profileDisplay} - {formatTimestampAsTime(event.created_at)} +
+ {$profileDisplay} + {formatTimestampAsTime(event.created_at)}
{/if}

{event.content} {#if isPending} - - + + Sending... {:else if failure} Failed to send! @@ -114,9 +122,9 @@

{#if $reactions.length > 0 || $zaps.length > 0} -
+
{#each groupBy(e => e.content, $reactions).entries() as [content, events]} - +
-
+

Get in touch

Having problems? Let us know by filing an issue.

- import {onMount} from 'svelte' - import {readable} from 'svelte/store' - import {displayRelayUrl, isShareableRelayUrl} from '@welshman/util' - import type {SignedEvent} from '@welshman/util' + import {onMount} from "svelte" + import {readable} from "svelte/store" + import {displayRelayUrl, isShareableRelayUrl} from "@welshman/util" + import type {SignedEvent} from "@welshman/util" import Button from "@lib/components/Button.svelte" - import Link from "@lib/components/Link.svelte" import Icon from "@lib/components/Icon.svelte" - import {clip} from "@app/toast" import {DEFAULT_RELAYS, INDEXER_RELAYS} from "@app/base" import {searchRelays, subscribe, loadRelay} from "@app/state" @@ -20,12 +18,12 @@ onMount(() => { const sub = subscribe({ - filters: [{kinds: [30166], '#N': ['29']}], + filters: [{kinds: [30166], "#N": ["29"]}], relays: [...INDEXER_RELAYS, ...DEFAULT_RELAYS], }) - sub.emitter.on('event', (url: string, event: SignedEvent) => { - const d = event.tags.find(t => t[0] === 'd')?.[1] || "" + sub.emitter.on("event", (url: string, event: SignedEvent) => { + const d = event.tags.find(t => t[0] === "d")?.[1] || "" if (isShareableRelayUrl(d)) { loadRelay(d) diff --git a/src/routes/spaces/[nom]/[[room]]/+page.svelte b/src/routes/spaces/[nom]/[[room]]/+page.svelte index fc3f27b7..475363fa 100644 --- a/src/routes/spaces/[nom]/[[room]]/+page.svelte +++ b/src/routes/spaces/[nom]/[[room]]/+page.svelte @@ -8,7 +8,7 @@
-
+
@@ -78,7 +78,7 @@
-
+
{#each elements as { type, id, value, showPubkey } (id)} {#if type === "date"}
diff --git a/svelte.config.js b/svelte.config.js index b0598b89..5448af8c 100644 --- a/svelte.config.js +++ b/svelte.config.js @@ -6,7 +6,7 @@ export default { preprocess: vitePreprocess(), kit: { adapter: adapter({ - fallback: 'index.html', + fallback: "index.html", }), alias: { "@src": "src",