mirror of
https://github.com/coracle-social/flotilla.git
synced 2025-12-10 19:07:06 +00:00
Handle drawer close
This commit is contained in:
@@ -147,7 +147,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
<button
|
<button
|
||||||
class="join absolute -top-2 right-0 border border-solid border-neutral text-xs opacity-0 transition-all group-hover:opacity-100"
|
class="join absolute top-1 right-1 border border-solid border-neutral text-xs opacity-0 transition-all group-hover:opacity-100"
|
||||||
on:click|stopPropagation>
|
on:click|stopPropagation>
|
||||||
<ChannelMessageEmojiButton {url} {room} {event} />
|
<ChannelMessageEmojiButton {url} {room} {event} />
|
||||||
<Button class="btn join-item btn-xs" on:click={showInfo}>
|
<Button class="btn join-item btn-xs" on:click={showInfo}>
|
||||||
|
|||||||
@@ -32,5 +32,6 @@ export const pushDrawer = (
|
|||||||
|
|
||||||
export const clearModal = () => {
|
export const clearModal = () => {
|
||||||
goto("#")
|
goto("#")
|
||||||
|
modals.clear()
|
||||||
emitter.emit("close")
|
emitter.emit("close")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="drawer drawer-end">
|
<div class="drawer drawer-end">
|
||||||
<input {id} type="checkbox" class="drawer-toggle" bind:this={input} />
|
<input {id} type="checkbox" class="drawer-toggle" bind:this={input} on:change />
|
||||||
<div class="drawer-content">
|
<div class="drawer-content">
|
||||||
<label for={id} bind:this={label} />
|
<label for={id} bind:this={label} />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -62,7 +62,13 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let ready: Promise<unknown>
|
const onDrawerClose = (e: any) => {
|
||||||
|
if (!e.target.checked) {
|
||||||
|
clearModal()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let ready: Promise<unknown> = Promise.resolve()
|
||||||
let dialog: HTMLDialogElement
|
let dialog: HTMLDialogElement
|
||||||
let drawer: SvelteComponent
|
let drawer: SvelteComponent
|
||||||
let modal: any
|
let modal: any
|
||||||
@@ -156,10 +162,12 @@
|
|||||||
if ($pubkey) {
|
if ($pubkey) {
|
||||||
loadUserData($pubkey)
|
loadUserData($pubkey)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ready.then(async () => {
|
ready.then(async () => {
|
||||||
await sleep(1)
|
await sleep(1)
|
||||||
|
|
||||||
|
subs.push(
|
||||||
page.subscribe($page => {
|
page.subscribe($page => {
|
||||||
modal = modals.get($page.url.hash.slice(1))
|
modal = modals.get($page.url.hash.slice(1))
|
||||||
|
|
||||||
@@ -178,8 +186,8 @@
|
|||||||
dialog?.close()
|
dialog?.close()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
)
|
||||||
}
|
})
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
for (const unsub of subs) {
|
for (const unsub of subs) {
|
||||||
@@ -216,7 +224,7 @@
|
|||||||
</form>
|
</form>
|
||||||
{/if}
|
{/if}
|
||||||
</dialog>
|
</dialog>
|
||||||
<Drawer bind:this={drawer}>
|
<Drawer bind:this={drawer} on:change={onDrawerClose}>
|
||||||
{#if modal && modal.options?.drawer}
|
{#if modal && modal.options?.drawer}
|
||||||
{#key modal}
|
{#key modal}
|
||||||
<svelte:component this={modal.component} {...modal.props} />
|
<svelte:component this={modal.component} {...modal.props} />
|
||||||
|
|||||||
Reference in New Issue
Block a user