migrate: switch to svelte 5 events system for everything
This commit is contained in:
1 parent
43a857ed66
commit
53cb0e4f20
27 files changed
+248
-303
No files matched your search
@@ -1,8 +1,9 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Avatar from '$lib/components/ui/Avatar.svelte'
|
import Avatar from '$lib/components/ui/Avatar.svelte'
|
||||||
import { getClient } from '$lib/lemmy.js'
|
import { getClient } from '$lib/lemmy.js'
|
||||||
import type { Community, ListingType } from 'lemmy-js-client'
|
import type { Community, CommunityView, ListingType } from 'lemmy-js-client'
|
||||||
import { MenuButton, Search } from 'mono-svelte'
|
import { MenuButton, Search } from 'mono-svelte'
|
||||||
|
import type { SearchProps } from 'mono-svelte/search/Search.svelte'
|
||||||
import { createEventDispatcher } from 'svelte'
|
import { createEventDispatcher } from 'svelte'
|
||||||
import { Icon, XCircle, ServerStack } from 'svelte-hero-icons'
|
import { Icon, XCircle, ServerStack } from 'svelte-hero-icons'
|
||||||
import { fly } from 'svelte/transition'
|
import { fly } from 'svelte/transition'
|
||||||
@@ -13,6 +14,7 @@
|
|||||||
instance?: string | undefined
|
instance?: string | undefined
|
||||||
listing_type?: ListingType
|
listing_type?: ListingType
|
||||||
showWhenEmpty?: boolean
|
showWhenEmpty?: boolean
|
||||||
|
onselect?: (item: any) => void
|
||||||
[key: string]: any
|
[key: string]: any
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,9 +47,7 @@
|
|||||||
return results.communities.map((c) => c.community)
|
return results.communities.map((c) => c.community)
|
||||||
}}
|
}}
|
||||||
extractName={(c) => `${c.title}@${new URL(c.actor_id).hostname}`}
|
extractName={(c) => `${c.title}@${new URL(c.actor_id).hostname}`}
|
||||||
on:select
|
|
||||||
bind:query={q}
|
bind:query={q}
|
||||||
{showWhenEmpty}
|
|
||||||
{...rest}
|
{...rest}
|
||||||
>
|
>
|
||||||
{#snippet noresults()}
|
{#snippet noresults()}
|
||||||
@@ -90,9 +90,7 @@
|
|||||||
: []
|
: []
|
||||||
}}
|
}}
|
||||||
extractName={(i) => `${i.domain}`}
|
extractName={(i) => `${i.domain}`}
|
||||||
on:select
|
|
||||||
bind:query={q}
|
bind:query={q}
|
||||||
{showWhenEmpty}
|
|
||||||
{...rest}
|
{...rest}
|
||||||
>
|
>
|
||||||
{#snippet noresults()}
|
{#snippet noresults()}
|
||||||
|
|||||||
@@ -175,9 +175,9 @@
|
|||||||
<ImageUploadModal
|
<ImageUploadModal
|
||||||
bind:open={uploading.icon}
|
bind:open={uploading.icon}
|
||||||
multiple={false}
|
multiple={false}
|
||||||
on:upload={(uploaded) => {
|
onupload={(uploaded) => {
|
||||||
uploading.icon = false
|
uploading.icon = false
|
||||||
formData.icon = uploaded.detail[0]
|
formData.icon = uploaded[0]
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
@@ -203,9 +203,9 @@
|
|||||||
<ImageUploadModal
|
<ImageUploadModal
|
||||||
bind:open={uploading.banner}
|
bind:open={uploading.banner}
|
||||||
multiple={false}
|
multiple={false}
|
||||||
on:upload={(uploaded) => {
|
onupload={(uploaded) => {
|
||||||
uploading.banner = false
|
uploading.banner = false
|
||||||
formData.banner = uploaded.detail[0]
|
formData.banner = uploaded[0]
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { preventDefault } from 'svelte/legacy'
|
|
||||||
|
|
||||||
import { profile } from '$lib/auth.svelte.js'
|
import { profile } from '$lib/auth.svelte.js'
|
||||||
import ProgressBar from '$lib/components/ui/ProgressBar.svelte'
|
import ProgressBar from '$lib/components/ui/ProgressBar.svelte'
|
||||||
import { errorMessage } from '$lib/lemmy/error'
|
import { errorMessage } from '$lib/lemmy/error'
|
||||||
@@ -8,7 +6,6 @@
|
|||||||
import { uploadImage } from '$lib/util.svelte.js'
|
import { uploadImage } from '$lib/util.svelte.js'
|
||||||
import { ImageInput, Spinner, toast } from 'mono-svelte'
|
import { ImageInput, Spinner, toast } from 'mono-svelte'
|
||||||
import { Button, Modal } from 'mono-svelte'
|
import { Button, Modal } from 'mono-svelte'
|
||||||
import { createEventDispatcher } from 'svelte'
|
|
||||||
import { DocumentPlus, Icon } from 'svelte-hero-icons'
|
import { DocumentPlus, Icon } from 'svelte-hero-icons'
|
||||||
import { expoOut } from 'svelte/easing'
|
import { expoOut } from 'svelte/easing'
|
||||||
import { slide } from 'svelte/transition'
|
import { slide } from 'svelte/transition'
|
||||||
@@ -18,6 +15,7 @@
|
|||||||
image?: FileList | null
|
image?: FileList | null
|
||||||
preview?: boolean
|
preview?: boolean
|
||||||
multiple?: boolean
|
multiple?: boolean
|
||||||
|
onupload?: (urls: string[]) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
let {
|
let {
|
||||||
@@ -25,6 +23,7 @@
|
|||||||
image = $bindable(null),
|
image = $bindable(null),
|
||||||
preview = true,
|
preview = true,
|
||||||
multiple = true,
|
multiple = true,
|
||||||
|
onupload,
|
||||||
}: Props = $props()
|
}: Props = $props()
|
||||||
let progress = $state(1)
|
let progress = $state(1)
|
||||||
|
|
||||||
@@ -32,8 +31,6 @@
|
|||||||
preview && image ? Array.from(image).map(URL.createObjectURL) : undefined,
|
preview && image ? Array.from(image).map(URL.createObjectURL) : undefined,
|
||||||
)
|
)
|
||||||
|
|
||||||
const dispatcher = createEventDispatcher<{ upload: string[] }>()
|
|
||||||
|
|
||||||
async function upload() {
|
async function upload() {
|
||||||
if (!$profile?.jwt || image == null) return
|
if (!$profile?.jwt || image == null) return
|
||||||
|
|
||||||
@@ -58,7 +55,7 @@
|
|||||||
|
|
||||||
if (!uploaded) throw new Error('Image upload returned undefined')
|
if (!uploaded) throw new Error('Image upload returned undefined')
|
||||||
|
|
||||||
dispatcher('upload', uploaded)
|
onupload?.(uploaded)
|
||||||
progress = 1
|
progress = 1
|
||||||
open = false
|
open = false
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -81,7 +78,13 @@
|
|||||||
<ProgressBar {progress} />
|
<ProgressBar {progress} />
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
<form class="flex flex-col gap-4" onsubmit={preventDefault(upload)}>
|
<form
|
||||||
|
class="flex flex-col gap-4"
|
||||||
|
onsubmit={(e) => {
|
||||||
|
e.preventDefault()
|
||||||
|
upload()
|
||||||
|
}}
|
||||||
|
>
|
||||||
<label
|
<label
|
||||||
for="image-input"
|
for="image-input"
|
||||||
class="p-4 border-2 border-dashed rounded-xl cursor-pointer transition-colors
|
class="p-4 border-2 border-dashed rounded-xl cursor-pointer transition-colors
|
||||||
|
|||||||
@@ -176,11 +176,6 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// onMount(async () => {
|
|
||||||
// await tick()
|
|
||||||
// $virtualizer.measure()
|
|
||||||
// })
|
|
||||||
|
|
||||||
let items = $derived($virtualizer.getVirtualItems())
|
let items = $derived($virtualizer.getVirtualItems())
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
if (virtualItemEls.length)
|
if (virtualItemEls.length)
|
||||||
@@ -195,8 +190,6 @@
|
|||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!-- <svelte:window on:keydown={handleKeydown} /> -->
|
|
||||||
|
|
||||||
<ul
|
<ul
|
||||||
class="flex flex-col list-none divide-y divide-slate-200 dark:divide-zinc-800"
|
class="flex flex-col list-none divide-y divide-slate-200 dark:divide-zinc-800"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -258,8 +258,8 @@
|
|||||||
<UploadModal
|
<UploadModal
|
||||||
bind:open={uploadingImage}
|
bind:open={uploadingImage}
|
||||||
multiple={false}
|
multiple={false}
|
||||||
on:upload={(e) => {
|
onupload={(e) => {
|
||||||
if (e.detail) data.url = e.detail[0]
|
if (e) data.url = e[0]
|
||||||
uploadingImage = false
|
uploadingImage = false
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
@@ -282,8 +282,8 @@
|
|||||||
listing_type="All"
|
listing_type="All"
|
||||||
label={$t('form.post.community')}
|
label={$t('form.post.community')}
|
||||||
required
|
required
|
||||||
on:select={(e) => {
|
onselect={(e) => {
|
||||||
const c = e.detail
|
const c = e
|
||||||
if (!c) {
|
if (!c) {
|
||||||
data.community = null
|
data.community = null
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
instance?: string | undefined
|
instance?: string | undefined
|
||||||
listing_type?: ListingType
|
listing_type?: ListingType
|
||||||
showWhenEmpty?: boolean
|
showWhenEmpty?: boolean
|
||||||
|
onselect?: (e: any) => void
|
||||||
[key: string]: any
|
[key: string]: any
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -39,9 +40,7 @@
|
|||||||
return results.users.map((c) => c.person)
|
return results.users.map((c) => c.person)
|
||||||
}}
|
}}
|
||||||
extractName={(c) => `${c.name}@${new URL(c.actor_id).hostname}`}
|
extractName={(c) => `${c.name}@${new URL(c.actor_id).hostname}`}
|
||||||
on:select
|
|
||||||
bind:query={q}
|
bind:query={q}
|
||||||
{showWhenEmpty}
|
|
||||||
{...rest}
|
{...rest}
|
||||||
>
|
>
|
||||||
{#snippet noresults()}
|
{#snippet noresults()}
|
||||||
|
|||||||
@@ -125,8 +125,8 @@
|
|||||||
<ImageUploadModal
|
<ImageUploadModal
|
||||||
bind:open={uploadingImage}
|
bind:open={uploadingImage}
|
||||||
bind:image
|
bind:image
|
||||||
on:upload={(e) => {
|
onupload={(e) => {
|
||||||
e.detail.forEach((i) => {
|
e.forEach((i) => {
|
||||||
wrapSelection(`\n\n`, '')
|
wrapSelection(`\n\n`, '')
|
||||||
})
|
})
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
<script lang="ts">
|
|
||||||
import { createEventDispatcher } from 'svelte'
|
|
||||||
|
|
||||||
type T = $$Generic
|
|
||||||
|
|
||||||
const dispatcher = createEventDispatcher<{ action: any }>()
|
|
||||||
|
|
||||||
function action(detail: any) {
|
|
||||||
dispatcher('action', detail)
|
|
||||||
}
|
|
||||||
interface Props {
|
|
||||||
class?: string
|
|
||||||
children?: import('svelte').Snippet<[any]>
|
|
||||||
}
|
|
||||||
|
|
||||||
let { class: clazz = '', children }: Props = $props()
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<ul
|
|
||||||
class="divide-y divide-slate-200 dark:divide-zinc-900 flex flex-col {clazz}"
|
|
||||||
>
|
|
||||||
{@render children?.({ action })}
|
|
||||||
</ul>
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
<script>
|
|
||||||
/**
|
|
||||||
* @typedef {Object} Props
|
|
||||||
* @property {import('svelte').Snippet} [children]
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @type {Props} */
|
|
||||||
let { children } = $props()
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<div class="p-2 flex flex-row">
|
|
||||||
{@render children?.()}
|
|
||||||
</div>
|
|
||||||
@@ -12,20 +12,7 @@
|
|||||||
sm: 'shadow-sm',
|
sm: 'shadow-sm',
|
||||||
none: 'shadow-none',
|
none: 'shadow-none',
|
||||||
}
|
}
|
||||||
</script>
|
|
||||||
|
|
||||||
<script lang="ts">
|
|
||||||
import type {
|
|
||||||
HTMLInputAttributes,
|
|
||||||
HTMLInputTypeAttribute,
|
|
||||||
} from 'svelte/elements'
|
|
||||||
|
|
||||||
import Label from '../forms/Label.svelte'
|
|
||||||
import { generateID } from '../forms/helper.js'
|
|
||||||
|
|
||||||
const borderClass = `
|
|
||||||
border border-slate-200 border-b-slate-300 dark:border-zinc-900 dark:border-t-zinc-800
|
|
||||||
`
|
|
||||||
interface Props extends Omit<HTMLInputAttributes, 'size' | 'prefix'> {
|
interface Props extends Omit<HTMLInputAttributes, 'size' | 'prefix'> {
|
||||||
label?: string | undefined
|
label?: string | undefined
|
||||||
value?: string
|
value?: string
|
||||||
@@ -44,6 +31,22 @@
|
|||||||
children?: import('svelte').Snippet
|
children?: import('svelte').Snippet
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type { Props as TextInputProps }
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import type {
|
||||||
|
HTMLInputAttributes,
|
||||||
|
HTMLInputTypeAttribute,
|
||||||
|
} from 'svelte/elements'
|
||||||
|
|
||||||
|
import Label from '../forms/Label.svelte'
|
||||||
|
import { generateID } from '../forms/helper.js'
|
||||||
|
|
||||||
|
const borderClass = `
|
||||||
|
border border-slate-200 border-b-slate-300 dark:border-zinc-900 dark:border-t-zinc-800
|
||||||
|
`
|
||||||
|
|
||||||
let {
|
let {
|
||||||
label = undefined,
|
label = undefined,
|
||||||
value = $bindable(''),
|
value = $bindable(''),
|
||||||
|
|||||||
@@ -15,6 +15,8 @@
|
|||||||
customTitle?: import('svelte').Snippet
|
customTitle?: import('svelte').Snippet
|
||||||
children?: import('svelte').Snippet
|
children?: import('svelte').Snippet
|
||||||
actions?: import('svelte').Snippet<[any]>
|
actions?: import('svelte').Snippet<[any]>
|
||||||
|
ondismissed?: () => void
|
||||||
|
onaction?: () => void
|
||||||
}
|
}
|
||||||
|
|
||||||
let {
|
let {
|
||||||
@@ -25,11 +27,11 @@
|
|||||||
customTitle,
|
customTitle,
|
||||||
children,
|
children,
|
||||||
actions,
|
actions,
|
||||||
|
ondismissed,
|
||||||
|
onaction,
|
||||||
}: Props = $props()
|
}: Props = $props()
|
||||||
|
|
||||||
let el: any = $state()
|
let el: any = $state()
|
||||||
|
|
||||||
const dispatcher = createEventDispatcher<{ action: any; dismissed: any }>()
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Portal>
|
<Portal>
|
||||||
@@ -46,7 +48,7 @@ bg-white/50 dark:bg-black/50 box-border p-4"
|
|||||||
if (!el.contains(e.target)) {
|
if (!el.contains(e.target)) {
|
||||||
open = false
|
open = false
|
||||||
|
|
||||||
dispatcher('dismissed')
|
ondismissed?.()
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@@ -94,9 +96,9 @@ bg-white/50 dark:bg-black/50 box-border p-4"
|
|||||||
<Button
|
<Button
|
||||||
class="w-full"
|
class="w-full"
|
||||||
onclick={(e) => {
|
onclick={(e) => {
|
||||||
dispatcher('action', e)
|
onaction?.()
|
||||||
open = false
|
open = false
|
||||||
dispatcher('dismissed')
|
ondismissed?.()
|
||||||
}}
|
}}
|
||||||
color="primary"
|
color="primary"
|
||||||
size="lg"
|
size="lg"
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
<Modal
|
<Modal
|
||||||
title={$shownModal.title}
|
title={$shownModal.title}
|
||||||
dismissable={$shownModal.dismissable}
|
dismissable={$shownModal.dismissable}
|
||||||
on:dismissed={() => shownModal.set(undefined)}
|
ondismissed={() => shownModal.set(undefined)}
|
||||||
bind:open
|
bind:open
|
||||||
>
|
>
|
||||||
<p>{$shownModal.body}</p>
|
<p>{$shownModal.body}</p>
|
||||||
|
|||||||
@@ -1,24 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts" module>
|
||||||
import { Menu, TextInput, Spinner, MenuButton } from '../index.js'
|
interface Props<T> extends Omit<TextInputProps, 'onselect' | 'children'> {
|
||||||
import { debounce } from '../util/time.js'
|
|
||||||
import { createEventDispatcher } from 'svelte'
|
|
||||||
import { Icon, MagnifyingGlass } from 'svelte-hero-icons'
|
|
||||||
|
|
||||||
type T = $$Generic
|
|
||||||
let items: T[] = $state([])
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is here so that the menu doesn't open as soon as it's mounted.
|
|
||||||
*/
|
|
||||||
let openMenu = $state(false)
|
|
||||||
let searching = $state(false)
|
|
||||||
|
|
||||||
const dispatcher = createEventDispatcher<{
|
|
||||||
input: Event
|
|
||||||
select: T | undefined
|
|
||||||
}>()
|
|
||||||
|
|
||||||
interface Props {
|
|
||||||
query?: string
|
query?: string
|
||||||
selected?: T | undefined
|
selected?: T | undefined
|
||||||
search: (query: string) => Promise<T[]>
|
search: (query: string) => Promise<T[]>
|
||||||
@@ -27,9 +8,28 @@
|
|||||||
input?: import('svelte').Snippet
|
input?: import('svelte').Snippet
|
||||||
noresults?: import('svelte').Snippet
|
noresults?: import('svelte').Snippet
|
||||||
children?: import('svelte').Snippet<[any]>
|
children?: import('svelte').Snippet<[any]>
|
||||||
[key: string]: any
|
onselect?: (value: T | undefined) => void
|
||||||
|
oninput?: TextInputProps['oninput']
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type { Props as SearchProps }
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script lang="ts" generics="T">
|
||||||
|
import type { TextInputProps } from 'mono-svelte/forms/TextInput.svelte'
|
||||||
|
import { Menu, TextInput, Spinner, MenuButton } from '../index.js'
|
||||||
|
import { debounce } from '../util/time.js'
|
||||||
|
import { createEventDispatcher } from 'svelte'
|
||||||
|
import { Icon, MagnifyingGlass } from 'svelte-hero-icons'
|
||||||
|
|
||||||
|
let items: T[] = $state([])
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is here so that the menu doesn't open as soon as it's mounted.
|
||||||
|
*/
|
||||||
|
let openMenu = $state(false)
|
||||||
|
let searching = $state(false)
|
||||||
|
|
||||||
let {
|
let {
|
||||||
query = $bindable(''),
|
query = $bindable(''),
|
||||||
selected = $bindable(undefined),
|
selected = $bindable(undefined),
|
||||||
@@ -38,13 +38,15 @@
|
|||||||
select = (item: T) => {
|
select = (item: T) => {
|
||||||
selected = item
|
selected = item
|
||||||
query = extractName(item)
|
query = extractName(item)
|
||||||
dispatcher('select', item)
|
onselect?.(item)
|
||||||
},
|
},
|
||||||
input,
|
input,
|
||||||
noresults,
|
noresults,
|
||||||
children,
|
children,
|
||||||
|
onselect,
|
||||||
|
oninput,
|
||||||
...rest
|
...rest
|
||||||
}: Props = $props()
|
}: Props<T> = $props()
|
||||||
|
|
||||||
const debounceFunc = debounce(async () => {
|
const debounceFunc = debounce(async () => {
|
||||||
searching = true
|
searching = true
|
||||||
@@ -63,13 +65,13 @@
|
|||||||
oninput={(e) => {
|
oninput={(e) => {
|
||||||
searching = true
|
searching = true
|
||||||
openMenu = true
|
openMenu = true
|
||||||
dispatcher('input', e)
|
oninput?.(e)
|
||||||
debounceFunc()
|
debounceFunc()
|
||||||
}}
|
}}
|
||||||
onfocus={(e) => {
|
onfocus={(e) => {
|
||||||
searching = true
|
searching = true
|
||||||
openMenu = true
|
openMenu = true
|
||||||
dispatcher('input', e)
|
oninput?.(e)
|
||||||
debounceFunc()
|
debounceFunc()
|
||||||
}}
|
}}
|
||||||
{...rest}
|
{...rest}
|
||||||
@@ -96,7 +98,6 @@
|
|||||||
{#if children}{@render children({
|
{#if children}{@render children({
|
||||||
extractName,
|
extractName,
|
||||||
item,
|
item,
|
||||||
dispatcher,
|
|
||||||
select,
|
select,
|
||||||
})}{:else}
|
})}{:else}
|
||||||
<MenuButton onclick={() => select(item)}>
|
<MenuButton onclick={() => select(item)}>
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
type Profile,
|
type Profile,
|
||||||
profile,
|
profile,
|
||||||
} from '$lib/auth.svelte.js'
|
} from '$lib/auth.svelte.js'
|
||||||
import EditableList from '$lib/components/ui/list/EditableList.svelte'
|
|
||||||
import { Menu, MenuButton, Modal } from 'mono-svelte'
|
import { Menu, MenuButton, Modal } from 'mono-svelte'
|
||||||
import DebugObject from '$lib/components/util/debug/DebugObject.svelte'
|
import DebugObject from '$lib/components/util/debug/DebugObject.svelte'
|
||||||
import { DEFAULT_INSTANCE_URL, LINKED_INSTANCE_URL } from '$lib/instance.js'
|
import { DEFAULT_INSTANCE_URL, LINKED_INSTANCE_URL } from '$lib/instance.js'
|
||||||
|
|||||||
@@ -104,9 +104,9 @@
|
|||||||
<ImageUploadModal
|
<ImageUploadModal
|
||||||
bind:open={uploading.icon}
|
bind:open={uploading.icon}
|
||||||
multiple={false}
|
multiple={false}
|
||||||
on:upload={(uploaded) => {
|
onupload={(uploaded) => {
|
||||||
uploading.icon = false
|
uploading.icon = false
|
||||||
formData.icon = uploaded.detail[0]
|
formData.icon = uploaded[0]
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
@@ -132,9 +132,9 @@
|
|||||||
<ImageUploadModal
|
<ImageUploadModal
|
||||||
bind:open={uploading.banner}
|
bind:open={uploading.banner}
|
||||||
multiple={false}
|
multiple={false}
|
||||||
on:upload={(uploaded) => {
|
onupload={(uploaded) => {
|
||||||
uploading.banner = false
|
uploading.banner = false
|
||||||
formData.banner = uploaded.detail[0]
|
formData.banner = uploaded[0]
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
import { profile } from '$lib/auth.svelte.js'
|
import { profile } from '$lib/auth.svelte.js'
|
||||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||||
import EditableList from '$lib/components/ui/list/EditableList.svelte'
|
|
||||||
import RelativeDate from '$lib/components/util/RelativeDate.svelte'
|
import RelativeDate from '$lib/components/util/RelativeDate.svelte'
|
||||||
import { publishedToDate } from '$lib/components/util/date.js'
|
import { publishedToDate } from '$lib/components/util/date.js'
|
||||||
import { getClient } from '$lib/lemmy.js'
|
import { getClient } from '$lib/lemmy.js'
|
||||||
@@ -216,7 +215,7 @@
|
|||||||
</Button>
|
</Button>
|
||||||
</form>
|
</form>
|
||||||
<Material class="h-full overflow-auto" color="distinct">
|
<Material class="h-full overflow-auto" color="distinct">
|
||||||
<EditableList
|
<ul
|
||||||
class="[&>*]:py-3 dark:!divide-zinc-800 {allowInstance.instance != ''
|
class="[&>*]:py-3 dark:!divide-zinc-800 {allowInstance.instance != ''
|
||||||
? 'opacity-50'
|
? 'opacity-50'
|
||||||
: ''}"
|
: ''}"
|
||||||
@@ -262,7 +261,7 @@
|
|||||||
description={$t('routes.admin.federation.emptyBlock.description')}
|
description={$t('routes.admin.federation.emptyBlock.description')}
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
</EditableList>
|
</ul>
|
||||||
</Material>
|
</Material>
|
||||||
</div>
|
</div>
|
||||||
<div class="md:flex-1 w-full max-h-[42rem] flex flex-col gap-2">
|
<div class="md:flex-1 w-full max-h-[42rem] flex flex-col gap-2">
|
||||||
@@ -304,7 +303,7 @@
|
|||||||
</Button>
|
</Button>
|
||||||
</form>
|
</form>
|
||||||
<Material class="h-full overflow-auto" color="distinct">
|
<Material class="h-full overflow-auto" color="distinct">
|
||||||
<EditableList class="[&>*]:py-3 dark:!divide-zinc-800 ">
|
<ul class="[&>*]:py-3 dark:!divide-zinc-800">
|
||||||
{#if data.federated_instances.federated_instances.allowed.length > 0}
|
{#if data.federated_instances.federated_instances.allowed.length > 0}
|
||||||
{#each data.federated_instances.federated_instances.allowed.sort( (b, a) => b.domain.localeCompare(a.domain), ) as instance (instance.id)}
|
{#each data.federated_instances.federated_instances.allowed.sort( (b, a) => b.domain.localeCompare(a.domain), ) as instance (instance.id)}
|
||||||
<div
|
<div
|
||||||
@@ -350,7 +349,7 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</EditableList>
|
</ul>
|
||||||
</Material>
|
</Material>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
import Markdown from '$lib/components/markdown/Markdown.svelte'
|
import Markdown from '$lib/components/markdown/Markdown.svelte'
|
||||||
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||||
import EditableList from '$lib/components/ui/list/EditableList.svelte'
|
|
||||||
import { toast } from 'mono-svelte'
|
import { toast } from 'mono-svelte'
|
||||||
import { getClient } from '$lib/lemmy.js'
|
import { getClient } from '$lib/lemmy.js'
|
||||||
import type { Tagline } from 'lemmy-js-client'
|
import type { Tagline } from 'lemmy-js-client'
|
||||||
@@ -61,31 +60,30 @@
|
|||||||
</Button>
|
</Button>
|
||||||
</Header>
|
</Header>
|
||||||
|
|
||||||
<EditableList
|
<ul>
|
||||||
on:action={(e) => {
|
{#each taglines as tagline}
|
||||||
taglines.splice(
|
<div class="flex py-3">
|
||||||
taglines.findIndex((i) => i == e.detail),
|
<Markdown source={tagline} inline />
|
||||||
1,
|
|
||||||
)
|
|
||||||
|
|
||||||
// hack for reactivity
|
<div class="flex gap-2 ml-auto">
|
||||||
taglines = taglines
|
<Button
|
||||||
}}
|
onclick={() => {
|
||||||
>
|
taglines.splice(
|
||||||
{#snippet children({ action })}
|
taglines.findIndex((i) => i == tagline),
|
||||||
{#each taglines as tagline}
|
1,
|
||||||
<div class="flex py-3">
|
)
|
||||||
<Markdown source={tagline} inline />
|
|
||||||
|
|
||||||
<div class="flex gap-2 ml-auto">
|
// hack for reactivity
|
||||||
<Button onclick={() => action(tagline)} size="square-md">
|
taglines = taglines
|
||||||
<Icon src={Trash} mini size="16" />
|
}}
|
||||||
</Button>
|
size="square-md"
|
||||||
</div>
|
>
|
||||||
|
<Icon src={Trash} mini size="16" />
|
||||||
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
{/each}
|
</div>
|
||||||
{/snippet}
|
{/each}
|
||||||
</EditableList>
|
</ul>
|
||||||
<form
|
<form
|
||||||
class="flex flex-col mt-auto gap-2 w-full"
|
class="flex flex-col mt-auto gap-2 w-full"
|
||||||
onsubmit={preventDefault(() => {
|
onsubmit={preventDefault(() => {
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
import { profile } from '$lib/auth.svelte.js'
|
import { profile } from '$lib/auth.svelte.js'
|
||||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||||
import EditableList from '$lib/components/ui/list/EditableList.svelte'
|
|
||||||
import { toast } from 'mono-svelte'
|
import { toast } from 'mono-svelte'
|
||||||
import { instance } from '$lib/instance.js'
|
import { instance } from '$lib/instance.js'
|
||||||
import { getClient } from '$lib/lemmy.js'
|
import { getClient } from '$lib/lemmy.js'
|
||||||
@@ -48,26 +47,29 @@
|
|||||||
|
|
||||||
<Header pageHeader>{$t('routes.admin.team.title')}</Header>
|
<Header pageHeader>{$t('routes.admin.team.title')}</Header>
|
||||||
{#if data.site}
|
{#if data.site}
|
||||||
<EditableList on:action={(e) => removeAdmin(e.detail, false)}>
|
<ul>
|
||||||
{#snippet children({ action })}
|
{#if data.site.admins.length <= 0}
|
||||||
{#if data.site.admins.length <= 0}
|
<Placeholder
|
||||||
<Placeholder
|
icon={QuestionMarkCircle}
|
||||||
icon={QuestionMarkCircle}
|
title={$t('routes.admin.team.empty.title')}
|
||||||
title={$t('routes.admin.team.empty.title')}
|
description={$t('routes.admin.team.empty.description')}
|
||||||
description={$t('routes.admin.team.empty.description')}
|
/>
|
||||||
/>
|
{:else}
|
||||||
{:else}
|
{#each data.site?.admins ?? [] as admin}
|
||||||
{#each data.site?.admins ?? [] as admin}
|
<div class="py-3 flex items-center justify-between">
|
||||||
<div class="py-3 flex items-center justify-between">
|
<UserLink avatar showInstance={false} user={admin.person} />
|
||||||
<UserLink avatar showInstance={false} user={admin.person} />
|
<Button
|
||||||
<Button onclick={() => action(admin.person.id)} size="square-md">
|
onclick={() => {
|
||||||
<Icon src={Trash} mini size="16" />
|
removeAdmin(admin.person.id, false)
|
||||||
</Button>
|
}}
|
||||||
</div>
|
size="square-md"
|
||||||
{/each}
|
>
|
||||||
{/if}
|
<Icon src={Trash} mini size="16" />
|
||||||
{/snippet}
|
</Button>
|
||||||
</EditableList>
|
</div>
|
||||||
|
{/each}
|
||||||
|
{/if}
|
||||||
|
</ul>
|
||||||
<form
|
<form
|
||||||
class="flex flex-row items-center gap-2 mt-auto w-full"
|
class="flex flex-row items-center gap-2 mt-auto w-full"
|
||||||
onsubmit={preventDefault(() => {
|
onsubmit={preventDefault(() => {
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { preventDefault } from 'svelte/legacy'
|
|
||||||
|
|
||||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||||
import Avatar from '$lib/components/ui/Avatar.svelte'
|
import Avatar from '$lib/components/ui/Avatar.svelte'
|
||||||
import EditableList from '$lib/components/ui/list/EditableList.svelte'
|
|
||||||
import { Icon, Plus, Trash } from 'svelte-hero-icons'
|
import { Icon, Plus, Trash } from 'svelte-hero-icons'
|
||||||
import type { PageData } from './$types.js'
|
import type { PageData } from './$types.js'
|
||||||
import { profile } from '$lib/auth.svelte.js'
|
import { profile } from '$lib/auth.svelte.js'
|
||||||
@@ -108,41 +105,46 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Header pageHeader>Moderators</Header>
|
<Header pageHeader>Moderators</Header>
|
||||||
<EditableList
|
<ul class="divide-y divide-slate-200 dark:divide-zinc-800">
|
||||||
on:action={(e) => {
|
{#each data.community.moderators as moderator (moderator.moderator.id)}
|
||||||
toast({
|
<div
|
||||||
content: `Are you sure you want to remove ${e.detail.name} as a moderator?`,
|
class="py-4 flex items-center gap-2 justify-between"
|
||||||
action: () => removeMod(e.detail.id),
|
animate:flip={{ duration: 300 }}
|
||||||
})
|
>
|
||||||
}}
|
<div class="flex gap-2 items-center">
|
||||||
>
|
<Avatar
|
||||||
{#snippet children({ action })}
|
width={28}
|
||||||
{#each data.community.moderators as moderator (moderator.moderator.id)}
|
url={moderator.moderator.avatar}
|
||||||
<div
|
alt={moderator.moderator.name}
|
||||||
class="py-4 flex items-center gap-2 justify-between"
|
/>
|
||||||
animate:flip={{ duration: 300 }}
|
<div class="flex flex-col gap-0">
|
||||||
>
|
<UserLink user={moderator.moderator} showInstance={false} />
|
||||||
<div class="flex gap-2 items-center">
|
<span class="text-xs text-slate-600 dark:text-zinc-400">
|
||||||
<Avatar
|
{new URL(moderator.moderator.actor_id).hostname}
|
||||||
width={28}
|
</span>
|
||||||
url={moderator.moderator.avatar}
|
|
||||||
alt={moderator.moderator.name}
|
|
||||||
/>
|
|
||||||
<div class="flex flex-col gap-0">
|
|
||||||
<UserLink user={moderator.moderator} showInstance={false} />
|
|
||||||
<span class="text-xs text-slate-600 dark:text-zinc-400">
|
|
||||||
{new URL(moderator.moderator.actor_id).hostname}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<Button size="square-md" onclick={() => action(moderator.moderator)}>
|
|
||||||
<Icon src={Trash} mini size="16" />
|
|
||||||
</Button>
|
|
||||||
</div>
|
</div>
|
||||||
{/each}
|
<Button
|
||||||
{/snippet}
|
size="square-md"
|
||||||
</EditableList>
|
onclick={() => {
|
||||||
<form onsubmit={preventDefault(addModerator)} class="mt-auto flex gap-2 w-full">
|
toast({
|
||||||
|
content: `Are you sure you want to remove ${moderator.moderator.name} as a moderator?`,
|
||||||
|
action: () => removeMod(moderator.moderator.id),
|
||||||
|
})
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Icon src={Trash} mini size="16" />
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
{/each}
|
||||||
|
</ul>
|
||||||
|
<form
|
||||||
|
onsubmit={(e) => {
|
||||||
|
e.preventDefault()
|
||||||
|
addModerator()
|
||||||
|
}}
|
||||||
|
class="mt-auto flex gap-2 w-full"
|
||||||
|
>
|
||||||
<TextInput
|
<TextInput
|
||||||
bind:value={formData.newModerator}
|
bind:value={formData.newModerator}
|
||||||
class="w-full"
|
class="w-full"
|
||||||
|
|||||||
@@ -96,11 +96,11 @@
|
|||||||
label="Instance"
|
label="Instance"
|
||||||
class="flex-1"
|
class="flex-1"
|
||||||
q={page.url.searchParams.get('instance') || ''}
|
q={page.url.searchParams.get('instance') || ''}
|
||||||
on:select={(e) =>
|
onselect={(e) =>
|
||||||
searchParam(
|
searchParam(
|
||||||
page.url,
|
page.url,
|
||||||
'instance',
|
'instance',
|
||||||
e.detail?.domain.toString() ?? '',
|
e?.domain.toString() ?? '',
|
||||||
'page',
|
'page',
|
||||||
'community',
|
'community',
|
||||||
'user',
|
'user',
|
||||||
@@ -115,13 +115,8 @@
|
|||||||
label="Community"
|
label="Community"
|
||||||
class="flex-1"
|
class="flex-1"
|
||||||
q={page.url.searchParams.get('community') ? 'Selected' : ''}
|
q={page.url.searchParams.get('community') ? 'Selected' : ''}
|
||||||
on:select={(e) =>
|
onselect={(e) =>
|
||||||
searchParam(
|
searchParam(page.url, 'community', e?.id.toString() ?? '', 'page')}
|
||||||
page.url,
|
|
||||||
'community',
|
|
||||||
e.detail?.id.toString() ?? '',
|
|
||||||
'page',
|
|
||||||
)}
|
|
||||||
/>
|
/>
|
||||||
<UserAutocomplete
|
<UserAutocomplete
|
||||||
instance={page.url.searchParams.get('instance') || undefined}
|
instance={page.url.searchParams.get('instance') || undefined}
|
||||||
@@ -134,8 +129,8 @@
|
|||||||
q={page.url.searchParams.get('user')
|
q={page.url.searchParams.get('user')
|
||||||
? (data.filters.user ?? 'Selected')
|
? (data.filters.user ?? 'Selected')
|
||||||
: ''}
|
: ''}
|
||||||
on:select={(e) =>
|
onselect={(e) =>
|
||||||
searchParam(page.url, 'user', e.detail?.id.toString() ?? '', 'page')}
|
searchParam(page.url, 'user', e?.id.toString() ?? '', 'page')}
|
||||||
/>
|
/>
|
||||||
{#if $profile?.user && isAdmin($profile?.user)}
|
{#if $profile?.user && isAdmin($profile?.user)}
|
||||||
<UserAutocomplete
|
<UserAutocomplete
|
||||||
@@ -148,13 +143,8 @@
|
|||||||
q={page.url.searchParams.get('mod_id')
|
q={page.url.searchParams.get('mod_id')
|
||||||
? (data.filters.moderator ?? 'Selected')
|
? (data.filters.moderator ?? 'Selected')
|
||||||
: ''}
|
: ''}
|
||||||
on:select={(e) =>
|
onselect={(e) =>
|
||||||
searchParam(
|
searchParam(page.url, 'mod_id', e?.id.toString() ?? '', 'page')}
|
||||||
page.url,
|
|
||||||
'mod_id',
|
|
||||||
e.detail?.id.toString() ?? '',
|
|
||||||
'page',
|
|
||||||
)}
|
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
PersonBlockView,
|
PersonBlockView,
|
||||||
} from 'lemmy-js-client'
|
} from 'lemmy-js-client'
|
||||||
import type { PageData } from './$types.js'
|
import type { PageData } from './$types.js'
|
||||||
import EditableList from '$lib/components/ui/list/EditableList.svelte'
|
|
||||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||||
import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
|
import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
|
||||||
import { getClient } from '$lib/lemmy.js'
|
import { getClient } from '$lib/lemmy.js'
|
||||||
@@ -90,89 +89,83 @@
|
|||||||
{#if data.my_user?.instance_blocks && (data.my_user?.instance_blocks?.length ?? 0) > 0}
|
{#if data.my_user?.instance_blocks && (data.my_user?.instance_blocks?.length ?? 0) > 0}
|
||||||
<div>
|
<div>
|
||||||
<SectionTitle>{$t('content.instances')}</SectionTitle>
|
<SectionTitle>{$t('content.instances')}</SectionTitle>
|
||||||
<EditableList on:action={(i) => unblockInstances(i.detail)}>
|
<ul>
|
||||||
{#snippet children({ action })}
|
{#each data.my_user?.instance_blocks as block (block.instance.id)}
|
||||||
{#each data.my_user?.instance_blocks as block (block.instance.id)}
|
<div
|
||||||
<div
|
class="flex flex-row gap-2 items-center py-4"
|
||||||
class="flex flex-row gap-2 items-center py-4"
|
animate:flip={{ duration: 250 }}
|
||||||
animate:flip={{ duration: 250 }}
|
out:slide|local={{ axis: 'y' }}
|
||||||
out:slide|local={{ axis: 'y' }}
|
>
|
||||||
|
<Button
|
||||||
|
title="Unblock"
|
||||||
|
size="square-md"
|
||||||
|
rounding="pill"
|
||||||
|
onclick={() => unblockInstances(block)}
|
||||||
>
|
>
|
||||||
<Button
|
{#snippet prefix()}
|
||||||
title="Unblock"
|
<Icon src={XMark} mini size="16" />
|
||||||
size="square-md"
|
{/snippet}
|
||||||
rounding="pill"
|
</Button>
|
||||||
onclick={() => action(block)}
|
<Entity
|
||||||
>
|
icon={block.site?.icon}
|
||||||
{#snippet prefix()}
|
name={block.site?.name ?? block.instance.domain}
|
||||||
<Icon src={XMark} mini size="16" />
|
label={block.instance.domain}
|
||||||
{/snippet}
|
/>
|
||||||
</Button>
|
</div>
|
||||||
<Entity
|
{/each}
|
||||||
icon={block.site?.icon}
|
</ul>
|
||||||
name={block.site?.name ?? block.instance.domain}
|
|
||||||
label={block.instance.domain}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
{/each}
|
|
||||||
{/snippet}
|
|
||||||
</EditableList>
|
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
{#if data.community_blocks?.length > 0}
|
{#if data.community_blocks?.length > 0}
|
||||||
<div>
|
<div>
|
||||||
<SectionTitle>{$t('content.communities')}</SectionTitle>
|
<SectionTitle>{$t('content.communities')}</SectionTitle>
|
||||||
<EditableList on:action={(i) => unblockCommunity(i.detail)}>
|
<ul>
|
||||||
{#snippet children({ action })}
|
{#each data.community_blocks as block (block.community.id)}
|
||||||
{#each data.community_blocks as block (block.community.id)}
|
<div
|
||||||
<div
|
class="flex flex-row gap-2 items-center py-2"
|
||||||
class="flex flex-row gap-2 items-center py-2"
|
animate:flip={{ duration: 250 }}
|
||||||
animate:flip={{ duration: 250 }}
|
out:slide|global={{ axis: 'y', easing: expoOut, duration: 300 }}
|
||||||
out:slide|global={{ axis: 'y', easing: expoOut, duration: 300 }}
|
>
|
||||||
|
<Button
|
||||||
|
title="Unblock"
|
||||||
|
size="square-md"
|
||||||
|
rounding="pill"
|
||||||
|
onclick={() => unblockCommunity(block)}
|
||||||
>
|
>
|
||||||
<Button
|
{#snippet prefix()}
|
||||||
title="Unblock"
|
<Icon src={XMark} mini size="16" />
|
||||||
size="square-md"
|
{/snippet}
|
||||||
rounding="pill"
|
</Button>
|
||||||
onclick={() => action(block)}
|
<CommunityLink community={block.community} avatar />
|
||||||
>
|
</div>
|
||||||
{#snippet prefix()}
|
{/each}
|
||||||
<Icon src={XMark} mini size="16" />
|
</ul>
|
||||||
{/snippet}
|
|
||||||
</Button>
|
|
||||||
<CommunityLink community={block.community} avatar />
|
|
||||||
</div>
|
|
||||||
{/each}
|
|
||||||
{/snippet}
|
|
||||||
</EditableList>
|
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
{#if data.person_blocks?.length > 0}
|
{#if data.person_blocks?.length > 0}
|
||||||
<div>
|
<div>
|
||||||
<SectionTitle>{$t('content.users')}</SectionTitle>
|
<SectionTitle>{$t('content.users')}</SectionTitle>
|
||||||
<EditableList on:action={(i) => unblockUser(i.detail)}>
|
<ul>
|
||||||
{#snippet children({ action })}
|
{#each data.person_blocks as block (block.target.id)}
|
||||||
{#each data.person_blocks as block (block.target.id)}
|
<div
|
||||||
<div
|
class="flex flex-row gap-2 items-center py-2"
|
||||||
class="flex flex-row gap-2 items-center py-2"
|
animate:flip={{ duration: 250 }}
|
||||||
animate:flip={{ duration: 250 }}
|
out:slide|global={{ axis: 'y', easing: expoOut, duration: 300 }}
|
||||||
out:slide|global={{ axis: 'y', easing: expoOut, duration: 300 }}
|
>
|
||||||
|
<Button
|
||||||
|
title="Unblock"
|
||||||
|
size="square-md"
|
||||||
|
rounding="pill"
|
||||||
|
onclick={() => unblockUser(block)}
|
||||||
>
|
>
|
||||||
<Button
|
{#snippet prefix()}
|
||||||
title="Unblock"
|
<Icon src={XMark} mini size="16" />
|
||||||
size="square-md"
|
{/snippet}
|
||||||
rounding="pill"
|
</Button>
|
||||||
onclick={() => action(block)}
|
<UserLink user={block.target} avatar badges />
|
||||||
>
|
</div>
|
||||||
{#snippet prefix()}
|
{/each}
|
||||||
<Icon src={XMark} mini size="16" />
|
</ul>
|
||||||
{/snippet}
|
|
||||||
</Button>
|
|
||||||
<UserLink user={block.target} avatar badges />
|
|
||||||
</div>
|
|
||||||
{/each}
|
|
||||||
{/snippet}
|
|
||||||
</EditableList>
|
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
{:else}
|
{:else}
|
||||||
|
|||||||
@@ -99,9 +99,9 @@
|
|||||||
<Modal
|
<Modal
|
||||||
bind:open={deletion.modal}
|
bind:open={deletion.modal}
|
||||||
action="Submit"
|
action="Submit"
|
||||||
on:action={() => deleteAccount(4)}
|
onaction={() => deleteAccount(4)}
|
||||||
>
|
>
|
||||||
{#snippet title()}
|
{#snippet customTitle()}
|
||||||
<span>{$t('form.profile.deleteAccount.label')}</span>
|
<span>{$t('form.profile.deleteAccount.label')}</span>
|
||||||
{/snippet}
|
{/snippet}
|
||||||
<TextInput
|
<TextInput
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
<div animate:flip={{ duration: 500, easing: expoInOut }}>
|
<div animate:flip={{ duration: 500, easing: expoInOut }}>
|
||||||
<PictrsImage
|
<PictrsImage
|
||||||
image={image.local_image}
|
image={image.local_image}
|
||||||
on:delete={() => {
|
ondelete={() => {
|
||||||
data.images = data.images.toSpliced(
|
data.images = data.images.toSpliced(
|
||||||
data.images.findIndex(
|
data.images.findIndex(
|
||||||
(i) =>
|
(i) =>
|
||||||
|
|||||||
@@ -11,8 +11,6 @@
|
|||||||
import { createEventDispatcher } from 'svelte'
|
import { createEventDispatcher } from 'svelte'
|
||||||
import { ArrowDown, ArrowDownTray, Icon, Trash } from 'svelte-hero-icons'
|
import { ArrowDown, ArrowDownTray, Icon, Trash } from 'svelte-hero-icons'
|
||||||
|
|
||||||
const dispatch = createEventDispatcher<{ delete: boolean }>()
|
|
||||||
|
|
||||||
let loading = $state(false)
|
let loading = $state(false)
|
||||||
|
|
||||||
async function deleteImage(image: LocalImage) {
|
async function deleteImage(image: LocalImage) {
|
||||||
@@ -25,7 +23,7 @@
|
|||||||
filename: image.pictrs_alias,
|
filename: image.pictrs_alias,
|
||||||
})
|
})
|
||||||
|
|
||||||
dispatch('delete', res)
|
ondelete?.(res)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
toast({ content: e as any, type: 'error' })
|
toast({ content: e as any, type: 'error' })
|
||||||
}
|
}
|
||||||
@@ -34,9 +32,10 @@
|
|||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
image: LocalImage
|
image: LocalImage
|
||||||
|
ondelete?: (res: boolean) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
let { image }: Props = $props()
|
let { image, ondelete }: Props = $props()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="flex flex-col gap-1">
|
<div class="flex flex-col gap-1">
|
||||||
|
|||||||
@@ -139,8 +139,8 @@
|
|||||||
jwt={$profile?.jwt}
|
jwt={$profile?.jwt}
|
||||||
listing_type={'All'}
|
listing_type={'All'}
|
||||||
showWhenEmpty={true}
|
showWhenEmpty={true}
|
||||||
on:select={(c) =>
|
onselect={(c) =>
|
||||||
searchParam(page.url, 'community', c.detail?.id || undefined, 'page')}
|
searchParam(page.url, 'community', c?.id || undefined, 'page')}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -91,7 +91,7 @@
|
|||||||
{#if importing}
|
{#if importing}
|
||||||
<Modal
|
<Modal
|
||||||
bind:open={importing}
|
bind:open={importing}
|
||||||
on:action={() => {
|
onaction={() => {
|
||||||
try {
|
try {
|
||||||
if (importText == '') {
|
if (importText == '') {
|
||||||
throw new Error('Import is empty')
|
throw new Error('Import is empty')
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
{#if importing}
|
{#if importing}
|
||||||
<Modal
|
<Modal
|
||||||
bind:open={importing}
|
bind:open={importing}
|
||||||
on:action={() => {
|
onaction={() => {
|
||||||
try {
|
try {
|
||||||
if (importText == '') {
|
if (importText == '') {
|
||||||
throw new Error('Import is empty')
|
throw new Error('Import is empty')
|
||||||
|
|||||||
Reference in new issue
Block a user