refactor: use icon prop instead of snippet prefix
This commit is contained in:
56 files changed
+409
-595
No files matched your search
@@ -1,27 +1,27 @@
|
||||
<script lang="ts">
|
||||
import { browser } from '$app/environment'
|
||||
import { navigating, page } from '$app/state'
|
||||
import Moderation from '$lib/components/lemmy/moderation/Moderation.svelte'
|
||||
import { site } from '$lib/client/lemmy.svelte'
|
||||
import SiteCard from '$lib/components/lemmy/instance/InstanceCard.svelte'
|
||||
import Moderation from '$lib/components/lemmy/moderation/Moderation.svelte'
|
||||
import ExpandableImage from '$lib/components/ui/ExpandableImage.svelte'
|
||||
import Shell from '$lib/components/ui/layout/Shell.svelte'
|
||||
import Navbar from '$lib/components/ui/navbar/Navbar.svelte'
|
||||
import Sidebar from '$lib/components/ui/sidebar/Sidebar.svelte'
|
||||
import { locale } from '$lib/i18n/translations'
|
||||
import { LINKED_INSTANCE_URL } from '$lib/instance.svelte'
|
||||
import { site } from '$lib/client/lemmy.svelte'
|
||||
import { settings } from '$lib/settings.svelte.js'
|
||||
import { getDefaultColors } from '$lib/ui/theme/presets'
|
||||
import {
|
||||
inDarkColorScheme,
|
||||
rgbToHex,
|
||||
theme,
|
||||
} from '$lib/ui/theme/theme.svelte.js'
|
||||
import { getDefaultColors } from '$lib/ui/theme/presets'
|
||||
import { Button, ModalContainer, Spinner, ToastContainer } from 'mono-svelte'
|
||||
import nProgress from 'nprogress'
|
||||
import 'nprogress/nprogress.css'
|
||||
import { onMount } from 'svelte'
|
||||
import { Forward, Icon } from 'svelte-hero-icons'
|
||||
import { Forward } from 'svelte-hero-icons'
|
||||
import '../style/app.css'
|
||||
interface Props {
|
||||
children?: import('svelte').Snippet
|
||||
@@ -121,10 +121,8 @@
|
||||
<Button
|
||||
class="fixed -top-16 focus:top-0 left-0 m-4 z-300 transition-all"
|
||||
href="#main"
|
||||
icon={Forward}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Forward} mini size="16" />
|
||||
{/snippet}
|
||||
Skip Navigation
|
||||
</Button>
|
||||
|
||||
|
||||
@@ -103,23 +103,20 @@
|
||||
rounding="pill"
|
||||
class="px-4"
|
||||
color="primary"
|
||||
icon={ArrowLeftOnRectangle}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowLeftOnRectangle} size="16" mini />
|
||||
{/snippet}
|
||||
{$t('account.login')}
|
||||
</Button>
|
||||
<Button href="/signup" rounding="pill" class="px-4">
|
||||
{#snippet prefix()}
|
||||
<Icon src={Identification} size="16" mini />
|
||||
{/snippet}
|
||||
<Button
|
||||
href="/signup"
|
||||
rounding="pill"
|
||||
class="px-4"
|
||||
icon={Identification}
|
||||
>
|
||||
{$t('account.signup')}
|
||||
</Button>
|
||||
{#if !LINKED_INSTANCE_URL}
|
||||
<Button href="/accounts/login/guest" rounding="pill">
|
||||
{#snippet prefix()}
|
||||
<Icon src={Plus} size="16" micro />
|
||||
{/snippet}
|
||||
<Button href="/accounts/login/guest" rounding="pill" icon={Plus}>
|
||||
{$t('account.addGuest')}
|
||||
</Button>
|
||||
{/if}
|
||||
@@ -129,7 +126,7 @@
|
||||
</Header>
|
||||
<form class="accounts-grid gap-4">
|
||||
<CommonList
|
||||
selected={p => p.id == profile.meta.profile}
|
||||
selected={(p) => p.id == profile.meta.profile}
|
||||
items={profile.meta.profiles}
|
||||
animate={false}
|
||||
>
|
||||
@@ -168,7 +165,10 @@
|
||||
{/if}
|
||||
</span>
|
||||
<span class="text-sm text-slate-600 dark:text-zinc-400">
|
||||
<span class="capitalize">{p.client?.name ?? DEFAULT_CLIENT_TYPE.name}</span> • {p.instance}
|
||||
<span class="capitalize"
|
||||
>{p.client?.name ?? DEFAULT_CLIENT_TYPE.name}</span
|
||||
>
|
||||
• {p.instance}
|
||||
</span>
|
||||
</div>
|
||||
<Menu placement="bottom-end">
|
||||
@@ -179,38 +179,29 @@
|
||||
color="tertiary"
|
||||
class="justify-self-end ml-auto z-50"
|
||||
aria-label={$t('post.actions.more.label')}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={EllipsisHorizontal} mini size="16" />
|
||||
{/snippet}
|
||||
</Button>
|
||||
icon={EllipsisHorizontal}
|
||||
></Button>
|
||||
{/snippet}
|
||||
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
||||
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
||||
<div
|
||||
class="px-4 py-2 flex items-center gap-2"
|
||||
onclick={e => e.stopPropagation()}
|
||||
onclick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<Button
|
||||
size="square-md"
|
||||
color="secondary"
|
||||
title={$t('account.moveUp')}
|
||||
onclick={() => profile.move(p.id, true)}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={ChevronUp} size="16" mini />
|
||||
{/snippet}
|
||||
</Button>
|
||||
icon={ChevronUp}
|
||||
></Button>
|
||||
<Button
|
||||
size="square-md"
|
||||
color="secondary"
|
||||
title={$t('account.moveDown')}
|
||||
onclick={() => profile.move(p.id, false)}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={ChevronDown} size="16" mini />
|
||||
{/snippet}
|
||||
</Button>
|
||||
icon={ChevronDown}
|
||||
></Button>
|
||||
</div>
|
||||
{#if settings.debugInfo}
|
||||
<MenuButton
|
||||
@@ -218,10 +209,8 @@
|
||||
debugProfile = p
|
||||
debugging = !debugging
|
||||
}}
|
||||
icon={BugAnt}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={BugAnt} size="16" mini />
|
||||
{/snippet}
|
||||
{$t('common.debug')}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
@@ -232,10 +221,8 @@
|
||||
removing.shown = !removing.shown
|
||||
}}
|
||||
color="danger-subtle"
|
||||
icon={ArrowRightOnRectangle}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowRightOnRectangle} size="16" mini />
|
||||
{/snippet}
|
||||
{$t('account.logout')}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
|
||||
@@ -167,11 +167,8 @@
|
||||
onclick={() => review(false)}
|
||||
loading={denying || reviewing}
|
||||
disabled={approving || denying || reviewing}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={XMark} micro size="16" />
|
||||
{/snippet}
|
||||
</Button>
|
||||
icon={XMark}
|
||||
></Button>
|
||||
<Button
|
||||
size="square-md"
|
||||
class="hover:bg-slate-200 {application.creator_local_user
|
||||
@@ -182,10 +179,7 @@
|
||||
onclick={() => review(true)}
|
||||
loading={approving}
|
||||
disabled={approving || denying || reviewing}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Check} micro size="16" />
|
||||
{/snippet}
|
||||
</Button>
|
||||
icon={Check}
|
||||
></Button>
|
||||
</div>
|
||||
</Material>
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import { client, getClient, site } from '$lib/client/lemmy.svelte'
|
||||
import { client, site } from '$lib/client/lemmy.svelte'
|
||||
import type { EditSite } from '$lib/client/types'
|
||||
import ImageInputUpload from '$lib/components/form/ImageInputUpload.svelte'
|
||||
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||
@@ -72,7 +72,7 @@
|
||||
|
||||
<form
|
||||
class="flex flex-col gap-4"
|
||||
onsubmit={e => {
|
||||
onsubmit={(e) => {
|
||||
e.preventDefault()
|
||||
save()
|
||||
}}
|
||||
@@ -80,25 +80,25 @@
|
||||
<Header pageHeader>{$t('routes.admin.config.title')}</Header>
|
||||
{#if formData}
|
||||
<TextInput
|
||||
bind:value={() => formData.name ?? '', v => (formData.description = v)}
|
||||
bind:value={() => formData.name ?? '', (v) => (formData.description = v)}
|
||||
label={$t('form.name')}
|
||||
/>
|
||||
<TextInput
|
||||
bind:value={
|
||||
() => formData.description ?? '', v => (formData.description = v)
|
||||
() => formData.description ?? '', (v) => (formData.description = v)
|
||||
}
|
||||
label={$t('form.description')}
|
||||
/>
|
||||
<MarkdownEditor
|
||||
previewButton
|
||||
bind:value={() => formData.sidebar ?? '', v => (formData.sidebar = v)}
|
||||
bind:value={() => formData.sidebar ?? '', (v) => (formData.sidebar = v)}
|
||||
label={$t('routes.admin.config.sidebar')}
|
||||
/>
|
||||
<MarkdownEditor
|
||||
previewButton
|
||||
bind:value={
|
||||
() => formData.legal_information ?? '',
|
||||
v => (formData.legal_information = v)
|
||||
(v) => (formData.legal_information = v)
|
||||
}
|
||||
label={$t('routes.legal.title')}
|
||||
/>
|
||||
@@ -196,7 +196,7 @@
|
||||
</Badge>
|
||||
</button>
|
||||
{/snippet}
|
||||
{#each site.data.all_languages.filter(l => !formData.discussion_languages?.includes(l.id)) as language (language.id)}
|
||||
{#each site.data.all_languages.filter((l) => !formData.discussion_languages?.includes(l.id)) as language (language.id)}
|
||||
<MenuButton
|
||||
class="min-h-[16px] py-0"
|
||||
onclick={() => {
|
||||
@@ -209,7 +209,7 @@
|
||||
</Menu>
|
||||
{#each formData.discussion_languages ?? [] as languageId, index (languageId)}
|
||||
{@const language = site.data.all_languages.find(
|
||||
l => l.id == languageId,
|
||||
(l) => l.id == languageId,
|
||||
)}
|
||||
<button
|
||||
type="button"
|
||||
|
||||
@@ -172,10 +172,7 @@
|
||||
{#if data.site && data.instances.value?.blocked}
|
||||
<FileInput preview={false} bind:files={csv}>
|
||||
{#snippet button()}
|
||||
<Button class="w-max">
|
||||
{#snippet prefix()}
|
||||
<Icon src={Plus} mini size="18" />
|
||||
{/snippet}
|
||||
<Button class="w-max" icon={Plus}>
|
||||
{$t('routes.admin.federation.csv')}
|
||||
</Button>
|
||||
{/snippet}
|
||||
@@ -235,11 +232,8 @@
|
||||
(i) => i.id != instance.id,
|
||||
)
|
||||
}}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={XMark} size="16" mini />
|
||||
{/snippet}
|
||||
</Button>
|
||||
icon={XMark}
|
||||
></Button>
|
||||
</div>
|
||||
{/each}
|
||||
{:else}
|
||||
@@ -319,11 +313,8 @@
|
||||
(i) => i.id != instance.id,
|
||||
)
|
||||
}}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={XMark} size="16" mini />
|
||||
{/snippet}
|
||||
</Button>
|
||||
icon={XMark}
|
||||
></Button>
|
||||
</div>
|
||||
{/each}
|
||||
{:else}
|
||||
|
||||
@@ -96,10 +96,7 @@
|
||||
>
|
||||
<MarkdownEditor bind:value={newTagline} images={false} />
|
||||
|
||||
<Button size="lg" submit>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Plus} size="16" mini />
|
||||
{/snippet}
|
||||
<Button size="lg" submit icon={Plus}>
|
||||
{$t('common.add')}
|
||||
</Button>
|
||||
</form>
|
||||
@@ -127,10 +124,7 @@
|
||||
images={false}
|
||||
/>
|
||||
|
||||
<Button size="lg" submit>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Plus} size="16" mini />
|
||||
{/snippet}
|
||||
<Button size="lg" submit icon={Plus}>
|
||||
{$t('common.add')}
|
||||
</Button>
|
||||
</form>
|
||||
|
||||
@@ -109,10 +109,8 @@
|
||||
color="primary"
|
||||
size="sm"
|
||||
submit
|
||||
icon={Plus}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Plus} micro size="16" />
|
||||
{/snippet}
|
||||
{$t('common.add')}
|
||||
</Button>
|
||||
</form>
|
||||
|
||||
@@ -146,10 +146,8 @@
|
||||
rounding="xl"
|
||||
color="primary"
|
||||
submit
|
||||
icon={Plus}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Plus} micro size="16" />
|
||||
{/snippet}
|
||||
{$t('common.add')}
|
||||
</Button>
|
||||
</form>
|
||||
@@ -54,28 +54,23 @@
|
||||
class="rounded-2xl h-9 aspect-square"
|
||||
rounding="none"
|
||||
aria-label={$t('common.refresh')}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowPath} size="16" mini />
|
||||
{/snippet}
|
||||
</Button>
|
||||
icon={ArrowPath}
|
||||
></Button>
|
||||
<Button
|
||||
onclick={markAllAsRead}
|
||||
loading={markingAsRead}
|
||||
disabled={markingAsRead || data.inbox.value.length == 0}
|
||||
rounding="pill"
|
||||
color="primary"
|
||||
icon={Check}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Check} size="16" mini />
|
||||
{/snippet}
|
||||
{$t('routes.inbox.markAsRead')}
|
||||
</Button>
|
||||
</div>
|
||||
</Header>
|
||||
|
||||
<Select
|
||||
class="relative w-max"
|
||||
class="relative"
|
||||
bind:value={
|
||||
() => data.unreadOnly.value.toString(),
|
||||
(v) => (data.unreadOnly.value = v == 'true')
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
<script lang="ts">
|
||||
import { notifications, profile } from '$lib/auth.svelte.js'
|
||||
import { getClient } from '$lib/client/lemmy.svelte'
|
||||
import { CommentItem } from '$lib/components/lemmy/comment'
|
||||
import PrivateMessage from '$lib/components/lemmy/inbox/PrivateMessage.svelte'
|
||||
import Avatar from '$lib/components/ui/Avatar.svelte'
|
||||
import Expandable from '$lib/components/ui/Expandable.svelte'
|
||||
import RelativeDate from '$lib/components/util/RelativeDate.svelte'
|
||||
import { publishedToDate } from '$lib/components/util/date.js'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { getClient } from '$lib/client/lemmy.svelte'
|
||||
import type { InboxItem } from '$lib/lemmy/inbox.js'
|
||||
import { escapeHtml } from '$lib/util.svelte'
|
||||
import { Button } from 'mono-svelte'
|
||||
import { Eye, EyeSlash, Icon } from 'svelte-hero-icons'
|
||||
import { CommentItem } from '$lib/components/lemmy/comment'
|
||||
import { Eye, EyeSlash } from 'svelte-hero-icons'
|
||||
|
||||
interface Props {
|
||||
item: InboxItem
|
||||
@@ -99,10 +99,8 @@
|
||||
size="sm"
|
||||
rounding="pill"
|
||||
class="shrink-0"
|
||||
icon={item.read ? EyeSlash : Eye}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={item.read ? EyeSlash : Eye} size="16" micro />
|
||||
{/snippet}
|
||||
{item.read
|
||||
? $t('post.actions.more.markUnread')
|
||||
: $t('post.actions.more.markRead')}
|
||||
@@ -132,10 +130,8 @@
|
||||
}}
|
||||
size="sm"
|
||||
rounding="pill"
|
||||
icon={item.read ? EyeSlash : Eye}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={item.read ? EyeSlash : Eye} size="16" micro />
|
||||
{/snippet}
|
||||
{item.read
|
||||
? $t('post.actions.more.markUnread')
|
||||
: $t('post.actions.more.markRead')}
|
||||
|
||||
@@ -109,11 +109,12 @@
|
||||
{$t('filter.inbox.messages')}
|
||||
{#snippet extended()}
|
||||
<div class="flex flex-wrap gap-4">
|
||||
<Button size="square-md" href="." title={$t('common.back')}>
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowLeft} micro size="16" />
|
||||
{/snippet}
|
||||
</Button>
|
||||
<Button
|
||||
size="square-md"
|
||||
href="."
|
||||
title={$t('common.back')}
|
||||
icon={ArrowLeft}
|
||||
></Button>
|
||||
<UserLink avatar user={data.creator.value.person_view.person} />
|
||||
</div>
|
||||
{/snippet}
|
||||
@@ -239,11 +240,8 @@
|
||||
submit
|
||||
loading={textbox.loading}
|
||||
disabled={textbox.loading}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={PaperAirplane} size="18" micro />
|
||||
{/snippet}
|
||||
</Button>
|
||||
icon={PaperAirplane}
|
||||
></Button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -64,17 +64,19 @@
|
||||
</Button>
|
||||
{/snippet}
|
||||
{#if primary}
|
||||
<MenuButton color="danger-subtle" onclick={() => ondelete?.(true)}>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Trash} size="16" micro />
|
||||
{/snippet}
|
||||
<MenuButton
|
||||
color="danger-subtle"
|
||||
onclick={() => ondelete?.(true)}
|
||||
icon={Trash}
|
||||
>
|
||||
{$t('post.actions.more.delete')}
|
||||
</MenuButton>
|
||||
{:else}
|
||||
<MenuButton color="danger-subtle" onclick={() => onreport?.(true)}>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Flag} size="16" micro />
|
||||
{/snippet}
|
||||
<MenuButton
|
||||
color="danger-subtle"
|
||||
onclick={() => onreport?.(true)}
|
||||
icon={Flag}
|
||||
>
|
||||
{$t('moderation.report')}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
import { errorMessage } from '$lib/lemmy/error'
|
||||
import type { ReportView } from '$lib/lemmy/report.js'
|
||||
import { Badge, Button, Label, Material, Modal, toast } from 'mono-svelte'
|
||||
import { CheckBadge, Icon } from 'svelte-hero-icons'
|
||||
import { CheckBadge } from 'svelte-hero-icons'
|
||||
|
||||
interface Props {
|
||||
item: ReportView[]
|
||||
@@ -175,10 +175,8 @@
|
||||
rounding="pill"
|
||||
size="sm"
|
||||
color={item.resolved ? 'secondary' : 'primary'}
|
||||
icon={CheckBadge}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={CheckBadge} micro size="16" />
|
||||
{/snippet}
|
||||
{!item.resolved
|
||||
? $t('routes.moderation.resolve')
|
||||
: $t('routes.moderation.unresolve')}
|
||||
|
||||
@@ -24,7 +24,15 @@
|
||||
import { expoOut } from 'svelte/easing'
|
||||
import { fly } from 'svelte/transition'
|
||||
import CommentProvider from './CommentProvider.svelte'
|
||||
import { mediaType, parseTags, Post, PostActions, postLink, PostMedia, PostMeta } from '$lib/components/lemmy/post'
|
||||
import {
|
||||
mediaType,
|
||||
parseTags,
|
||||
Post,
|
||||
PostActions,
|
||||
postLink,
|
||||
PostMedia,
|
||||
PostMeta,
|
||||
} from '$lib/components/lemmy/post'
|
||||
|
||||
let { data } = $props()
|
||||
|
||||
@@ -307,10 +315,8 @@
|
||||
<Button
|
||||
color="tertiary"
|
||||
onclick={() => window.scrollTo({ top: 0, behavior: 'smooth' })}
|
||||
icon={ChevronDoubleUp}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={ChevronDoubleUp} mini size="16" />
|
||||
{/snippet}
|
||||
{$t('routes.post.scrollToTop')}
|
||||
</Button>
|
||||
{/snippet}
|
||||
|
||||
@@ -107,11 +107,8 @@
|
||||
class="h-8.5 w-8.5"
|
||||
rounding="xl"
|
||||
onclick={onupdate}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowPath} size="16" mini />
|
||||
{/snippet}
|
||||
</Button>
|
||||
icon={ArrowPath}
|
||||
></Button>
|
||||
</div>
|
||||
{/snippet}
|
||||
</EndPlaceholder>
|
||||
@@ -150,11 +147,13 @@
|
||||
{$t('filter.sort.controversial')}
|
||||
</Option>
|
||||
</Select>
|
||||
<Button size="custom" class="h-8.5 w-8.5" rounding="xl" onclick={onupdate}>
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowPath} size="16" mini />
|
||||
{/snippet}
|
||||
</Button>
|
||||
<Button
|
||||
size="custom"
|
||||
class="h-8.5 w-8.5"
|
||||
rounding="xl"
|
||||
onclick={onupdate}
|
||||
icon={ArrowPath}
|
||||
></Button>
|
||||
</div>
|
||||
{/if}
|
||||
{#if virtualize}
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
<script lang="ts">
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||
import EndPlaceholder from '$lib/components/ui/EndPlaceholder.svelte'
|
||||
import Entity from '$lib/components/ui/Entity.svelte'
|
||||
import CommonList from '$lib/components/ui/layout/CommonList.svelte'
|
||||
import { Header } from '$lib/components/ui/layout'
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
import { t } from '$lib/i18n/translations.js'
|
||||
import { client } from '$lib/client/lemmy.svelte.js'
|
||||
import type {
|
||||
CommunityBlockView,
|
||||
InstanceBlockView,
|
||||
PersonBlockView,
|
||||
} from '$lib/client/types'
|
||||
import { Button } from 'mono-svelte'
|
||||
import { Check, Icon, XMark } from 'svelte-hero-icons'
|
||||
import type { PageData } from './$types.js'
|
||||
import { client } from '$lib/client/lemmy.svelte.js'
|
||||
import { CommunityLink } from '$lib/components/lemmy/community'
|
||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||
import EndPlaceholder from '$lib/components/ui/EndPlaceholder.svelte'
|
||||
import Entity from '$lib/components/ui/Entity.svelte'
|
||||
import { Header } from '$lib/components/ui/layout'
|
||||
import CommonList from '$lib/components/ui/layout/CommonList.svelte'
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
import { t } from '$lib/i18n/translations.js'
|
||||
import { Button } from 'mono-svelte'
|
||||
import { Check, XMark } from 'svelte-hero-icons'
|
||||
import type { PageData } from './$types.js'
|
||||
|
||||
interface Props {
|
||||
// sveltekit doesn't feel like making types work right now
|
||||
@@ -109,11 +109,8 @@
|
||||
size="square-md"
|
||||
rounding="pill"
|
||||
onclick={() => unblockCommunity(block)}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={XMark} micro size="16" />
|
||||
{/snippet}
|
||||
</Button>
|
||||
icon={XMark}
|
||||
></Button>
|
||||
</div>
|
||||
{/snippet}
|
||||
</CommonList>
|
||||
@@ -139,11 +136,8 @@
|
||||
size="square-md"
|
||||
rounding="pill"
|
||||
onclick={() => unblockUser(block)}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={XMark} micro size="16" />
|
||||
{/snippet}
|
||||
</Button>
|
||||
icon={XMark}
|
||||
></Button>
|
||||
</div>
|
||||
{/snippet}
|
||||
</CommonList>
|
||||
@@ -173,11 +167,8 @@
|
||||
size="square-md"
|
||||
rounding="pill"
|
||||
onclick={() => unblockInstances(block)}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={XMark} micro size="16" />
|
||||
{/snippet}
|
||||
</Button>
|
||||
icon={XMark}
|
||||
></Button>
|
||||
</div>
|
||||
{/snippet}
|
||||
</CommonList>
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
|
||||
<form
|
||||
class="flex flex-col gap-4 h-full"
|
||||
onsubmit={e => {
|
||||
onsubmit={(e) => {
|
||||
e.preventDefault()
|
||||
save()
|
||||
}}
|
||||
@@ -80,7 +80,7 @@
|
||||
/>
|
||||
<MarkdownEditor
|
||||
images={false}
|
||||
bind:value={() => formData.bio ?? '', v => (formData.bio = v)}
|
||||
bind:value={() => formData.bio ?? '', (v) => (formData.bio = v)}
|
||||
label={$t('form.profile.bio')}
|
||||
previewButton
|
||||
/>
|
||||
@@ -128,7 +128,7 @@
|
||||
</Badge>
|
||||
</button>
|
||||
{/snippet}
|
||||
{#each site.data.all_languages.filter(l => !formData.discussion_languages?.includes(l.id)) as language (language.id)}
|
||||
{#each site.data.all_languages.filter((l) => !formData.discussion_languages?.includes(l.id)) as language (language.id)}
|
||||
<MenuButton
|
||||
class="min-h-[16px] py-0"
|
||||
onclick={() => {
|
||||
@@ -141,7 +141,7 @@
|
||||
</Menu>
|
||||
{#each formData.discussion_languages as languageId, index (languageId)}
|
||||
{@const language = site.data.all_languages.find(
|
||||
l => l.id == languageId,
|
||||
(l) => l.id == languageId,
|
||||
)}
|
||||
<button
|
||||
type="button"
|
||||
|
||||
@@ -59,22 +59,13 @@
|
||||
<Icon src={EllipsisHorizontal} size="16" micro />
|
||||
</Button>
|
||||
{/snippet}
|
||||
<MenuButton href="/profile/media">
|
||||
{#snippet prefix()}
|
||||
<Icon src={Photo} size="16" mini />
|
||||
{/snippet}
|
||||
<MenuButton href="/profile/media" icon={Photo}>
|
||||
{$t('routes.profile.media.title')}
|
||||
</MenuButton>
|
||||
<MenuButton href="/profile/voted/up">
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowUp} size="16" micro />
|
||||
{/snippet}
|
||||
<MenuButton href="/profile/voted/up" icon={ArrowUp}>
|
||||
{$t('routes.profile.upvoted')}
|
||||
</MenuButton>
|
||||
<MenuButton href="/profile/voted/down">
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowDown} size="16" micro />
|
||||
{/snippet}
|
||||
<MenuButton href="/profile/voted/down" icon={ArrowDown}>
|
||||
{$t('routes.profile.downvoted')}
|
||||
</MenuButton>
|
||||
</Menu>
|
||||
|
||||
@@ -3,14 +3,9 @@
|
||||
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { defaultSettings, settings } from '$lib/settings.svelte'
|
||||
import { Button, toast, Modal, modal, action } from 'mono-svelte'
|
||||
import { action, Button, Modal, modal, toast } from 'mono-svelte'
|
||||
import TextArea from 'mono-svelte/forms/TextArea.svelte'
|
||||
import {
|
||||
ArrowDownTray,
|
||||
ArrowPath,
|
||||
ArrowUpTray,
|
||||
Icon,
|
||||
} from 'svelte-hero-icons'
|
||||
import { ArrowDownTray, ArrowPath, ArrowUpTray } from 'svelte-hero-icons'
|
||||
|
||||
let { children } = $props()
|
||||
let importing = $state(false)
|
||||
@@ -57,10 +52,8 @@
|
||||
importing = true
|
||||
}}
|
||||
rounding="pill"
|
||||
icon={ArrowDownTray}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowDownTray} mini size="18" />
|
||||
{/snippet}
|
||||
{$t('settings.import')}
|
||||
</Button>
|
||||
<Button
|
||||
@@ -70,10 +63,8 @@
|
||||
toast({ content: $t('toast.copied') })
|
||||
}}
|
||||
rounding="pill"
|
||||
icon={ArrowUpTray}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowUpTray} mini size="18" />
|
||||
{/snippet}
|
||||
{$t('settings.export')}
|
||||
</Button>
|
||||
<Button
|
||||
@@ -95,10 +86,8 @@
|
||||
})
|
||||
}}
|
||||
rounding="pill"
|
||||
icon={ArrowPath}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowPath} mini size="18" />
|
||||
{/snippet}
|
||||
{$t('settings.reset')}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
@@ -85,10 +85,8 @@
|
||||
href="https://buymeacoffee.com/xylight"
|
||||
target="_blank"
|
||||
rounding="xl"
|
||||
icon={Heart}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Heart} size="16" micro />
|
||||
{/snippet}
|
||||
{$t('nav.menu.donate')}
|
||||
</Button>
|
||||
</Setting>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { settings } from '$lib/settings.svelte'
|
||||
import { Checkbox, Switch } from 'mono-svelte'
|
||||
import { Switch } from 'mono-svelte'
|
||||
import {
|
||||
Bars3,
|
||||
BookOpen,
|
||||
@@ -75,23 +75,21 @@
|
||||
/>
|
||||
<Setting icon={ServerStack}>
|
||||
{#snippet title()}
|
||||
<span>{$t('settings.lemmy.instances.title')}</span>
|
||||
{$t('settings.lemmy.instances.title')}
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span>
|
||||
{$t('settings.lemmy.instances.description')}
|
||||
</span>
|
||||
{$t('settings.lemmy.instances.description')}
|
||||
{/snippet}
|
||||
<div class="flex flex-row flex-wrap items-center gap-4">
|
||||
<Checkbox bind:checked={settings.showInstances.user}>
|
||||
<Switch bind:checked={settings.showInstances.user}>
|
||||
{$t('content.users')}
|
||||
</Checkbox>
|
||||
<Checkbox bind:checked={settings.showInstances.comments}>
|
||||
</Switch>
|
||||
<Switch bind:checked={settings.showInstances.comments}>
|
||||
{$t('content.comments')}
|
||||
</Checkbox>
|
||||
<Checkbox bind:checked={settings.showInstances.community}>
|
||||
</Switch>
|
||||
<Switch bind:checked={settings.showInstances.community}>
|
||||
{$t('content.communities')}
|
||||
</Checkbox>
|
||||
</Switch>
|
||||
</div>
|
||||
</Setting>
|
||||
<ToggleSetting
|
||||
|
||||
@@ -92,10 +92,8 @@
|
||||
},
|
||||
]
|
||||
}}
|
||||
icon={Plus}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Plus} micro size="16" />
|
||||
{/snippet}
|
||||
Add Preset
|
||||
</Button>
|
||||
</li>
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
<script lang="ts">
|
||||
import { preventDefault } from 'svelte/legacy'
|
||||
|
||||
import { goto } from '$app/navigation'
|
||||
import { page } from '$app/state'
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
@@ -20,10 +18,10 @@
|
||||
import { errorMessage } from '$lib/lemmy/error.js'
|
||||
import {
|
||||
Button,
|
||||
Checkbox,
|
||||
Label,
|
||||
Material,
|
||||
Spinner,
|
||||
Switch,
|
||||
TextInput,
|
||||
toast,
|
||||
} from 'mono-svelte'
|
||||
@@ -155,7 +153,10 @@
|
||||
{#if stage == 'signup'}
|
||||
<form
|
||||
class="flex flex-col gap-4 h-full w-full flex-2/3"
|
||||
onsubmit={preventDefault(submit)}
|
||||
onsubmit={(e) => {
|
||||
e.preventDefault()
|
||||
submit()
|
||||
}}
|
||||
>
|
||||
<Button href="/accounts" class=" mb-4 w-max" rounding="pill">
|
||||
<Icon src={ArrowLeft} size="16" micro />
|
||||
@@ -267,7 +268,7 @@
|
||||
</div>
|
||||
</Material>
|
||||
{/if}
|
||||
<Checkbox bind:checked={nsfw}>{$t('form.profile.showNSFW')}</Checkbox>
|
||||
<Switch bind:checked={nsfw}>{$t('form.profile.showNSFW')}</Switch>
|
||||
<input type="dn" name="honeypot" bind:value={honeypot} class="hidden" />
|
||||
<Button
|
||||
submit
|
||||
|
||||
@@ -103,11 +103,8 @@
|
||||
title: $t('routes.theme.preset.delete.title'),
|
||||
})
|
||||
}}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Trash} size="16" mini />
|
||||
{/snippet}
|
||||
</Button>
|
||||
icon={Trash}
|
||||
></Button>
|
||||
{/if}
|
||||
</div>
|
||||
</Material>
|
||||
|
||||
@@ -3,11 +3,27 @@
|
||||
import { client } from '$lib/client/lemmy.svelte'
|
||||
import type { PersonView } from '$lib/client/types'
|
||||
import { ban, isAdmin } from '$lib/components/lemmy/moderation/moderation'
|
||||
import ShieldIcon from '$lib/components/lemmy/moderation/ShieldIcon.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { blockUser, isBlocked } from '$lib/lemmy/user'
|
||||
import { Button, Menu, MenuButton, Modal, removeToast, toast } from 'mono-svelte'
|
||||
import { AtSymbol, EllipsisHorizontal, Envelope, Fire, Icon, Newspaper, NoSymbol, ShieldExclamation } from 'svelte-hero-icons'
|
||||
import {
|
||||
Button,
|
||||
Menu,
|
||||
MenuButton,
|
||||
Modal,
|
||||
removeToast,
|
||||
toast,
|
||||
} from 'mono-svelte'
|
||||
import {
|
||||
AtSymbol,
|
||||
EllipsisHorizontal,
|
||||
Envelope,
|
||||
Fire,
|
||||
Icon,
|
||||
Newspaper,
|
||||
NoSymbol,
|
||||
ShieldCheck,
|
||||
ShieldExclamation,
|
||||
} from 'svelte-hero-icons'
|
||||
|
||||
let { person }: { person: PersonView } = $props()
|
||||
|
||||
@@ -29,8 +45,6 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
{#if purgingUser}
|
||||
<Modal bind:open={purgingUser}>
|
||||
{#snippet customTitle()}
|
||||
@@ -41,19 +55,12 @@
|
||||
{person.person.name}
|
||||
</span>
|
||||
</p>
|
||||
<p>
|
||||
Are you sure you want to do this?
|
||||
</p>
|
||||
<p>Are you sure you want to do this?</p>
|
||||
<div class="flex flex-row gap-2">
|
||||
<Button size="lg" onclick={() => (purgingUser = false)} class="flex-1">
|
||||
Cancel
|
||||
</Button>
|
||||
<Button
|
||||
size="lg"
|
||||
color="danger"
|
||||
onclick={purgeUser}
|
||||
class="flex-1"
|
||||
>
|
||||
<Button size="lg" color="danger" onclick={purgeUser} class="flex-1">
|
||||
Purge
|
||||
</Button>
|
||||
</div>
|
||||
@@ -67,10 +74,8 @@
|
||||
rounding="pill"
|
||||
color="primary"
|
||||
href="/inbox/messages/{person.person.id}"
|
||||
icon={Envelope}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon micro size="16" src={Envelope} />
|
||||
{/snippet}
|
||||
{$t('content.message')}
|
||||
</Button>
|
||||
{#if person.person.matrix_user_id}
|
||||
@@ -89,49 +94,55 @@
|
||||
{#if isAdmin(profile.current?.user)}
|
||||
<Menu class="ml-auto" placement="bottom-end">
|
||||
{#snippet target(attachment)}
|
||||
<Button {@attach attachment} size="sm" rounding="pill">
|
||||
<ShieldIcon width={16} filled />
|
||||
<Button
|
||||
{@attach attachment}
|
||||
size="sm"
|
||||
rounding="pill"
|
||||
icon={ShieldCheck}
|
||||
>
|
||||
{$t('moderation.label')}
|
||||
</Button>
|
||||
{/snippet}
|
||||
<MenuButton
|
||||
href="/modlog?user={person.person.id}"
|
||||
color="success-subtle"
|
||||
icon={Newspaper}
|
||||
>
|
||||
<Icon src={Newspaper} size="16" micro />
|
||||
{$t('moderation.modlog.user')}
|
||||
</MenuButton>
|
||||
<MenuButton
|
||||
color="danger-subtle"
|
||||
onclick={() => ban(person.person.banned, person.person)}
|
||||
icon={ShieldExclamation}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon mini size="16" src={ShieldExclamation} />
|
||||
{/snippet}
|
||||
{person.person.banned ? 'Unban' : 'Ban'}
|
||||
</MenuButton>
|
||||
<MenuButton
|
||||
color="danger-subtle"
|
||||
onclick={() => (purgingUser = !purgingUser)}
|
||||
icon={Fire}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon mini size="16" src={Fire} />
|
||||
{/snippet}
|
||||
Purge
|
||||
</MenuButton>
|
||||
</Menu>
|
||||
{/if}
|
||||
<Menu placement="bottom-end">
|
||||
{#snippet target(attachment)}
|
||||
<Button {@attach attachment} size="custom" class="h-8 w-8" rounding="pill">
|
||||
{#snippet prefix()}
|
||||
<Icon src={EllipsisHorizontal} size="16" mini />
|
||||
{/snippet}
|
||||
</Button>
|
||||
<Button
|
||||
{@attach attachment}
|
||||
size="custom"
|
||||
class="h-8 w-8"
|
||||
rounding="pill"
|
||||
icon={EllipsisHorizontal}
|
||||
></Button>
|
||||
{/snippet}
|
||||
<MenuButton
|
||||
color="danger-subtle"
|
||||
onclick={() => blockUser(isBlocked(profile.current.user!, person.person.id), person.person.id)}
|
||||
onclick={() =>
|
||||
blockUser(
|
||||
isBlocked(profile.current.user!, person.person.id),
|
||||
person.person.id,
|
||||
)}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon mini size="16" src={NoSymbol} />
|
||||
|
||||
Reference in new issue
Block a user