migrate: switch to callbacks instead of events
This commit is contained in:
1 parent
c7e2963390
commit
b291aeebf8
67 files changed
+332
-357
No files matched your search
@@ -64,7 +64,7 @@
|
||||
{/each}
|
||||
</div>
|
||||
<Button
|
||||
on:click={() => clearErrorScope(scope)}
|
||||
onclick={() => clearErrorScope(scope)}
|
||||
color="tertiary"
|
||||
size="square-sm"
|
||||
class="ml-auto"
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
{#snippet noresults()}
|
||||
<div class="w-full h-full">
|
||||
{#if q == '' && showWhenEmpty}
|
||||
<MenuButton on:click={() => dispatcher('select', undefined)}>
|
||||
<MenuButton onclick={() => dispatcher('select', undefined)}>
|
||||
<Icon src={XCircle} size="16" mini />
|
||||
<div class="flex flex-col text-left">
|
||||
<span>None</span>
|
||||
@@ -66,7 +66,7 @@
|
||||
{/snippet}
|
||||
{#snippet children({ item, select })}
|
||||
<div in:fly|global={{ y: -4, opacity: 0 }}>
|
||||
<MenuButton on:click={() => select(item)}>
|
||||
<MenuButton onclick={() => select(item)}>
|
||||
<Avatar url={item.icon} alt={item.title} width={24} />
|
||||
<div class="flex flex-col text-left">
|
||||
<span>{item.title}</span>
|
||||
@@ -98,7 +98,7 @@
|
||||
{#snippet noresults()}
|
||||
<div class="w-full h-full">
|
||||
{#if q == '' && showWhenEmpty}
|
||||
<MenuButton on:click={() => dispatcher('select', undefined)}>
|
||||
<MenuButton onclick={() => dispatcher('select', undefined)}>
|
||||
<div class="flex flex-col text-left">
|
||||
<span>None (Start typing to search)</span>
|
||||
</div>
|
||||
@@ -110,7 +110,7 @@
|
||||
{/snippet}
|
||||
{#snippet children({ item, select })}
|
||||
<div in:fly|global={{ y: -4, opacity: 0 }}>
|
||||
<MenuButton on:click={() => select(item)}>
|
||||
<MenuButton onclick={() => select(item)}>
|
||||
<Icon src={ServerStack} size="16" mini />
|
||||
<div class="flex flex-col text-left">
|
||||
<span>{item.domain}</span>
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
color="tertiary"
|
||||
rounding="pill"
|
||||
class="text-slate-700 dark:text-zinc-300"
|
||||
on:click={() => (replying = !replying)}
|
||||
onclick={() => (replying = !replying)}
|
||||
disabled={comment.post.locked || disabled}
|
||||
>
|
||||
<Icon src={ChatBubbleOvalLeft} size="14" micro />
|
||||
@@ -92,7 +92,7 @@
|
||||
{/snippet}
|
||||
<MenuDivider>{$t('comment.actions.label')}</MenuDivider>
|
||||
<MenuButton
|
||||
on:click={() => {
|
||||
onclick={() => {
|
||||
navigator.share?.({
|
||||
url: comment.comment.ap_id,
|
||||
}) ?? navigator.clipboard.writeText(comment.comment.ap_id)
|
||||
@@ -103,7 +103,7 @@
|
||||
</MenuButton>
|
||||
{#if settings.translator}
|
||||
<MenuButton
|
||||
on:click={() => {
|
||||
onclick={() => {
|
||||
// @ts-ignore
|
||||
text.set(comment.comment.content)
|
||||
translating = !translating
|
||||
@@ -117,13 +117,13 @@
|
||||
{/if}
|
||||
{#if $profile?.jwt}
|
||||
{#if comment.creator.id == $profile.user?.local_user_view.person.id}
|
||||
<MenuButton on:click={() => dispatcher('edit', comment)}>
|
||||
<MenuButton onclick={() => dispatcher('edit', comment)}>
|
||||
<Icon src={PencilSquare} mini size="16" />
|
||||
<span>{$t('post.actions.more.edit')}</span>
|
||||
</MenuButton>
|
||||
{/if}
|
||||
<MenuButton
|
||||
on:click={async () => {
|
||||
onclick={async () => {
|
||||
if ($profile?.jwt)
|
||||
comment.saved = await save(comment, !comment.saved, $profile.jwt)
|
||||
}}
|
||||
@@ -136,7 +136,7 @@
|
||||
{#if $profile?.user && $profile.jwt && $profile.user.local_user_view.person.id == comment.creator.id}
|
||||
<MenuButton
|
||||
color="danger-subtle"
|
||||
on:click={async () => {
|
||||
onclick={async () => {
|
||||
if ($profile?.jwt)
|
||||
comment.comment.deleted = await deleteItem(
|
||||
comment,
|
||||
@@ -154,7 +154,7 @@
|
||||
</MenuButton>
|
||||
{/if}
|
||||
{#if $profile.jwt && $profile.user?.local_user_view.person.id != comment.creator.id}
|
||||
<MenuButton on:click={() => report(comment)} color="danger-subtle">
|
||||
<MenuButton onclick={() => report(comment)} color="danger-subtle">
|
||||
<Icon src={Flag} mini size="16" />
|
||||
<span>{$t('moderation.report')}</span>
|
||||
</MenuButton>
|
||||
|
||||
@@ -106,7 +106,7 @@
|
||||
<Button
|
||||
size="custom"
|
||||
title={$t('common.cancel')}
|
||||
on:click={() => dispatch('cancel', true)}
|
||||
onclick={() => dispatch('cancel', true)}
|
||||
color="tertiary"
|
||||
class="w-8 h-8"
|
||||
rounding="xl"
|
||||
@@ -114,7 +114,7 @@
|
||||
<Icon src={XMark} size="16" micro />
|
||||
</Button>
|
||||
<Button
|
||||
on:click={submit}
|
||||
onclick={submit}
|
||||
color="primary"
|
||||
{loading}
|
||||
disabled={locked || loading || banned}
|
||||
|
||||
@@ -137,7 +137,7 @@
|
||||
color="tertiary"
|
||||
class="font-normal text-slate-600 dark:text-zinc-400"
|
||||
loaderWidth={16}
|
||||
on:click={() => {
|
||||
onclick={() => {
|
||||
if (node.depth > 4) {
|
||||
goto(
|
||||
`/comment/${$page.params.instance}/${node.comment_view.comment.id}#comments`,
|
||||
|
||||
@@ -234,7 +234,7 @@
|
||||
color={community_view.subscribed == 'Subscribed'
|
||||
? 'secondary'
|
||||
: 'primary'}
|
||||
on:click={subscribe}
|
||||
onclick={subscribe}
|
||||
class="flex-1 relative z-[inherit]"
|
||||
>
|
||||
{#snippet prefix()}
|
||||
@@ -279,7 +279,7 @@
|
||||
<MenuButton
|
||||
color="danger-subtle"
|
||||
size="lg"
|
||||
on:click={() =>
|
||||
onclick={() =>
|
||||
block(community_view.community.id, !community_view.blocked)}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
@@ -293,7 +293,7 @@
|
||||
<MenuButton
|
||||
color="danger-subtle"
|
||||
size="lg"
|
||||
on:click={() => blockInstance(community_view.community.instance_id)}
|
||||
onclick={() => blockInstance(community_view.community.instance_id)}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={BuildingOffice2} size="16" mini />
|
||||
@@ -304,7 +304,7 @@
|
||||
{#if $profile?.user && isAdmin($profile.user)}
|
||||
<MenuButton
|
||||
color="danger-subtle"
|
||||
on:click={() =>
|
||||
onclick={() =>
|
||||
modal({
|
||||
title: $t('admin.purgeCommunity.title'),
|
||||
body: `${community_view.community.title}: ${$t('admin.purgeCommunity.warning')}`,
|
||||
|
||||
@@ -132,7 +132,7 @@ dark:border-zinc-800 border-slate-300 border-opacity-50 text-slate-700 dark:text
|
||||
loading={subscribing}
|
||||
size="lg"
|
||||
color={subscribed == 'NotSubscribed' ? 'primary' : 'secondary'}
|
||||
on:click={async () => {
|
||||
onclick={async () => {
|
||||
subscribed =
|
||||
(await subscribe())?.community_view.subscribed ??
|
||||
'NotSubscribed'
|
||||
@@ -186,7 +186,7 @@ dark:border-zinc-800 border-slate-300 border-opacity-50 text-slate-700 dark:text
|
||||
<MenuButton
|
||||
color="danger-subtle"
|
||||
size="lg"
|
||||
on:click={() => block(community.id, !blocked)}
|
||||
onclick={() => block(community.id, !blocked)}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={NoSymbol} size="16" mini />
|
||||
@@ -199,7 +199,7 @@ dark:border-zinc-800 border-slate-300 border-opacity-50 text-slate-700 dark:text
|
||||
<MenuButton
|
||||
color="danger-subtle"
|
||||
size="lg"
|
||||
on:click={() => blockInstance(community.instance_id)}
|
||||
onclick={() => blockInstance(community.instance_id)}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={BuildingOffice2} size="16" mini />
|
||||
@@ -210,7 +210,7 @@ dark:border-zinc-800 border-slate-300 border-opacity-50 text-slate-700 dark:text
|
||||
{#if $profile?.user && isAdmin($profile.user)}
|
||||
<MenuButton
|
||||
color="danger-subtle"
|
||||
on:click={() =>
|
||||
onclick={() =>
|
||||
modal({
|
||||
title: $t('admin.purgeCommunity.title'),
|
||||
body: `${community.title}: ${$t('admin.purgeCommunity.warning')}`,
|
||||
|
||||
@@ -98,7 +98,7 @@
|
||||
</div>
|
||||
</a>
|
||||
<div class="flex flex-row items-center gap-2">
|
||||
<Button size="square-md" on:click={() => (showInfo = !showInfo)}>
|
||||
<Button size="square-md" onclick={() => (showInfo = !showInfo)}>
|
||||
<Icon src={InformationCircle} size="16" micro />
|
||||
</Button>
|
||||
<Subscribe {community}>
|
||||
@@ -106,7 +106,7 @@
|
||||
<Button
|
||||
disabled={subscribing || !$profile?.jwt}
|
||||
loading={subscribing}
|
||||
on:click={async () => {
|
||||
onclick={async () => {
|
||||
const res = await subscribe()
|
||||
|
||||
if (res) {
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
{$t('moderation.label')}
|
||||
{/if}
|
||||
</MenuDivider>
|
||||
<MenuButton color="danger-subtle" on:click={() => remove(item)}>
|
||||
<MenuButton color="danger-subtle" onclick={() => remove(item)}>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Trash} size="16" mini />
|
||||
{/snippet}
|
||||
@@ -57,7 +57,7 @@
|
||||
<!--Comment made by someone else-->
|
||||
<MenuButton
|
||||
color="danger-subtle"
|
||||
on:click={() =>
|
||||
onclick={() =>
|
||||
ban(item.creator_banned_from_community, item.creator, item.community)}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
@@ -71,7 +71,7 @@
|
||||
<!--Comment made by self-->
|
||||
<MenuButton
|
||||
color="success-subtle"
|
||||
on:click={async () => {
|
||||
onclick={async () => {
|
||||
if (!$profile.jwt) return
|
||||
item.comment = (
|
||||
await feature(
|
||||
@@ -94,7 +94,7 @@
|
||||
|
||||
{#if $profile?.user && isAdmin($profile.user)}
|
||||
<MenuDivider>{$t('admin.label')}</MenuDivider>
|
||||
<MenuButton color="danger-subtle" on:click={() => remove(item, true)}>
|
||||
<MenuButton color="danger-subtle" onclick={() => remove(item, true)}>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Fire} size="16" mini />
|
||||
{/snippet}
|
||||
|
||||
@@ -97,7 +97,7 @@
|
||||
</MenuDivider>
|
||||
<MenuButton
|
||||
color="warning-subtle"
|
||||
on:click={() => lock(!item.post.locked)}
|
||||
onclick={() => lock(!item.post.locked)}
|
||||
loading={locking}
|
||||
disabled={locking}
|
||||
>
|
||||
@@ -109,7 +109,7 @@
|
||||
|
||||
<MenuButton
|
||||
color="success-subtle"
|
||||
on:click={() =>
|
||||
onclick={() =>
|
||||
pin(isPostView(item) ? !item.post.featured_community : false)}
|
||||
loading={pinning}
|
||||
disabled={pinning}
|
||||
@@ -128,7 +128,7 @@
|
||||
{/if}
|
||||
</div>
|
||||
</MenuButton>
|
||||
<MenuButton color="danger-subtle" on:click={() => remove(item)}>
|
||||
<MenuButton color="danger-subtle" onclick={() => remove(item)}>
|
||||
<Icon src={Trash} size="16" mini />
|
||||
{#if isCommentView(item)}
|
||||
{item.comment.removed
|
||||
@@ -141,7 +141,7 @@
|
||||
{#if $profile?.user && $profile.user.local_user_view.person.id != item.creator.id}
|
||||
<MenuButton
|
||||
color="danger-subtle"
|
||||
on:click={() =>
|
||||
onclick={() =>
|
||||
ban(item.creator_banned_from_community, item.creator, item.community)}
|
||||
>
|
||||
<Icon src={ShieldExclamation} size="16" mini />
|
||||
@@ -155,7 +155,7 @@
|
||||
<MenuDivider>{$t('admin.label')}</MenuDivider>
|
||||
<MenuButton
|
||||
color="success-subtle"
|
||||
on:click={() =>
|
||||
onclick={() =>
|
||||
pin(isPostView(item) ? !item.post.featured_local : false, true)}
|
||||
>
|
||||
<Icon src={Megaphone} size="16" mini />
|
||||
@@ -170,7 +170,7 @@
|
||||
<span class="text-xs opacity-80">{$t('admin.instance')}</span>
|
||||
</div>
|
||||
</MenuButton>
|
||||
<MenuButton color="danger-subtle" on:click={() => remove(item, true)}>
|
||||
<MenuButton color="danger-subtle" onclick={() => remove(item, true)}>
|
||||
<Icon src={Fire} size="16" mini />
|
||||
{$t('admin.purge')}
|
||||
</MenuButton>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
item?: PostView | CommentView | PrivateMessageView | undefined
|
||||
}
|
||||
|
||||
let { open = $bindable(), item = undefined }: Props = $props()
|
||||
let { open = $bindable(), item = $bindable() }: Props = $props()
|
||||
|
||||
const isComment = (
|
||||
item: PostView | CommentView | PrivateMessageView,
|
||||
|
||||
@@ -170,7 +170,7 @@
|
||||
{/await}
|
||||
{/if}
|
||||
<Button
|
||||
on:click={() => (debug = true)}
|
||||
onclick={() => (debug = true)}
|
||||
title="Debug"
|
||||
size="custom"
|
||||
color="ghost"
|
||||
@@ -196,7 +196,7 @@
|
||||
|
||||
{#if $profile?.jwt}
|
||||
<Button
|
||||
on:click={async () => {
|
||||
onclick={async () => {
|
||||
if (!$profile?.jwt) return
|
||||
saving = true
|
||||
post.saved = await save(post, !post.saved, $profile?.jwt)
|
||||
@@ -312,7 +312,7 @@
|
||||
{$t('post.actions.more.actions')}
|
||||
</MenuDivider>
|
||||
{#if $profile?.user && $profile?.jwt && $profile.user.local_user_view.person.id == post.creator.id}
|
||||
<MenuButton on:click={() => (editing = true)}>
|
||||
<MenuButton onclick={() => (editing = true)}>
|
||||
{#snippet prefix()}
|
||||
<Icon src={PencilSquare} size="16" micro />
|
||||
{/snippet}
|
||||
@@ -321,7 +321,7 @@
|
||||
{/if}
|
||||
{#if $profile?.jwt}
|
||||
<MenuButton
|
||||
on:click={async () => {
|
||||
onclick={async () => {
|
||||
if ($profile?.jwt)
|
||||
post.read = await markAsRead(post.post, !post.read, $profile.jwt)
|
||||
}}
|
||||
@@ -335,7 +335,7 @@
|
||||
</MenuButton>
|
||||
{/if}
|
||||
<MenuButton
|
||||
on:click={() => {
|
||||
onclick={() => {
|
||||
navigator.share?.({
|
||||
url: localShare
|
||||
? `${instanceToURL(getInstance())}/post/${post.post.id}`
|
||||
@@ -361,7 +361,7 @@
|
||||
color={!localShare ? 'primary' : 'secondary'}
|
||||
size="square-md"
|
||||
roundingSide="left"
|
||||
on:click={() => (localShare = false)}
|
||||
onclick={() => (localShare = false)}
|
||||
title={$t('filter.location.global')}
|
||||
>
|
||||
<Icon src={GlobeAmericas} size="16" micro />
|
||||
@@ -370,7 +370,7 @@
|
||||
color={localShare ? 'primary' : 'secondary'}
|
||||
size="square-md"
|
||||
roundingSide="right"
|
||||
on:click={() => (localShare = true)}
|
||||
onclick={() => (localShare = true)}
|
||||
title={$t('filter.location.local')}
|
||||
>
|
||||
<Icon src={MapPin} size="16" micro />
|
||||
@@ -380,7 +380,7 @@
|
||||
</MenuButton>
|
||||
{#if post.post.body && settings.translator}
|
||||
<MenuButton
|
||||
on:click={() => {
|
||||
onclick={() => {
|
||||
// @ts-ignore
|
||||
text.set(post.post.body)
|
||||
translating = !translating
|
||||
@@ -394,7 +394,7 @@
|
||||
{/if}
|
||||
{#if $profile?.jwt}
|
||||
<MenuButton
|
||||
on:click={() => {
|
||||
onclick={() => {
|
||||
setSessionStorage('postDraft', {
|
||||
body: `${
|
||||
settings.crosspostOriginalLink
|
||||
@@ -423,7 +423,7 @@
|
||||
</MenuButton>
|
||||
{#if $profile.user && post.creator.id == $profile.user.local_user_view.person.id}
|
||||
<MenuButton
|
||||
on:click={async () => {
|
||||
onclick={async () => {
|
||||
if ($profile?.jwt)
|
||||
post.post.deleted = await deleteItem(
|
||||
post,
|
||||
@@ -444,7 +444,7 @@
|
||||
{#if $profile.user?.local_user_view.person.id != post.creator.id}
|
||||
{#if feature('hidePosts', $site?.version)}
|
||||
<MenuButton
|
||||
on:click={async () => {
|
||||
onclick={async () => {
|
||||
if (!$profile?.jwt) return
|
||||
const hidden = await hidePost(
|
||||
post.post.id,
|
||||
@@ -466,7 +466,7 @@
|
||||
: $t('post.actions.more.hide')}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
<MenuButton on:click={() => report(post)} color="danger-subtle">
|
||||
<MenuButton onclick={() => report(post)} color="danger-subtle">
|
||||
{#snippet prefix()}
|
||||
<Icon src={Flag} width={16} micro />
|
||||
{/snippet}
|
||||
|
||||
@@ -51,7 +51,7 @@ ${view == 'list' ? `max-h-24` : 'max-h-48'}`
|
||||
<Markdown inline={!expanded} source={expanded ? body : body.slice(0, 1000)} />
|
||||
{#if overflows}
|
||||
<Button
|
||||
on:click={() => (expanded = !expanded)}
|
||||
onclick={() => (expanded = !expanded)}
|
||||
size="square-sm"
|
||||
color="tertiary"
|
||||
class="text-black dark:text-white absolute z-10 isolate pointer-events-auto bottom-0 {expanded
|
||||
|
||||
@@ -278,7 +278,7 @@
|
||||
color="primary"
|
||||
{loading}
|
||||
disabled={loading}
|
||||
on:click={() => loadMore()}
|
||||
onclick={() => loadMore()}
|
||||
>
|
||||
{$t('message.retry')}
|
||||
</Button>
|
||||
|
||||
@@ -295,7 +295,7 @@
|
||||
<span class="font-medium text-sm">{$t('form.post.community')}</span>
|
||||
<Button
|
||||
class="w-full !bg-white dark:!bg-black h-[38px]"
|
||||
on:click={() => (data.community = null)}
|
||||
onclick={() => (data.community = null)}
|
||||
alignment="left"
|
||||
size="sm"
|
||||
>
|
||||
@@ -347,7 +347,7 @@
|
||||
</div>
|
||||
{#if data.url}
|
||||
<Button
|
||||
on:click={() => (addAltText = !addAltText)}
|
||||
onclick={() => (addAltText = !addAltText)}
|
||||
rounding="pill"
|
||||
size="sm"
|
||||
color="ghost"
|
||||
@@ -359,7 +359,7 @@
|
||||
</Button>
|
||||
{/if}
|
||||
<Button
|
||||
on:click={() => (uploadingImage = !uploadingImage)}
|
||||
onclick={() => (uploadingImage = !uploadingImage)}
|
||||
rounding="pill"
|
||||
size="sm"
|
||||
color="ghost"
|
||||
@@ -372,7 +372,7 @@
|
||||
</Button>
|
||||
{#if generation.generatable}
|
||||
<Button
|
||||
on:click={() => generateTitle(data.url)}
|
||||
onclick={() => generateTitle(data.url)}
|
||||
loading={generation.loading}
|
||||
rounding="pill"
|
||||
size="sm"
|
||||
@@ -391,7 +391,7 @@
|
||||
<div class="flex flex-row gap-2 flex-wrap">
|
||||
{#if data.url === undefined}
|
||||
<Button
|
||||
on:click={async () => {
|
||||
onclick={async () => {
|
||||
data.url = ''
|
||||
try {
|
||||
const url = new URL(await navigator.clipboard.readText())
|
||||
@@ -406,7 +406,7 @@
|
||||
{$t('form.post.addUrl')}
|
||||
</Button>
|
||||
<Button
|
||||
on:click={() => {
|
||||
onclick={() => {
|
||||
data.url = ''
|
||||
uploadingImage = true
|
||||
}}
|
||||
@@ -418,7 +418,7 @@
|
||||
</Button>
|
||||
{/if}
|
||||
{#if data.language_id === undefined}
|
||||
<Button size="sm" rounding="pill" on:click={() => (data.language_id = 0)}>
|
||||
<Button size="sm" rounding="pill" onclick={() => (data.language_id = 0)}>
|
||||
<Icon src={Language} size="16" micro />
|
||||
{$t('form.post.setLanguage')}
|
||||
</Button>
|
||||
@@ -466,7 +466,7 @@
|
||||
|
||||
{#if !edit}
|
||||
<Button
|
||||
on:click={() => {
|
||||
onclick={() => {
|
||||
toast({ content: $t('toast.restoredFromDraft') })
|
||||
const draft = getSessionStorage('postDraft')
|
||||
if (draft && !edit) {
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
{/each}
|
||||
<MenuDivider>{$t('post.actions.link.actions')}</MenuDivider>
|
||||
<MenuButton
|
||||
on:click={() => {
|
||||
onclick={() => {
|
||||
navigator?.share?.({ url: url }) ?? navigator?.clipboard?.writeText?.(url)
|
||||
|
||||
toast({ content: $t('toast.copied') })
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
>
|
||||
{#if post.alt_text}
|
||||
<Button
|
||||
on:click={(e) => {
|
||||
onclick={(e) => {
|
||||
e.stopPropagation()
|
||||
modal({
|
||||
title: 'Alt',
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
{#snippet noresults()}
|
||||
<div class="w-full h-full">
|
||||
{#if showWhenEmpty}
|
||||
<MenuButton on:click={() => dispatcher('select', undefined)}>
|
||||
<MenuButton onclick={() => dispatcher('select', undefined)}>
|
||||
<Icon src={XCircle} size="16" mini />
|
||||
<div class="flex flex-col text-left">
|
||||
<span>None</span>
|
||||
@@ -60,7 +60,7 @@
|
||||
{/snippet}
|
||||
{#snippet children({ item, select })}
|
||||
<div in:fly|global={{ y: -4, opacity: 0 }}>
|
||||
<MenuButton on:click={() => select(item)}>
|
||||
<MenuButton onclick={() => select(item)}>
|
||||
<Avatar url={item.avatar} alt={item.name} width={24} />
|
||||
<div class="flex flex-col text-left">
|
||||
<span>{item.name}</span>
|
||||
|
||||
@@ -165,63 +165,63 @@ overflow-hidden transition-colors {clazz}"
|
||||
: ''}"
|
||||
>
|
||||
<Button
|
||||
on:click={() => wrapSelection('**', '**')}
|
||||
onclick={() => wrapSelection('**', '**')}
|
||||
title="Bold"
|
||||
size="square-md"
|
||||
>
|
||||
<Icon src={Bold} size="16" mini />
|
||||
</Button>
|
||||
<Button
|
||||
on:click={() => wrapSelection('*', '*')}
|
||||
onclick={() => wrapSelection('*', '*')}
|
||||
title="Italic"
|
||||
size="square-md"
|
||||
>
|
||||
<Icon src={Italic} size="16" micro />
|
||||
</Button>
|
||||
<Button
|
||||
on:click={() => wrapSelection('[', '](https://example.com)')}
|
||||
onclick={() => wrapSelection('[', '](https://example.com)')}
|
||||
title="Link"
|
||||
size="square-md"
|
||||
>
|
||||
<Icon src={Link} size="16" micro />
|
||||
</Button>
|
||||
<Button
|
||||
on:click={() => wrapSelection('\n# ', '')}
|
||||
onclick={() => wrapSelection('\n# ', '')}
|
||||
title="Header"
|
||||
size="square-md"
|
||||
>
|
||||
<Icon src={H1} size="16" micro />
|
||||
</Button>
|
||||
<Button
|
||||
on:click={() => wrapSelection('~~', '~~')}
|
||||
onclick={() => wrapSelection('~~', '~~')}
|
||||
title="Strikethrough"
|
||||
size="square-md"
|
||||
>
|
||||
<Icon src={Strikethrough} size="16" micro />
|
||||
</Button>
|
||||
<Button
|
||||
on:click={() => wrapSelection('\n> ', '')}
|
||||
onclick={() => wrapSelection('\n> ', '')}
|
||||
title="Quote"
|
||||
size="square-md"
|
||||
>
|
||||
<span class="font-bold font-serif text-lg">"</span>
|
||||
</Button>
|
||||
<Button
|
||||
on:click={() => wrapSelection('\n- ', '')}
|
||||
onclick={() => wrapSelection('\n- ', '')}
|
||||
title="List"
|
||||
size="square-md"
|
||||
>
|
||||
<Icon src={ListBullet} micro size="16" />
|
||||
</Button>
|
||||
<Button
|
||||
on:click={() => wrapSelection('`', '`')}
|
||||
onclick={() => wrapSelection('`', '`')}
|
||||
title="Code"
|
||||
size="square-md"
|
||||
>
|
||||
<Icon src={CodeBracket} micro size="16" />
|
||||
</Button>
|
||||
<Button
|
||||
on:click={() =>
|
||||
onclick={() =>
|
||||
wrapSelection('::: spoiler <spoiler title>\n', '\n:::')}
|
||||
title="Spoiler"
|
||||
size="square-md"
|
||||
@@ -229,7 +229,7 @@ overflow-hidden transition-colors {clazz}"
|
||||
<Icon src={ExclamationTriangle} micro size="16" />
|
||||
</Button>
|
||||
<Button
|
||||
on:click={() => wrapSelection('~', '~')}
|
||||
onclick={() => wrapSelection('~', '~')}
|
||||
title="Subscript"
|
||||
size="square-md"
|
||||
>
|
||||
@@ -239,7 +239,7 @@ overflow-hidden transition-colors {clazz}"
|
||||
</span>
|
||||
</Button>
|
||||
<Button
|
||||
on:click={() => wrapSelection('^', '^')}
|
||||
onclick={() => wrapSelection('^', '^')}
|
||||
title="Superscript"
|
||||
size="square-md"
|
||||
>
|
||||
@@ -250,7 +250,7 @@ overflow-hidden transition-colors {clazz}"
|
||||
</Button>
|
||||
{#if images}
|
||||
<Button
|
||||
on:click={() => (uploadingImage = !uploadingImage)}
|
||||
onclick={() => (uploadingImage = !uploadingImage)}
|
||||
title="Image"
|
||||
size="square-md"
|
||||
>
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
<Button
|
||||
size="square-sm"
|
||||
color="tertiary"
|
||||
on:click={() => {
|
||||
onclick={() => {
|
||||
navigator?.clipboard?.writeText(codeblock.code)
|
||||
toast({ content: $t('toast.copied') })
|
||||
}}
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
<Modal title={$t('post.actions.more.translate')} bind:open>
|
||||
<TextArea bind:value={$text} rows={2}>
|
||||
{#snippet suffix()}
|
||||
<Button on:click={() => translate($text)} color="primary">
|
||||
<Button onclick={() => translate($text)} color="primary">
|
||||
{$t('post.actions.more.translate')}
|
||||
</Button>
|
||||
{/snippet}
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
rounding="full"
|
||||
padding="none"
|
||||
color="uniform"
|
||||
on:click={(e) => e.stopPropagation()}
|
||||
onclick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<Button
|
||||
download
|
||||
@@ -102,7 +102,7 @@
|
||||
<Icon src={ArrowDownTray} size="20" micro />
|
||||
</Button>
|
||||
<Button
|
||||
on:click={async () => {
|
||||
onclick={async () => {
|
||||
if (navigator.share) {
|
||||
const file = await downloadImage($page.state.openImage)
|
||||
|
||||
@@ -125,7 +125,7 @@
|
||||
{/snippet}
|
||||
</Button>
|
||||
<Button
|
||||
on:click={() => {
|
||||
onclick={() => {
|
||||
zoomed = !zoomed
|
||||
}}
|
||||
color="tertiary"
|
||||
@@ -140,7 +140,7 @@
|
||||
/>
|
||||
</Button>
|
||||
<Button
|
||||
on:click={() => history.back()}
|
||||
onclick={() => history.back()}
|
||||
color="tertiary"
|
||||
size="square-lg"
|
||||
rounding="pill"
|
||||
|
||||
@@ -13,18 +13,18 @@
|
||||
import { fly } from 'svelte/transition'
|
||||
|
||||
interface Props {
|
||||
page?: number;
|
||||
cursor?: { next?: string; back?: string } | undefined;
|
||||
hasMore?: boolean;
|
||||
children?: import('svelte').Snippet;
|
||||
page?: number
|
||||
cursor?: { next?: string; back?: string } | undefined
|
||||
hasMore?: boolean
|
||||
children?: import('svelte').Snippet
|
||||
}
|
||||
|
||||
let {
|
||||
page = $bindable(0),
|
||||
cursor = undefined,
|
||||
hasMore = true,
|
||||
children
|
||||
}: Props = $props();
|
||||
children,
|
||||
}: Props = $props()
|
||||
|
||||
const dispatcher = createEventDispatcher<{ change: number; cursor: string }>()
|
||||
</script>
|
||||
@@ -41,7 +41,7 @@
|
||||
{/if}
|
||||
<Button
|
||||
color="ghost"
|
||||
on:click={() => {
|
||||
onclick={() => {
|
||||
if (cursor?.back) dispatcher('cursor', cursor?.back)
|
||||
else dispatcher('change', --page)
|
||||
}}
|
||||
@@ -52,8 +52,8 @@
|
||||
disabled={(!cursor?.back && cursor?.next) || page <= 1}
|
||||
>
|
||||
{#snippet suffix()}
|
||||
<Icon src={ChevronLeft} size="24" mini />
|
||||
{/snippet}
|
||||
<Icon src={ChevronLeft} size="24" mini />
|
||||
{/snippet}
|
||||
</Button>
|
||||
|
||||
{#if page}
|
||||
@@ -73,7 +73,7 @@
|
||||
|
||||
<Button
|
||||
color="ghost"
|
||||
on:click={() => {
|
||||
onclick={() => {
|
||||
if (cursor?.next) dispatcher('cursor', cursor?.next)
|
||||
else dispatcher('change', ++page)
|
||||
}}
|
||||
@@ -84,7 +84,7 @@
|
||||
disabled={!hasMore}
|
||||
>
|
||||
{#snippet suffix()}
|
||||
<Icon src={ChevronRight} size="24" mini />
|
||||
{/snippet}
|
||||
<Icon src={ChevronRight} size="24" mini />
|
||||
{/snippet}
|
||||
</Button>
|
||||
</nav>
|
||||
@@ -4,18 +4,15 @@
|
||||
import { Icon, type IconSource } from 'svelte-hero-icons'
|
||||
import { dockProps } from '../layout/Shell.svelte'
|
||||
|
||||
|
||||
|
||||
|
||||
interface Props {
|
||||
label: string;
|
||||
icon?: IconSource | undefined;
|
||||
href?: string | undefined;
|
||||
adaptive?: boolean;
|
||||
isSelectedFilter?: (path: string) => boolean;
|
||||
class?: string;
|
||||
customIcon?: import('svelte').Snippet<[any]>;
|
||||
children?: import('svelte').Snippet;
|
||||
label: string
|
||||
icon?: IconSource | undefined
|
||||
href?: string | undefined
|
||||
adaptive?: boolean
|
||||
isSelectedFilter?: (path: string) => boolean
|
||||
class?: string
|
||||
customIcon?: import('svelte').Snippet<[any]>
|
||||
children?: import('svelte').Snippet
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
@@ -24,14 +21,13 @@
|
||||
icon = undefined,
|
||||
href = undefined,
|
||||
adaptive = true,
|
||||
isSelectedFilter = (path) =>
|
||||
href != undefined && path == href,
|
||||
isSelectedFilter = (path) => href != undefined && path == href,
|
||||
class: clazz = '',
|
||||
customIcon,
|
||||
children,
|
||||
...rest
|
||||
}: Props = $props();
|
||||
|
||||
}: Props = $props()
|
||||
|
||||
let isSelected = $derived(isSelectedFilter($page.url.pathname))
|
||||
let isPanel = $derived(adaptive ? $dockProps.noGap : false)
|
||||
</script>
|
||||
@@ -39,7 +35,7 @@
|
||||
<Button
|
||||
color={isPanel ? 'secondary' : 'tertiary'}
|
||||
{...rest}
|
||||
on:click
|
||||
onclick
|
||||
on:contextmenu
|
||||
class="rounded-full w-10 h-10 flex-shrink-0 {adaptive
|
||||
? '@3xl:h-8 @3xl:px-3 @3xl:rounded-[10px] @3xl:w-auto'
|
||||
@@ -60,7 +56,7 @@
|
||||
size={isPanel ? '16' : '18'}
|
||||
/>
|
||||
{:else}
|
||||
{@render customIcon?.({ size: isPanel ? 16 : 18, isSelected, })}
|
||||
{@render customIcon?.({ size: isPanel ? 16 : 18, isSelected })}
|
||||
{/if}
|
||||
<span class="hidden {adaptive ? '@3xl:block' : ''}">{label}</span>
|
||||
{@render children?.()}
|
||||
|
||||
@@ -209,7 +209,7 @@
|
||||
</button>
|
||||
</div>
|
||||
<Button
|
||||
on:click={() => (showInstance = !showInstance)}
|
||||
onclick={() => (showInstance = !showInstance)}
|
||||
color="tertiary"
|
||||
title={$t('nav.menu.instance')}
|
||||
size="square-md"
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
<Button
|
||||
href={action.href}
|
||||
on:click
|
||||
onclick
|
||||
alignment="left"
|
||||
color="tertiary"
|
||||
size="lg"
|
||||
|
||||
@@ -278,7 +278,7 @@
|
||||
<li>
|
||||
<CommandItem
|
||||
{action}
|
||||
on:click={(e) => {
|
||||
onclick={(e) => {
|
||||
if (action.href) {
|
||||
togglePalette()
|
||||
return
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
class="hidden group-hover:inline-flex opacity-0 group-hover:opacity-100 transition-all z-20
|
||||
items-center justify-center box-border w-7 h-7"
|
||||
style="grid-column: 1; grid-row: 1;"
|
||||
on:click={() => addFavorite(follow)}
|
||||
onclick={() => addFavorite(follow)}
|
||||
>
|
||||
<Icon src={Star} size="16" mini />
|
||||
</Button>
|
||||
@@ -43,7 +43,7 @@
|
||||
class="hidden group-hover:inline-flex opacity-0 group-hover:opacity-100 transition-all z-20
|
||||
items-center justify-center box-border w-7 h-7"
|
||||
style="grid-column: 1; grid-row: 1;"
|
||||
on:click={() => addFavorite(follow, false)}
|
||||
onclick={() => addFavorite(follow, false)}
|
||||
>
|
||||
<Icon src={Trash} size="16" mini />
|
||||
</Button>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
loading={switching}
|
||||
loaderWidth={20}
|
||||
selected={$profile?.id == prof.id}
|
||||
on:click={async () => {
|
||||
onclick={async () => {
|
||||
switching = true
|
||||
|
||||
if ($profile?.id != prof.id) {
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
{#each settings.dock.pins as pin}
|
||||
<SidebarButton
|
||||
icon={iconOfLink(pin.url)}
|
||||
on:click={() => goto(pin.url)}
|
||||
onclick={() => goto(pin.url)}
|
||||
alignment="center"
|
||||
selected={`${$page.url.pathname}${$page.url.search}` == pin.url}
|
||||
on:contextmenu={(e) => {
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
alignment="left"
|
||||
{...rest}
|
||||
{href}
|
||||
on:click
|
||||
onclick
|
||||
on:contextmenu
|
||||
class="font-normal block !origin-left border border-transparent {!selected
|
||||
? 'text-slate-600 dark:text-zinc-400'
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
in:fly={{ duration: 300, easing: expoOut, y: 6, delay: 100 }}
|
||||
>
|
||||
<Button
|
||||
on:click={() => {
|
||||
onclick={() => {
|
||||
filters.clear()
|
||||
filters = filters
|
||||
}}
|
||||
@@ -51,7 +51,7 @@
|
||||
{/if}
|
||||
{#each uniqueIds as id}
|
||||
<Button
|
||||
on:click={() => {
|
||||
onclick={() => {
|
||||
if (filters.has(id)) filters.delete(id)
|
||||
else filters.add(id)
|
||||
filters = filters
|
||||
|
||||
@@ -65,9 +65,6 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import { createBubbler } from 'svelte/legacy';
|
||||
|
||||
const bubble = createBubbler();
|
||||
import Spinner from '../loader/Spinner.svelte'
|
||||
|
||||
type ButtonRoundness = 'pill' | 'xl' | 'lg' | 'md' | 'none'
|
||||
@@ -115,27 +112,23 @@
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
interface Props {
|
||||
loading?: boolean;
|
||||
submit?: boolean;
|
||||
color?: ButtonColor;
|
||||
size?: ButtonSize;
|
||||
rounding?: ButtonRoundness;
|
||||
roundingSide?: ButtonRoundingSide;
|
||||
alignment?: ButtonAlignment;
|
||||
shadow?: ButtonShadow;
|
||||
column?: boolean;
|
||||
animations?: any;
|
||||
loaderWidth?: number | undefined;
|
||||
href?: string | undefined;
|
||||
class?: string;
|
||||
prefix?: import('svelte').Snippet;
|
||||
children?: import('svelte').Snippet;
|
||||
suffix?: import('svelte').Snippet;
|
||||
loading?: boolean
|
||||
submit?: boolean
|
||||
color?: ButtonColor
|
||||
size?: ButtonSize
|
||||
rounding?: ButtonRoundness
|
||||
roundingSide?: ButtonRoundingSide
|
||||
alignment?: ButtonAlignment
|
||||
shadow?: ButtonShadow
|
||||
column?: boolean
|
||||
animations?: any
|
||||
loaderWidth?: number | undefined
|
||||
href?: string | undefined
|
||||
class?: string
|
||||
prefix?: import('svelte').Snippet
|
||||
children?: import('svelte').Snippet
|
||||
suffix?: import('svelte').Snippet
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
@@ -150,9 +143,9 @@
|
||||
shadow = 'none',
|
||||
column = false,
|
||||
animations = {
|
||||
scale: false,
|
||||
large: false,
|
||||
},
|
||||
scale: false,
|
||||
large: false,
|
||||
},
|
||||
loaderWidth = undefined,
|
||||
href = undefined,
|
||||
class: clazz = '',
|
||||
@@ -160,8 +153,7 @@
|
||||
children,
|
||||
suffix,
|
||||
...rest
|
||||
}: Props = $props();
|
||||
|
||||
}: Props = $props()
|
||||
</script>
|
||||
|
||||
<svelte:element
|
||||
@@ -169,12 +161,6 @@
|
||||
role={href ? 'link' : 'button'}
|
||||
{href}
|
||||
{...rest}
|
||||
onclick={bubble('click')}
|
||||
oncontextmenu={bubble('contextmenu')}
|
||||
ondrag={bubble('drag')}
|
||||
ondrop={bubble('drop')}
|
||||
ondragstart={bubble('dragstart')}
|
||||
ondragend={bubble('dragend')}
|
||||
class="
|
||||
{loading ? buttonColor.secondary : buttonColor[color]}
|
||||
{buttonSize[size]}
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
import { Check, Icon, Clipboard } from 'svelte-hero-icons'
|
||||
import { scale } from 'svelte/transition'
|
||||
|
||||
|
||||
let copied = $state(false)
|
||||
|
||||
let pre: HTMLPreElement = $state()
|
||||
@@ -18,11 +17,11 @@
|
||||
}
|
||||
|
||||
interface Props {
|
||||
src: string;
|
||||
filename?: string | undefined;
|
||||
htmlSrc?: string | undefined;
|
||||
children?: import('svelte').Snippet;
|
||||
class?: string;
|
||||
src: string
|
||||
filename?: string | undefined
|
||||
htmlSrc?: string | undefined
|
||||
children?: import('svelte').Snippet
|
||||
class?: string
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
@@ -33,8 +32,7 @@
|
||||
children,
|
||||
class: clazz = '',
|
||||
...rest
|
||||
}: Props = $props();
|
||||
|
||||
}: Props = $props()
|
||||
</script>
|
||||
|
||||
<Material
|
||||
@@ -51,7 +49,7 @@
|
||||
size="square-sm"
|
||||
color="tertiary"
|
||||
aria-label="Copy"
|
||||
on:click={() => {
|
||||
onclick={() => {
|
||||
copied = true
|
||||
copy()
|
||||
setTimeout(() => (copied = false), 2000)
|
||||
|
||||
@@ -3,21 +3,18 @@
|
||||
import { Check, Icon, Clipboard } from 'svelte-hero-icons'
|
||||
import { scale } from 'svelte/transition'
|
||||
|
||||
|
||||
|
||||
let copied = $state(false)
|
||||
|
||||
interface Props {
|
||||
/**
|
||||
* Show a copy button.
|
||||
*/
|
||||
value: string;
|
||||
copy?: boolean;
|
||||
class?: string;
|
||||
* Show a copy button.
|
||||
*/
|
||||
value: string
|
||||
copy?: boolean
|
||||
class?: string
|
||||
}
|
||||
|
||||
let { value, copy = true, class: clazz = '' }: Props = $props();
|
||||
|
||||
let { value, copy = true, class: clazz = '' }: Props = $props()
|
||||
</script>
|
||||
|
||||
<div
|
||||
@@ -32,7 +29,7 @@
|
||||
size="square-md"
|
||||
color="tertiary"
|
||||
aria-label="Copy"
|
||||
on:click={() => {
|
||||
onclick={() => {
|
||||
copied = true
|
||||
navigator.clipboard.writeText(value)
|
||||
setTimeout(() => (copied = false), 2000)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { run, createBubbler } from 'svelte/legacy';
|
||||
import { run, createBubbler } from 'svelte/legacy'
|
||||
|
||||
const bubble = createBubbler();
|
||||
const bubble = createBubbler()
|
||||
import {
|
||||
buttonColor,
|
||||
buttonSize,
|
||||
@@ -24,12 +24,11 @@
|
||||
|
||||
type T = $$Generic
|
||||
|
||||
|
||||
|
||||
let open = $state(false)
|
||||
let element: HTMLSelectElement | undefined = $state()
|
||||
|
||||
let options: { value: any; label: string | null; disabled: boolean }[] = $state([])
|
||||
let options: { value: any; label: string | null; disabled: boolean }[] =
|
||||
$state([])
|
||||
|
||||
// Capture all options from the select element
|
||||
run(() => {
|
||||
@@ -40,7 +39,7 @@
|
||||
disabled: option.disabled,
|
||||
}))
|
||||
: []
|
||||
});
|
||||
})
|
||||
|
||||
const dispatcher = createEventDispatcher<{
|
||||
change: any
|
||||
@@ -48,16 +47,16 @@
|
||||
input: any
|
||||
}>()
|
||||
interface Props {
|
||||
value?: T | undefined;
|
||||
placeholder?: string | undefined;
|
||||
label?: string | undefined;
|
||||
size?: ButtonSize;
|
||||
shadow?: ButtonShadow;
|
||||
id?: string;
|
||||
class?: string;
|
||||
customLabel?: import('svelte').Snippet;
|
||||
children?: import('svelte').Snippet;
|
||||
customOption?: import('svelte').Snippet<[any]>;
|
||||
value?: T | undefined
|
||||
placeholder?: string | undefined
|
||||
label?: string | undefined
|
||||
size?: ButtonSize
|
||||
shadow?: ButtonShadow
|
||||
id?: string
|
||||
class?: string
|
||||
customLabel?: import('svelte').Snippet
|
||||
children?: import('svelte').Snippet
|
||||
customOption?: import('svelte').Snippet<[any]>
|
||||
}
|
||||
|
||||
let {
|
||||
@@ -70,9 +69,8 @@
|
||||
class: clazz = '',
|
||||
customLabel,
|
||||
children,
|
||||
customOption
|
||||
}: Props = $props();
|
||||
|
||||
customOption,
|
||||
}: Props = $props()
|
||||
</script>
|
||||
|
||||
<div class="flex flex-col gap-1 {clazz}">
|
||||
@@ -85,8 +83,7 @@
|
||||
<div class="w-full relative">
|
||||
<Menu bind:open>
|
||||
{#snippet target()}
|
||||
<select
|
||||
|
||||
<select
|
||||
{id}
|
||||
bind:this={element}
|
||||
class="{buttonSize[size]} {buttonShadow[
|
||||
@@ -96,12 +93,12 @@
|
||||
{clazz}"
|
||||
bind:value
|
||||
onmousedown={(e) => {
|
||||
e.preventDefault()
|
||||
}}
|
||||
e.preventDefault()
|
||||
}}
|
||||
onkeypress={(e) => {
|
||||
e.preventDefault()
|
||||
open = !open
|
||||
}}
|
||||
e.preventDefault()
|
||||
open = !open
|
||||
}}
|
||||
onchange={bubble('change')}
|
||||
oncontextmenu={bubble('contextmenu')}
|
||||
{placeholder}
|
||||
@@ -111,13 +108,16 @@
|
||||
{/if}
|
||||
{@render children?.()}
|
||||
</select>
|
||||
{/snippet}
|
||||
{/snippet}
|
||||
|
||||
{#each options as option}
|
||||
{#if customOption}{@render customOption({ option, selected: option.value == value, })}{:else}
|
||||
{#if customOption}{@render customOption({
|
||||
option,
|
||||
selected: option.value == value,
|
||||
})}{:else}
|
||||
<MenuButton
|
||||
on:contextmenu={() => dispatcher('contextmenu')}
|
||||
on:click={() => {
|
||||
onclick={() => {
|
||||
value = option.value
|
||||
dispatcher('change')
|
||||
}}
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
import Portal from '../popover/Portal.svelte'
|
||||
|
||||
interface Props {
|
||||
action?: string | undefined;
|
||||
open?: boolean;
|
||||
title?: string | undefined;
|
||||
dismissable?: boolean;
|
||||
customTitle?: import('svelte').Snippet;
|
||||
children?: import('svelte').Snippet;
|
||||
actions?: import('svelte').Snippet<[any]>;
|
||||
action?: string | undefined
|
||||
open?: boolean
|
||||
title?: string | undefined
|
||||
dismissable?: boolean
|
||||
customTitle?: import('svelte').Snippet
|
||||
children?: import('svelte').Snippet
|
||||
actions?: import('svelte').Snippet<[any]>
|
||||
}
|
||||
|
||||
let {
|
||||
@@ -24,8 +24,8 @@
|
||||
dismissable = true,
|
||||
customTitle,
|
||||
children,
|
||||
actions
|
||||
}: Props = $props();
|
||||
actions,
|
||||
}: Props = $props()
|
||||
|
||||
let el: any = $state()
|
||||
|
||||
@@ -70,14 +70,14 @@ bg-white/50 dark:bg-black/50 box-border p-4"
|
||||
class="absolute top-0 right-0 m-2 text-slate-600 dark:text-zinc-400"
|
||||
color="tertiary"
|
||||
size="square-sm"
|
||||
on:click={() => {
|
||||
onclick={() => {
|
||||
open = false
|
||||
dispatcher('dismissed')
|
||||
}}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={XMark} size="20" mini />
|
||||
{/snippet}
|
||||
<Icon src={XMark} size="20" mini />
|
||||
{/snippet}
|
||||
</Button>
|
||||
{/if}
|
||||
<h1 class="font-semibold text-xl max-w-full">
|
||||
@@ -90,10 +90,10 @@ bg-white/50 dark:bg-black/50 box-border p-4"
|
||||
{@render children?.()}
|
||||
{#if action}
|
||||
<div class="mt-2 flex w-full">
|
||||
{#if actions}{@render actions({ action, })}{:else}
|
||||
{#if actions}{@render actions({ action })}{:else}
|
||||
<Button
|
||||
class="w-full"
|
||||
on:click={(e) => {
|
||||
onclick={(e) => {
|
||||
dispatcher('action', e)
|
||||
open = false
|
||||
dispatcher('dismissed')
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { run } from 'svelte/legacy';
|
||||
import { run } from 'svelte/legacy'
|
||||
|
||||
import Button from '../button/Button.svelte'
|
||||
import Modal from '../modal/Modal.svelte'
|
||||
@@ -11,7 +11,7 @@
|
||||
// reactivity hack
|
||||
run(() => {
|
||||
open = $shownModal ? true : false
|
||||
});
|
||||
})
|
||||
</script>
|
||||
|
||||
{#if $shownModal}
|
||||
@@ -32,7 +32,7 @@
|
||||
<Button
|
||||
size="lg"
|
||||
class="flex-1 w-full"
|
||||
on:click={action.action}
|
||||
onclick={action.action}
|
||||
color={action.type}
|
||||
>
|
||||
{#if action.icon}
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
|
||||
<Button
|
||||
{...rest}
|
||||
on:click
|
||||
{color}
|
||||
rounding="none"
|
||||
class="w-full px-2 rounded-lg min-h-[36px] font-normal {disabled
|
||||
|
||||
@@ -4,12 +4,9 @@
|
||||
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.
|
||||
*/
|
||||
@@ -22,14 +19,14 @@
|
||||
}>()
|
||||
|
||||
interface Props {
|
||||
query?: string;
|
||||
selected?: T | undefined;
|
||||
search: (query: string) => Promise<T[]>;
|
||||
extractName: (item: T) => string;
|
||||
select?: any;
|
||||
input?: import('svelte').Snippet;
|
||||
noresults?: import('svelte').Snippet;
|
||||
children?: import('svelte').Snippet<[any]>;
|
||||
query?: string
|
||||
selected?: T | undefined
|
||||
search: (query: string) => Promise<T[]>
|
||||
extractName: (item: T) => string
|
||||
select?: any
|
||||
input?: import('svelte').Snippet
|
||||
noresults?: import('svelte').Snippet
|
||||
children?: import('svelte').Snippet<[any]>
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
@@ -39,15 +36,15 @@
|
||||
search,
|
||||
extractName,
|
||||
select = (item: T) => {
|
||||
selected = item
|
||||
query = extractName(item)
|
||||
dispatcher('select', item)
|
||||
},
|
||||
selected = item
|
||||
query = extractName(item)
|
||||
dispatcher('select', item)
|
||||
},
|
||||
input,
|
||||
noresults,
|
||||
children,
|
||||
...rest
|
||||
}: Props = $props();
|
||||
}: Props = $props()
|
||||
|
||||
const debounceFunc = debounce(async () => {
|
||||
searching = true
|
||||
@@ -60,7 +57,7 @@
|
||||
<div class="relative">
|
||||
<Menu bind:open={openMenu}>
|
||||
{#snippet target()}
|
||||
{#if input}{@render input()}{:else}
|
||||
{#if input}{@render input()}{:else}
|
||||
<TextInput
|
||||
bind:value={query}
|
||||
on:input={(e) => {
|
||||
@@ -79,13 +76,13 @@
|
||||
inlineAffixes
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<div class="h-5 flex items-center">
|
||||
<div class="h-5 flex items-center">
|
||||
<Icon src={MagnifyingGlass} mini size="16" />
|
||||
</div>
|
||||
{/snippet}
|
||||
{/snippet}
|
||||
</TextInput>
|
||||
{/if}
|
||||
{/snippet}
|
||||
{/snippet}
|
||||
{#if searching}
|
||||
<div class="w-full h-24 grid place-items-center">
|
||||
<Spinner width={24} />
|
||||
@@ -96,8 +93,13 @@
|
||||
</div>
|
||||
{:else}
|
||||
{#each items as item}
|
||||
{#if children}{@render children({ extractName, item, dispatcher, select, })}{:else}
|
||||
<MenuButton on:click={() => select(item)}>
|
||||
{#if children}{@render children({
|
||||
extractName,
|
||||
item,
|
||||
dispatcher,
|
||||
select,
|
||||
})}{:else}
|
||||
<MenuButton onclick={() => select(item)}>
|
||||
{extractName(item)}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
<div class="flex items-center gap-2">
|
||||
<Button
|
||||
rounding="xl"
|
||||
on:click={() => goto($page.url, { invalidateAll: true })}
|
||||
onclick={() => goto($page.url, { invalidateAll: true })}
|
||||
>
|
||||
{$t('message.retry')}
|
||||
</Button>
|
||||
|
||||
+23
-20
@@ -77,28 +77,31 @@
|
||||
themeVars.subscribe((vars) => {
|
||||
document.body.setAttribute('style', vars)
|
||||
})
|
||||
// $effect(() => {
|
||||
// if (settings) {
|
||||
// document.body.classList.remove(
|
||||
// 'font-display',
|
||||
// 'font-inter',
|
||||
// 'font-sans',
|
||||
// 'font-system',
|
||||
// 'font-nunito',
|
||||
// )
|
||||
// document.body.classList.add(
|
||||
// settings.font == 'inter'
|
||||
// ? 'font-inter'
|
||||
// : settings.font == 'system'
|
||||
// ? 'font-system'
|
||||
// : settings.font == 'satoshi/nunito'
|
||||
// ? 'font-nunito'
|
||||
// : 'font-sans',
|
||||
// )
|
||||
// }
|
||||
// })
|
||||
}
|
||||
})
|
||||
|
||||
if (browser) {
|
||||
$effect(() => {
|
||||
if (settings) {
|
||||
document.body.classList.remove(
|
||||
'font-display',
|
||||
'font-inter',
|
||||
'font-sans',
|
||||
'font-system',
|
||||
'font-nunito',
|
||||
)
|
||||
document.body.classList.add(
|
||||
settings.font == 'inter'
|
||||
? 'font-inter'
|
||||
: settings.font == 'system'
|
||||
? 'font-system'
|
||||
: settings.font == 'satoshi/nunito'
|
||||
? 'font-nunito'
|
||||
: 'font-sans',
|
||||
)
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
|
||||
@@ -85,15 +85,11 @@
|
||||
</div>
|
||||
<p>This removes the account from Photon, it does not delete the account.</p>
|
||||
<div class="flex flex-row gap-2 items-center">
|
||||
<Button
|
||||
size="lg"
|
||||
class="flex-1"
|
||||
on:click={() => (removing.shown = false)}
|
||||
>
|
||||
<Button size="lg" class="flex-1" onclick={() => (removing.shown = false)}>
|
||||
Cancel
|
||||
</Button>
|
||||
<Button
|
||||
on:click={() => {
|
||||
onclick={() => {
|
||||
removing.shown = false
|
||||
if (removing.account) deleteProfile(removing.account.id)
|
||||
}}
|
||||
@@ -182,7 +178,7 @@
|
||||
title={profile.id == $currentProfile?.id
|
||||
? 'Switch'
|
||||
: 'Current'}
|
||||
on:click={async () => {
|
||||
onclick={async () => {
|
||||
if (profile.id != $currentProfile?.id) {
|
||||
switching = profile.id
|
||||
await setUserID(profile.id)
|
||||
@@ -248,7 +244,7 @@
|
||||
size="square-md"
|
||||
color="secondary"
|
||||
title={$t('account.moveUp')}
|
||||
on:click={() => moveProfile(profile.id, true)}
|
||||
onclick={() => moveProfile(profile.id, true)}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={ChevronUp} size="16" mini />
|
||||
@@ -258,7 +254,7 @@
|
||||
size="square-md"
|
||||
color="secondary"
|
||||
title={$t('account.moveDown')}
|
||||
on:click={() => moveProfile(profile.id, false)}
|
||||
onclick={() => moveProfile(profile.id, false)}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={ChevronDown} size="16" mini />
|
||||
@@ -267,7 +263,7 @@
|
||||
</div>
|
||||
<MenuButton
|
||||
disabled={!profile.color}
|
||||
on:click={() => (profile.color = undefined)}
|
||||
onclick={() => (profile.color = undefined)}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowUturnLeft} size="16" mini />
|
||||
@@ -276,7 +272,7 @@
|
||||
</MenuButton>
|
||||
{#if settings.debugInfo}
|
||||
<MenuButton
|
||||
on:click={() => {
|
||||
onclick={() => {
|
||||
debugProfile = profile
|
||||
debugging = !debugging
|
||||
}}
|
||||
@@ -289,7 +285,7 @@
|
||||
{/if}
|
||||
{#if !LINKED_INSTANCE_URL || profile.user}
|
||||
<MenuButton
|
||||
on:click={() => action(profile)}
|
||||
onclick={() => action(profile)}
|
||||
color="danger-subtle"
|
||||
>
|
||||
{#snippet prefix()}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
size="custom"
|
||||
color="none"
|
||||
class="w-max hover:underline text-slate-600 dark:text-zinc-400"
|
||||
on:click={() => history?.back()}
|
||||
onclick={() => history?.back()}
|
||||
>
|
||||
<Icon src={ArrowLeft} size="16" micro />
|
||||
{$t('account.accounts')}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
size="custom"
|
||||
color="none"
|
||||
class="w-max hover:underline text-slate-600 dark:text-zinc-400"
|
||||
on:click={() => history?.back()}
|
||||
onclick={() => history?.back()}
|
||||
>
|
||||
<Icon src={ArrowLeft} size="16" micro />
|
||||
{$t('account.accounts')}
|
||||
|
||||
@@ -139,7 +139,7 @@
|
||||
? '!text-red-500'
|
||||
: ''}"
|
||||
aria-label={$t('routes.admin.applications.deny')}
|
||||
on:click={() => review(false)}
|
||||
onclick={() => review(false)}
|
||||
loading={denying || reviewing}
|
||||
disabled={approving || denying || reviewing}
|
||||
>
|
||||
@@ -154,7 +154,7 @@
|
||||
? '!text-green-500'
|
||||
: ''}"
|
||||
title={$t('routes.admin.applications.approve')}
|
||||
on:click={() => review(true)}
|
||||
onclick={() => review(true)}
|
||||
loading={approving}
|
||||
disabled={approving || denying || reviewing}
|
||||
>
|
||||
|
||||
@@ -175,7 +175,7 @@
|
||||
|
||||
<Header pageHeader class="font-bold text-2xl flex items-center justify-between">
|
||||
{$t('routes.admin.federation.title')}
|
||||
<Button color="primary" on:click={save} loading={saving} disabled={saving}>
|
||||
<Button color="primary" onclick={save} loading={saving} disabled={saving}>
|
||||
{$t('common.save')}
|
||||
</Button>
|
||||
</Header>
|
||||
@@ -239,7 +239,7 @@
|
||||
</div>
|
||||
<Button
|
||||
size="square-md"
|
||||
on:click={() => {
|
||||
onclick={() => {
|
||||
if (!data.federated_instances?.federated_instances?.blocked)
|
||||
return
|
||||
|
||||
@@ -323,7 +323,7 @@
|
||||
</div>
|
||||
<Button
|
||||
size="square-md"
|
||||
on:click={() => {
|
||||
onclick={() => {
|
||||
if (!data.federated_instances?.federated_instances?.allowed)
|
||||
return
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
<Header pageHeader class="justify-between">
|
||||
{$t('routes.admin.taglines.title')}<Button
|
||||
color="primary"
|
||||
on:click={save}
|
||||
onclick={save}
|
||||
loading={saving}
|
||||
disabled={saving}
|
||||
size="lg"
|
||||
@@ -78,7 +78,7 @@
|
||||
<Markdown source={tagline} inline />
|
||||
|
||||
<div class="flex gap-2 ml-auto">
|
||||
<Button on:click={() => action(tagline)} size="square-md">
|
||||
<Button onclick={() => action(tagline)} size="square-md">
|
||||
<Icon src={Trash} mini size="16" />
|
||||
</Button>
|
||||
</div>
|
||||
@@ -137,7 +137,7 @@
|
||||
</Button>
|
||||
</form>
|
||||
|
||||
<Button on:click={save} color="primary" size="lg" class="w-full">
|
||||
<Button onclick={save} color="primary" size="lg" class="w-full">
|
||||
{$t('common.save')}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
{#each data.site?.admins ?? [] as admin}
|
||||
<div class="py-3 flex items-center justify-between">
|
||||
<UserLink avatar showInstance={false} user={admin.person} />
|
||||
<Button on:click={() => action(admin.person.id)} size="square-md">
|
||||
<Button onclick={() => action(admin.person.id)} size="square-md">
|
||||
<Icon src={Trash} mini size="16" />
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
@@ -135,7 +135,7 @@
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<Button size="square-md" on:click={() => action(moderator.moderator)}>
|
||||
<Button size="square-md" onclick={() => action(moderator.moderator)}>
|
||||
<Icon src={Trash} mini size="16" />
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
@@ -136,7 +136,7 @@ items-center px-2 w-max"
|
||||
|
||||
<div class="flex items-center gap-2">
|
||||
<Button
|
||||
on:click={() => goto($page.url, { invalidateAll: true })}
|
||||
onclick={() => goto($page.url, { invalidateAll: true })}
|
||||
size="square-lg"
|
||||
rounding="xl"
|
||||
title={$t('common.refresh')}
|
||||
@@ -146,7 +146,7 @@ items-center px-2 w-max"
|
||||
{/snippet}
|
||||
</Button>
|
||||
<Button
|
||||
on:click={markAllAsRead}
|
||||
onclick={markAllAsRead}
|
||||
loading={markingAsRead}
|
||||
disabled={markingAsRead}
|
||||
size="lg"
|
||||
|
||||
@@ -132,7 +132,7 @@
|
||||
color={item.read ? 'secondary' : 'primary'}
|
||||
{loading}
|
||||
disabled={loading}
|
||||
on:click={(e) => {
|
||||
onclick={(e) => {
|
||||
e.stopPropagation()
|
||||
markAsRead(!item.read)
|
||||
}}
|
||||
@@ -166,7 +166,7 @@
|
||||
color={item.read ? 'secondary' : 'primary'}
|
||||
{loading}
|
||||
disabled={loading}
|
||||
on:click={(e) => {
|
||||
onclick={(e) => {
|
||||
e.stopPropagation()
|
||||
markAsRead(!item.read)
|
||||
}}
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
import { EllipsisVertical, Flag, Icon, Trash } from 'svelte-hero-icons'
|
||||
|
||||
interface Props {
|
||||
message: PrivateMessageView;
|
||||
primary?: boolean;
|
||||
message: PrivateMessageView
|
||||
primary?: boolean
|
||||
}
|
||||
|
||||
let { message, primary = false }: Props = $props();
|
||||
let { message, primary = false }: Props = $props()
|
||||
|
||||
const dispatch = createEventDispatcher<{ delete: boolean; report: boolean }>()
|
||||
</script>
|
||||
@@ -33,36 +33,35 @@
|
||||
</div>
|
||||
<Menu>
|
||||
{#snippet target()}
|
||||
<Button
|
||||
<Button
|
||||
color="tertiary"
|
||||
class="opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 transition-all flex-shrink-0"
|
||||
size="square-md"
|
||||
rounding="pill"
|
||||
|
||||
title={$t('post.actions.more.actions')}
|
||||
>
|
||||
<Icon src={EllipsisVertical} size="16" micro />
|
||||
</Button>
|
||||
{/snippet}
|
||||
{/snippet}
|
||||
<MenuDivider>{$t('post.actions.more.actions')}</MenuDivider>
|
||||
{#if primary}
|
||||
<MenuButton
|
||||
color="danger-subtle"
|
||||
on:click={() => dispatch('delete', true)}
|
||||
onclick={() => dispatch('delete', true)}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Trash} size="16" micro />
|
||||
{/snippet}
|
||||
<Icon src={Trash} size="16" micro />
|
||||
{/snippet}
|
||||
{$t('post.actions.more.delete')}
|
||||
</MenuButton>
|
||||
{:else}
|
||||
<MenuButton
|
||||
color="danger-subtle"
|
||||
on:click={() => dispatch('report', true)}
|
||||
onclick={() => dispatch('report', true)}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Flag} size="16" micro />
|
||||
{/snippet}
|
||||
<Icon src={Flag} size="16" micro />
|
||||
{/snippet}
|
||||
{$t('moderation.report')}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
|
||||
@@ -132,7 +132,7 @@
|
||||
</div>
|
||||
{/if}
|
||||
<Button
|
||||
on:click={resolve}
|
||||
onclick={resolve}
|
||||
class="ml-auto {item.resolved
|
||||
? '!text-green-600 dark:!text-green-400'
|
||||
: ''}"
|
||||
|
||||
@@ -157,7 +157,7 @@
|
||||
/>
|
||||
{/if}
|
||||
<Button
|
||||
on:click={() => {
|
||||
onclick={() => {
|
||||
searchParam(
|
||||
$page.url,
|
||||
'',
|
||||
|
||||
@@ -236,7 +236,7 @@
|
||||
{#if $profile?.jwt}
|
||||
<Button
|
||||
class="ml-auto"
|
||||
on:click={() => {
|
||||
onclick={() => {
|
||||
if ($profile?.jwt) {
|
||||
fetchOnHome($profile?.jwt)
|
||||
}
|
||||
@@ -272,7 +272,7 @@
|
||||
title={data.post.post_view.post.name}
|
||||
style="width: max-content;"
|
||||
/>
|
||||
<Button on:click={() => history.back()} size="square-md">
|
||||
<Button onclick={() => history.back()} size="square-md">
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowLeft} micro size="16" />
|
||||
{/snippet}
|
||||
@@ -350,7 +350,7 @@
|
||||
? `/comment/${$page.params.instance}/${data.thread.showContext}`
|
||||
: undefined}
|
||||
class="hover:bg-white/50 dark:hover:bg-zinc-800/30"
|
||||
on:click={data.thread.singleThread ? reloadComments : undefined}
|
||||
onclick={data.thread.singleThread ? reloadComments : undefined}
|
||||
>
|
||||
{data.thread.showContext
|
||||
? $t('routes.post.thread.context')
|
||||
@@ -381,7 +381,7 @@
|
||||
{#if $profile?.jwt}
|
||||
{#if !commenting}
|
||||
<EndPlaceholder class="">
|
||||
<Button color="primary" on:click={() => (commenting = true)}>
|
||||
<Button color="primary" onclick={() => (commenting = true)}>
|
||||
<Icon src={PlusCircle} size="16" micro />
|
||||
{$t('routes.post.addComment')}
|
||||
</Button>
|
||||
@@ -401,7 +401,7 @@
|
||||
{$t('filter.sort.controversial')}
|
||||
</option>
|
||||
</Select>
|
||||
<Button size="square-md" on:click={reloadComments}>
|
||||
<Button size="square-md" onclick={reloadComments}>
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowPath} size="16" mini />
|
||||
{/snippet}
|
||||
@@ -447,7 +447,7 @@
|
||||
{$t('filter.sort.controversial')}
|
||||
</option>
|
||||
</Select>
|
||||
<Button size="square-md" on:click={reloadComments}>
|
||||
<Button size="square-md" onclick={reloadComments}>
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowPath} size="16" mini />
|
||||
{/snippet}
|
||||
@@ -485,7 +485,7 @@
|
||||
{#snippet action()}
|
||||
<Button
|
||||
color="tertiary"
|
||||
on:click={() => window.scrollTo({ top: 0, behavior: 'smooth' })}
|
||||
onclick={() => window.scrollTo({ top: 0, behavior: 'smooth' })}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={ChevronDoubleUp} mini size="16" />
|
||||
|
||||
@@ -102,7 +102,7 @@
|
||||
title="Unblock"
|
||||
size="square-md"
|
||||
rounding="pill"
|
||||
on:click={() => action(block)}
|
||||
onclick={() => action(block)}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={XMark} mini size="16" />
|
||||
@@ -134,7 +134,7 @@
|
||||
title="Unblock"
|
||||
size="square-md"
|
||||
rounding="pill"
|
||||
on:click={() => action(block)}
|
||||
onclick={() => action(block)}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={XMark} mini size="16" />
|
||||
@@ -162,7 +162,7 @@
|
||||
title="Unblock"
|
||||
size="square-md"
|
||||
rounding="pill"
|
||||
on:click={() => action(block)}
|
||||
onclick={() => action(block)}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={XMark} mini size="16" />
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { run, preventDefault } from 'svelte/legacy';
|
||||
import { run, preventDefault } from 'svelte/legacy'
|
||||
|
||||
import { goto } from '$app/navigation'
|
||||
import { page } from '$app/stores'
|
||||
@@ -10,15 +10,15 @@
|
||||
import { Button, Material, TextInput, toast } from 'mono-svelte'
|
||||
import { ClipboardDocument, Icon } from 'svelte-hero-icons'
|
||||
|
||||
let { data } = $props();
|
||||
let { data } = $props()
|
||||
|
||||
// @ts-ignore
|
||||
let totpLink: string | undefined = $state(undefined)
|
||||
let totpEnabled;
|
||||
let totpEnabled
|
||||
run(() => {
|
||||
totpEnabled =
|
||||
data.my_user?.local_user_view.local_user.totp_2fa_enabled ?? totpLink
|
||||
});
|
||||
})
|
||||
|
||||
let verify_totp = $state('')
|
||||
|
||||
@@ -65,18 +65,17 @@
|
||||
label={$t('form.profile.2fa.totp')}
|
||||
>
|
||||
{#snippet suffix()}
|
||||
<button
|
||||
|
||||
<button
|
||||
class="contents"
|
||||
onclick={() => {
|
||||
if (!totpLink) return
|
||||
navigator.clipboard?.writeText(totpLink)
|
||||
toast({ content: $t('toast.copied') })
|
||||
}}
|
||||
if (!totpLink) return
|
||||
navigator.clipboard?.writeText(totpLink)
|
||||
toast({ content: $t('toast.copied') })
|
||||
}}
|
||||
>
|
||||
<Icon src={ClipboardDocument} size="20" mini />
|
||||
</button>
|
||||
{/snippet}
|
||||
{/snippet}
|
||||
<span class="font-normal text-xs">
|
||||
{$t('form.profile.2fa.paste')}
|
||||
</span>
|
||||
@@ -92,17 +91,17 @@
|
||||
label={$t('form.2fa')}
|
||||
/>
|
||||
{#if totpEnabled}
|
||||
<Button on:click={() => twofa(false, true)} size="lg" color="primary">
|
||||
<Button onclick={() => twofa(false, true)} size="lg" color="primary">
|
||||
{$t('common.disable')}
|
||||
</Button>
|
||||
{:else}
|
||||
<Button on:click={() => twofa(true, true)} size="lg" color="primary">
|
||||
<Button onclick={() => twofa(true, true)} size="lg" color="primary">
|
||||
{$t('common.enable')}
|
||||
</Button>
|
||||
{/if}
|
||||
</form>
|
||||
{:else}
|
||||
<Button on:click={() => twofa(true)} size="lg" color="primary">
|
||||
<Button onclick={() => twofa(true)} size="lg" color="primary">
|
||||
{$t('form.setup')}
|
||||
</Button>
|
||||
{/if}
|
||||
|
||||
@@ -140,7 +140,7 @@
|
||||
</span>
|
||||
{/snippet}
|
||||
</Switch>
|
||||
<Button size="lg" color="danger" on:click={() => deleteAccount(3)}>
|
||||
<Button size="lg" color="danger" onclick={() => deleteAccount(3)}>
|
||||
{$t('routes.profile.delete.title')}
|
||||
</Button>
|
||||
</Material>
|
||||
@@ -64,7 +64,7 @@
|
||||
</Button>
|
||||
<Button
|
||||
title={$t('post.actions.more.delete')}
|
||||
on:click={() => deleteImage(image)}
|
||||
onclick={() => deleteImage(image)}
|
||||
size="square-md"
|
||||
{loading}
|
||||
disabled={loading}
|
||||
|
||||
@@ -122,7 +122,7 @@
|
||||
size="square-lg"
|
||||
color="tertiary"
|
||||
class="self-end justify-self-center"
|
||||
on:click={() => (moreOptions = !moreOptions)}
|
||||
onclick={() => (moreOptions = !moreOptions)}
|
||||
>
|
||||
<Icon src={ChevronDown} size="20" mini />
|
||||
</Button>
|
||||
|
||||
@@ -114,7 +114,7 @@
|
||||
<div class="flex items-center">
|
||||
<Button
|
||||
size="square-lg"
|
||||
on:click={() => {
|
||||
onclick={() => {
|
||||
importText = ''
|
||||
importing = true
|
||||
}}
|
||||
@@ -128,7 +128,7 @@
|
||||
</Button>
|
||||
<Button
|
||||
size="square-lg"
|
||||
on:click={() => {
|
||||
onclick={() => {
|
||||
const json = JSON.stringify(settings)
|
||||
navigator?.clipboard?.writeText?.(json)
|
||||
toast({ content: $t('toast.copied') })
|
||||
@@ -143,7 +143,7 @@
|
||||
</Button>
|
||||
<Button
|
||||
size="square-lg"
|
||||
on:click={() => {
|
||||
onclick={() => {
|
||||
toast({
|
||||
content: $t('toast.resetSettings'),
|
||||
action: () => {},
|
||||
@@ -508,7 +508,7 @@
|
||||
disabled={settings.dock.pins
|
||||
?.map((p) => p.url)
|
||||
?.includes(pin.url)}
|
||||
on:click={() => {
|
||||
onclick={() => {
|
||||
settings.dock.pins = [...(settings.dock.pins ?? []), pin]
|
||||
}}
|
||||
>
|
||||
@@ -705,7 +705,7 @@
|
||||
size="square-md"
|
||||
rounding="lg"
|
||||
class="ml-auto"
|
||||
on:click={() => {
|
||||
onclick={() => {
|
||||
settings.moderation.presets.splice(index, 1)
|
||||
settings.moderation.presets = settings.moderation.presets
|
||||
}}
|
||||
@@ -740,7 +740,7 @@
|
||||
<Button
|
||||
color="none"
|
||||
class="w-full"
|
||||
on:click={() => {
|
||||
onclick={() => {
|
||||
settings.moderation.presets = [
|
||||
...settings.moderation.presets,
|
||||
{
|
||||
|
||||
@@ -194,7 +194,7 @@
|
||||
{err}
|
||||
</Material>
|
||||
{/await}
|
||||
<Button on:click={() => getCaptcha()} size="square-md">
|
||||
<Button onclick={() => getCaptcha()} size="square-md">
|
||||
<Icon src={ArrowPath} size="16" mini />
|
||||
</Button>
|
||||
<TextInput required bind:value={verifyCaptcha} />
|
||||
|
||||
@@ -101,7 +101,7 @@
|
||||
</Material>
|
||||
<div class="flex items-center gap-4">
|
||||
<Button
|
||||
on:click={() => {
|
||||
onclick={() => {
|
||||
importing = !importing
|
||||
}}
|
||||
size="lg"
|
||||
@@ -111,7 +111,7 @@
|
||||
{$t('routes.theme.import')}
|
||||
</Button>
|
||||
<Button
|
||||
on:click={() => {
|
||||
onclick={() => {
|
||||
navigator.clipboard.writeText(JSON.stringify($theme.colors))
|
||||
toast({ content: 'Copied theme to clipboard.' })
|
||||
}}
|
||||
@@ -122,7 +122,7 @@
|
||||
</Button>
|
||||
<Button
|
||||
disabled={$theme.id <= 0}
|
||||
on:click={() => {
|
||||
onclick={() => {
|
||||
modal({
|
||||
actions: [
|
||||
action({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { preventDefault } from 'svelte/legacy';
|
||||
import { preventDefault } from 'svelte/legacy'
|
||||
|
||||
import { t } from '$lib/translations'
|
||||
import { calculateVars, themeData, type Theme } from '$lib/ui/colors'
|
||||
@@ -7,10 +7,10 @@
|
||||
import { CheckCircle, Icon, Trash } from 'svelte-hero-icons'
|
||||
|
||||
interface Props {
|
||||
theme: Theme;
|
||||
theme: Theme
|
||||
}
|
||||
|
||||
let { theme = $bindable() }: Props = $props();
|
||||
let { theme = $bindable() }: Props = $props()
|
||||
|
||||
let editingName = $state(false)
|
||||
</script>
|
||||
@@ -33,10 +33,10 @@
|
||||
</div>
|
||||
<div
|
||||
class="bg-white dark:bg-zinc-900 w-8 h-4 rounded-sm border border-slate-200 dark:border-zinc-800"
|
||||
></div>
|
||||
></div>
|
||||
<div
|
||||
class="w-3 h-3 bg-primary-900 dark:bg-primary-100 rounded-full ml-auto"
|
||||
></div>
|
||||
></div>
|
||||
</div>
|
||||
{#if theme.id == $themeData.currentTheme}
|
||||
<Icon
|
||||
@@ -66,7 +66,7 @@
|
||||
color="ghost"
|
||||
size="square-md"
|
||||
class="flex-shrink-0"
|
||||
on:click={() => {
|
||||
onclick={() => {
|
||||
modal({
|
||||
actions: [
|
||||
action({
|
||||
@@ -97,8 +97,8 @@
|
||||
}}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Trash} size="16" mini />
|
||||
{/snippet}
|
||||
<Icon src={Trash} size="16" mini />
|
||||
{/snippet}
|
||||
</Button>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
@@ -138,13 +138,13 @@
|
||||
Are you sure you want to do this? (The button will enable in 3 seconds.)
|
||||
</p>
|
||||
<div class="flex flex-row gap-2">
|
||||
<Button size="lg" on:click={() => (purgingUser = false)} class="flex-1">
|
||||
<Button size="lg" onclick={() => (purgingUser = false)} class="flex-1">
|
||||
Cancel
|
||||
</Button>
|
||||
<Button
|
||||
size="lg"
|
||||
color="danger"
|
||||
on:click={purgeUser}
|
||||
onclick={purgeUser}
|
||||
disabled={!purgeEnabled}
|
||||
class="flex-1"
|
||||
>
|
||||
@@ -250,7 +250,7 @@
|
||||
{/snippet}
|
||||
<MenuButton
|
||||
color="danger-subtle"
|
||||
on:click={() =>
|
||||
onclick={() =>
|
||||
ban(
|
||||
data.person_view.person.banned,
|
||||
data.person_view.person,
|
||||
@@ -263,7 +263,7 @@
|
||||
</MenuButton>
|
||||
<MenuButton
|
||||
color="danger-subtle"
|
||||
on:click={() => (purgingUser = !purgingUser)}
|
||||
onclick={() => (purgingUser = !purgingUser)}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon mini size="16" src={Fire} />
|
||||
@@ -282,7 +282,7 @@
|
||||
{/snippet}
|
||||
<MenuButton
|
||||
color="danger-subtle"
|
||||
on:click={() => blockUser(data.person_view.person.id)}
|
||||
onclick={() => blockUser(data.person_view.person.id)}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon mini size="16" src={NoSymbol} />
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<p>
|
||||
{post}
|
||||
</p>
|
||||
<Button on:click={() => (post = placeholders.get('post'))} class="w-max">
|
||||
<Button onclick={() => (post = placeholders.get('post'))} class="w-max">
|
||||
Generate
|
||||
</Button>
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<p>
|
||||
{comment}
|
||||
</p>
|
||||
<Button on:click={() => (comment = placeholders.get('comment'))} class="w-max">
|
||||
<Button onclick={() => (comment = placeholders.get('comment'))} class="w-max">
|
||||
Generate
|
||||
</Button>
|
||||
|
||||
@@ -33,6 +33,6 @@
|
||||
<p>
|
||||
{url}
|
||||
</p>
|
||||
<Button on:click={() => (url = placeholders.get('url'))} class="w-max">
|
||||
<Button onclick={() => (url = placeholders.get('url'))} class="w-max">
|
||||
Generate
|
||||
</Button>
|
||||
Reference in new issue
Block a user