Lint/format

This commit is contained in:
Jon Staab
2024-10-18 16:09:17 -07:00
parent b79a274944
commit 8bb2a12a2d
10 changed files with 41 additions and 50 deletions
-1
View File
@@ -36,7 +36,6 @@ import {
getWriteRelayUrls, getWriteRelayUrls,
loadFollows, loadFollows,
loadMutes, loadMutes,
getFollows,
tagEvent, tagEvent,
tagReactionTo, tagReactionTo,
getRelayUrls, getRelayUrls,
+7 -8
View File
@@ -1,15 +1,14 @@
<script lang="ts"> <script lang="ts">
import {nip19} from 'nostr-tools' import {nip19} from "nostr-tools"
import {ctx} from '@welshman/lib' import {ctx} from "@welshman/lib"
import Icon from "@lib/components/Icon.svelte" import Icon from "@lib/components/Icon.svelte"
import FieldInline from "@lib/components/FieldInline.svelte" import FieldInline from "@lib/components/FieldInline.svelte"
import Button from "@lib/components/Button.svelte" import Button from "@lib/components/Button.svelte"
import ModalHeader from "@lib/components/ModalHeader.svelte" import ModalHeader from "@lib/components/ModalHeader.svelte"
import {clip} from '@app/toast' import {clip} from "@app/toast"
export let event export let event
const relays = ctx.app.router.Event(event).getUrls()
const note1 = nip19.noteEncode(event.id) const note1 = nip19.noteEncode(event.id)
const npub1 = nip19.npubEncode(event.pubkey) const npub1 = nip19.npubEncode(event.pubkey)
const json = JSON.stringify(event, null, 2) const json = JSON.stringify(event, null, 2)
@@ -27,7 +26,7 @@
<p slot="label">Event ID</p> <p slot="label">Event ID</p>
<label class="input input-bordered flex w-full items-center gap-2" slot="input"> <label class="input input-bordered flex w-full items-center gap-2" slot="input">
<Icon icon="file" /> <Icon icon="file" />
<input type="text" class="grow ellipsize" value={note1} /> <input type="text" class="ellipsize grow" value={note1} />
<Button on:click={copyId} class="flex items-center"> <Button on:click={copyId} class="flex items-center">
<Icon icon="copy" /> <Icon icon="copy" />
</Button> </Button>
@@ -37,7 +36,7 @@
<p slot="label">Author Pubkey</p> <p slot="label">Author Pubkey</p>
<label class="input input-bordered flex w-full items-center gap-2" slot="input"> <label class="input input-bordered flex w-full items-center gap-2" slot="input">
<Icon icon="user-circle" /> <Icon icon="user-circle" />
<input type="text" class="grow ellipsize" value={npub1} /> <input type="text" class="ellipsize grow" value={npub1} />
<Button on:click={copyPubkey} class="flex items-center"> <Button on:click={copyPubkey} class="flex items-center">
<Icon icon="copy" /> <Icon icon="copy" />
</Button> </Button>
@@ -45,8 +44,8 @@
</FieldInline> </FieldInline>
<div class="relative"> <div class="relative">
<pre class="card2 card2-sm bg-alt overflow-auto"><code>{json}</code></pre> <pre class="card2 card2-sm bg-alt overflow-auto"><code>{json}</code></pre>
<p class="absolute right-2 top-2 flex justify-between items-center flex-grow"> <p class="absolute right-2 top-2 flex flex-grow items-center justify-between">
<Button on:click={copyJson} class="flex items-center btn btn-sm btn-neutral"> <Button on:click={copyJson} class="btn btn-neutral btn-sm flex items-center">
<Icon icon="copy" /> Copy <Icon icon="copy" /> Copy
</Button> </Button>
</p> </p>
+4 -4
View File
@@ -1,7 +1,7 @@
<script lang="ts"> <script lang="ts">
import {page} from "$app/stores" import {page} from "$app/stores"
import {goto} from "$app/navigation" import {goto} from "$app/navigation"
import {displayRelayUrl} from '@welshman/util' import {displayRelayUrl} from "@welshman/util"
import Icon from "@lib/components/Icon.svelte" import Icon from "@lib/components/Icon.svelte"
import Link from "@lib/components/Link.svelte" import Link from "@lib/components/Link.svelte"
import Button from "@lib/components/Button.svelte" import Button from "@lib/components/Button.svelte"
@@ -28,7 +28,7 @@
let space = $page.params?.nrelay ? decodeNRelay($page.params?.nrelay) : undefined let space = $page.params?.nrelay ? decodeNRelay($page.params?.nrelay) : undefined
let showSettings = false let showSettings = false
const assertNotNil = <T>(x: T) => x! const assertNotNil = <T,>(x: T) => x!
const resetSpace = () => { const resetSpace = () => {
space = "" space = ""
@@ -63,7 +63,7 @@
<div class="column menu gap-2"> <div class="column menu gap-2">
{#if showSettings} {#if showSettings}
<p class="mb-4 text-2xl text-center"> <p class="mb-4 text-center text-2xl">
Settings for <span class="text-primary">{displayRelayUrl(assertNotNil(space))}</span> Settings for <span class="text-primary">{displayRelayUrl(assertNotNil(space))}</span>
</p> </p>
{#if getMembershipUrls($userMembership).includes(space || "")} {#if getMembershipUrls($userMembership).includes(space || "")}
@@ -82,7 +82,7 @@
Go Back Go Back
</Button> </Button>
{:else if space} {:else if space}
<p class="mb-4 text-2xl text-center"> <p class="mb-4 text-center text-2xl">
Actions for <span class="text-primary">{displayRelayUrl(space)}</span> Actions for <span class="text-primary">{displayRelayUrl(space)}</span>
</p> </p>
<div class="grid grid-cols-3 gap-2"> <div class="grid grid-cols-3 gap-2">
+2 -2
View File
@@ -44,7 +44,7 @@
}) })
</script> </script>
<Button class="card2 bg-alt shadow-xl flex flex-col" on:click={onClick}> <Button class="card2 bg-alt flex flex-col shadow-xl" on:click={onClick}>
<Profile {pubkey} /> <Profile {pubkey} />
<ProfileInfo {pubkey} /> <ProfileInfo {pubkey} />
{#if roots.length > 0} {#if roots.length > 0}
@@ -53,7 +53,7 @@
{@const nevent = nip19.neventEncode({id: event.id, relays})} {@const nevent = nip19.neventEncode({id: event.id, relays})}
{@const following = getPubkeyTagValues(getListTags($userFollows)).includes(pubkey)} {@const following = getPubkeyTagValues(getListTags($userFollows)).includes(pubkey)}
<div class="divider" /> <div class="divider" />
<button type="button" class="chat chat-start cursor-default flex" on:click|stopPropagation> <button type="button" class="chat chat-start flex cursor-default" on:click|stopPropagation>
<div class="bg-alt col-4 chat-bubble text-left"> <div class="bg-alt col-4 chat-bubble text-left">
<Content showEntire hideMedia={!following} {event} /> <Content showEntire hideMedia={!following} {event} />
<Link external href={entityLink(nevent)} class="row-2 group justify-end whitespace-nowrap"> <Link external href={entityLink(nevent)} class="row-2 group justify-end whitespace-nowrap">
+2 -1
View File
@@ -81,7 +81,8 @@
<slot /> <slot />
<div class="fixed bottom-0 left-0 right-0 z-nav h-14 bg-base-100 md:hidden border border-top border-base-200"> <div
class="border-top fixed bottom-0 left-0 right-0 z-nav h-14 border border-base-200 bg-base-100 md:hidden">
<div class="m-auto flex max-w-md justify-between px-2"> <div class="m-auto flex max-w-md justify-between px-2">
<div class="flex gap-4 sm:gap-8"> <div class="flex gap-4 sm:gap-8">
<PrimaryNavItem title="Home" on:click={showHomeMenu}> <PrimaryNavItem title="Home" on:click={showHomeMenu}>
-7
View File
@@ -1,13 +1,6 @@
<script lang="ts"> <script lang="ts">
import {ctx} from "@welshman/lib"
import {repository} from "@welshman/app"
import {getReplyFilters} from "@welshman/util"
import {deriveEvents} from "@welshman/store"
import Icon from "@lib/components/Icon.svelte"
import Link from "@lib/components/Link.svelte"
import Content from "@app/components/Content.svelte" import Content from "@app/components/Content.svelte"
import NoteCard from "@app/components/NoteCard.svelte" import NoteCard from "@app/components/NoteCard.svelte"
import {entityLink} from "@app/state"
export let event export let event
</script> </script>
+1 -1
View File
@@ -6,7 +6,7 @@
<slot name="input" /> <slot name="input" />
</div> </div>
{#if $$slots.info} {#if $$slots.info}
<p class="text-sm col-start-2 col-span-2"> <p class="col-span-2 col-start-2 text-sm">
<slot name="info" /> <slot name="info" />
</p> </p>
{/if} {/if}
+2 -2
View File
@@ -26,8 +26,8 @@
}) })
</script> </script>
<div class="column max-h-full content-t" bind:this={element}> <div class="column content-t max-h-full" bind:this={element}>
<div class="flex-grow content-x"> <div class="content-x flex-grow">
<label class="input input-bordered flex w-full items-center gap-2"> <label class="input input-bordered flex w-full items-center gap-2">
<Icon icon="magnifer" /> <Icon icon="magnifer" />
<input bind:value={term} class="grow" type="text" placeholder="Search for people..." /> <input bind:value={term} class="grow" type="text" placeholder="Search for people..." />
+9 -11
View File
@@ -1,5 +1,5 @@
<script lang="ts"> <script lang="ts">
import {nip19} from 'nostr-tools' import {nip19} from "nostr-tools"
import {hexToBytes} from "@noble/hashes/utils" import {hexToBytes} from "@noble/hashes/utils"
import {ctx} from "@welshman/lib" import {ctx} from "@welshman/lib"
import { import {
@@ -91,7 +91,7 @@
{/key} {/key}
</div> </div>
{#if editing} {#if editing}
<form class="card2 bg-alt shadow-xl col-4" transition:slide on:submit|preventDefault={saveEdit}> <form class="card2 bg-alt col-4 shadow-xl" transition:slide on:submit|preventDefault={saveEdit}>
<div class="flex justify-center py-2"> <div class="flex justify-center py-2">
<InputProfilePicture bind:file bind:url={values.picture} /> <InputProfilePicture bind:file bind:url={values.picture} />
</div> </div>
@@ -128,7 +128,7 @@
</form> </form>
{/if} {/if}
{#if $session?.method === "nip01"} {#if $session?.method === "nip01"}
<div class="card2 bg-alt shadow-xl col-4" transition:slide> <div class="card2 bg-alt col-4 shadow-xl" transition:slide>
<FieldInline> <FieldInline>
<p slot="label">Public Key</p> <p slot="label">Public Key</p>
<label class="input input-bordered flex w-full items-center gap-2" slot="input"> <label class="input input-bordered flex w-full items-center gap-2" slot="input">
@@ -139,10 +139,10 @@
</Button> </Button>
</label> </label>
<p slot="info"> <p slot="info">
Your public key is your nostr user identifier. It also allows other people to Your public key is your nostr user identifier. It also allows other people to authenticate
authenticate your messages. your messages.
<p> </p>
</FieldInline> <p></p></FieldInline>
<FieldInline> <FieldInline>
<p slot="label">Private Key</p> <p slot="label">Private Key</p>
<label class="input input-bordered flex w-full items-center gap-2" slot="input"> <label class="input input-bordered flex w-full items-center gap-2" slot="input">
@@ -152,10 +152,8 @@
<Icon icon="copy" /> <Icon icon="copy" />
</Button> </Button>
</label> </label>
<p slot="info"> <p slot="info">Your private key is your nostr password. Keep this somewhere safe!</p>
Your private key is your nostr password. Keep this somewhere safe! <p></p></FieldInline>
<p>
</FieldInline>
</div> </div>
{/if} {/if}
</div> </div>
@@ -1,7 +1,7 @@
<script lang="ts"> <script lang="ts">
import {onMount} from "svelte" import {onMount} from "svelte"
import {page} from "$app/stores" import {page} from "$app/stores"
import {sortBy, tryCatch, last, ago} from "@welshman/lib" import {sortBy, last, ago} from "@welshman/lib"
import type {TrustedEvent} from "@welshman/util" import type {TrustedEvent} from "@welshman/util"
import {EVENT_DATE, EVENT_TIME} from "@welshman/util" import {EVENT_DATE, EVENT_TIME} from "@welshman/util"
import {subscribe, formatTimestampAsDate} from "@welshman/app" import {subscribe, formatTimestampAsDate} from "@welshman/app"
@@ -21,8 +21,7 @@
const createEvent = () => pushModal(EventCreate, {url}) const createEvent = () => pushModal(EventCreate, {url})
const getEnd = (event: TrustedEvent) => const getEnd = (event: TrustedEvent) => parseInt(event.tags.find(t => t[0] === "end")?.[1] || "")
parseInt(event.tags.find(t => t[0] === "end")?.[1] || "")
const getStart = (event: TrustedEvent) => const getStart = (event: TrustedEvent) =>
parseInt(event.tags.find(t => t[0] === "start")?.[1] || "") parseInt(event.tags.find(t => t[0] === "start")?.[1] || "")
@@ -35,19 +34,21 @@
dateDisplay?: string dateDisplay?: string
} }
$: items = sortBy(e => -getStart(e), $events).reduce<Item[]>((r, event) => { $: items = sortBy(e => -getStart(e), $events)
const end = getEnd(event) .reduce<Item[]>((r, event) => {
const start = getStart(event) const end = getEnd(event)
const start = getStart(event)
if (isNaN(start) || isNaN(end)) return r if (isNaN(start) || isNaN(end)) return r
const prevDateDisplay = const prevDateDisplay =
r.length > 0 ? formatTimestampAsDate(getStart(last(r).event)) : undefined r.length > 0 ? formatTimestampAsDate(getStart(last(r).event)) : undefined
const newDateDisplay = formatTimestampAsDate(start) const newDateDisplay = formatTimestampAsDate(start)
const dateDisplay = prevDateDisplay === newDateDisplay ? undefined : newDateDisplay const dateDisplay = prevDateDisplay === newDateDisplay ? undefined : newDateDisplay
return [...r, {event, dateDisplay}] return [...r, {event, dateDisplay}]
}, []).slice(0, limit) }, [])
.slice(0, limit)
onMount(() => { onMount(() => {
const sub = subscribe({filters: [{kinds, since: ago(30)}]}) const sub = subscribe({filters: [{kinds, since: ago(30)}]})