Skip to content

Commit

Permalink
Small tweaks and bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Staab committed Nov 19, 2024
1 parent 270e962 commit 8856ab5
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 45 deletions.
7 changes: 4 additions & 3 deletions src/app/MenuDesktop.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<script lang="ts">
import {seconds} from "hurdak"
import {derived, get} from "svelte/store"
import {now} from "@welshman/lib"
import {now, omit} from "@welshman/lib"
import {LOCAL_RELAY_URL} from "@welshman/util"
import {PublishStatus} from "@welshman/net"
import {
signer,
Expand Down Expand Up @@ -36,13 +37,13 @@
continue
}
const statuses = Object.values(get(status)).map(s => s.status)
const statuses = Object.values(omit([LOCAL_RELAY_URL], get(status))).map(s => s.status)
if (statuses.includes(PublishStatus.Success)) {
success.push(request.event)
} else if (statuses.includes(PublishStatus.Pending)) {
pending.push(request.event)
} else {
} else if (statuses.length > 0) {
failure.push(request.event)
}
}
Expand Down
14 changes: 4 additions & 10 deletions src/app/views/NoteCreate.svelte
Original file line number Diff line number Diff line change
@@ -1,31 +1,25 @@
<script lang="ts">
import {onMount} from "svelte"
import {whereEq} from "ramda"
import {ctx, last, now} from "@welshman/lib"
import {ctx, last} from "@welshman/lib"
import {createEvent} from "@welshman/util"
import {session, tagPubkey} from "@welshman/app"
import {PublishStatus} from "@welshman/net"
import {commaFormat, toTitle, switcherFn} from "hurdak"
import {commaFormat} from "hurdak"
import {writable, type Writable} from "svelte/store"
import {Editor} from "svelte-tiptap"
import {nip19} from "nostr-tools"
import {v4 as uuid} from "uuid"
import Anchor from "src/partials/Anchor.svelte"
import Content from "src/partials/Content.svelte"
import Field from "src/partials/Field.svelte"
import FlexColumn from "src/partials/FlexColumn.svelte"
import Input from "src/partials/Input.svelte"
import Menu from "src/partials/Menu.svelte"
import MenuItem from "src/partials/MenuItem.svelte"
import Popover from "src/partials/Popover.svelte"
import {showPublishInfo, showToast, showWarning} from "src/partials/Toast.svelte"
import Compose from "src/app/shared/Compose.svelte"
import NsecWarning from "src/app/shared/NsecWarning.svelte"
import NoteContent from "src/app/shared/NoteContent.svelte"
import NoteOptions from "src/app/shared/NoteOptions.svelte"
import {getEditorOptions} from "src/app/editor"
import {router} from "src/app/util/router"
import {dateToSeconds} from "src/util/misc"
import {currencyOptions} from "src/util/i18n"
import {getClientTags, publish, sign, tagsFromContent, userSettings} from "src/engine"
Expand Down Expand Up @@ -94,7 +88,7 @@
const thunk = publish({
event: signedTemplate,
relays: ctx.app.router.PublishEvent(template).getUrls(),
relays: ctx.app.router.PublishEvent(signedTemplate).getUrls(),
delay: $userSettings.send_delay,
})
Expand Down Expand Up @@ -176,7 +170,7 @@
<span class="text-2xl font-bold">Create a Note</span>
</div>
<FlexColumn>
<Field label={"What do you want to say?"}>
<Field label="What do you want to say?">
<div
class="rounded-xl border border-solid border-neutral-600 p-3"
class:bg-white={!showPreview}
Expand Down
4 changes: 3 additions & 1 deletion src/app/views/Publishes.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
Object.values(get(thunk.status)).some(s => statuses.includes(s.status))
$: recent = (Object.values($thunks) as Thunk[]).filter(
t => t.event.created_at > now() - seconds(24, "hour"),
t =>
remove(LOCAL_RELAY_URL, t.request.relays).length > 0 &&
t.event.created_at > now() - seconds(24, "hour"),
)
$: relays = new Set(
remove(
Expand Down
8 changes: 4 additions & 4 deletions src/app/views/UserSettings.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
import Select from "src/partials/Select.svelte"
import {pluralize} from "hurdak"
const values = {...$userSettings, send_delay: $userSettings.send_delay / 1000}
const values = {...$userSettings}
const submit = () => {
publishSettings({...values, send_delay: values.send_delay * 1000})
publishSettings({...values})
showInfo("Your settings have been saved!")
}
Expand Down Expand Up @@ -59,9 +59,9 @@
<Field>
<div slot="label" class="flex justify-between">
<strong>Send Delay</strong>
<div>{values.send_delay} {pluralize(values.send_delay, "second")}</div>
<div>{values.send_delay / 1000} {pluralize(values.send_delay / 1000, "second")}</div>
</div>
<Input type="range" step="1" bind:value={values.send_delay} min={0} max={15}></Input>
<Input type="range" step="1000" bind:value={values.send_delay} min={0} max={15_000}></Input>
<p slot="info">A delay period allowing you to cancel a reply or note creation, in seconds.</p>
</Field>
<Field>
Expand Down
2 changes: 0 additions & 2 deletions src/app/views/Zap.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
export let splits
export let id = null
export let anonymous = false
export let callback = null
export let amount = getSetting("default_zap")
let zaps = []
Expand Down Expand Up @@ -130,7 +129,6 @@
load({
relays,
onEvent: callback,
filters: [{kinds: [9735], authors: [zapper.nostrPubkey], "#p": [pubkey], since}],
})
}
Expand Down
11 changes: 1 addition & 10 deletions src/engine/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,7 @@ import {
uniqBy,
} from "@welshman/lib"
import type {PublishRequest, Target} from "@welshman/net"
import {
Executor,
Local,
Multi,
Relays,
SubscriptionEvent,
publish as basePublish,
} from "@welshman/net"
import {Executor, Local, Multi, Relays, SubscriptionEvent} from "@welshman/net"
import {Nip01Signer, Nip59} from "@welshman/signer"
import {deriveEvents, deriveEventsMapped, throttled, withGetter} from "@welshman/store"
import type {
Expand Down Expand Up @@ -765,8 +758,6 @@ export type MyPublishRequest = PublishRequest & {
delay?: number
}

export type Pub = ReturnType<typeof basePublish>

export const publish = ({forcePlatform = true, ...request}: MyPublishRequest) => {
request.relays = forcePlatform
? forcePlatformRelays(request.relays)
Expand Down
12 changes: 6 additions & 6 deletions src/partials/Channel.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -245,17 +245,17 @@
<Compose
bind:element={textarea}
{editor}
class="w-full resize-none bg-transparent p-2 text-neutral-100 outline-0 placeholder:text-neutral-100" />
class="w-full resize-none border-r border-solid border-tinted-700 bg-transparent p-2 text-neutral-100 outline-0 placeholder:text-neutral-100" />
<div>
<button
on:click={() => editor.commands.selectFiles()}
class="flex cursor-pointer flex-col justify-center gap-2 border-l border-solid border-tinted-700 p-3
py-6 text-neutral-100 transition-all hover:bg-accent hover:text-white">
class="flex cursor-pointer flex-col justify-center gap-2 p-3
py-6 text-neutral-100 transition-all hover:bg-accent hover:text-white"
on:click={() => editor.commands.selectFiles()}>
<i class="fa-solid fa-paperclip fa-lg" />
</button>
<button
on:click={sendOrConfirm}
class="flex cursor-pointer flex-col justify-center gap-2 border-l border-solid border-tinted-700 p-3
class="flex cursor-pointer flex-col justify-center gap-2 p-3
py-6 text-neutral-100 transition-all hover:bg-accent hover:text-white">
<i class="fa-solid fa-paper-plane fa-lg" />
</button>
Expand Down Expand Up @@ -287,7 +287,7 @@
<p>
{displayList($pubkeysWithoutInbox.map(displayProfileByPubkey))}
{pluralize($pubkeysWithoutInbox.length, "does not have", "do not have")}
inbox relays, which means they likely don't want to receive DMs.
inbox relays, which means they may not be able to receive DMs.
</p>
{:else if !userHasInbox}
<p>
Expand Down
18 changes: 9 additions & 9 deletions src/partials/Toast.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,13 @@
</script>

{#if $toast}
{#key $toast.id}
<div
on:touchstart={onTouchStart}
on:touchmove={onTouchMove}
on:touchend={onTouchEnd}
class="pointer-events-none fixed left-0 right-0 top-0 z-toast flex justify-center"
transition:fly={{y: -50, duration: 300}}>
<div
on:touchstart={onTouchStart}
on:touchmove={onTouchMove}
on:touchend={onTouchEnd}
class="pointer-events-none fixed left-0 right-0 top-0 z-toast flex justify-center"
transition:fly={{y: -50, duration: 300}}>
{#key $toast.id}
<div
style={`transform: translate(${offset}px, 0)`}
class={cx(
Expand Down Expand Up @@ -127,6 +127,6 @@
<i class="fa fa-times" />
</div>
</div>
</div>
{/key}
{/key}
</div>
{/if}

0 comments on commit 8856ab5

Please sign in to comment.