feat: add deep link customization #169
@@ -18,8 +18,14 @@
|
||||
import {pushToast} from "@app/util/toast"
|
||||
import {PROTECTED} from "@app/core/state"
|
||||
import {makeEditor} from "@app/editor"
|
||||
import {DraftKey} from "@app/util/drafts"
|
||||
import {canEnforceNip70} from "@app/core/commands"
|
||||
|
||||
type Values = {
|
||||
content?: string | object
|
||||
title?: string
|
||||
}
|
||||
|
||||
type Props = {
|
||||
url: string
|
||||
h?: string
|
||||
@@ -28,6 +34,9 @@
|
||||
|
||||
const {url, h, initialContent = ""}: Props = $props()
|
||||
|
||||
const draftKey = new DraftKey<Values>(`thread:${url}:${h ?? ""}`)
|
||||
const initialValues = initialContent ? {content: initialContent} : draftKey.get()
|
||||
|
||||
const shouldProtect = canEnforceNip70(url)
|
||||
|
||||
const uploading = writable(false)
|
||||
@@ -71,18 +80,29 @@
|
||||
event: makeEvent(THREAD, {content, tags}),
|
||||
})
|
||||
|
||||
draftKey.clear()
|
||||
history.back()
|
||||
}
|
||||
|
||||
let title: string = $state(initialValues?.title ?? "")
|
||||
let content: string | object = $state(initialValues?.content ?? "")
|
||||
|
||||
const onChange = (json: object) => {
|
||||
content = json
|
||||
}
|
||||
|
||||
const editor = makeEditor({
|
||||
content: initialContent,
|
||||
url,
|
||||
submit,
|
||||
uploading,
|
||||
onChange,
|
||||
placeholder: "What's on your mind?",
|
||||
content,
|
||||
})
|
||||
|
||||
let title: string = $state("")
|
||||
$effect(() => {
|
||||
draftKey.set({title, content})
|
||||
})
|
||||
</script>
|
||||
|
||||
<Modal tag="form" onsubmit={preventDefault(submit)}>
|
||||
@@ -137,4 +157,4 @@
|
||||
</Button>
|
||||
<Button type="submit" class="btn btn-primary">Create Thread</Button>
|
||||
</ModalFooter>
|
||||
</Modal>
|
||||
</Modal>
|
||||
|
||||
@@ -9,6 +9,6 @@
|
||||
|
||||
<div
|
||||
data-component="Page"
|
||||
class="relative flex-grow flex flex-col min-w-0 ml-sai mb-sai mt-sai mr-sai bg-base-200 md:ml-0 md:mb-0 {props.class}">
|
||||
class="scroll-container relative flex-grow flex min-h-0 flex-col min-w-0 overflow-y-auto overflow-x-hidden ml-sai mb-sai mt-sai mr-sai bg-base-200 md:ml-0 md:mb-0 {props.class}">
|
||||
{@render props.children?.()}
|
||||
</div>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
if (term) {
|
||||
pubkeys = Array.from(new Set($profileSearch.searchValues(term)))
|
||||
} else {
|
||||
pubkeys = Array.from(new Set($bootstrapPubkeys))
|
||||
pubkeys = $bootstrapPubkeys
|
||||
|
hodlbod marked this conversation as resolved
Outdated
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -67,6 +67,6 @@
|
||||
</SecondaryNavSection>
|
||||
</SecondaryNav>
|
||||
|
||||
<Page class="scroll-container overflow-y-auto overflow-x-hidden">
|
||||
<Page>
|
||||
|
hodlbod marked this conversation as resolved
Outdated
hodlbod
commented
I think this is a badly resolved conflict. I think this is a badly resolved conflict.
Ghost
commented
Agreed. Since the scroll wasn't working in Agreed. Since the scroll wasn't working in `setings/`, I did that. I reverted `+layout.svelte` and fixed scrolling centrally in `Page.svelte`.
|
||||
{@render children?.()}
|
||||
</Page>
|
||||
|
||||
Reference in New Issue
Block a user
These shouldn't be necessary, were you seeing duplicate values?
Yes, I was seeing duplicate values when the add-follow deep link was triggered multiple times for the same pubkey. I agree this dedupe does not belong in
+page.svelte, so I removed the extraSet(....)there and kept deduping in the follow update flow instead.