refactor: use icon prop instead of snippet prefix
This commit is contained in:
56 files changed
+409
-595
No files matched your search
@@ -1,15 +1,15 @@
|
||||
<script lang="ts">
|
||||
import { profile } from '$lib/auth.svelte'
|
||||
import { client } from '$lib/client/lemmy.svelte'
|
||||
import type { LocalImage, Person } from '$lib/client/types'
|
||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||
import { publishedToDate } from '$lib/components/util/date'
|
||||
import RelativeDate from '$lib/components/util/RelativeDate.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { instance } from '$lib/instance.svelte'
|
||||
import { client } from '$lib/client/lemmy.svelte'
|
||||
import { instanceToURL } from '$lib/util.svelte'
|
||||
import type { LocalImage, Person } from '$lib/client/types'
|
||||
import { action, Button, modal, toast } from 'mono-svelte'
|
||||
import { ArrowDownTray, Icon, Trash } from 'svelte-hero-icons'
|
||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||
import { ArrowDownTray, Trash } from 'svelte-hero-icons'
|
||||
|
||||
let loading = $state(false)
|
||||
|
||||
@@ -60,11 +60,8 @@
|
||||
href="{instanceToURL(instance.data)}/pictrs/image/{image.pictrs_alias}"
|
||||
size="square-md"
|
||||
class="ml-auto"
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowDownTray} size="16" mini />
|
||||
{/snippet}
|
||||
</Button>
|
||||
icon={ArrowDownTray}
|
||||
></Button>
|
||||
<Button
|
||||
title={$t('post.actions.more.delete')}
|
||||
onclick={() => {
|
||||
@@ -88,10 +85,7 @@
|
||||
size="square-md"
|
||||
{loading}
|
||||
disabled={loading}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Trash} size="16" mini class="text-red-500" />
|
||||
{/snippet}
|
||||
</Button>
|
||||
icon={Trash}
|
||||
></Button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -74,11 +74,8 @@
|
||||
rounding="pill"
|
||||
size="square-md"
|
||||
class="text-slate-600 dark:text-zinc-400"
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={EllipsisHorizontal} size="16" micro />
|
||||
{/snippet}
|
||||
</Button>
|
||||
icon={EllipsisHorizontal}
|
||||
></Button>
|
||||
{/snippet}
|
||||
<MenuButton
|
||||
onclick={() => {
|
||||
@@ -88,18 +85,13 @@
|
||||
})
|
||||
else navigator.clipboard.writeText(comment.comment.ap_id)
|
||||
}}
|
||||
icon={Share}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Share} mini size="16" />
|
||||
{/snippet}
|
||||
{$t('post.actions.more.share')}
|
||||
</MenuButton>
|
||||
{#if profile.current?.jwt}
|
||||
{#if comment.creator.id == profile.current.user?.local_user_view.person.id}
|
||||
<MenuButton onclick={() => onedit?.(comment)}>
|
||||
{#snippet prefix()}
|
||||
<Icon src={PencilSquare} mini size="16" />
|
||||
{/snippet}
|
||||
<MenuButton onclick={() => onedit?.(comment)} icon={PencilSquare}>
|
||||
{$t('post.actions.more.edit')}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
@@ -108,10 +100,8 @@
|
||||
if (profile.current?.jwt)
|
||||
comment.saved = await save(comment, !comment.saved)
|
||||
}}
|
||||
icon={comment.saved ? BookmarkSlash : Bookmark}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={comment.saved ? BookmarkSlash : Bookmark} mini size="16" />
|
||||
{/snippet}
|
||||
{comment.saved ? $t('post.actions.unsave') : $t('post.actions.save')}
|
||||
</MenuButton>
|
||||
{#if profile.current?.user && profile.current.jwt && profile.current.user.local_user_view.person.id == comment.creator.id}
|
||||
@@ -124,20 +114,19 @@
|
||||
!comment.comment.deleted,
|
||||
)
|
||||
}}
|
||||
icon={Trash}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Trash} mini size="16" />
|
||||
{/snippet}
|
||||
{comment.comment.deleted
|
||||
? $t('post.actions.more.restore')
|
||||
: $t('post.actions.more.delete')}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
{#if profile.current.jwt && profile.current.user?.local_user_view.person.id != comment.creator.id}
|
||||
<MenuButton onclick={() => report(comment)} color="danger-subtle">
|
||||
{#snippet prefix()}
|
||||
<Icon src={Flag} mini size="16" />
|
||||
{/snippet}
|
||||
<MenuButton
|
||||
onclick={() => report(comment)}
|
||||
color="danger-subtle"
|
||||
icon={Flag}
|
||||
>
|
||||
{$t('moderation.report')}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
</script>
|
||||
|
||||
<form
|
||||
onsubmit={e => {
|
||||
onsubmit={(e) => {
|
||||
e.preventDefault()
|
||||
submit()
|
||||
}}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<script lang="ts">
|
||||
import { browser } from '$app/environment'
|
||||
import { goto } from '$app/navigation'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { client } from '$lib/client/lemmy.svelte'
|
||||
import { errorMessage } from '$lib/lemmy/error'
|
||||
import type { Post } from '$lib/client/types'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { errorMessage } from '$lib/lemmy/error'
|
||||
import { Button, toast } from 'mono-svelte'
|
||||
import { ArrowDownCircle, Icon } from 'svelte-hero-icons'
|
||||
import { ArrowDownCircle } from 'svelte-hero-icons'
|
||||
import Comment from './Comment.svelte'
|
||||
import Comments from './CommentTree.svelte'
|
||||
import { buildCommentsTree, type CommentNodeI } from './comments.svelte'
|
||||
@@ -129,15 +129,8 @@
|
||||
)
|
||||
}
|
||||
}}
|
||||
icon={ArrowDownCircle}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon
|
||||
src={ArrowDownCircle}
|
||||
micro
|
||||
size="16"
|
||||
class="text-primary-900 dark:text-primary-100"
|
||||
/>
|
||||
{/snippet}
|
||||
{$t('comment.more', {
|
||||
comments: node.comment_view.counts.child_count,
|
||||
})}
|
||||
|
||||
@@ -139,7 +139,6 @@
|
||||
loading.subscribing = false
|
||||
}
|
||||
|
||||
|
||||
let setFlair = $state(false)
|
||||
|
||||
interface Props {
|
||||
@@ -155,7 +154,6 @@
|
||||
}: Props = $props()
|
||||
</script>
|
||||
|
||||
|
||||
{#await community_view}
|
||||
<div
|
||||
class="w-full h-full grid place-items-center"
|
||||
@@ -165,9 +163,12 @@
|
||||
<Spinner width={24} />
|
||||
</div>
|
||||
{:then community_view}
|
||||
<Modal title={$t('cards.community.flair')} bind:open={setFlair}>
|
||||
<CommunityFlair community={community_view.community.id} onsubmit={() => setFlair = !setFlair} />
|
||||
</Modal>
|
||||
<Modal title={$t('cards.community.flair')} bind:open={setFlair}>
|
||||
<CommunityFlair
|
||||
community={community_view.community.id}
|
||||
onsubmit={() => (setFlair = !setFlair)}
|
||||
/>
|
||||
</Modal>
|
||||
<aside
|
||||
class={[
|
||||
'min-w-full pt-0 text-slate-600 dark:text-zinc-400 flex flex-col gap-1',
|
||||
@@ -198,7 +199,7 @@
|
||||
</EndPlaceholder>
|
||||
{#if profile.current?.jwt}
|
||||
{@const subscribed = profile.current.user?.follows.some(
|
||||
i => i.community.id == community_view.community.id,
|
||||
(i) => i.community.id == community_view.community.id,
|
||||
)}
|
||||
<Button
|
||||
disabled={loading.subscribing}
|
||||
@@ -209,25 +210,19 @@
|
||||
onclick={() => subscribe(community_view)}
|
||||
class="px-4 relative z-[inherit]"
|
||||
alignment="left"
|
||||
icon={community_view.subscribed == 'Subscribed' ? Check : Plus}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon
|
||||
src={community_view.subscribed == 'Subscribed' ? Check : Plus}
|
||||
mini
|
||||
size="16"
|
||||
/>
|
||||
{/snippet}
|
||||
{subscribed
|
||||
? $t('cards.community.subscribed')
|
||||
: $t('cards.community.subscribe')}
|
||||
</Button>
|
||||
{#if client().setFlair}
|
||||
<SidebarButton
|
||||
onclick={() => setFlair = !setFlair}
|
||||
rounding="xl"
|
||||
icon={Tag}
|
||||
label={$t('cards.community.flair')}
|
||||
/>
|
||||
{#if client().setFlair}
|
||||
<SidebarButton
|
||||
onclick={() => (setFlair = !setFlair)}
|
||||
rounding="xl"
|
||||
icon={Tag}
|
||||
label={$t('cards.community.flair')}
|
||||
/>
|
||||
{/if}
|
||||
{/if}
|
||||
{#if profile.current?.user && amMod(profile.current.user, community_view.community)}
|
||||
@@ -269,10 +264,8 @@
|
||||
size="lg"
|
||||
onclick={() =>
|
||||
block(community_view.community.id, !community_view.blocked)}
|
||||
icon={NoSymbol}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={NoSymbol} size="16" mini />
|
||||
{/snippet}
|
||||
{community_view.blocked
|
||||
? $t('cards.community.unblock')
|
||||
: $t('cards.community.block')}
|
||||
@@ -282,10 +275,8 @@
|
||||
color="danger-subtle"
|
||||
size="lg"
|
||||
onclick={() => blockInstance(community_view.community.instance_id)}
|
||||
icon={BuildingOffice2}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={BuildingOffice2} size="16" mini />
|
||||
{/snippet}
|
||||
{$t('cards.community.blockInstance')}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
@@ -312,10 +303,8 @@
|
||||
dismissable: true,
|
||||
type: 'error',
|
||||
})}
|
||||
icon={Fire}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Fire} size="16" mini />
|
||||
{/snippet}
|
||||
{$t('admin.purge')}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
@@ -364,7 +353,7 @@
|
||||
</span>
|
||||
{/snippet}
|
||||
<ItemList
|
||||
items={moderators.map(i => ({
|
||||
items={moderators.map((i) => ({
|
||||
id: i.moderator.id,
|
||||
name: i.moderator.display_name || i.moderator.name,
|
||||
url: userLink(i.moderator),
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
Option,
|
||||
Select,
|
||||
Material,
|
||||
Menu
|
||||
Menu,
|
||||
} from 'mono-svelte'
|
||||
import { GlobeAlt, Icon, MapPin, Plus } from 'svelte-hero-icons'
|
||||
import { Header } from '$lib/components/ui/layout'
|
||||
@@ -98,7 +98,7 @@
|
||||
|
||||
if (profile.current.user) {
|
||||
const c = profile.current.user.moderates
|
||||
.map(m => m.community.id)
|
||||
.map((m) => m.community.id)
|
||||
.indexOf(res.community_view.community.id)
|
||||
if (c != -1) {
|
||||
profile.current.user.moderates[c] = {
|
||||
@@ -139,7 +139,7 @@
|
||||
</script>
|
||||
|
||||
<form
|
||||
onsubmit={e => {
|
||||
onsubmit={(e) => {
|
||||
e.preventDefault()
|
||||
submit()
|
||||
}}
|
||||
@@ -201,7 +201,7 @@
|
||||
</Badge>
|
||||
</button>
|
||||
{/snippet}
|
||||
{#each site.data.all_languages.filter(l => !formData.languages?.includes(l.id)) as language (language.id)}
|
||||
{#each site.data.all_languages.filter((l) => !formData.languages?.includes(l.id)) as language (language.id)}
|
||||
<MenuButton
|
||||
class="min-h-[16px] py-0"
|
||||
onclick={() => {
|
||||
@@ -217,7 +217,7 @@
|
||||
</Menu>
|
||||
{#each formData.languages ?? [] as languageId, index (languageId)}
|
||||
{@const language = site.data.all_languages.find(
|
||||
l => l.id == languageId,
|
||||
(l) => l.id == languageId,
|
||||
)}
|
||||
<button
|
||||
type="button"
|
||||
|
||||
@@ -14,7 +14,15 @@
|
||||
CommunityModeratorView,
|
||||
SubscribedType,
|
||||
} from '$lib/client/types'
|
||||
import { action, Button, Menu, MenuButton, Modal, modal, toast } from 'mono-svelte'
|
||||
import {
|
||||
action,
|
||||
Button,
|
||||
Menu,
|
||||
MenuButton,
|
||||
Modal,
|
||||
modal,
|
||||
toast,
|
||||
} from 'mono-svelte'
|
||||
import {
|
||||
BuildingOffice2,
|
||||
Check,
|
||||
@@ -61,9 +69,11 @@
|
||||
let setFlair = $state(false)
|
||||
</script>
|
||||
|
||||
|
||||
<Modal title={$t('cards.community.flair')} bind:open={setFlair}>
|
||||
<CommunityFlair community={community.id} onsubmit={() => setFlair = !setFlair} />
|
||||
<CommunityFlair
|
||||
community={community.id}
|
||||
onsubmit={() => (setFlair = !setFlair)}
|
||||
/>
|
||||
</Modal>
|
||||
|
||||
<EntityHeader
|
||||
@@ -119,7 +129,7 @@
|
||||
<hr class="flex-1 border-slate-200 dark:border-zinc-800 mx-3" />
|
||||
{/snippet}
|
||||
<ItemList
|
||||
items={moderators.map(m => ({
|
||||
items={moderators.map((m) => ({
|
||||
id: m.moderator.id,
|
||||
name: m.moderator.name,
|
||||
url: userLink(m.moderator),
|
||||
@@ -129,7 +139,12 @@
|
||||
/>
|
||||
</Expandable>
|
||||
{/if}
|
||||
<div class={["flex items-center gap-2 h-max w-max", compact == 'lg' && 'lg:hidden']}>
|
||||
<div
|
||||
class={[
|
||||
'flex items-center gap-2 h-max w-max',
|
||||
compact == 'lg' && 'lg:hidden',
|
||||
]}
|
||||
>
|
||||
{#if profile.current?.jwt}
|
||||
<Subscribe
|
||||
community={{
|
||||
@@ -152,14 +167,8 @@
|
||||
}}
|
||||
class="relative z-[inherit]"
|
||||
rounding="pill"
|
||||
icon={subscribed != 'NotSubscribed' ? Check : Plus}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon
|
||||
src={subscribed != 'NotSubscribed' ? Check : Plus}
|
||||
micro
|
||||
size="16"
|
||||
/>
|
||||
{/snippet}
|
||||
{subscribed == 'Subscribed' || subscribed == 'Pending'
|
||||
? $t('cards.community.subscribed')
|
||||
: $t('cards.community.subscribe')}
|
||||
@@ -167,13 +176,19 @@
|
||||
{/snippet}
|
||||
</Subscribe>
|
||||
|
||||
<Button size="custom" class="h-9 aspect-square" rounding="pill" onclick={() => setFlair = !setFlair} aria-label={$t('cards.community.flair')}>
|
||||
<Button
|
||||
size="custom"
|
||||
class="h-9 aspect-square"
|
||||
rounding="pill"
|
||||
onclick={() => (setFlair = !setFlair)}
|
||||
aria-label={$t('cards.community.flair')}
|
||||
>
|
||||
<Icon src={Tag} size="16" micro />
|
||||
</Button>
|
||||
{/if}
|
||||
|
||||
{#if profile.current?.user && profile.current.user.moderates
|
||||
.map(c => c.community.id)
|
||||
.map((c) => c.community.id)
|
||||
.includes(community.id)}
|
||||
<Button
|
||||
color="secondary"
|
||||
@@ -190,11 +205,13 @@
|
||||
{/if}
|
||||
<Menu placement="top-end">
|
||||
{#snippet target(attachment)}
|
||||
<Button {@attach attachment} size="custom" rounding="pill" class="h-8.5 aspect-square">
|
||||
{#snippet prefix()}
|
||||
<Icon src={EllipsisHorizontal} size="16" mini />
|
||||
{/snippet}
|
||||
</Button>
|
||||
<Button
|
||||
{@attach attachment}
|
||||
size="custom"
|
||||
rounding="pill"
|
||||
class="h-8.5 aspect-square"
|
||||
icon={EllipsisHorizontal}
|
||||
></Button>
|
||||
{/snippet}
|
||||
<MenuButton href="/modlog?community={community.id}">
|
||||
<Icon src={Newspaper} size="16" mini />
|
||||
@@ -214,10 +231,8 @@
|
||||
color="danger-subtle"
|
||||
size="lg"
|
||||
onclick={() => block(community.id, !blocked)}
|
||||
icon={NoSymbol}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={NoSymbol} size="16" mini />
|
||||
{/snippet}
|
||||
{blocked
|
||||
? $t('cards.community.unblock')
|
||||
: $t('cards.community.block')}
|
||||
@@ -227,10 +242,8 @@
|
||||
color="danger-subtle"
|
||||
size="lg"
|
||||
onclick={() => blockInstance(community.instance_id)}
|
||||
icon={BuildingOffice2}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={BuildingOffice2} size="16" mini />
|
||||
{/snippet}
|
||||
{$t('cards.community.blockInstance')}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
@@ -257,10 +270,8 @@
|
||||
dismissable: true,
|
||||
type: 'error',
|
||||
})}
|
||||
icon={Fire}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Fire} size="16" mini />
|
||||
{/snippet}
|
||||
{$t('admin.purge')}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
|
||||
@@ -201,10 +201,8 @@
|
||||
? 'aspect-square @md:px-2 @md:min-w-30 @md:aspect-auto'
|
||||
: 'px-3',
|
||||
]}
|
||||
icon={subscribed ? Check : Plus}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={subscribed ? Check : Plus} size="16" micro />
|
||||
{/snippet}
|
||||
<span class={[view == 'compact' && 'hidden', '@md:block']}>
|
||||
{#if subscribed}
|
||||
{$t('cards.community.subscribed')}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import Avatar from '$lib/components/ui/Avatar.svelte'
|
||||
import type { Community, Person } from '$lib/client/types'
|
||||
import { client } from '$lib/client/lemmy.svelte'
|
||||
import { Label, toast, Button, Checkbox, Modal } from 'mono-svelte'
|
||||
import { Label, toast, Button, Modal, Switch } from 'mono-svelte'
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
@@ -115,12 +115,12 @@
|
||||
label={$t('moderation.reason')}
|
||||
/>
|
||||
{#if !banned}
|
||||
<Checkbox bind:checked={deleteData}>
|
||||
<Switch bind:checked={deleteData}>
|
||||
{$t('moderation.ban.deleteData')}
|
||||
{#snippet description()}
|
||||
{$t('moderation.ban.warning')}
|
||||
{/snippet}
|
||||
</Checkbox>
|
||||
</Switch>
|
||||
<Label text={$t('moderation.ban.expires')}>
|
||||
<Duration bind:value={expires}></Duration>
|
||||
</Label>
|
||||
|
||||
@@ -43,10 +43,7 @@
|
||||
{$t('moderation.label')}
|
||||
{/if}
|
||||
</MenuDivider>
|
||||
<MenuButton color="danger-subtle" onclick={() => remove(item)}>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Trash} size="16" mini />
|
||||
{/snippet}
|
||||
<MenuButton color="danger-subtle" onclick={() => remove(item)} icon={Trash}>
|
||||
{#if isCommentView(item)}
|
||||
{item.comment.removed
|
||||
? $t('moderation.restore')
|
||||
@@ -59,10 +56,8 @@
|
||||
color="danger-subtle"
|
||||
onclick={() =>
|
||||
ban(item.creator_banned_from_community, item.creator, item.community)}
|
||||
icon={ShieldExclamation}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={ShieldExclamation} size="16" mini />
|
||||
{/snippet}
|
||||
{item.creator_banned_from_community
|
||||
? $t('moderation.ban.unbanFromCommunity')
|
||||
: $t('moderation.ban.banFromCommunity')}
|
||||
@@ -81,10 +76,8 @@
|
||||
)
|
||||
).comment_view.comment
|
||||
}}
|
||||
icon={Megaphone}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Megaphone} size="16" micro />
|
||||
{/snippet}
|
||||
{item.comment.distinguished
|
||||
? $t('moderation.unfeature')
|
||||
: $t('moderation.feature')}
|
||||
@@ -107,10 +100,11 @@
|
||||
|
||||
{#if profile.current?.user && isAdmin(profile.current.user)}
|
||||
<MenuDivider showLabel>{$t('admin.label')}</MenuDivider>
|
||||
<MenuButton color="danger-subtle" onclick={() => remove(item, true)}>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Fire} size="16" mini />
|
||||
{/snippet}
|
||||
<MenuButton
|
||||
color="danger-subtle"
|
||||
onclick={() => remove(item, true)}
|
||||
icon={Fire}
|
||||
>
|
||||
{$t('admin.purge')}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
|
||||
@@ -91,10 +91,8 @@
|
||||
color="warning-subtle"
|
||||
onclick={() => lock(!item.post.locked)}
|
||||
loading={acting}
|
||||
icon={item.post.locked ? LockOpen : LockClosed}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={item.post.locked ? LockOpen : LockClosed} size="16" mini />
|
||||
{/snippet}
|
||||
{item.post.locked ? $t('moderation.unlock') : $t('moderation.lock')}
|
||||
</MenuButton>
|
||||
|
||||
|
||||
@@ -2,22 +2,22 @@
|
||||
import { preventDefault, run } from 'svelte/legacy'
|
||||
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import { getClient } from '$lib/client/lemmy.svelte'
|
||||
import type { CommentView, PostView } from '$lib/client/types'
|
||||
import MultiSelect from '$lib/components/input/Switch.svelte'
|
||||
import { removalTemplate } from '$lib/components/lemmy/moderation/moderation.js'
|
||||
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { getClient } from '$lib/client/lemmy.svelte'
|
||||
import { errorMessage } from '$lib/lemmy/error'
|
||||
import { isCommentView, isPostView } from '$lib/lemmy/item.js'
|
||||
import { settings } from '$lib/settings.svelte.js'
|
||||
import { fullCommunityName } from '$lib/util.svelte.js'
|
||||
import type { CommentView, PostView } from '$lib/client/types'
|
||||
import { Button, Modal, Select, Switch, toast } from 'mono-svelte'
|
||||
import Option from 'mono-svelte/forms/select/Option.svelte'
|
||||
import { Fire, Icon, Trash } from 'svelte-hero-icons'
|
||||
import { amMod, isAdmin } from './moderation'
|
||||
import { errorMessage } from '$lib/lemmy/error'
|
||||
import { Post } from '../post'
|
||||
import { Fire, Trash } from 'svelte-hero-icons'
|
||||
import { Comment } from '../comment'
|
||||
import { Post } from '../post'
|
||||
import { amMod, isAdmin } from './moderation'
|
||||
|
||||
interface Props {
|
||||
open: boolean
|
||||
@@ -257,10 +257,8 @@
|
||||
{loading}
|
||||
disabled={loading}
|
||||
submit
|
||||
icon={purge ? Fire : Trash}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={purge ? Fire : Trash} mini size="16" />
|
||||
{/snippet}
|
||||
{#if purge}
|
||||
{$t('admin.purge')}
|
||||
{:else}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<script lang="ts" module> type BadgeType =
|
||||
<script lang="ts" module>
|
||||
type BadgeType =
|
||||
| 'nsfw'
|
||||
| 'saved'
|
||||
| 'featured'
|
||||
@@ -86,11 +87,11 @@
|
||||
|
||||
const newTitle = title
|
||||
.toString()
|
||||
.replace(/^(\[.[^\]]+\])|(\[.[^\]]+\])$/g, match => {
|
||||
.replace(/^(\[.[^\]]+\])|(\[.[^\]]+\])$/g, (match) => {
|
||||
const contents = match.split(',').map((part: string) => part.trim())
|
||||
|
||||
contents
|
||||
.map(i => i.replaceAll(/(\[|\])/g, ''))
|
||||
.map((i) => i.replaceAll(/(\[|\])/g, ''))
|
||||
.forEach((content: string) => {
|
||||
extracted.push(
|
||||
textToTag.get(content) ?? {
|
||||
@@ -332,15 +333,16 @@
|
||||
{/if}
|
||||
{#each Object.keys(badges)
|
||||
// filter by ones that are true
|
||||
.filter(i => badges[i as BadgeType] == true)
|
||||
.filter((i) => badges[i as BadgeType] == true)
|
||||
// get from predetermined map
|
||||
.map(i => badgeToData.get(i as BadgeType))
|
||||
.map((i) => badgeToData.get(i as BadgeType))
|
||||
// remove null
|
||||
.filter(i => i != undefined) as badge}
|
||||
<Badge label={badge.label} color={badge.color} allowIconOnly>{#snippet icon()}
|
||||
.filter((i) => i != undefined) as badge}
|
||||
<Badge label={badge.label} color={badge.color} allowIconOnly
|
||||
>{#snippet icon()}
|
||||
<Icon src={badge.icon} micro size="14" />{/snippet}{badge.label}
|
||||
</Badge>
|
||||
{/each}
|
||||
{/each}
|
||||
{@render extraBadges?.()}
|
||||
</div>
|
||||
</header>
|
||||
@@ -358,10 +360,8 @@
|
||||
<a
|
||||
href={useAttachedUrl
|
||||
? postUrl
|
||||
: `/post/${encodeURIComponent(profile.current.intsance)}/${id}`}
|
||||
target={useAttachedUrl
|
||||
? '_blank'
|
||||
: undefined}
|
||||
: `/post/${encodeURIComponent(profile.current.instance)}/${id}`}
|
||||
target={useAttachedUrl ? '_blank' : undefined}
|
||||
rel={useAttachedUrl ? 'noopener noreferrer' : undefined}
|
||||
class="inline-block hover:underline hover:text-primary-900 dark:hover:text-primary-100 transition-colors"
|
||||
>
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
<PostForm
|
||||
edit
|
||||
editingPost={post.post}
|
||||
onsubmit={e => {
|
||||
onsubmit={(e) => {
|
||||
editing = false
|
||||
post = e
|
||||
onedit?.(e)
|
||||
@@ -124,11 +124,8 @@
|
||||
color="secondary"
|
||||
rounding="pill"
|
||||
class={buttonSquare}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={BugAnt} micro size="16" />
|
||||
{/snippet}
|
||||
</Button>
|
||||
icon={BugAnt}
|
||||
></Button>
|
||||
{/if}
|
||||
{#if profile.current?.user && (amMod(profile.current.user, post.community) || isAdmin(profile.current.user))}
|
||||
{#await import('$lib/components/lemmy/moderation/ModerationMenu.svelte') then { default: ModerationMenu }}
|
||||
@@ -164,11 +161,8 @@
|
||||
loading={saving}
|
||||
disabled={saving}
|
||||
title={post.saved ? $t('post.actions.unsave') : $t('post.actions.save')}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={post.saved ? BookmarkSlash : Bookmark} size="16" mini />
|
||||
{/snippet}
|
||||
</Button>
|
||||
icon={post.saved ? BookmarkSlash : Bookmark}
|
||||
></Button>
|
||||
{/if}
|
||||
|
||||
<Menu placement="bottom-end">
|
||||
@@ -180,11 +174,8 @@
|
||||
rounding="pill"
|
||||
size="custom"
|
||||
class={buttonSquare}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={EllipsisHorizontal} size="16" micro />
|
||||
{/snippet}
|
||||
</Button>
|
||||
icon={EllipsisHorizontal}
|
||||
></Button>
|
||||
{/snippet}
|
||||
{#snippet children(open)}
|
||||
{#if open}
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
<script lang="ts">
|
||||
import { goto } from '$app/navigation'
|
||||
import { profile } from '$lib/auth.svelte'
|
||||
import { client } from '$lib/client/lemmy.svelte'
|
||||
import { PiefedClient } from '$lib/client/piefed/piefed'
|
||||
import type { PostView } from '$lib/client/types'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { deleteItem, markAsRead } from '$lib/lemmy/contentview'
|
||||
import { setSessionStorage } from '$lib/session'
|
||||
import { settings } from '$lib/settings.svelte'
|
||||
import { instanceToURL } from '$lib/util.svelte'
|
||||
import type { PostView } from '$lib/client/types'
|
||||
import { Button, Menu, MenuButton, toast } from 'mono-svelte'
|
||||
import {
|
||||
ArrowTopRightOnSquare,
|
||||
@@ -15,7 +17,6 @@
|
||||
EyeSlash,
|
||||
Flag,
|
||||
GlobeAlt,
|
||||
Icon,
|
||||
MapPin,
|
||||
PencilSquare,
|
||||
Share,
|
||||
@@ -24,8 +25,6 @@
|
||||
} from 'svelte-hero-icons'
|
||||
import { report } from '../../moderation/moderation'
|
||||
import { hidePost } from '../helpers'
|
||||
import { client } from '$lib/client/lemmy.svelte'
|
||||
import { PiefedClient } from '$lib/client/piefed/piefed'
|
||||
|
||||
interface Props {
|
||||
post: PostView
|
||||
@@ -52,10 +51,7 @@
|
||||
</script>
|
||||
|
||||
{#if profile.current?.user && profile.current?.jwt && profile.current.user.local_user_view.person.id == post.creator.id}
|
||||
<MenuButton onclick={() => (editing = true)}>
|
||||
{#snippet prefix()}
|
||||
<Icon src={PencilSquare} size="16" micro />
|
||||
{/snippet}
|
||||
<MenuButton onclick={() => (editing = true)} icon={PencilSquare}>
|
||||
{$t('post.actions.more.edit')}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
@@ -65,10 +61,8 @@
|
||||
if (profile.current?.jwt)
|
||||
post.read = await markAsRead(post.post, !post.read)
|
||||
}}
|
||||
icon={post.read ? EyeSlash : Eye}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={post.read ? EyeSlash : Eye} size="16" micro />
|
||||
{/snippet}
|
||||
{post.read
|
||||
? $t('post.actions.more.markUnread')
|
||||
: $t('post.actions.more.markRead')}
|
||||
@@ -78,10 +72,8 @@
|
||||
<MenuButton
|
||||
onclick={() => share()}
|
||||
class={['flex-1', !post.post.local && 'rounded-r-lg']}
|
||||
icon={Share}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Share} size="16" micro />
|
||||
{/snippet}
|
||||
{$t('post.actions.more.share')}
|
||||
</MenuButton>
|
||||
{#if !post.post.local}
|
||||
@@ -94,27 +86,13 @@
|
||||
size="custom"
|
||||
class="w-6 h-6 self-center"
|
||||
data-autoclose="false"
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon
|
||||
src={EllipsisHorizontal}
|
||||
size="16"
|
||||
micro
|
||||
class="text-slate-600 dark:text-zinc-400"
|
||||
/>
|
||||
{/snippet}
|
||||
</Button>
|
||||
icon={EllipsisHorizontal}
|
||||
></Button>
|
||||
{/snippet}
|
||||
<MenuButton onclick={() => share(true)}>
|
||||
{#snippet prefix()}
|
||||
<Icon src={GlobeAlt} size="16" micro />
|
||||
{/snippet}
|
||||
<MenuButton onclick={() => share(true)} icon={GlobeAlt}>
|
||||
{$t('filter.location.global')}
|
||||
</MenuButton>
|
||||
<MenuButton onclick={() => share(false)}>
|
||||
{#snippet prefix()}
|
||||
<Icon src={MapPin} size="16" micro />
|
||||
{/snippet}
|
||||
<MenuButton onclick={() => share(false)} icon={MapPin}>
|
||||
{$t('filter.location.local')}
|
||||
</MenuButton>
|
||||
</Menu>
|
||||
@@ -141,10 +119,8 @@
|
||||
|
||||
goto('/create/post?crosspost=true')
|
||||
}}
|
||||
icon={ArrowTopRightOnSquare}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowTopRightOnSquare} size="16" micro />
|
||||
{/snippet}
|
||||
{$t('post.actions.more.crosspost')}
|
||||
</MenuButton>
|
||||
{#if profile.current.user && post.creator.id == profile.current.user.local_user_view.person.id}
|
||||
@@ -154,10 +130,8 @@
|
||||
post.post.deleted = await deleteItem(post, !post.post.deleted)
|
||||
}}
|
||||
color="danger-subtle"
|
||||
icon={Trash}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Trash} size="16" micro />
|
||||
{/snippet}
|
||||
{post.post.deleted
|
||||
? $t('post.actions.more.restore')
|
||||
: $t('post.actions.more.delete')}
|
||||
@@ -177,19 +151,14 @@
|
||||
if (hidden) onhide?.(hidden)
|
||||
}}
|
||||
color="danger-subtle"
|
||||
icon={XMark}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={XMark} size="16" micro />
|
||||
{/snippet}
|
||||
{post.hidden
|
||||
? $t('post.actions.more.unhide')
|
||||
: $t('post.actions.more.hide')}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
<MenuButton onclick={() => report(post)} color="danger-subtle">
|
||||
{#snippet prefix()}
|
||||
<Icon src={Flag} size="16" micro />
|
||||
{/snippet}
|
||||
<MenuButton onclick={() => report(post)} color="danger-subtle" icon={Flag}>
|
||||
{$t('moderation.report')}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<script lang="ts">
|
||||
import type { PostView } from '$lib/client/types'
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
import { settings } from '$lib/settings.svelte.js'
|
||||
import type { PostView } from '$lib/client/types'
|
||||
import { Button } from 'mono-svelte'
|
||||
import type { Snippet } from 'svelte'
|
||||
import { ArchiveBox, Icon, Plus } from 'svelte-hero-icons'
|
||||
import { ArchiveBox, Plus } from 'svelte-hero-icons'
|
||||
import { Post } from '..'
|
||||
|
||||
interface Props {
|
||||
@@ -26,10 +26,7 @@
|
||||
title="No posts"
|
||||
description="There are no posts that match this filter."
|
||||
>
|
||||
<Button href="/communities">
|
||||
{#snippet prefix()}
|
||||
<Icon src={Plus} size="16" mini />
|
||||
{/snippet}
|
||||
<Button href="/communities" icon={Plus}>
|
||||
<span>Follow some communities</span>
|
||||
</Button>
|
||||
</Placeholder>
|
||||
|
||||
@@ -181,10 +181,12 @@
|
||||
title={$t('routes.frontpage.empty.title')}
|
||||
description={$t('routes.frontpage.empty.description')}
|
||||
>
|
||||
<Button href="/communities" rounding="pill" color="primary">
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowTopRightOnSquare} size="16" mini />
|
||||
{/snippet}
|
||||
<Button
|
||||
href="/communities"
|
||||
rounding="pill"
|
||||
color="primary"
|
||||
icon={ArrowTopRightOnSquare}
|
||||
>
|
||||
{$t('nav.communities')}
|
||||
</Button>
|
||||
</Placeholder>
|
||||
@@ -265,10 +267,7 @@
|
||||
community_name: feedData.community_name ?? 'undefined',
|
||||
})}
|
||||
{#snippet action()}
|
||||
<Button color="tertiary">
|
||||
{#snippet prefix()}
|
||||
<Icon src={ChevronDoubleUp} size="16" micro />
|
||||
{/snippet}
|
||||
<Button color="tertiary" icon={ChevronDoubleUp}>
|
||||
{$t('routes.post.scrollToTop')}
|
||||
</Button>
|
||||
{/snippet}
|
||||
|
||||
@@ -360,10 +360,8 @@
|
||||
size="sm"
|
||||
color={data.alt_text ? 'primary' : 'ghost'}
|
||||
class="text-xs"
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={ChatBubbleBottomCenterText} size="15" micro />
|
||||
{/snippet}{$t('form.post.altText')}
|
||||
icon={ChatBubbleBottomCenterText}
|
||||
>{$t('form.post.altText')}
|
||||
</Button>
|
||||
{/if}
|
||||
<Button
|
||||
@@ -372,10 +370,8 @@
|
||||
size="sm"
|
||||
color="ghost"
|
||||
class="text-xs"
|
||||
icon={Photo}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Photo} size="15" micro />
|
||||
{/snippet}
|
||||
{$t('form.post.uploadImage')}
|
||||
</Button>
|
||||
{#if generation.generatable}
|
||||
@@ -386,10 +382,8 @@
|
||||
size="sm"
|
||||
color="ghost"
|
||||
class="text-xs"
|
||||
icon={Sparkles}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Sparkles} size="15" micro />
|
||||
{/snippet}
|
||||
{$t('form.post.generateTitle')}
|
||||
</Button>
|
||||
{/if}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { Button, Material, toast } from 'mono-svelte'
|
||||
import { focusTrap } from 'svelte-focus-trap'
|
||||
import { Icon, Share, XMark } from 'svelte-hero-icons'
|
||||
import { Share, XMark } from 'svelte-hero-icons'
|
||||
import { expoOut } from 'svelte/easing'
|
||||
import { fade, scale } from 'svelte/transition'
|
||||
|
||||
@@ -66,22 +66,16 @@
|
||||
size="square-lg"
|
||||
rounding="pill"
|
||||
aria-label={$t('post.actions.more.share')}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Share} size="20" micro />
|
||||
{/snippet}
|
||||
</Button>
|
||||
icon={Share}
|
||||
></Button>
|
||||
<Button
|
||||
onclick={() => history.back()}
|
||||
color="tertiary"
|
||||
size="square-lg"
|
||||
rounding="pill"
|
||||
aria-label={$t('common.back')}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={XMark} size="20" micro />
|
||||
{/snippet}
|
||||
</Button>
|
||||
icon={XMark}
|
||||
></Button>
|
||||
</Material>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { navigating } from '$app/state'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { Button, TextInput } from 'mono-svelte'
|
||||
import { Icon, MagnifyingGlass } from 'svelte-hero-icons'
|
||||
import { MagnifyingGlass } from 'svelte-hero-icons'
|
||||
|
||||
interface Props {
|
||||
query?: string | null
|
||||
@@ -30,9 +30,6 @@
|
||||
title="Search"
|
||||
rounding="pill"
|
||||
loading={navigating.to?.route.id == '/search'}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={MagnifyingGlass} size="16" micro />
|
||||
{/snippet}
|
||||
</Button>
|
||||
icon={MagnifyingGlass}
|
||||
></Button>
|
||||
</div>
|
||||
@@ -79,7 +79,7 @@
|
||||
label={$t('nav.admin')}
|
||||
icon={ServerStack}
|
||||
class="relative"
|
||||
isSelectedFilter={path => path.startsWith('/admin')}
|
||||
isSelectedFilter={(path) => path.startsWith('/admin')}
|
||||
/>
|
||||
{/if}
|
||||
{#if amModOfAny(profile.current?.user)}
|
||||
@@ -142,7 +142,7 @@
|
||||
<Spinner width={20} />
|
||||
</div>
|
||||
{:then { default: Profile }}
|
||||
<Profile />
|
||||
<Profile />
|
||||
{/await}
|
||||
{/if}
|
||||
{/snippet}
|
||||
|
||||
@@ -66,10 +66,7 @@
|
||||
{/snippet}
|
||||
|
||||
{#if profile.current?.jwt}
|
||||
<MenuButton href="/inbox">
|
||||
{#snippet prefix()}
|
||||
<Icon src={Inbox} micro size="16" />
|
||||
{/snippet}
|
||||
<MenuButton href="/inbox" icon={Inbox}>
|
||||
{$t('profile.inbox')}
|
||||
{#if $notifications.inbox > 0}
|
||||
<Badge color="red-subtle" class="text-xs ml-auto font-bold py-0.5!">
|
||||
@@ -94,43 +91,25 @@
|
||||
</MenuButton>
|
||||
{/if}
|
||||
<MenuDivider>{$t('profile.profile')}</MenuDivider>
|
||||
<MenuButton href="/profile">
|
||||
{#snippet prefix()}
|
||||
<Icon src={UserCircle} micro size="16" />
|
||||
{/snippet}
|
||||
<MenuButton href="/profile" icon={UserCircle}>
|
||||
{$t('profile.profile')}
|
||||
</MenuButton>
|
||||
<MenuButton href="/saved">
|
||||
{#snippet prefix()}
|
||||
<Icon src={Bookmark} micro size="16" />
|
||||
{/snippet}
|
||||
<MenuButton href="/saved" icon={Bookmark}>
|
||||
{$t('profile.saved')}
|
||||
</MenuButton>
|
||||
{:else}
|
||||
<MenuButton href="/accounts/login">
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowLeftOnRectangle} mini size="16" />
|
||||
{/snippet}
|
||||
<MenuButton href="/accounts/login" icon={ArrowLeftOnRectangle}>
|
||||
{$t('account.login')}
|
||||
</MenuButton>
|
||||
<MenuButton href="/signup">
|
||||
{#snippet prefix()}
|
||||
<Icon src={Identification} micro size="16" />
|
||||
{/snippet}
|
||||
<MenuButton href="/signup" icon={Identification}>
|
||||
{$t('account.signup')}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
<MenuButton href="/accounts">
|
||||
{#snippet prefix()}
|
||||
<Icon src={UserGroup} micro size="16" />
|
||||
{/snippet}
|
||||
<MenuButton href="/accounts" icon={UserGroup}>
|
||||
{$t('account.accounts')}
|
||||
</MenuButton>
|
||||
<MenuDivider>{$t('nav.menu.app')}</MenuDivider>
|
||||
<MenuButton href="/settings">
|
||||
{#snippet prefix()}
|
||||
<Icon src={Cog6Tooth} micro size="16" />
|
||||
{/snippet}
|
||||
<MenuButton href="/settings" icon={Cog6Tooth}>
|
||||
{$t('nav.menu.settings')}
|
||||
</MenuButton>
|
||||
<Select bind:value={theme.colorScheme} size="sm" placement="bottom">
|
||||
@@ -158,19 +137,11 @@
|
||||
</Option>
|
||||
{/snippet}
|
||||
</Select>
|
||||
<MenuButton href="/theme">
|
||||
{#snippet prefix()}
|
||||
<Icon src={Swatch} size="16" micro />
|
||||
{/snippet}
|
||||
<MenuButton href="/theme" icon={Swatch}>
|
||||
{$t('nav.menu.theme')}
|
||||
</MenuButton>
|
||||
{#if settings.debugInfo}
|
||||
<MenuButton href="/util">
|
||||
{#snippet prefix()}
|
||||
<Icon src={BugAnt} mini size="16" />
|
||||
{/snippet}
|
||||
Debug
|
||||
</MenuButton>
|
||||
<MenuButton href="/util" icon={BugAnt}>Debug</MenuButton>
|
||||
{/if}
|
||||
<li class="flex flex-col px-2 py-1 mx-auto my-1 text-xs w-full">
|
||||
<div class="flex flex-row gap-2 w-full items-center">
|
||||
|
||||
@@ -48,7 +48,10 @@
|
||||
<div class="font-medium">{profile.current.username}</div>
|
||||
{#if !LINKED_INSTANCE_URL}
|
||||
<div class="text-xs text-slate-500 dark:text-zinc-500">
|
||||
<span class="capitalize">{profile.current.client?.name ?? DEFAULT_CLIENT_TYPE.name}</span> • {profile.current.instance}
|
||||
<span class="capitalize"
|
||||
>{profile.current.client?.name ?? DEFAULT_CLIENT_TYPE.name}</span
|
||||
>
|
||||
• {profile.current.instance}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
@@ -75,7 +78,10 @@
|
||||
<div class="font-medium text-sm">{p.username}</div>
|
||||
{#if !LINKED_INSTANCE_URL}
|
||||
<div class="text-xs text-slate-500 dark:text-zinc-500">
|
||||
<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}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
@@ -95,10 +101,7 @@
|
||||
{/if}
|
||||
</MenuButton>
|
||||
{/each}
|
||||
<MenuButton href="/accounts">
|
||||
{#snippet prefix()}
|
||||
<Icon src={UserGroup} size="16" micro />
|
||||
{/snippet}
|
||||
<MenuButton href="/accounts" icon={UserGroup}>
|
||||
{$t('account.accounts')}
|
||||
</MenuButton>
|
||||
</Menu>
|
||||
@@ -131,7 +131,7 @@
|
||||
</span>
|
||||
{/snippet}
|
||||
<ItemList
|
||||
items={profile.current.user.moderates.map(i => ({
|
||||
items={profile.current.user.moderates.map((i) => ({
|
||||
id: i.community.id,
|
||||
name: i.community.title,
|
||||
url: communityLink(i.community),
|
||||
@@ -157,7 +157,7 @@
|
||||
{/snippet}
|
||||
|
||||
<ItemList
|
||||
items={profile.current.user.follows.map(i => ({
|
||||
items={profile.current.user.follows.map((i) => ({
|
||||
id: i.community.id,
|
||||
name: i.community.title,
|
||||
url: communityLink(i.community),
|
||||
|
||||
@@ -73,6 +73,7 @@
|
||||
children?: Snippet
|
||||
suffix?: Snippet
|
||||
onclick?: HTMLButtonAttributes['onclick']
|
||||
icon?: IconSource
|
||||
}
|
||||
|
||||
export type { Props as ButtonProps }
|
||||
@@ -87,6 +88,7 @@
|
||||
|
||||
import Spinner from '../loader/Spinner.svelte'
|
||||
import type { Snippet } from 'svelte'
|
||||
import { Icon, type IconSource } from 'svelte-hero-icons'
|
||||
|
||||
let {
|
||||
loading = false,
|
||||
@@ -103,6 +105,7 @@
|
||||
prefix,
|
||||
children,
|
||||
suffix,
|
||||
icon,
|
||||
...rest
|
||||
}: Props = $props()
|
||||
</script>
|
||||
@@ -136,6 +139,8 @@
|
||||
<Spinner width={loaderWidth ?? 16} />
|
||||
{:else if prefix}
|
||||
{@render prefix?.()}
|
||||
{:else if icon}
|
||||
<Icon src={icon} size="16" mini />
|
||||
{/if}
|
||||
{@render children?.()}
|
||||
{@render suffix?.()}
|
||||
|
||||
@@ -93,8 +93,12 @@
|
||||
</script>
|
||||
|
||||
{#snippet selectTarget(attachment: Attachment)}
|
||||
<Label text={label} customText={customLabel} class={['space-y-1 relative', baseClass]}>
|
||||
<div class="relative" role="presentation">
|
||||
<Label
|
||||
text={label}
|
||||
customText={customLabel}
|
||||
class={['space-y-1 relative', baseClass]}
|
||||
>
|
||||
<div class="relative w-max max-w-full" role="presentation">
|
||||
<select
|
||||
{@attach attachment}
|
||||
{...rest}
|
||||
@@ -109,10 +113,10 @@
|
||||
clazz,
|
||||
]}
|
||||
bind:value
|
||||
onmousedown={e => {
|
||||
onmousedown={(e) => {
|
||||
e.preventDefault()
|
||||
}}
|
||||
onkeypress={e => {
|
||||
onkeypress={(e) => {
|
||||
e.preventDefault()
|
||||
open = !open
|
||||
}}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
<script lang="ts">
|
||||
import { pushState, replaceState } from '$app/navigation'
|
||||
import { page } from '$app/state'
|
||||
import type { Snippet } from 'svelte'
|
||||
import { focusTrap } from 'svelte-focus-trap'
|
||||
import { Icon, XMark } from 'svelte-hero-icons'
|
||||
import { XMark } from 'svelte-hero-icons'
|
||||
import { backOut } from 'svelte/easing'
|
||||
import type { ClassValue } from 'svelte/elements'
|
||||
import { fade, scale } from 'svelte/transition'
|
||||
import { Button } from '../index.js'
|
||||
import Portal from '../popover/Portal.svelte'
|
||||
import type { Snippet } from 'svelte'
|
||||
import { page } from '$app/state'
|
||||
import { pushState, replaceState } from '$app/navigation'
|
||||
|
||||
interface Props {
|
||||
action?: string | undefined
|
||||
@@ -110,11 +110,8 @@ bg-white/50 dark:bg-black/50 box-border p-4"
|
||||
color="tertiary"
|
||||
size="square-sm"
|
||||
onclick={() => onclose()}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={XMark} size="20" mini />
|
||||
{/snippet}
|
||||
</Button>
|
||||
icon={XMark}
|
||||
></Button>
|
||||
{/if}
|
||||
{#if title !== null}
|
||||
<h1 class="font-semibold text-xl max-w-full">
|
||||
|
||||
@@ -70,13 +70,13 @@
|
||||
<TextInput
|
||||
{@attach attachment}
|
||||
bind:value={query}
|
||||
oninput={e => {
|
||||
oninput={(e) => {
|
||||
searching = true
|
||||
openMenu = true
|
||||
oninput?.(e)
|
||||
debounceFunc()
|
||||
}}
|
||||
onfocus={e => {
|
||||
onfocus={(e) => {
|
||||
searching = true
|
||||
openMenu = true
|
||||
oninput?.(e)
|
||||
|
||||
@@ -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