- publishDelete({relays: [url], event, protect: await canEnforceNip70(url)})
+ publishDelete({relays: [url], event, protect: await shouldProtect})
const createReaction = async (template: EventContent) =>
- publishReaction({...template, event, relays: [url], protect: await canEnforceNip70(url)})
+ publishReaction({...template, event, relays: [url], protect: await shouldProtect})
diff --git a/src/app/components/EventActions.svelte b/src/app/components/EventActions.svelte
index ae9c7094..2c0f446f 100644
--- a/src/app/components/EventActions.svelte
+++ b/src/app/components/EventActions.svelte
@@ -22,6 +22,8 @@
const {url, noun, event, hideZap, customActions}: Props = $props()
+ const shouldProtect = canEnforceNip70(url)
+
const showPopover = () => popover?.show()
const hidePopover = () => popover?.hide()
@@ -31,7 +33,7 @@
event,
content: emoji.unicode,
relays: [url],
- protect: await canEnforceNip70(url),
+ protect: await shouldProtect,
})
let popover: Instance | undefined = $state()
diff --git a/src/app/components/EventDeleteConfirm.svelte b/src/app/components/EventDeleteConfirm.svelte
index 3ee9a951..c56bf86c 100644
--- a/src/app/components/EventDeleteConfirm.svelte
+++ b/src/app/components/EventDeleteConfirm.svelte
@@ -11,8 +11,10 @@
const {url, event}: Props = $props()
+ const shouldProtect = canEnforceNip70(url)
+
const confirm = async () => {
- await publishDelete({event, relays: [url], protect: await canEnforceNip70(url)})
+ await publishDelete({event, relays: [url], protect: await shouldProtect})
clearModals()
}
diff --git a/src/app/components/EventReply.svelte b/src/app/components/EventReply.svelte
index b70bc439..698cf25e 100644
--- a/src/app/components/EventReply.svelte
+++ b/src/app/components/EventReply.svelte
@@ -14,6 +14,8 @@
const {url, event, onClose, onSubmit} = $props()
+ const shouldProtect = canEnforceNip70(url)
+
const uploading = writable(false)
const selectFiles = () => editor.then(ed => ed.commands.selectFiles())
@@ -25,7 +27,7 @@
const content = ed.getText({blockSeparator: "\n"}).trim()
const tags = ed.storage.nostr.getEditorTags()
- if (await canEnforceNip70(url)) {
+ if (await shouldProtect) {
tags.push(PROTECTED)
}
diff --git a/src/app/components/EventReportDetails.svelte b/src/app/components/EventReportDetails.svelte
index 1bdfcc06..4ba6ef23 100644
--- a/src/app/components/EventReportDetails.svelte
+++ b/src/app/components/EventReportDetails.svelte
@@ -10,6 +10,8 @@
const {url, event} = $props()
+ const shouldProtect = canEnforceNip70(url)
+
const reports = deriveEvents(repository, {
filters: [{kinds: [REPORT], "#e": [event.id]}],
})
@@ -17,7 +19,7 @@
const back = () => history.back()
const deleteReport = async (report: TrustedEvent) => {
- publishDelete({event: report, relays: [url], protect: await canEnforceNip70(url)})
+ publishDelete({event: report, relays: [url], protect: await shouldProtect})
if ($reports.length === 0) {
history.back()
diff --git a/src/app/components/GoalActions.svelte b/src/app/components/GoalActions.svelte
index 012b57fc..ce1928b8 100644
--- a/src/app/components/GoalActions.svelte
+++ b/src/app/components/GoalActions.svelte
@@ -15,13 +15,15 @@
const {url, event, showActivity = false}: Props = $props()
+ const shouldProtect = canEnforceNip70(url)
+
const path = makeGoalPath(url, event.id)
const deleteReaction = async (event: TrustedEvent) =>
- publishDelete({relays: [url], event, protect: await canEnforceNip70(url)})
+ publishDelete({relays: [url], event, protect: await shouldProtect})
const createReaction = async (template: EventContent) =>
- publishReaction({...template, event, relays: [url], protect: await canEnforceNip70(url)})
+ publishReaction({...template, event, relays: [url], protect: await shouldProtect})
diff --git a/src/app/components/GoalCreate.svelte b/src/app/components/GoalCreate.svelte
index b51c3b5c..295b42f6 100644
--- a/src/app/components/GoalCreate.svelte
+++ b/src/app/components/GoalCreate.svelte
@@ -17,6 +17,8 @@
const {url} = $props()
+ const shouldProtect = canEnforceNip70(url)
+
const uploading = writable(false)
const back = () => history.back()
@@ -50,7 +52,7 @@
["relays", url],
]
- if (await canEnforceNip70(url)) {
+ if (await shouldProtect) {
tags.push(PROTECTED)
}
diff --git a/src/app/components/NoteItem.svelte b/src/app/components/NoteItem.svelte
index 5da49183..539a59a8 100644
--- a/src/app/components/NoteItem.svelte
+++ b/src/app/components/NoteItem.svelte
@@ -10,18 +10,20 @@
const {url, event} = $props()
+ const shouldProtect = canEnforceNip70(url)
+
const deleteReaction = async (event: TrustedEvent) =>
- publishDelete({relays: [url], event, protect: await canEnforceNip70(url)})
+ publishDelete({relays: [url], event, protect: await shouldProtect})
const createReaction = async (template: EventContent) =>
- publishReaction({...template, event, relays: [url], protect: await canEnforceNip70(url)})
+ publishReaction({...template, event, relays: [url], protect: await shouldProtect})
const onEmoji = async (emoji: NativeEmoji) =>
publishReaction({
event,
content: emoji.unicode,
relays: [url],
- protect: await canEnforceNip70(url),
+ protect: await shouldProtect,
})
diff --git a/src/app/components/ThreadActions.svelte b/src/app/components/ThreadActions.svelte
index d26491a2..d3462b80 100644
--- a/src/app/components/ThreadActions.svelte
+++ b/src/app/components/ThreadActions.svelte
@@ -15,13 +15,15 @@
const {url, event, showActivity = false}: Props = $props()
+ const shouldProtect = canEnforceNip70(url)
+
const path = makeThreadPath(url, event.id)
const deleteReaction = async (event: TrustedEvent) =>
- publishDelete({relays: [url], event, protect: await canEnforceNip70(url)})
+ publishDelete({relays: [url], event, protect: await shouldProtect})
const createReaction = async (template: EventContent) =>
- publishReaction({...template, event, relays: [url], protect: await canEnforceNip70(url)})
+ publishReaction({...template, event, relays: [url], protect: await shouldProtect})
diff --git a/src/app/components/ThreadCreate.svelte b/src/app/components/ThreadCreate.svelte
index 1965b1e7..72b1bdf8 100644
--- a/src/app/components/ThreadCreate.svelte
+++ b/src/app/components/ThreadCreate.svelte
@@ -16,6 +16,8 @@
const {url} = $props()
+ const shouldProtect = canEnforceNip70(url)
+
const uploading = writable(false)
const back = () => history.back()
@@ -44,7 +46,7 @@
const tags = [...ed.storage.nostr.getEditorTags(), ["title", title]]
- if (await canEnforceNip70(url)) {
+ if (await shouldProtect) {
tags.push(PROTECTED)
}
diff --git a/src/app/components/ThunkFailure.svelte b/src/app/components/ThunkFailure.svelte
new file mode 100644
index 00000000..569b8de1
--- /dev/null
+++ b/src/app/components/ThunkFailure.svelte
@@ -0,0 +1,66 @@
+
+
+{#if showFailure}
+ {@const url = failedUrls[0]}
+ {@const status = $thunk.status[url]}
+ {@const message = $thunk.details[url]}
+
+{/if}
diff --git a/src/app/components/ThunkPending.svelte b/src/app/components/ThunkPending.svelte
new file mode 100644
index 00000000..4223a96c
--- /dev/null
+++ b/src/app/components/ThunkPending.svelte
@@ -0,0 +1,32 @@
+
+
+
+
+
+ Sending...
+
+
+
diff --git a/src/app/components/ThunkStatus.svelte b/src/app/components/ThunkStatus.svelte
index 9148acfb..5c24da04 100644
--- a/src/app/components/ThunkStatus.svelte
+++ b/src/app/components/ThunkStatus.svelte
@@ -1,95 +1,22 @@
{#if showFailure}
- {@const url = failedUrls[0]}
- {@const status = $thunk.status[url]}
- {@const message = $thunk.details[url]}
-
+
{:else if showPending}
-
-
-
- Sending...
-
-
-
+
{/if}
diff --git a/src/app/components/ThunkToast.svelte b/src/app/components/ThunkToast.svelte
new file mode 100644
index 00000000..d8fd74d9
--- /dev/null
+++ b/src/app/components/ThunkToast.svelte
@@ -0,0 +1,39 @@
+
+
+{#if !isComplete}
+
+{:else if !isFailure}
+
Message sent!
+{/if}
diff --git a/src/app/components/Toast.svelte b/src/app/components/Toast.svelte
index d9cf3c83..4afeb7c0 100644
--- a/src/app/components/Toast.svelte
+++ b/src/app/components/Toast.svelte
@@ -21,12 +21,17 @@
class:bg-base-100={theme === "info"}
class:text-base-content={theme === "info"}
class:alert-error={theme === "error"}>
-
- {@html renderAsHtml(parse({content: $toast.message}))}
- {#if $toast.action}
-
+
+ {#if $toast.message}
+ {@html renderAsHtml(parse({content: $toast.message}))}
+ {#if $toast.action}
+
+ {/if}
+ {:else if $toast.children}
+ {@const {component: Component, props} = $toast?.children || {}}
+
{/if}