84 files changed
+2068
-1083
No files matched your search
@@ -1,24 +0,0 @@
|
||||
name: Node.js CI
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: ['main']
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [20.x]
|
||||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
cache: 'npm'
|
||||
- run: npm install
|
||||
- run: npm test
|
||||
+2
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "photon-lemmy",
|
||||
"version": "1.29.6",
|
||||
"version": "1.30.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "vite dev",
|
||||
@@ -35,6 +35,7 @@
|
||||
"svelte-check": "^3.0.1",
|
||||
"svelte-hero-icons": "^5.0.0",
|
||||
"svelte-tiny-virtual-list": "^2.0.5",
|
||||
"sveltekit-i18n": "^2.4.2",
|
||||
"tailwindcss": "^3.3.3",
|
||||
"tslib": "^2.4.1",
|
||||
"typescript": "^5.0.0",
|
||||
|
||||
@@ -2,21 +2,14 @@
|
||||
import Markdown from '$lib/components/markdown/Markdown.svelte'
|
||||
import Avatar from '$lib/components/ui/Avatar.svelte'
|
||||
import StickyCard from '$lib/components/ui/StickyCard.svelte'
|
||||
import FormattedNumber from '$lib/components/util/FormattedNumber.svelte'
|
||||
import RelativeDate from '$lib/components/util/RelativeDate.svelte'
|
||||
import { publishedToDate } from '$lib/components/util/date.js'
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import type { PersonView, SiteView, Tagline } from 'lemmy-js-client'
|
||||
import { Button, Disclosure, Popover } from 'mono-svelte'
|
||||
import { Button } from 'mono-svelte'
|
||||
import {
|
||||
BuildingOffice,
|
||||
Calendar,
|
||||
ChartBar,
|
||||
ChatBubbleOvalLeftEllipsis,
|
||||
Icon,
|
||||
InformationCircle,
|
||||
Newspaper,
|
||||
PencilSquare,
|
||||
ServerStack,
|
||||
UserGroup,
|
||||
} from 'svelte-hero-icons'
|
||||
@@ -24,6 +17,7 @@
|
||||
import LabelStat from '../ui/LabelStat.svelte'
|
||||
import ItemList from './generic/ItemList.svelte'
|
||||
import { userLink } from '$lib/lemmy/generic'
|
||||
import { t } from '$lib/translations'
|
||||
|
||||
export let site: SiteView
|
||||
export let taglines: Tagline[] | undefined = undefined
|
||||
@@ -49,15 +43,25 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-row gap-1 !border-0">
|
||||
<Button href="/modlog" title="Modlog" color="ghost" size="square-md">
|
||||
<Button
|
||||
href="/modlog"
|
||||
title={$t('routes.modlog')}
|
||||
color="ghost"
|
||||
size="square-md"
|
||||
>
|
||||
<Icon src={Newspaper} size="16" mini />
|
||||
</Button>
|
||||
<Button href="/legal" title="Legal" color="ghost" size="square-md">
|
||||
<Button
|
||||
href="/legal"
|
||||
title={$t('routes.legal.title')}
|
||||
color="ghost"
|
||||
size="square-md"
|
||||
>
|
||||
<Icon src={BuildingOffice} size="16" mini />
|
||||
</Button>
|
||||
<Button
|
||||
href="/instances"
|
||||
title="Instances"
|
||||
title={$t('routes.instances')}
|
||||
class="3xl:rounded-l-none"
|
||||
color="ghost"
|
||||
size="square-md"
|
||||
@@ -78,7 +82,8 @@
|
||||
|
||||
<Expandable>
|
||||
<svelte:fragment slot="title">
|
||||
<Icon src={InformationCircle} size="15" mini /> About
|
||||
<Icon src={InformationCircle} size="15" mini />
|
||||
{$t('cards.site.about')}
|
||||
</svelte:fragment>
|
||||
<Markdown source={site.site.description} />
|
||||
<div class="my-4" />
|
||||
@@ -87,21 +92,22 @@
|
||||
|
||||
<Expandable>
|
||||
<svelte:fragment slot="title">
|
||||
<Icon src={ChartBar} size="15" mini /> Stats
|
||||
<Icon src={ChartBar} size="15" mini />
|
||||
{$t('cards.site.stats')}
|
||||
</svelte:fragment>
|
||||
<div class="flex flex-row gap-4 flex-wrap">
|
||||
<LabelStat
|
||||
label="Users"
|
||||
label={$t('content.users')}
|
||||
content={site.counts.users.toString()}
|
||||
formatted
|
||||
/>
|
||||
<LabelStat
|
||||
label="Posts"
|
||||
label={$t('content.posts')}
|
||||
content={site.counts.posts.toString()}
|
||||
formatted
|
||||
/>
|
||||
<LabelStat
|
||||
label="Communities"
|
||||
label={$t('content.communities')}
|
||||
content={site.counts.communities.toString()}
|
||||
formatted
|
||||
/>
|
||||
@@ -111,7 +117,8 @@
|
||||
{#if admins}
|
||||
<Expandable>
|
||||
<svelte:fragment slot="title">
|
||||
<Icon src={UserGroup} size="15" mini /> Admins
|
||||
<Icon src={UserGroup} size="15" mini />
|
||||
{$t('cards.site.admins')}
|
||||
</svelte:fragment>
|
||||
<ItemList
|
||||
items={admins.map((a) => ({
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
import ShieldIcon from '../moderation/ShieldIcon.svelte'
|
||||
import { page } from '$app/stores'
|
||||
import { onMount } from 'svelte'
|
||||
import { t } from '$lib/translations'
|
||||
|
||||
export let node: CommentNodeI
|
||||
export let postId: number
|
||||
@@ -50,11 +51,6 @@
|
||||
node.comment_view.comment.content = newComment
|
||||
|
||||
editing = false
|
||||
|
||||
toast({
|
||||
content: 'Successfully edited comment.',
|
||||
type: 'success',
|
||||
})
|
||||
} catch (err) {
|
||||
toast({
|
||||
// @ts-ignore i hate this
|
||||
@@ -145,7 +141,7 @@
|
||||
src={Trash}
|
||||
solid
|
||||
size="12"
|
||||
title="Deleted"
|
||||
title={$t('post.badges.deleted')}
|
||||
class="text-red-600 dark:text-red-500"
|
||||
/>
|
||||
{/if}
|
||||
@@ -154,7 +150,7 @@
|
||||
src={Bookmark}
|
||||
solid
|
||||
size="12"
|
||||
title="Saved"
|
||||
title={$t('post.badges.saved')}
|
||||
class="text-yellow-600 dark:text-yellow-500"
|
||||
/>
|
||||
{/if}
|
||||
@@ -181,7 +177,7 @@
|
||||
<div
|
||||
class="max-w-full my-2 border-l border-slate-200 dark:border-zinc-800 pl-4"
|
||||
>
|
||||
<h1 class="font-bold text-sm mb-2">Reply</h1>
|
||||
<h1 class="font-bold text-sm mb-2">{$t('comment.reply')}</h1>
|
||||
<CommentForm
|
||||
{postId}
|
||||
parentId={node.comment_view.comment.id}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
EllipsisHorizontal,
|
||||
Flag,
|
||||
Icon,
|
||||
Language,
|
||||
PencilSquare,
|
||||
Square2Stack,
|
||||
Trash,
|
||||
@@ -23,6 +24,10 @@
|
||||
import { profile } from '$lib/auth.js'
|
||||
import { deleteItem, save } from '$lib/lemmy/contentview.js'
|
||||
import { Button, Menu, MenuButton, MenuDivider } from 'mono-svelte'
|
||||
import { t } from '$lib/translations'
|
||||
import Translation from '$lib/components/translate/Translation.svelte'
|
||||
import { text } from '$lib/components/translate/translation'
|
||||
import { userSettings } from '$lib/settings'
|
||||
|
||||
export let comment: CommentView
|
||||
export let replying: boolean = false
|
||||
@@ -30,8 +35,13 @@
|
||||
const dispatcher = createEventDispatcher<{ edit: CommentView }>()
|
||||
|
||||
let reply = ''
|
||||
let translating = false
|
||||
</script>
|
||||
|
||||
{#if translating}
|
||||
<Translation bind:open={translating} />
|
||||
{/if}
|
||||
|
||||
<div class="flex flex-row items-center gap-0.5 h-7 relative">
|
||||
<CommentVote
|
||||
bind:upvotes={comment.counts.upvotes}
|
||||
@@ -47,7 +57,7 @@
|
||||
disabled={comment.post.locked}
|
||||
>
|
||||
<Icon src={ArrowUturnLeft} width={14} height={14} mini />
|
||||
<span class="text-xs">Reply</span>
|
||||
<span class="text-xs">{$t('comment.reply')}</span>
|
||||
</Button>
|
||||
{#if $profile?.user && (amMod($profile?.user, comment.community) || isAdmin($profile.user))}
|
||||
<CommentModerationMenu bind:item={comment} />
|
||||
@@ -56,7 +66,7 @@
|
||||
<Button
|
||||
slot="target"
|
||||
class="!p-1 text-slate-600 dark:text-zinc-400"
|
||||
aria-label="Comment actions"
|
||||
title={$t('comment.actions.label')}
|
||||
color="tertiary"
|
||||
>
|
||||
<Icon
|
||||
@@ -67,7 +77,7 @@
|
||||
slot="prefix"
|
||||
/>
|
||||
</Button>
|
||||
<MenuDivider>Actions</MenuDivider>
|
||||
<MenuDivider>{$t('comment.actions.label')}</MenuDivider>
|
||||
<MenuButton
|
||||
on:click={() => {
|
||||
navigator.share?.({
|
||||
@@ -76,13 +86,25 @@
|
||||
}}
|
||||
>
|
||||
<Icon src={Square2Stack} mini size="16" />
|
||||
<divv>Copy Link</divv>
|
||||
<div>{$t('comment.actions.link')}</div>
|
||||
</MenuButton>
|
||||
{#if $userSettings.translator}
|
||||
<MenuButton
|
||||
on:click={() => {
|
||||
// @ts-ignore
|
||||
text.set(comment.comment.content)
|
||||
translating = !translating
|
||||
}}
|
||||
>
|
||||
<Icon src={Language} size="16" mini slot="prefix" />
|
||||
{$t('post.actions.more.translate')}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
{#if $profile?.jwt}
|
||||
{#if comment.creator.id == $profile.user?.local_user_view.person.id}
|
||||
<MenuButton on:click={() => dispatcher('edit', comment)}>
|
||||
<Icon src={PencilSquare} mini size="16" />
|
||||
<span>Edit</span>
|
||||
<span>{$t('post.actions.more.edit')}</span>
|
||||
</MenuButton>
|
||||
{/if}
|
||||
<MenuButton
|
||||
@@ -92,7 +114,9 @@
|
||||
}}
|
||||
>
|
||||
<Icon src={comment.saved ? BookmarkSlash : Bookmark} mini size="16" />
|
||||
<span>{comment.saved ? 'Unsave' : 'Save'}</span>
|
||||
<span>
|
||||
{comment.saved ? $t('post.actions.unsave') : $t('post.actions.save')}
|
||||
</span>
|
||||
</MenuButton>
|
||||
{#if $profile?.user && $profile.jwt && $profile.user.local_user_view.person.id == comment.creator.id}
|
||||
<MenuButton
|
||||
@@ -107,13 +131,17 @@
|
||||
}}
|
||||
>
|
||||
<Icon src={Trash} mini size="16" />
|
||||
<span>{comment.comment.deleted ? 'Restore' : 'Delete'}</span>
|
||||
<span>
|
||||
{comment.comment.deleted
|
||||
? $t('post.actions.more.restore')
|
||||
: $t('post.actions.more.delete')}
|
||||
</span>
|
||||
</MenuButton>
|
||||
{/if}
|
||||
{#if $profile.jwt && $profile.user?.local_user_view.person.id != comment.creator.id}
|
||||
<MenuButton on:click={() => report(comment)} color="danger-subtle">
|
||||
<Icon src={Flag} mini size="16" />
|
||||
<span>Report</span>
|
||||
<span>{$t('moderation.report')}</span>
|
||||
</MenuButton>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||
import { placeholders } from '$lib/util.js'
|
||||
import { Button } from 'mono-svelte'
|
||||
import { t } from '$lib/translations'
|
||||
|
||||
export let postId: number
|
||||
export let parentId: number | undefined = undefined
|
||||
@@ -40,10 +41,6 @@
|
||||
dispatch('comment', response)
|
||||
|
||||
value = ''
|
||||
toast({
|
||||
content: 'Your comment was submitted.',
|
||||
type: 'success',
|
||||
})
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
toast({
|
||||
@@ -69,7 +66,7 @@
|
||||
{...$$restProps}
|
||||
{rows}
|
||||
placeholder={locked
|
||||
? 'This post is locked.'
|
||||
? $t('comment.locked')
|
||||
: placeholder ?? placeholders.get('comment')}
|
||||
bind:value
|
||||
disabled={locked || loading}
|
||||
@@ -92,7 +89,7 @@
|
||||
{loading}
|
||||
disabled={locked || loading}
|
||||
>
|
||||
Submit
|
||||
{$t('form.submit')}
|
||||
</Button>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
import { shouldShowVoteColor } from '../post/PostVote.svelte'
|
||||
import { fly } from 'svelte/transition'
|
||||
import { backOut } from 'svelte/easing'
|
||||
import { t } from '$lib/translations'
|
||||
|
||||
export let vote: number = 0
|
||||
export let upvotes: number
|
||||
@@ -25,7 +26,7 @@
|
||||
|
||||
const castVote = async (newVote: number) => {
|
||||
if (!$profile?.jwt) {
|
||||
toast({ content: 'You must be logged in to vote.', type: 'warning' })
|
||||
toast({ content: $t('toast.loginVoteGate'), type: 'warning' })
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
import { Button } from 'mono-svelte'
|
||||
import { afterNavigate } from '$app/navigation'
|
||||
import { backOut } from 'svelte/easing'
|
||||
import { t } from '$lib/translations'
|
||||
|
||||
export let nodes: CommentNodeI[]
|
||||
export let isParent: boolean
|
||||
@@ -62,7 +63,7 @@
|
||||
if (newComments.comments.length == 0) {
|
||||
loadingChildren = false
|
||||
toast({
|
||||
content: 'The API returned no comments.',
|
||||
content: $t('toast.noComments'),
|
||||
type: 'error',
|
||||
})
|
||||
return
|
||||
@@ -81,7 +82,7 @@
|
||||
parent.children = treeParent.children
|
||||
if (treeParent.children.length == 0) {
|
||||
toast({
|
||||
content: 'The API returned no comments.',
|
||||
content: $t('toast.noComments'),
|
||||
type: 'warning',
|
||||
})
|
||||
}
|
||||
@@ -90,7 +91,7 @@
|
||||
parent.children = tree
|
||||
if (tree.length == 0) {
|
||||
toast({
|
||||
content: 'The API returned no comments.',
|
||||
content: $t('toast.noComments'),
|
||||
type: 'warning',
|
||||
})
|
||||
}
|
||||
@@ -99,7 +100,7 @@
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
toast({
|
||||
content: `Failed to fetch comments. ${error as any}`,
|
||||
content: error as any,
|
||||
type: 'error',
|
||||
})
|
||||
}
|
||||
@@ -112,7 +113,7 @@
|
||||
? 'divide-y dark:divide-zinc-800 divide-slate-100'
|
||||
: 'pl-3.5 border-l border-slate-200 dark:border-zinc-800 my-1'}
|
||||
>
|
||||
{#each nodes as node (node.comment_view.comment.id)}
|
||||
{#each nodes as node}
|
||||
<Comment
|
||||
postId={post.id}
|
||||
bind:node
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
import ShieldIcon from '../moderation/ShieldIcon.svelte'
|
||||
import ItemList from '../generic/ItemList.svelte'
|
||||
import { communityLink, userLink } from '$lib/lemmy/generic'
|
||||
import { t } from '$lib/translations'
|
||||
|
||||
export let community_view: CommunityView
|
||||
export let moderators: CommunityModeratorView[] = []
|
||||
@@ -83,7 +84,7 @@
|
||||
|
||||
try {
|
||||
const loading = toast({
|
||||
content: `${blocked ? 'Unblocking' : 'blocking'} community...`,
|
||||
content: ``,
|
||||
loading: true,
|
||||
})
|
||||
|
||||
@@ -95,9 +96,9 @@
|
||||
removeToast(loading)
|
||||
|
||||
toast({
|
||||
content: `Successfully ${
|
||||
blocked ? 'unblocked' : 'blocked'
|
||||
} that community.`,
|
||||
content: blocked
|
||||
? $t('toast.unblockedCommunity')
|
||||
: $t('toast.blockedCommunity'),
|
||||
type: 'success',
|
||||
})
|
||||
} catch (error) {
|
||||
@@ -119,14 +120,14 @@
|
||||
|
||||
async function purgeCommunity() {
|
||||
purgingCommunity = false
|
||||
const purgeToast = toast({ content: 'Purging community...', loading: true })
|
||||
const purgeToast = toast({ content: '', loading: true })
|
||||
|
||||
try {
|
||||
await client().purgeCommunity({
|
||||
community_id: community_view.community.id,
|
||||
})
|
||||
removeToast(purgeToast)
|
||||
toast({ content: 'Purged that community.', type: 'success' })
|
||||
toast({ content: $t('toast.purgedCommunity'), type: 'success' })
|
||||
} catch (e) {
|
||||
toast({ content: e as any, type: 'error' })
|
||||
}
|
||||
@@ -136,7 +137,7 @@
|
||||
if (!$profile?.jwt) return
|
||||
try {
|
||||
const loading = toast({
|
||||
content: `Blocking instance...`,
|
||||
content: ``,
|
||||
loading: true,
|
||||
})
|
||||
|
||||
@@ -159,14 +160,12 @@
|
||||
|
||||
{#if purgingCommunity}
|
||||
<Modal bind:open={purgingCommunity}>
|
||||
<svelte:fragment slot="title">Purging Community</svelte:fragment>
|
||||
<svelte:fragment slot="title">
|
||||
{$t('admin.purgeCommunity.title')}
|
||||
</svelte:fragment>
|
||||
<CommunityLink avatar community={community_view.community} />
|
||||
<p>
|
||||
Purging community <span class="font-bold">
|
||||
{community_view.community.title}
|
||||
</span>
|
||||
</p>
|
||||
<p>
|
||||
Are you sure you want to do this? (The button will enable in 3 seconds.)
|
||||
{$t('admin.purgeCommunity.warning')}
|
||||
</p>
|
||||
<div class="flex flex-row gap-2">
|
||||
<Button
|
||||
@@ -174,7 +173,7 @@
|
||||
on:click={() => (purgingCommunity = false)}
|
||||
class="flex-1"
|
||||
>
|
||||
Cancel
|
||||
{$t('common.cancel')}
|
||||
</Button>
|
||||
<Button
|
||||
size="lg"
|
||||
@@ -183,7 +182,7 @@
|
||||
disabled={!purgeEnabled}
|
||||
class="flex-1"
|
||||
>
|
||||
Purge
|
||||
{$t('admin.purge')}
|
||||
</Button>
|
||||
</div>
|
||||
</Modal>
|
||||
@@ -224,23 +223,25 @@
|
||||
>
|
||||
<Expandable class="!pt-0">
|
||||
<svelte:fragment slot="title">
|
||||
<Icon src={InformationCircle} size="15" mini /> About
|
||||
<Icon src={InformationCircle} size="15" mini />
|
||||
{$t('cards.site.about')}
|
||||
</svelte:fragment>
|
||||
<Markdown source={community_view.community.description} />
|
||||
</Expandable>
|
||||
|
||||
<Expandable>
|
||||
<svelte:fragment slot="title">
|
||||
<Icon src={ChartBar} size="15" mini /> Stats
|
||||
<Icon src={ChartBar} size="15" mini />
|
||||
{$t('cards.site.stats')}
|
||||
</svelte:fragment>
|
||||
<div class="flex flex-row gap-4 flex-wrap">
|
||||
<LabelStat
|
||||
label="Members"
|
||||
label={$t('cards.community.members')}
|
||||
content={community_view.counts.subscribers.toString()}
|
||||
formatted
|
||||
/>
|
||||
<LabelStat
|
||||
label="Posts"
|
||||
label={$t('content.posts')}
|
||||
content={community_view.counts.posts.toString()}
|
||||
formatted
|
||||
/>
|
||||
@@ -250,7 +251,8 @@
|
||||
{#if moderators && moderators.length > 0}
|
||||
<Expandable>
|
||||
<svelte:fragment slot="title">
|
||||
<ShieldIcon width={15} filled /> Moderators
|
||||
<ShieldIcon width={15} filled />
|
||||
{$t('cards.community.moderators')}
|
||||
</svelte:fragment>
|
||||
<ItemList
|
||||
items={moderators.map((m) => ({
|
||||
@@ -286,8 +288,8 @@
|
||||
/>
|
||||
{community_view.subscribed == 'Subscribed' ||
|
||||
community_view.subscribed == 'Pending'
|
||||
? 'Subscribed'
|
||||
: 'Subscribe'}
|
||||
? $t('cards.community.subscribed')
|
||||
: $t('cards.community.subscribe')}
|
||||
</Button>
|
||||
{/if}
|
||||
{#if $profile?.user && amMod($profile.user, community_view.community)}
|
||||
@@ -307,17 +309,19 @@
|
||||
</Button>
|
||||
<MenuButton href="/modlog?community={community_view.community.id}">
|
||||
<Icon src={Newspaper} size="16" mini />
|
||||
Modlog
|
||||
{$t('cards.community.modlog')}
|
||||
</MenuButton>
|
||||
{#if $profile?.jwt}
|
||||
<MenuButton color="danger-subtle" size="lg" on:click={block}>
|
||||
<Icon src={NoSymbol} size="16" mini slot="prefix" />
|
||||
{community_view.blocked ? 'Unblock' : 'Block'}
|
||||
{community_view.blocked
|
||||
? $t('cards.community.unblock')
|
||||
: $t('cards.community.block')}
|
||||
</MenuButton>
|
||||
{#if $profile?.user}
|
||||
<MenuButton color="danger-subtle" size="lg" on:click={blockInstance}>
|
||||
<Icon src={BuildingOffice2} size="16" mini slot="prefix" />
|
||||
Block instance
|
||||
{$t('cards.community.blockInstance')}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
{#if $profile?.user && isAdmin($profile.user)}
|
||||
@@ -326,7 +330,7 @@
|
||||
on:click={() => (purgingCommunity = !purgingCommunity)}
|
||||
>
|
||||
<Icon src={Fire} size="16" mini slot="prefix" />
|
||||
Purge
|
||||
{$t('admin.purge')}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
import { addSubscription } from '$lib/lemmy/user.js'
|
||||
import { Button, Checkbox, TextInput } from 'mono-svelte'
|
||||
import { uploadImage } from '$lib/util.js'
|
||||
import { t } from '$lib/translations'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
|
||||
/**
|
||||
* The community ID to edit.
|
||||
@@ -68,7 +70,7 @@
|
||||
})
|
||||
|
||||
toast({
|
||||
content: `Your community was ${edit ? 'saved' : 'created'}.`,
|
||||
content: $t('toast.updatedCommunity'),
|
||||
type: 'success',
|
||||
})
|
||||
|
||||
@@ -106,23 +108,31 @@
|
||||
|
||||
<form on:submit|preventDefault={submit} class="flex flex-col gap-4 h-full">
|
||||
<slot name="formtitle">
|
||||
<h1 class="text-2xl font-bold">Create Community</h1>
|
||||
<Header>{$t('routes.createCommunity')}</Header>
|
||||
</slot>
|
||||
<TextInput
|
||||
required
|
||||
label="Name"
|
||||
label={$t('form.name')}
|
||||
bind:value={formData.name}
|
||||
on:input={() => {
|
||||
formData.name = formData.name.toLowerCase().replaceAll(' ', '_')
|
||||
}}
|
||||
disabled={edit != undefined}
|
||||
/>
|
||||
<TextInput required label="Display name" bind:value={formData.displayName} />
|
||||
<ImageInput label="Icon" bind:files={formData.icon} />
|
||||
<ImageInput label="Banner" bind:files={formData.banner} />
|
||||
<MarkdownEditor previewButton label="Sidebar" bind:value={formData.sidebar} />
|
||||
<TextInput
|
||||
required
|
||||
label={$t('form.profile.displayName')}
|
||||
bind:value={formData.displayName}
|
||||
/>
|
||||
<ImageInput label={$t('form.profile.avatar')} bind:files={formData.icon} />
|
||||
<ImageInput label={$t('form.profile.banner')} bind:files={formData.banner} />
|
||||
<MarkdownEditor
|
||||
previewButton
|
||||
label={$t('routes.admin.config.banner')}
|
||||
bind:value={formData.sidebar}
|
||||
/>
|
||||
|
||||
<Checkbox bind:checked={formData.nsfw}>NSFW</Checkbox>
|
||||
<Checkbox bind:checked={formData.nsfw}>{$t('post.badges.nsfw')}</Checkbox>
|
||||
<Checkbox bind:checked={formData.postsLockedToModerators}>
|
||||
Only moderators can post
|
||||
</Checkbox>
|
||||
@@ -134,6 +144,6 @@
|
||||
loading={formData.submitting}
|
||||
disabled={formData.submitting}
|
||||
>
|
||||
{edit ? 'Save' : 'Create'}
|
||||
{edit ? $t('common.save') : $t('form.submit')}
|
||||
</Button>
|
||||
</form>
|
||||
@@ -20,6 +20,7 @@
|
||||
import CommunityCard from '$lib/components/lemmy/community/CommunityCard.svelte'
|
||||
import LabelStat from '$lib/components/ui/LabelStat.svelte'
|
||||
import PostBody from '../post/PostBody.svelte'
|
||||
import { t } from '$lib/translations'
|
||||
|
||||
export let community: CommunityView
|
||||
|
||||
@@ -77,9 +78,9 @@
|
||||
slot="prefix"
|
||||
/>
|
||||
{#if isSubscribed(community.subscribed)}
|
||||
Subscribed
|
||||
{$t('cards.community.subscribed')}
|
||||
{:else}
|
||||
Subscribe
|
||||
{$t('cards.community.subscribe')}
|
||||
{/if}
|
||||
</Button>
|
||||
</Subscribe>
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
import { Select } from 'mono-svelte'
|
||||
import { GlobeAmericas, Icon } from 'svelte-hero-icons'
|
||||
import { amModOfAny } from '../moderation/moderation'
|
||||
import { t } from '$lib/translations'
|
||||
|
||||
export let selected: string
|
||||
export let navigate: boolean = true
|
||||
@@ -33,19 +34,19 @@
|
||||
{#if showLabel}
|
||||
<span class="flex items-center gap-1">
|
||||
<Icon src={GlobeAmericas} size="16" mini />
|
||||
Location
|
||||
{$t('filter.location.label')}
|
||||
</span>
|
||||
{/if}
|
||||
</svelte:fragment>
|
||||
<option value="All">All</option>
|
||||
<option value="Local">Local</option>
|
||||
<option value="All">{$t('filter.location.all')}</option>
|
||||
<option value="Local">{$t('filter.location.local')}</option>
|
||||
<option value="Subscribed" disabled={$profile?.jwt == undefined}>
|
||||
Subscribed
|
||||
{$t('filter.location.subscribed')}
|
||||
</option>
|
||||
<option
|
||||
value="ModeratorView"
|
||||
disabled={!$profile?.jwt || !amModOfAny($profile?.user)}
|
||||
>
|
||||
Moderator
|
||||
{$t('filter.location.moderator')}
|
||||
</option>
|
||||
</Select>
|
||||
@@ -2,6 +2,7 @@
|
||||
import { page } from '$app/stores'
|
||||
import { site } from '$lib/lemmy.js'
|
||||
import { userSettings } from '$lib/settings'
|
||||
import { t } from '$lib/translations'
|
||||
import { searchParam } from '$lib/util.js'
|
||||
import { feature } from '$lib/version.js'
|
||||
import type { SortType } from 'lemmy-js-client'
|
||||
@@ -33,21 +34,19 @@
|
||||
>
|
||||
<span slot="label" class="flex items-center gap-1">
|
||||
<Icon src={ChartBar} size="13" mini />
|
||||
Sort
|
||||
{$t('filter.sort.label')}
|
||||
</span>
|
||||
<option value="Active">Active</option>
|
||||
<option value="Hot">Hot</option>
|
||||
<option value="Active">{$t('filter.sort.active')}</option>
|
||||
<option value="Hot">{$t('filter.sort.hot')}</option>
|
||||
{#if feature('scaledSort', $site?.version)}
|
||||
<option value="Scaled">Scaled</option>
|
||||
<option value="Scaled">{$t('filter.sort.scaled')}</option>
|
||||
{/if}
|
||||
<option value="TopAll">Top</option>
|
||||
<option value="New">New</option>
|
||||
{#if feature('controversialSort', $site?.version)}
|
||||
<option value="Controversial">Controversial</option>
|
||||
{/if}
|
||||
<option value="Old">Old</option>
|
||||
<option value="MostComments">Comments</option>
|
||||
<option value="NewComments">New Replies</option>
|
||||
<option value="TopAll">{$t('filter.sort.top.label')}</option>
|
||||
<option value="New">{$t('filter.sort.new')}</option>
|
||||
<option value="Old">{$t('filter.sort.old')}</option>
|
||||
<option value="Controversial">{$t('filter.sort.controversial')}</option>
|
||||
<option value="MostComments">{$t('filter.sort.mostcomments')}</option>
|
||||
<option value="NewComments">{$t('filter.sort.newcomments')}</option>
|
||||
</Select>
|
||||
{#if selected?.startsWith('Top')}
|
||||
<div transition:fly={{ easing: backOut, x: 2 }}>
|
||||
@@ -62,18 +61,26 @@
|
||||
>
|
||||
<span slot="label" class="flex items-center gap-1">
|
||||
<Icon src={Clock} size="15" mini />
|
||||
Time
|
||||
{$t('filter.sort.top.time.label')}
|
||||
</span>
|
||||
<option value="TopAll">All</option>
|
||||
<option value="TopNineMonths">9 Months</option>
|
||||
<option value="TopSixMonths">6 Months</option>
|
||||
<option value="TopThreeMonths">3 Months</option>
|
||||
<option value="TopMonth">Month</option>
|
||||
<option value="TopWeek">Week</option>
|
||||
<option value="TopDay">Day</option>
|
||||
<option value="TopTwelveHour">12 Hours</option>
|
||||
<option value="TopSixHour">6 Hours</option>
|
||||
<option value="TopHour">Hour</option>
|
||||
<option value="TopAll">{$t('filter.sort.top.time.all')}</option>
|
||||
<option value="TopNineMonths">
|
||||
{$t('filter.sort.top.time.9months')}
|
||||
</option>
|
||||
<option value="TopSixMonths">
|
||||
{$t('filter.sort.top.time.6months')}
|
||||
</option>
|
||||
<option value="TopThreeMonths">
|
||||
{$t('filter.sort.top.time.3months')}
|
||||
</option>
|
||||
<option value="TopMonth">{$t('filter.sort.top.time.month')}</option>
|
||||
<option value="TopWeek">{$t('filter.sort.top.time.week')}</option>
|
||||
<option value="TopDay">{$t('filter.sort.top.time.day')}</option>
|
||||
<option value="TopTwelveHour">
|
||||
{$t('filter.sort.top.time.12hours')}
|
||||
</option>
|
||||
<option value="TopSixHour">{$t('filter.sort.top.time.6hours')}</option>
|
||||
<option value="TopHour">{$t('filter.sort.top.time.hour')}</option>
|
||||
</Select>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { userSettings } from '$lib/settings.js'
|
||||
import { t } from '$lib/translations'
|
||||
import { Select } from 'mono-svelte'
|
||||
import { Icon, ViewColumns } from 'svelte-hero-icons'
|
||||
|
||||
@@ -11,12 +12,12 @@
|
||||
{#if showLabel}
|
||||
<span class="flex items-center gap-1">
|
||||
<Icon src={ViewColumns} size="14" mini />
|
||||
View
|
||||
{$t('filter.view.label')}
|
||||
</span>
|
||||
{/if}
|
||||
</svelte:fragment>
|
||||
<option value="cozy">Cozy</option>
|
||||
<option value="list">List</option>
|
||||
<option value="compact">Compact</option>
|
||||
<option value="card">Legacy</option>
|
||||
<option value="cozy">{$t('filter.view.cozy')}</option>
|
||||
<option value="list">{$t('filter.view.list')}</option>
|
||||
<option value="compact">{$t('filter.view.compact')}</option>
|
||||
<option value="card">{$t('filter.view.legacy')}</option>
|
||||
</Select>
|
||||
@@ -1,38 +1,38 @@
|
||||
<script lang="ts">
|
||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||
import type { Person } from 'lemmy-js-client'
|
||||
import { Button, Modal } from 'mono-svelte'
|
||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||
import { t } from '$lib/translations'
|
||||
import type { Person } from 'lemmy-js-client'
|
||||
import { Button, Modal } from 'mono-svelte'
|
||||
|
||||
export let open: boolean = false
|
||||
export let user: Person
|
||||
export let open: boolean = false
|
||||
export let user: Person
|
||||
|
||||
export let denying: boolean
|
||||
export let denying: boolean
|
||||
|
||||
export let denyReason: string = ''
|
||||
export let denyReason: string = ''
|
||||
|
||||
let loading = false
|
||||
let loading = false
|
||||
|
||||
function deny() {
|
||||
denying = true
|
||||
open = false
|
||||
}
|
||||
function deny() {
|
||||
denying = true
|
||||
open = false
|
||||
}
|
||||
</script>
|
||||
|
||||
<Modal bind:open>
|
||||
<h1 class="text-2xl font-bold" slot="title">Deny Application</h1>
|
||||
<form on:submit|preventDefault={() => deny()} class="flex flex-col gap-4">
|
||||
<p class="inline-flex flex-row gap-2 items-center">
|
||||
Denying <UserLink avatar {user} />'s Application
|
||||
</p>
|
||||
<MarkdownEditor
|
||||
bind:value={denyReason}
|
||||
label="Deny Reason (optional)"
|
||||
placeholder="Application Reason breaks rule #3"
|
||||
rows={4}
|
||||
/>
|
||||
<Button color="primary" size="lg" submit {loading} disabled={loading}>
|
||||
Deny
|
||||
</Button>
|
||||
</form>
|
||||
<h1 class="text-2xl font-bold" slot="title">
|
||||
{$t('routes.admin.applications.modalTitle')}
|
||||
</h1>
|
||||
<form on:submit|preventDefault={() => deny()} class="flex flex-col gap-4">
|
||||
<UserLink avatar {user} />
|
||||
<MarkdownEditor
|
||||
bind:value={denyReason}
|
||||
label={$t('routes.admin.applications.reason')}
|
||||
rows={4}
|
||||
/>
|
||||
<Button color="primary" size="lg" submit {loading} disabled={loading}>
|
||||
{$t('routes.admin.applications.deny')}
|
||||
</Button>
|
||||
</form>
|
||||
</Modal>
|
||||
@@ -3,8 +3,10 @@
|
||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import { t } from '$lib/translations'
|
||||
import type { Person } from 'lemmy-js-client'
|
||||
import { Button, Modal, toast } from 'mono-svelte'
|
||||
import { Icon, PaperAirplane } from 'svelte-hero-icons'
|
||||
|
||||
export let open: boolean = false
|
||||
export let user: Person
|
||||
@@ -25,7 +27,7 @@
|
||||
})
|
||||
|
||||
toast({
|
||||
content: 'Successfully sent that person a message.',
|
||||
content: $t('toast.sentMessage'),
|
||||
type: 'success',
|
||||
})
|
||||
|
||||
@@ -45,16 +47,16 @@
|
||||
<h1 class="text-2xl font-bold" slot="title">Message</h1>
|
||||
<form on:submit|preventDefault={sendMessage} class="flex flex-col gap-4">
|
||||
<p class="inline-flex flex-row gap-2 items-center">
|
||||
Sending <UserLink avatar {user} /> a message
|
||||
<Icon src={PaperAirplane} size="16" mini />
|
||||
<UserLink avatar {user} />
|
||||
</p>
|
||||
<MarkdownEditor
|
||||
bind:value={message}
|
||||
label="Message"
|
||||
placeholder="your hair looks nice today"
|
||||
label={$t('content.message')}
|
||||
rows={4}
|
||||
/>
|
||||
<Button color="primary" size="lg" submit {loading} disabled={loading}>
|
||||
Send
|
||||
{$t('common.send')}
|
||||
</Button>
|
||||
</form>
|
||||
</Modal>
|
||||
@@ -6,6 +6,8 @@
|
||||
import { profile } from '$lib/auth.js'
|
||||
import { Button, Checkbox, Modal, TextInput } from 'mono-svelte'
|
||||
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||
import { t } from '$lib/translations'
|
||||
import CommunityLink from '../community/CommunityLink.svelte'
|
||||
|
||||
export let open = false
|
||||
let item: Person | undefined
|
||||
@@ -40,7 +42,7 @@
|
||||
date = Date.parse(expires)
|
||||
if (Number.isNaN(date)) {
|
||||
toast({
|
||||
content: 'Invalid date. It must be an absolute date.',
|
||||
content: $t('toast.invalidDateAbsolute'),
|
||||
type: 'error',
|
||||
})
|
||||
|
||||
@@ -51,7 +53,7 @@
|
||||
|
||||
if (date < Date.now()) {
|
||||
toast({
|
||||
content: 'Invalid date. It is before the current time.',
|
||||
content: $t('toast.invalidDateBeforeCurrent'),
|
||||
type: 'error',
|
||||
})
|
||||
|
||||
@@ -82,9 +84,7 @@
|
||||
open = false
|
||||
|
||||
toast({
|
||||
content: `Successfully ${
|
||||
banned ? 'unbanned' : 'banned'
|
||||
} that user. You may need to refresh to see changes.`,
|
||||
content: banned ? $t('toast.unbannedUser') : $t('toast.bannedUser'),
|
||||
type: 'success',
|
||||
})
|
||||
|
||||
@@ -101,42 +101,38 @@
|
||||
</script>
|
||||
|
||||
<Modal bind:open class="max-w-xl w-full">
|
||||
<h1 slot="title">{banned ? 'Unbanning' : 'Banning'} user</h1>
|
||||
<h1 slot="title">
|
||||
{banned ? $t('moderation.ban.unbanning') : $t('moderation.ban.banning')}
|
||||
</h1>
|
||||
{#if item}
|
||||
<form class="flex flex-col gap-4" on:submit|preventDefault={submit}>
|
||||
<div class="flex items-center gap-1">
|
||||
<Avatar url={item.avatar} alt={item.name} width={24} />
|
||||
<span class="font-bold">{item.name}</span>
|
||||
</div>
|
||||
<p>
|
||||
{banned ? 'Unbanning' : 'Banning'} from
|
||||
<span class="font-bold">{community ? community.name : 'site'}</span>
|
||||
</p>
|
||||
{#if community}
|
||||
<CommunityLink {community} avatar />
|
||||
{/if}
|
||||
<MarkdownEditor
|
||||
required
|
||||
bind:value={reason}
|
||||
label="Reason"
|
||||
placeholder="Why are you {banned
|
||||
? 'unbanning'
|
||||
: 'banning'} {item.name}?"
|
||||
label={$t('moderation.reason')}
|
||||
/>
|
||||
{#if !banned}
|
||||
<Checkbox bind:checked={deleteData}>
|
||||
Delete data
|
||||
{$t('moderation.ban.deleteData')}
|
||||
<svelte:fragment slot="description">
|
||||
This will delete ALL of this user's posts and comments on this {community
|
||||
? 'community'
|
||||
: 'site'}.
|
||||
{$t('moderation.ban.warning')}
|
||||
</svelte:fragment>
|
||||
</Checkbox>
|
||||
<TextInput
|
||||
bind:value={expires}
|
||||
label="Expires (UTC)"
|
||||
label={$t('moderation.ban.expires')}
|
||||
placeholder="2024 August 5"
|
||||
/>
|
||||
{/if}
|
||||
<Button submit color="primary" {loading} disabled={loading} size="lg">
|
||||
Submit
|
||||
{$t('form.submit')}
|
||||
</Button>
|
||||
</form>
|
||||
{/if}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
import { profile } from '$lib/auth.js'
|
||||
import ShieldIcon from '$lib/components/lemmy/moderation/ShieldIcon.svelte'
|
||||
import { Button, Menu, MenuButton, MenuDivider } from 'mono-svelte'
|
||||
import { t } from '$lib/translations'
|
||||
|
||||
export let item: PostView | CommentView
|
||||
</script>
|
||||
@@ -22,16 +23,20 @@
|
||||
</Button>
|
||||
{#if ($profile?.user && amMod($profile.user, item.community)) || ($profile?.user && isAdmin($profile.user))}
|
||||
<MenuDivider>
|
||||
Moderation {#if !item.community.local && !amMod($profile.user, item.community)}
|
||||
(Instance Only)
|
||||
{#if !item.community.local && !amMod($profile.user, item.community)}
|
||||
{$t('moderation.labelInstanceOnly')}
|
||||
{:else}
|
||||
{$t('moderation.label')}
|
||||
{/if}
|
||||
</MenuDivider>
|
||||
<MenuButton color="success-subtle" on:click={() => remove(item)}>
|
||||
<Icon src={Trash} size="16" mini />
|
||||
{#if isCommentView(item)}
|
||||
{item.comment.removed ? 'Restore' : 'Remove'}
|
||||
{item.comment.removed
|
||||
? $t('moderation.restore')
|
||||
: $t('moderation.remove')}
|
||||
{:else}
|
||||
{item.post.removed ? 'Restore' : 'Remove'}
|
||||
{item.post.removed ? $t('moderation.restore') : $t('moderation.remove')}
|
||||
{/if}
|
||||
</MenuButton>
|
||||
{#if $profile?.user && $profile.user?.local_user_view.person.id != item.creator.id}
|
||||
@@ -42,17 +47,17 @@
|
||||
>
|
||||
<Icon src={ShieldExclamation} size="16" mini />
|
||||
{item.creator_banned_from_community
|
||||
? 'Unban from community'
|
||||
: 'Ban from community'}
|
||||
? $t('moderation.ban.unbanFromCommunity')
|
||||
: $t('moderation.ban.banFromCommunity')}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
{#if $profile?.user && isAdmin($profile.user)}
|
||||
<MenuDivider>Admin</MenuDivider>
|
||||
<MenuDivider>{$t('admin.label')}</MenuDivider>
|
||||
<MenuButton color="danger-subtle" on:click={() => remove(item, true)}>
|
||||
<Icon src={Fire} size="16" mini slot="prefix" />
|
||||
Purge
|
||||
{$t('admin.purge')}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
</Menu>
|
||||
@@ -15,6 +15,8 @@
|
||||
import { Menu, MenuButton, MenuDivider, toast } from 'mono-svelte'
|
||||
import { profile } from '$lib/auth.js'
|
||||
import { Button } from 'mono-svelte'
|
||||
import { t } from '$lib/translations'
|
||||
import ShieldIcon from './ShieldIcon.svelte'
|
||||
|
||||
export let item: PostView | CommentView
|
||||
|
||||
@@ -34,11 +36,6 @@
|
||||
})
|
||||
|
||||
item.post.locked = lock
|
||||
|
||||
toast({
|
||||
content: `Successfully ${lock ? 'locked' : 'unlocked'} that post.`,
|
||||
type: 'success',
|
||||
})
|
||||
} catch (err) {
|
||||
toast({
|
||||
content: err as any,
|
||||
@@ -62,11 +59,6 @@
|
||||
})
|
||||
|
||||
item.post.featured_community = pinned
|
||||
|
||||
toast({
|
||||
content: `Successfully ${pinned ? 'pinned' : 'unpinned'} that post.`,
|
||||
type: 'success',
|
||||
})
|
||||
} catch (err) {
|
||||
toast({
|
||||
content: err as any,
|
||||
@@ -87,26 +79,14 @@
|
||||
loading={acting}
|
||||
{...$$restProps}
|
||||
>
|
||||
<svg
|
||||
width="16"
|
||||
height="16"
|
||||
viewBox="0 0 20 22"
|
||||
fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
slot="prefix"
|
||||
>
|
||||
<path
|
||||
fill-rule="evenodd"
|
||||
clip-rule="evenodd"
|
||||
d="M10.516 1.17C10.3767 1.03791 10.192 0.964283 10 0.964283C9.80801 0.964283 9.62333 1.03791 9.484 1.17C7.36127 3.18588 4.53412 4.29133 1.607 4.25C1.44753 4.24793 1.29156 4.29674 1.16172 4.38935C1.03189 4.48196 0.934957 4.61355 0.885 4.765C0.462973 6.05116 0.248618 7.39637 0.25 8.75C0.25 14.692 4.314 19.683 9.813 21.098C9.93566 21.1296 10.0643 21.1296 10.187 21.098C15.686 19.683 19.75 14.692 19.75 8.75C19.75 7.36 19.527 6.02 19.115 4.765C19.0652 4.61336 18.9684 4.48156 18.8385 4.38875C18.7087 4.29595 18.5526 4.247 18.393 4.249L18.25 4.25C15.254 4.25 12.533 3.08 10.516 1.17Z"
|
||||
fill="currentColor"
|
||||
/>
|
||||
</svg>
|
||||
<ShieldIcon filled width={16} />
|
||||
</Button>
|
||||
{#if ($profile?.user && amMod($profile.user, item.community)) || ($profile?.user && isAdmin($profile.user))}
|
||||
<MenuDivider>
|
||||
Moderation {#if !item.community.local && !amMod($profile.user, item.community)}
|
||||
(Instance Only)
|
||||
{#if !item.community.local && !amMod($profile.user, item.community)}
|
||||
{$t('moderation.labelInstanceOnly')}
|
||||
{:else}
|
||||
{$t('moderation.label')}
|
||||
{/if}
|
||||
</MenuDivider>
|
||||
<MenuButton
|
||||
@@ -121,7 +101,7 @@
|
||||
mini
|
||||
slot="prefix"
|
||||
/>
|
||||
{item.post.locked ? 'Unlock' : 'Lock'}
|
||||
{item.post.locked ? $t('moderation.unlock') : $t('moderation.lock')}
|
||||
</MenuButton>
|
||||
|
||||
<MenuButton
|
||||
@@ -135,18 +115,24 @@
|
||||
<div
|
||||
class="flex flex-row gap-2 text-left items-center justify-between w-full"
|
||||
>
|
||||
<span>{item.post.featured_community ? 'Unfeature' : 'Feature'}</span>
|
||||
<span>
|
||||
{item.post.featured_community
|
||||
? $t('moderation.unfeature')
|
||||
: $t('moderation.feature')}
|
||||
</span>
|
||||
{#if isAdmin($profile.user)}
|
||||
<span class="text-xs opacity-80">Community</span>
|
||||
<span class="text-xs opacity-80">{$t('form.post.community')}</span>
|
||||
{/if}
|
||||
</div>
|
||||
</MenuButton>
|
||||
<MenuButton color="danger-subtle" on:click={() => remove(item)}>
|
||||
<Icon src={Trash} size="16" mini />
|
||||
{#if isCommentView(item)}
|
||||
{item.comment.removed ? 'Restore' : 'Remove'}
|
||||
{item.comment.removed
|
||||
? $t('moderation.restore')
|
||||
: $t('moderation.remove')}
|
||||
{:else}
|
||||
{item.post.removed ? 'Restore' : 'Remove'}
|
||||
{item.post.removed ? $t('moderation.restore') : $t('moderation.remove')}
|
||||
{/if}
|
||||
</MenuButton>
|
||||
{#if $profile?.user && $profile.user.local_user_view.person.id != item.creator.id}
|
||||
@@ -157,13 +143,13 @@
|
||||
>
|
||||
<Icon src={ShieldExclamation} size="16" mini />
|
||||
{item.creator_banned_from_community
|
||||
? 'Unban from community'
|
||||
: 'Ban from community'}
|
||||
? $t('moderation.ban.unbanFromCommunity')
|
||||
: $t('moderation.ban.banFromCommunity')}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
{/if}
|
||||
{#if $profile?.user && isAdmin($profile.user)}
|
||||
<MenuDivider>Admin</MenuDivider>
|
||||
<MenuDivider>{$t('admin.label')}</MenuDivider>
|
||||
<MenuButton
|
||||
color="success-subtle"
|
||||
on:click={() =>
|
||||
@@ -173,13 +159,17 @@
|
||||
<div
|
||||
class="flex flex-row gap-2 text-left items-center justify-between w-full"
|
||||
>
|
||||
<span>{item.post.featured_local ? 'Unfeature' : 'Feature'}</span>
|
||||
<span class="text-xs opacity-80">Instance</span>
|
||||
<span>
|
||||
{item.post.featured_local
|
||||
? $t('moderation.unfeature')
|
||||
: $t('moderation.feature')}
|
||||
</span>
|
||||
<span class="text-xs opacity-80">{$t('admin.instance')}</span>
|
||||
</div>
|
||||
</MenuButton>
|
||||
<MenuButton color="danger-subtle" on:click={() => remove(item, true)}>
|
||||
<Icon src={Fire} size="16" mini />
|
||||
Purge
|
||||
{$t('admin.purge')}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
</Menu>
|
||||
@@ -14,6 +14,7 @@
|
||||
import { fullCommunityName } from '$lib/util.js'
|
||||
import { amMod, isAdmin } from './moderation'
|
||||
import { Button, Checkbox, Modal } from 'mono-svelte'
|
||||
import { t } from '$lib/translations'
|
||||
|
||||
export let open: boolean
|
||||
export let item: PostView | CommentView | undefined = undefined
|
||||
@@ -68,7 +69,7 @@
|
||||
}
|
||||
|
||||
toast({
|
||||
content: 'Successfully purged that submission.',
|
||||
content: $t('moderation.removeSubmission.successPurge'),
|
||||
type: 'success',
|
||||
})
|
||||
|
||||
@@ -81,7 +82,7 @@
|
||||
if (commentReason) {
|
||||
if (replyReason == '') {
|
||||
toast({
|
||||
content: 'Your reply cannot be empty if "Reply reason" is enabled.',
|
||||
content: $t('moderation.removeSubmission.failEmptyReply'),
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -96,7 +97,7 @@
|
||||
})
|
||||
.catch(() => {
|
||||
toast({
|
||||
content: 'Failed to message user. Removing anyway...',
|
||||
content: $t('moderation.removeSubmission.failMessage'),
|
||||
type: 'warning',
|
||||
})
|
||||
})
|
||||
@@ -109,7 +110,7 @@
|
||||
})
|
||||
.catch(() => {
|
||||
toast({
|
||||
content: 'Failed to post reply. Removing anyway...',
|
||||
content: $t('moderation.removeSubmission.failReply'),
|
||||
type: 'warning',
|
||||
})
|
||||
})
|
||||
@@ -134,13 +135,6 @@
|
||||
}
|
||||
|
||||
open = false
|
||||
|
||||
toast({
|
||||
content: `Successfully ${
|
||||
removed ? 'restored' : 'removed'
|
||||
} that submission.`,
|
||||
type: 'success',
|
||||
})
|
||||
} catch (err) {
|
||||
toast({
|
||||
content: err as any,
|
||||
@@ -166,7 +160,11 @@
|
||||
|
||||
<Modal bind:open>
|
||||
<span slot="title">
|
||||
{purge ? 'Purging' : removed ? 'Restoring' : 'Removing'} submission
|
||||
{purge
|
||||
? $t('moderation.removeSubmission.titlePurge')
|
||||
: removed
|
||||
? $t('moderation.removeSubmission.titleRestore')
|
||||
: $t('moderation.removeSubmission.title')}
|
||||
</span>
|
||||
{#if item}
|
||||
<form
|
||||
@@ -195,12 +193,17 @@
|
||||
/>
|
||||
|
||||
{#if !removed && $profile?.user && (amMod($profile.user, item.community) || (isAdmin($profile.user) && item.community.local))}
|
||||
<Checkbox bind:checked={commentReason}>Reply with reason</Checkbox>
|
||||
<Checkbox bind:checked={commentReason}>
|
||||
{$t('moderation.removeSubmission.withReason')}
|
||||
</Checkbox>
|
||||
|
||||
{#if commentReason}
|
||||
<MultiSelect
|
||||
options={[false, true]}
|
||||
optionNames={['Comment', 'Message']}
|
||||
optionNames={[
|
||||
$t('moderation.removeSubmission.comment'),
|
||||
$t('moderation.removeSubmission.message'),
|
||||
]}
|
||||
bind:selected={privateMessage}
|
||||
/>
|
||||
<MarkdownEditor
|
||||
@@ -209,7 +212,7 @@
|
||||
rows={3}
|
||||
>
|
||||
<div class="flex justify-between items-end mb-1" slot="label">
|
||||
Reply
|
||||
{$t('comment.reply')}
|
||||
<Select bind:value={preset} placeholder="No preset">
|
||||
{#each $userSettings.moderation.presets as preset}
|
||||
<option value={preset.content}>
|
||||
@@ -231,9 +234,9 @@
|
||||
>
|
||||
<Icon src={purge ? Fire : Trash} mini size="16" slot="prefix" />
|
||||
{#if purge}
|
||||
Purge
|
||||
{$t('admin.purge')}
|
||||
{:else}
|
||||
{removed ? 'Restore' : 'Remove'}
|
||||
{removed ? $t('moderation.restore') : $t('moderation.remove')}
|
||||
{/if}
|
||||
</Button>
|
||||
</form>
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
import { Button, Modal } from 'mono-svelte'
|
||||
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||
import { onMount } from 'svelte'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import { t } from '$lib/translations'
|
||||
|
||||
export let open: boolean
|
||||
export let item: PostView | CommentView | undefined = undefined
|
||||
@@ -39,7 +41,7 @@
|
||||
}
|
||||
open = false
|
||||
toast({
|
||||
content: 'That submission has been reported.',
|
||||
content: $t('moderation.reportModal.success'),
|
||||
type: 'success',
|
||||
})
|
||||
} catch (err) {
|
||||
@@ -59,10 +61,9 @@
|
||||
</script>
|
||||
|
||||
<Modal bind:open>
|
||||
<h1 class="font-bold text-2xl" slot="title">Report</h1>
|
||||
<Header slot="title">{$t('moderation.reportModal.title')}</Header>
|
||||
<form class="flex flex-col gap-4" on:submit|preventDefault={report}>
|
||||
{#if item}
|
||||
<span>Reporting this submission</span>
|
||||
<div class="pointer-events-none list-none">
|
||||
{#if isComment(item)}
|
||||
<Comment
|
||||
@@ -83,12 +84,11 @@
|
||||
<MarkdownEditor
|
||||
required
|
||||
rows={4}
|
||||
label="Reason"
|
||||
placeholder="he's being a meanie :("
|
||||
label={$t('moderation.reason')}
|
||||
bind:value={reason}
|
||||
/>
|
||||
<Button submit {loading} disabled={loading} color="primary" size="lg">
|
||||
Submit
|
||||
{$t('form.submit')}
|
||||
</Button>
|
||||
</form>
|
||||
</Modal>
|
||||
@@ -107,16 +107,7 @@
|
||||
<PostBody body={post.post.body} {view} style="grid-area: body" />
|
||||
{/if}
|
||||
{#if actions}
|
||||
<PostActions
|
||||
bind:post
|
||||
on:edit={(e) => {
|
||||
toast({
|
||||
content: 'The post was edited successfully.',
|
||||
type: 'success',
|
||||
})
|
||||
}}
|
||||
style="grid-area: actions;"
|
||||
/>
|
||||
<PostActions bind:post style="grid-area: actions;" />
|
||||
{:else if view == 'compact'}
|
||||
<div class="flex flex-row items-center gap-2 text-sm">
|
||||
<Badge>
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
EyeSlash,
|
||||
Flag,
|
||||
Icon,
|
||||
Language,
|
||||
Newspaper,
|
||||
PencilSquare,
|
||||
ServerStack,
|
||||
@@ -49,6 +50,9 @@
|
||||
} from 'mono-svelte'
|
||||
import { fediseer, type Data } from '$lib/fediseer/fediseer'
|
||||
import Fediseer from '$lib/fediseer/Fediseer.svelte'
|
||||
import { t } from '$lib/translations'
|
||||
import { text } from '$lib/components/translate/translation'
|
||||
import Translation from '$lib/components/translate/Translation.svelte'
|
||||
|
||||
export let post: PostView
|
||||
|
||||
@@ -61,6 +65,8 @@
|
||||
let fediseerOpen = false
|
||||
let fediseerData: Data | null = null
|
||||
let fediseerLoading = false
|
||||
|
||||
let translating = false
|
||||
</script>
|
||||
|
||||
{#if fediseerData}
|
||||
@@ -93,6 +99,8 @@
|
||||
</Modal>
|
||||
{/if}
|
||||
|
||||
<Translation bind:open={translating} />
|
||||
|
||||
<div
|
||||
class="flex flex-row gap-2 items-center !h-8 flex-shrink-0"
|
||||
style={$$props.style ?? ''}
|
||||
@@ -110,7 +118,7 @@
|
||||
href="/post/{getInstance()}/{post.post.id}"
|
||||
class="!text-inherit h-8 px-3"
|
||||
target={$userSettings.openLinksInNewTab ? '_blank' : ''}
|
||||
title="Comments"
|
||||
title={$t('post.actions.comments')}
|
||||
>
|
||||
<Icon slot="prefix" src={ChatBubbleOvalLeft} mini size="14" />
|
||||
<FormattedNumber number={post.counts.comments} />
|
||||
@@ -123,7 +131,12 @@
|
||||
<DebugObject object={post} bind:open={debug} />
|
||||
{/await}
|
||||
{/if}
|
||||
<Button on:click={() => (debug = true)} size="square-md" color="ghost">
|
||||
<Button
|
||||
on:click={() => (debug = true)}
|
||||
title="Debug"
|
||||
size="square-md"
|
||||
color="ghost"
|
||||
>
|
||||
<Icon src={BugAnt} mini size="16" slot="prefix" />
|
||||
</Button>
|
||||
{/if}
|
||||
@@ -143,7 +156,7 @@
|
||||
color="ghost"
|
||||
loading={saving}
|
||||
disabled={saving}
|
||||
title={post.saved ? 'Unsave' : 'Save'}
|
||||
title={post.saved ? $t('post.actions.unsave') : $t('post.actions.save')}
|
||||
>
|
||||
<Icon
|
||||
src={post.saved ? BookmarkSlash : Bookmark}
|
||||
@@ -159,12 +172,17 @@
|
||||
containerClass="overflow-auto max-h-[400px]"
|
||||
class="h-8"
|
||||
targetClass="h-full"
|
||||
title="Post actions"
|
||||
title={$t('post.actions.more.label')}
|
||||
>
|
||||
<Button slot="target" title="Post actions" color="ghost" size="square-md">
|
||||
<Button
|
||||
slot="target"
|
||||
title={$t('post.actions.more.label')}
|
||||
color="ghost"
|
||||
size="square-md"
|
||||
>
|
||||
<Icon slot="prefix" src={EllipsisHorizontal} width={16} mini />
|
||||
</Button>
|
||||
<MenuDivider>Creator</MenuDivider>
|
||||
<MenuDivider>{$t('post.actions.more.creator')}</MenuDivider>
|
||||
<MenuButton
|
||||
link
|
||||
href="/u/{post.creator.name}@{new URL(post.creator.actor_id).hostname}"
|
||||
@@ -189,7 +207,6 @@
|
||||
const data = await fediseer.getInstanceInfo(
|
||||
new URL(post.community.actor_id).hostname
|
||||
)
|
||||
console.log(data)
|
||||
fediseerData = data
|
||||
fediseerOpen = true
|
||||
fediseerLoading = false
|
||||
@@ -207,11 +224,11 @@
|
||||
<span>{new URL(post.community.actor_id).hostname}</span>
|
||||
</MenuButton>
|
||||
<hr class="w-[90%] mx-auto opacity-100 dark:opacity-10 my-2" />
|
||||
<MenuDivider>Actions</MenuDivider>
|
||||
<MenuDivider>{$t('post.actions.more.actions')}</MenuDivider>
|
||||
{#if $profile?.user && $profile?.jwt && $profile.user.local_user_view.person.id == post.creator.id}
|
||||
<MenuButton on:click={() => (editing = true)}>
|
||||
<Icon src={PencilSquare} width={16} mini slot="prefix" />
|
||||
Edit
|
||||
{$t('post.actions.more.edit')}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
{#if $profile?.jwt}
|
||||
@@ -222,7 +239,9 @@
|
||||
}}
|
||||
>
|
||||
<Icon slot="prefix" src={post.read ? EyeSlash : Eye} width={16} mini />
|
||||
Mark as {post.read ? 'Unread' : 'Read'}
|
||||
{post.read
|
||||
? $t('post.actions.more.markUnread')
|
||||
: $t('post.actions.more.markRead')}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
<MenuButton
|
||||
@@ -233,8 +252,20 @@
|
||||
}}
|
||||
>
|
||||
<Icon src={Share} width={16} mini slot="prefix" />
|
||||
Share
|
||||
{$t('post.actions.more.share')}
|
||||
</MenuButton>
|
||||
{#if post.post.body && $userSettings.translator}
|
||||
<MenuButton
|
||||
on:click={() => {
|
||||
// @ts-ignore
|
||||
text.set(post.post.body)
|
||||
translating = !translating
|
||||
}}
|
||||
>
|
||||
<Icon src={Language} size="16" mini slot="prefix" />
|
||||
{$t('post.actions.more.translate')}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
{#if $profile?.jwt}
|
||||
<MenuButton
|
||||
on:click={() => {
|
||||
@@ -260,7 +291,7 @@
|
||||
}}
|
||||
>
|
||||
<Icon src={ArrowTopRightOnSquare} width={16} mini slot="prefix" />
|
||||
Crosspost
|
||||
{$t('post.actions.more.crosspost')}
|
||||
</MenuButton>
|
||||
{#if $profile.user && post.creator.id == $profile.user.local_user_view.person.id}
|
||||
<MenuButton
|
||||
@@ -275,13 +306,15 @@
|
||||
color="danger-subtle"
|
||||
>
|
||||
<Icon src={Trash} width={16} mini slot="prefix" />
|
||||
{post.post.deleted ? 'Restore' : 'Delete'}
|
||||
{post.post.deleted
|
||||
? $t('post.actions.more.restore')
|
||||
: $t('post.actions.more.delete')}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
{#if $profile.user?.local_user_view.person.id != post.creator.id}
|
||||
<MenuButton on:click={() => report(post)} color="danger-subtle">
|
||||
<Icon src={Flag} width={16} mini slot="prefix" />
|
||||
Report
|
||||
{$t('moderation.report')}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
import ObjectAutocomplete from '$lib/components/lemmy/ObjectAutocomplete.svelte'
|
||||
import { Button } from 'mono-svelte'
|
||||
import Avatar from '$lib/components/ui/Avatar.svelte'
|
||||
import { t } from '$lib/translations'
|
||||
|
||||
export let edit = false
|
||||
|
||||
@@ -85,7 +86,7 @@
|
||||
if (!data.community && !edit) {
|
||||
toast({
|
||||
type: 'warning',
|
||||
content: 'You need to set a community.',
|
||||
content: $t('toast.needCommunity'),
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -95,7 +96,7 @@
|
||||
new URL(data.url)
|
||||
} catch (err) {
|
||||
toast({
|
||||
content: 'Invalid URL',
|
||||
content: $t('toast.invalidURL'),
|
||||
type: 'warning',
|
||||
})
|
||||
return
|
||||
@@ -170,14 +171,14 @@
|
||||
.join('\n')
|
||||
|
||||
toast({
|
||||
content: `Generated title and body from that website. Would you like to undo this action?`,
|
||||
content: $t('toast.generatedTitle'),
|
||||
type: 'info',
|
||||
action: () => (data = oldData),
|
||||
duration: 15 * 1000,
|
||||
})
|
||||
} catch (e) {
|
||||
toast({
|
||||
content: 'There was no usable title or description of that website.',
|
||||
content: $t('toast.failGenerateTitle'),
|
||||
})
|
||||
}
|
||||
generation.loading = false
|
||||
@@ -217,7 +218,7 @@
|
||||
<form on:submit|preventDefault={submit} class="flex flex-col gap-4 h-full">
|
||||
<slot name="formtitle">
|
||||
<h1 class="font-bold text-xl">
|
||||
{edit ? 'Edit' : 'Create'} Post
|
||||
{edit ? $t('form.post.edit') : $t('form.post.create')}
|
||||
</h1>
|
||||
</slot>
|
||||
{#if !edit && data}
|
||||
@@ -227,7 +228,7 @@
|
||||
bind:items={communities}
|
||||
jwt={$profile?.jwt}
|
||||
listing_type="All"
|
||||
label="Community"
|
||||
label={$t('form.post.community')}
|
||||
required
|
||||
on:select={(e) => {
|
||||
const c = e.detail
|
||||
@@ -243,7 +244,7 @@
|
||||
/>
|
||||
{:else}
|
||||
<div class="flex flex-col gap-1">
|
||||
<span class="font-medium text-sm">Community</span>
|
||||
<span class="font-medium text-sm">{$t('form.post.community')}</span>
|
||||
<Button
|
||||
class="w-full !bg-white dark:!bg-black h-[38px]"
|
||||
on:click={() => (data.community = null)}
|
||||
@@ -268,13 +269,13 @@
|
||||
{/if}
|
||||
<TextInput
|
||||
required
|
||||
label="Title"
|
||||
label={$t('form.post.title')}
|
||||
bind:value={data.title}
|
||||
placeholder={placeholders.get('post')}
|
||||
/>
|
||||
<div class="flex gap-2 w-full items-end">
|
||||
<TextInput
|
||||
label="URL"
|
||||
label={$t('form.post.url')}
|
||||
bind:value={data.url}
|
||||
placeholder={placeholders.get('url')}
|
||||
class="w-full"
|
||||
@@ -285,32 +286,32 @@
|
||||
? 'width: 38px; padding: 0;'
|
||||
: ''}"
|
||||
class="flex-shrink-0"
|
||||
title="Generate title/body"
|
||||
title={$t('form.post.generateTitle')}
|
||||
loading={generation.loading}
|
||||
disabled={!generation.generatable || generation.loading}
|
||||
>
|
||||
<Icon src={Sparkles} size="18" mini slot="prefix" />
|
||||
{#if generation.generatable}
|
||||
Generate Title
|
||||
{$t('form.post.generateTitle')}
|
||||
{/if}
|
||||
</Button>
|
||||
<Button
|
||||
on:click={() => (uploadingImage = !uploadingImage)}
|
||||
style="width: 38px; height: 38px; padding: 0;"
|
||||
class="flex-shrink-0"
|
||||
title="Upload image"
|
||||
title={$t('form.post.uploadImage')}
|
||||
>
|
||||
<Icon src={Photo} size="18" mini slot="prefix" />
|
||||
</Button>
|
||||
</div>
|
||||
<MarkdownEditor
|
||||
rows={8}
|
||||
label="Body"
|
||||
label={$t('form.post.body')}
|
||||
bind:value={data.body}
|
||||
placeholder={placeholders.get('post')}
|
||||
previewButton
|
||||
/>
|
||||
<Switch bind:checked={data.nsfw}>NSFW</Switch>
|
||||
<Switch bind:checked={data.nsfw}>{$t('form.post.nsfw')}</Switch>
|
||||
<div class="mt-auto" />
|
||||
<div class="flex flex-row items-center gap-2">
|
||||
<Button
|
||||
@@ -321,13 +322,13 @@
|
||||
disabled={data.loading}
|
||||
class="flex-1"
|
||||
>
|
||||
Submit
|
||||
{$t('form.submit')}
|
||||
</Button>
|
||||
|
||||
{#if !edit}
|
||||
<Button
|
||||
on:click={() => {
|
||||
toast({ content: 'Restored from draft' })
|
||||
toast({ content: $t('toast.restoredFromDraft') })
|
||||
const draft = getSessionStorage('postDraft')
|
||||
if (draft && !edit) {
|
||||
// @ts-ignore
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
import ShieldIcon from '../moderation/ShieldIcon.svelte'
|
||||
import { userSettings } from '$lib/settings'
|
||||
import Markdown from '$lib/components/markdown/Markdown.svelte'
|
||||
import { t } from '$lib/translations'
|
||||
|
||||
export let community: Community | undefined = undefined
|
||||
export let subscribed: SubscribedType | undefined = undefined
|
||||
@@ -113,36 +114,48 @@
|
||||
style="grid-area: badges;"
|
||||
>
|
||||
{#if badges.nsfw}
|
||||
<Badge color="red-subtle">NSFW</Badge>
|
||||
<Badge color="red-subtle">{$t('post.badges.nsfw')}</Badge>
|
||||
{/if}
|
||||
{#if badges.saved}
|
||||
<Badge label="Saved" color="yellow-subtle" allowIconOnly>
|
||||
<Badge
|
||||
label={$t('post.badges.saved')}
|
||||
color="yellow-subtle"
|
||||
allowIconOnly
|
||||
>
|
||||
<Icon src={Bookmark} mini size="12" slot="icon" />
|
||||
Saved
|
||||
{$t('post.badges.saved')}
|
||||
</Badge>
|
||||
{/if}
|
||||
{#if badges.locked}
|
||||
<Badge label="Locked" color="yellow-subtle" allowIconOnly>
|
||||
<Badge
|
||||
label={$t('post.badges.locked')}
|
||||
color="yellow-subtle"
|
||||
allowIconOnly
|
||||
>
|
||||
<Icon src={LockClosed} mini size="14" slot="icon" />
|
||||
<span class="max-md:hidden">Locked</span>
|
||||
<span class="max-md:hidden">{$t('post.badges.locked')}</span>
|
||||
</Badge>
|
||||
{/if}
|
||||
{#if badges.removed}
|
||||
<Badge label="Removed" color="red-subtle" allowIconOnly>
|
||||
<Badge label={$t('post.badges.removed')} color="red-subtle" allowIconOnly>
|
||||
<Icon src={Trash} mini size="14" slot="icon" />
|
||||
<span class="max-md:hidden">Removed</span>
|
||||
<span class="max-md:hidden">{$t('post.badges.removed')}</span>
|
||||
</Badge>
|
||||
{/if}
|
||||
{#if badges.deleted}
|
||||
<Badge label="Deleted" color="red-subtle" allowIconOnly>
|
||||
<Badge label={$t('post.badges.deleted')} color="red-subtle" allowIconOnly>
|
||||
<Icon src={Trash} mini size="14" slot="icon" />
|
||||
<span class="max-md:hidden">Deleted</span>
|
||||
<span class="max-md:hidden">{$t('post.badges.deleted')}</span>
|
||||
</Badge>
|
||||
{/if}
|
||||
{#if badges.featured}
|
||||
<Badge label="Featured" color="green-subtle" allowIconOnly>
|
||||
<Badge
|
||||
label={$t('post.badges.featured')}
|
||||
color="green-subtle"
|
||||
allowIconOnly
|
||||
>
|
||||
<Icon src={Megaphone} mini size="14" slot="icon" />
|
||||
<span class="max-md:hidden">Featured</span>
|
||||
<span class="max-md:hidden">{$t('post.badges.featured')}</span>
|
||||
</Badge>
|
||||
{/if}
|
||||
<slot name="badges" />
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
import { site } from '$lib/lemmy.js'
|
||||
import { fly } from 'svelte/transition'
|
||||
import { backOut } from 'svelte/easing'
|
||||
import { t } from '$lib/translations'
|
||||
|
||||
export let post: Post
|
||||
export let vote: number = 0
|
||||
@@ -42,7 +43,7 @@
|
||||
|
||||
const castVote = async (newVote: number) => {
|
||||
if (!$profile?.jwt) {
|
||||
toast({ content: 'You must be logged in to vote.', type: 'warning' })
|
||||
toast({ content: $t('toast.loginVoteGate'), type: 'warning' })
|
||||
return
|
||||
}
|
||||
loading = true
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { goto } from '$app/navigation'
|
||||
import { t } from '$lib/translations'
|
||||
import { TextInput } from 'mono-svelte'
|
||||
|
||||
let query: string = ''
|
||||
@@ -15,7 +16,7 @@
|
||||
<TextInput
|
||||
bind:value={query}
|
||||
class="w-full h-full {$$props.class}"
|
||||
placeholder="Search"
|
||||
placeholder={$t('nav.search')}
|
||||
autofocus
|
||||
/>
|
||||
</form>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import { profile } from '$lib/auth.js'
|
||||
import MultiSelect from '$lib/components/input/Switch.svelte'
|
||||
import Markdown from '$lib/components/markdown/Markdown.svelte'
|
||||
import { t } from '$lib/translations'
|
||||
import { uploadImage } from '$lib/util.js'
|
||||
import { ImageInput, toast } from 'mono-svelte'
|
||||
import { Button, Label, Modal, TextArea } from 'mono-svelte'
|
||||
@@ -63,12 +64,11 @@
|
||||
let uploadingImage = false
|
||||
let loading = false
|
||||
let image: any
|
||||
$: previewURL =
|
||||
image instanceof FileList
|
||||
? URL.createObjectURL(image[0])
|
||||
: image
|
||||
? URL.createObjectURL(image)
|
||||
: ''
|
||||
$: previewURL = image?.length
|
||||
? URL.createObjectURL(image[0])
|
||||
: image
|
||||
? URL.createObjectURL(image)
|
||||
: ''
|
||||
|
||||
async function upload() {
|
||||
if (!$profile?.jwt || !image) return
|
||||
@@ -97,7 +97,7 @@
|
||||
loading = false
|
||||
}
|
||||
|
||||
let previewing = false
|
||||
export let previewing = false
|
||||
|
||||
const shortcuts = {
|
||||
KeyB: () => wrapSelection('**', '**'),
|
||||
@@ -174,7 +174,8 @@ overflow-hidden transition-colors"
|
||||
>
|
||||
{#if previewing}
|
||||
<div
|
||||
class="px-3 py-2.5 h-32 overflow-auto text-sm resize-y bg-white dark:bg-zinc-950"
|
||||
class="px-3 py-2.5 overflow-auto text-sm resize-y bg-white dark:bg-zinc-950"
|
||||
style="height: {rows * 2}em"
|
||||
>
|
||||
<Markdown source={beforePreview(value)} />
|
||||
</div>
|
||||
@@ -317,7 +318,7 @@ overflow-hidden transition-colors"
|
||||
<MultiSelect
|
||||
bind:selected={previewing}
|
||||
options={[false, true]}
|
||||
optionNames={['Edit', 'Preview']}
|
||||
optionNames={[$t('form.edit'), $t('form.preview')]}
|
||||
/>
|
||||
{/if}
|
||||
<slot />
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
<script lang="ts">
|
||||
import { Button, Modal, Select, Spinner, TextArea } from 'mono-svelte'
|
||||
import { text } from './translation'
|
||||
import { locale, t } from '$lib/translations'
|
||||
import { userSettings } from '$lib/settings'
|
||||
import { ArrowRight, Icon } from 'svelte-hero-icons'
|
||||
import MarkdownEditor from '../markdown/MarkdownEditor.svelte'
|
||||
|
||||
interface TranslateResponse {
|
||||
translatedText: string
|
||||
}
|
||||
|
||||
export let open: boolean = false
|
||||
let error = false
|
||||
|
||||
const opened = () => translate($text)
|
||||
|
||||
$: if (open) opened()
|
||||
|
||||
let result: Promise<TranslateResponse> | undefined = undefined
|
||||
let from = 'auto'
|
||||
let to = $locale
|
||||
|
||||
async function translate(text: string) {
|
||||
const url = $userSettings.translator
|
||||
|
||||
if (!url) {
|
||||
return
|
||||
}
|
||||
|
||||
error = false
|
||||
|
||||
const requestURL = new URL(`https://${url}/translate`)
|
||||
requestURL.searchParams.set('q', text)
|
||||
requestURL.searchParams.set('source', from)
|
||||
requestURL.searchParams.set('target', to)
|
||||
requestURL.searchParams.set('alternatives', '')
|
||||
|
||||
result = fetch(requestURL.toString(), {
|
||||
method: 'POST',
|
||||
}).then(async (res) => {
|
||||
if (!res.ok) {
|
||||
error = true
|
||||
throw new Error(`${res.status} ${res.statusText}`)
|
||||
return {
|
||||
translatedText: `${res.status} ${res.statusText}`,
|
||||
}
|
||||
}
|
||||
|
||||
return await res.json()
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<Modal title={$t('post.actions.more.translate')} bind:open>
|
||||
<TextArea bind:value={$text} rows={2}>
|
||||
<Button on:click={() => translate($text)} slot="suffix" color="primary">
|
||||
{$t('post.actions.more.translate')}
|
||||
</Button>
|
||||
</TextArea>
|
||||
<div class="flex items-center gap-2 w-full">
|
||||
<Select bind:value={from} class="flex-1">
|
||||
<option value="auto">Auto</option>
|
||||
</Select>
|
||||
<Icon src={ArrowRight} mini size="20" />
|
||||
<Select on:change={() => translate($text)} bind:value={to} class="flex-1">
|
||||
<option value="en">English</option>
|
||||
<option value="ar">Arabic</option>
|
||||
<option value="zh">Chinese</option>
|
||||
<option value="cs">Czech</option>
|
||||
<option value="nl">Dutch</option>
|
||||
<option value="fi">Finnish</option>
|
||||
<option value="fr">French</option>
|
||||
<option value="de">German</option>
|
||||
<option value="el">Greek</option>
|
||||
<option value="it">Italian</option>
|
||||
<option value="ja">Japanese</option>
|
||||
<option value="pl">Polish</option>
|
||||
<option value="es">Spanish</option>
|
||||
<option value="sv">Swedish</option>
|
||||
</Select>
|
||||
</div>
|
||||
{#if result}
|
||||
{#await result}
|
||||
<div
|
||||
style="height: 226px; width:100%;"
|
||||
class="flex items-center justify-center"
|
||||
>
|
||||
<Spinner width={32} />
|
||||
</div>
|
||||
{:then result}
|
||||
{#if !error}
|
||||
<MarkdownEditor
|
||||
previewButton={false}
|
||||
previewing
|
||||
tools={false}
|
||||
rows={8}
|
||||
value={result.translatedText || 'Failed to translate'}
|
||||
disabled
|
||||
></MarkdownEditor>
|
||||
{/if}
|
||||
{:catch err}
|
||||
<MarkdownEditor
|
||||
previewButton={false}
|
||||
previewing
|
||||
tools={false}
|
||||
disabled
|
||||
rows={8}
|
||||
value={err || 'Failed to translate'}
|
||||
class="!border-red-500 !ring-red-500 !text-red-500"
|
||||
></MarkdownEditor>
|
||||
{/await}
|
||||
{:else}
|
||||
<TextArea disabled />
|
||||
{/if}
|
||||
</Modal>
|
||||
@@ -0,0 +1,3 @@
|
||||
import { writable } from 'svelte/store'
|
||||
|
||||
export let text = writable<string>(undefined)
|
||||
@@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { t } from '$lib/translations'
|
||||
import { Button } from 'mono-svelte'
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
import {
|
||||
@@ -32,7 +33,7 @@
|
||||
class={$$slots.default ? '' : 'flex-1'}
|
||||
>
|
||||
<Icon src={ChevronLeft} size="18" mini slot="prefix" />
|
||||
Back
|
||||
{$t('common.back')}
|
||||
</Button>
|
||||
{/if}
|
||||
|
||||
@@ -43,7 +44,7 @@
|
||||
}}
|
||||
class={$$slots.default ? '' : 'flex-1'}
|
||||
>
|
||||
Next
|
||||
{$t('common.next')}
|
||||
<Icon src={ChevronRight} size="18" mini slot="suffix" />
|
||||
</Button>
|
||||
</div>
|
||||
@@ -1,3 +1,3 @@
|
||||
<h1 class="text-3xl font-bold flex items-center">
|
||||
<h1 class="text-3xl font-bold flex items-center gap-2 {$$props.class ?? ''}">
|
||||
<slot />
|
||||
</h1>
|
||||
@@ -37,6 +37,7 @@
|
||||
import Logo from '../Logo.svelte'
|
||||
import { LINKED_INSTANCE_URL } from '$lib/instance'
|
||||
import SiteCard from '$lib/components/lemmy/SiteCard.svelte'
|
||||
import { t } from '$lib/translations'
|
||||
|
||||
let searching = false
|
||||
</script>
|
||||
@@ -48,7 +49,7 @@
|
||||
"
|
||||
style={$$props.style}
|
||||
>
|
||||
<NavButton href="/" label="Home" class="ml-2 logo">
|
||||
<NavButton href="/" label={$t('nav.home')} class="ml-2 logo">
|
||||
<svelte:fragment slot="icon">
|
||||
{#if LINKED_INSTANCE_URL}
|
||||
{#if $site}
|
||||
@@ -171,7 +172,7 @@
|
||||
{#if $profile?.user && isAdmin($profile.user)}
|
||||
<NavButton
|
||||
href="/admin"
|
||||
label="Admin"
|
||||
label={$t('nav.admin')}
|
||||
icon={ServerStack}
|
||||
class="relative"
|
||||
isSelectedFilter={(path) => path.startsWith('/admin')}
|
||||
@@ -184,7 +185,11 @@
|
||||
</NavButton>
|
||||
{/if}
|
||||
{#if amModOfAny($profile?.user)}
|
||||
<NavButton href="/moderation" label="Moderation" class="relative">
|
||||
<NavButton
|
||||
href="/moderation"
|
||||
label={$t('nav.moderation')}
|
||||
class="relative"
|
||||
>
|
||||
{#if ($profile?.user?.notifications.reports ?? 0) > 0}
|
||||
<div
|
||||
class="rounded-full w-2 h-2 bg-red-500 absolute -top-1 -left-1"
|
||||
@@ -193,10 +198,14 @@
|
||||
<ShieldIcon let:isSelected slot="icon" filled={isSelected} width={18} />
|
||||
</NavButton>
|
||||
{/if}
|
||||
<NavButton href="/communities" label="Explore" icon={GlobeAlt} />
|
||||
<NavButton
|
||||
href="/communities"
|
||||
label={$t('nav.communities')}
|
||||
icon={GlobeAlt}
|
||||
/>
|
||||
<NavButton
|
||||
on:click={() => (searching = true)}
|
||||
label="Search"
|
||||
label={$t('nav.search')}
|
||||
icon={MagnifyingGlass}
|
||||
/>
|
||||
<Menu placement="top">
|
||||
@@ -204,13 +213,13 @@
|
||||
class="relative"
|
||||
color="primary"
|
||||
slot="target"
|
||||
label="Create"
|
||||
label={$t('nav.create.label')}
|
||||
icon={Plus}
|
||||
/>
|
||||
<MenuDivider>Create</MenuDivider>
|
||||
<MenuDivider>{$t('nav.create.label')}</MenuDivider>
|
||||
<MenuButton link href="/create/post" disabled={!$profile?.jwt}>
|
||||
<Icon src={PencilSquare} mini width={16} slot="prefix" />
|
||||
Post
|
||||
{$t('nav.create.post')}
|
||||
</MenuButton>
|
||||
<MenuButton
|
||||
link
|
||||
@@ -221,11 +230,11 @@
|
||||
!isAdmin($profile.user))}
|
||||
>
|
||||
<Icon src={Newspaper} mini width={16} slot="prefix" />
|
||||
Community
|
||||
{$t('nav.create.community')}
|
||||
</MenuButton>
|
||||
{#if !$profile?.jwt}
|
||||
<span class="text-sm mx-4 my-1 py-1">
|
||||
<Link highlight href="/login">Log in</Link> to create content.
|
||||
{$t('nav.create.logingate')}
|
||||
</span>
|
||||
{/if}
|
||||
</Menu>
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
import { userSettings } from '$lib/settings'
|
||||
import { site } from '$lib/lemmy'
|
||||
import SiteCard from '$lib/components/lemmy/SiteCard.svelte'
|
||||
import { t } from '$lib/translations'
|
||||
|
||||
let showInstance = false
|
||||
</script>
|
||||
@@ -59,7 +60,7 @@
|
||||
class="w-10 h-10 rounded-full ring-1 ring-slate-200 dark:ring-zinc-700
|
||||
transition-all bg-slate-50 dark:bg-zinc-900 relative
|
||||
hover:dark:brightness-125 hover:brightness {$$props.buttonClass}"
|
||||
aria-label="Profile"
|
||||
title={$t('profile.profile')}
|
||||
slot="target"
|
||||
>
|
||||
{#if $profile?.user}
|
||||
@@ -93,15 +94,16 @@
|
||||
{$profile?.user?.local_user_view?.person.name}
|
||||
</div>
|
||||
{:else}
|
||||
<MenuDivider>Profile</MenuDivider>
|
||||
<MenuDivider>{$t('nav.menu.label')}</MenuDivider>
|
||||
{/if}
|
||||
{#if $profile?.user}
|
||||
<MenuButton link href="/profile">
|
||||
<Icon src={UserCircle} mini width={16} slot="prefix" /> Profile
|
||||
<Icon src={UserCircle} mini width={16} slot="prefix" />
|
||||
{$t('profile.profile')}
|
||||
</MenuButton>
|
||||
<MenuButton link href="/inbox">
|
||||
<Icon src={Inbox} mini width={16} slot="prefix" />
|
||||
Inbox
|
||||
{$t('profile.inbox')}
|
||||
{#if $profile.user.notifications.inbox > 0}
|
||||
<Badge color="red-subtle" class="text-xs ml-auto font-bold !py-0.5">
|
||||
{$profile.user.notifications.inbox}
|
||||
@@ -109,18 +111,19 @@
|
||||
{/if}
|
||||
</MenuButton>
|
||||
<MenuButton link href="/saved">
|
||||
<Icon src={Bookmark} mini width={16} slot="prefix" /> Saved
|
||||
<Icon src={Bookmark} mini width={16} slot="prefix" />
|
||||
{$t('profile.saved')}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
<MenuButton link href="/accounts">
|
||||
<Icon src={UserGroup} mini width={16} slot="prefix" />
|
||||
Accounts
|
||||
{$t('account.accounts')}
|
||||
</MenuButton>
|
||||
<hr class="dark:opacity-10 w-[90%] my-2 mx-auto" />
|
||||
<MenuDivider>App</MenuDivider>
|
||||
<MenuDivider>{$t('nav.menu.app')}</MenuDivider>
|
||||
<MenuButton link href="/settings">
|
||||
<Icon src={Cog6Tooth} mini width={16} slot="prefix" />
|
||||
Settings
|
||||
{$t('nav.menu.settings')}
|
||||
</MenuButton>
|
||||
<MenuButton class="!py-0">
|
||||
<Icon
|
||||
@@ -135,20 +138,20 @@
|
||||
size="16"
|
||||
slot="prefix"
|
||||
/>
|
||||
<span>Color Scheme</span>
|
||||
<span>{$t('nav.menu.colorscheme.label')}</span>
|
||||
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
||||
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
||||
<div class="contents" on:click|stopPropagation={() => {}}>
|
||||
<Select bind:value={$legacyTheme} class="ml-auto my-auto w-24" size="sm">
|
||||
<option value="system">System</option>
|
||||
<option value="light">Light</option>
|
||||
<option value="dark">Dark</option>
|
||||
<option value="system">{$t('nav.menu.colorscheme.system')}</option>
|
||||
<option value="light">{$t('nav.menu.colorscheme.light')}</option>
|
||||
<option value="dark">{$t('nav.menu.colorscheme.dark')}</option>
|
||||
</Select>
|
||||
</div>
|
||||
</MenuButton>
|
||||
<MenuButton href="/theme">
|
||||
<Icon src={Swatch} size="16" mini slot="prefix" />
|
||||
Theme
|
||||
{$t('nav.menu.theme')}
|
||||
</MenuButton>
|
||||
{#if $userSettings.debugInfo}
|
||||
<MenuButton link href="/util">
|
||||
@@ -165,7 +168,7 @@
|
||||
class="hover:brightness-110 transition-all"
|
||||
on:click={() => {
|
||||
navigator?.clipboard?.writeText(__VERSION__)
|
||||
toast({ content: 'Copied version to clipboard.' })
|
||||
toast({ content: $t('toast.copied') })
|
||||
}}
|
||||
>
|
||||
<Badge color="blue-subtle">{__VERSION__}</Badge>
|
||||
@@ -174,7 +177,7 @@
|
||||
<Button
|
||||
on:click={() => (showInstance = !showInstance)}
|
||||
color="tertiary"
|
||||
title="Instance"
|
||||
title={$t('nav.menu.instance')}
|
||||
size="square-md"
|
||||
>
|
||||
<Icon src={ServerStack} size="16" mini />
|
||||
@@ -182,7 +185,7 @@
|
||||
<Button
|
||||
color="tertiary"
|
||||
href="https://buymeacoffee.com/xylight"
|
||||
title="Donate"
|
||||
title={$t('nav.menu.donate')}
|
||||
size="square-md"
|
||||
>
|
||||
<Icon src={Heart} size="16" mini />
|
||||
@@ -190,14 +193,11 @@
|
||||
<Button
|
||||
color="tertiary"
|
||||
href="https://github.com/Xyphyn/Photon"
|
||||
title="GitHub"
|
||||
title={$t('nav.menu.source')}
|
||||
size="square-md"
|
||||
>
|
||||
<Icon src={CodeBracketSquare} size="16" mini />
|
||||
</Button>
|
||||
<Button color="tertiary" href="/about" title="About" size="square-md">
|
||||
<Icon src={InformationCircle} size="16" mini />
|
||||
</Button>
|
||||
</div>
|
||||
</li>
|
||||
</Menu>
|
||||
@@ -26,6 +26,7 @@
|
||||
import Expandable from '$lib/components/ui/Expandable.svelte'
|
||||
import EndPlaceholder from '../EndPlaceholder.svelte'
|
||||
import Application from '../../../../routes/admin/applications/Application.svelte'
|
||||
import { t } from '$lib/translations'
|
||||
</script>
|
||||
|
||||
<nav
|
||||
@@ -35,11 +36,13 @@
|
||||
>
|
||||
{#if $profile?.jwt}
|
||||
<SidebarButton icon={UserCircle} href="/profile/user">
|
||||
<span slot="label">Profile</span>
|
||||
<span slot="label">
|
||||
{$t('profile.profile')}
|
||||
</span>
|
||||
</SidebarButton>
|
||||
<SidebarButton icon={Inbox} href="/inbox">
|
||||
<span slot="label" class="flex items-center gap-2">
|
||||
Inbox
|
||||
{$t('profile.inbox')}
|
||||
{#if $profile?.user?.notifications.inbox}
|
||||
<Badge
|
||||
class="w-5 h-5 !p-0 grid place-items-center ml-auto"
|
||||
@@ -51,22 +54,30 @@
|
||||
</span>
|
||||
</SidebarButton>
|
||||
<SidebarButton icon={Bookmark} href="/saved">
|
||||
<span slot="label">Saved</span>
|
||||
<span slot="label">{$t('profile.saved')}</span>
|
||||
</SidebarButton>
|
||||
{:else}
|
||||
<SidebarButton href="/login" title="Log In" icon={ArrowLeftOnRectangle}>
|
||||
<span slot="label">Log In</span>
|
||||
<SidebarButton
|
||||
href="/login"
|
||||
title={$t('account.login')}
|
||||
icon={ArrowLeftOnRectangle}
|
||||
>
|
||||
<span slot="label">{$t('account.login')}</span>
|
||||
</SidebarButton>
|
||||
<SidebarButton href="/signup" title="Sign Up" icon={Identification}>
|
||||
<span slot="label">Sign Up</span>
|
||||
<SidebarButton
|
||||
href="/signup"
|
||||
title={$t('account.signup')}
|
||||
icon={Identification}
|
||||
>
|
||||
<span slot="label">{$t('account.signup')}</span>
|
||||
</SidebarButton>
|
||||
{#if LINKED_INSTANCE_URL === undefined}
|
||||
<SidebarButton
|
||||
href="/accounts"
|
||||
title="Change Instance"
|
||||
title={$t('account.changeinstance')}
|
||||
icon={ServerStack}
|
||||
>
|
||||
<span slot="label">Change Instance</span>
|
||||
<span slot="label">{$t('account.changeinstance')}</span>
|
||||
</SidebarButton>
|
||||
{/if}
|
||||
{/if}
|
||||
@@ -78,7 +89,7 @@
|
||||
</div>
|
||||
{/each}
|
||||
<SidebarButton href="/accounts" icon={UserGroup}>
|
||||
<span slot="label">Accounts</span>
|
||||
<span slot="label">{$t('account.accounts')}</span>
|
||||
</SidebarButton>
|
||||
{/if}
|
||||
<hr class="border-slate-200 dark:border-zinc-900 my-1" />
|
||||
@@ -99,7 +110,7 @@
|
||||
: '//max-lg:hidden'}"
|
||||
>
|
||||
<EndPlaceholder>
|
||||
Subscribed
|
||||
{$t('profile.subscribed')}
|
||||
<span slot="action" class="dark:text-white text-black">
|
||||
{$profile.user.follows.length}
|
||||
</span>
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
<script lang="ts">
|
||||
import { locale } from '$lib/translations'
|
||||
|
||||
export let number: number
|
||||
export let locale: string = 'en'
|
||||
let localeToUse: string = $locale
|
||||
export let options: Intl.NumberFormatOptions = {
|
||||
notation: 'compact',
|
||||
}
|
||||
|
||||
export { localeToUse as locale }
|
||||
</script>
|
||||
|
||||
<span class={$$props.class ?? ''}>
|
||||
{Intl.NumberFormat(locale, options).format(number)}
|
||||
{Intl.NumberFormat(localeToUse, options).format(number)}
|
||||
</span>
|
||||
@@ -1,4 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { locale } from '$lib/translations'
|
||||
|
||||
export let date: Date
|
||||
export let relativeTo: Date | undefined = undefined
|
||||
export let options: Intl.RelativeTimeFormatOptions = {
|
||||
@@ -36,10 +38,7 @@
|
||||
if (diffInMillis >= thresholds[i].threshold) {
|
||||
const value = Math.round(diffInMillis / thresholds[i].threshold)
|
||||
|
||||
let language = 'en'
|
||||
if (typeof navigator != 'undefined') {
|
||||
language = navigator.language
|
||||
}
|
||||
let language = $locale
|
||||
|
||||
const rtf = new Intl.RelativeTimeFormat(language, options)
|
||||
|
||||
|
||||
@@ -0,0 +1,673 @@
|
||||
{
|
||||
"profile": {
|
||||
"profile": "Profile",
|
||||
"inbox": "Inbox",
|
||||
"saved": "Saved",
|
||||
"subscribed": "Subscribed"
|
||||
},
|
||||
"nav": {
|
||||
"home": "Home",
|
||||
"admin": "Admin",
|
||||
"moderation": "Moderation",
|
||||
"communities": "Explore",
|
||||
"search": "Search",
|
||||
"create": {
|
||||
"label": "Create",
|
||||
"post": "Post",
|
||||
"community": "Community",
|
||||
"logingate": "You must log in to create content."
|
||||
},
|
||||
"menu": {
|
||||
"label": "Profile",
|
||||
"app": "App",
|
||||
"settings": "Settings",
|
||||
"colorscheme": {
|
||||
"label": "Color Scheme",
|
||||
"system": "System",
|
||||
"dark": "Dark",
|
||||
"light": "Light"
|
||||
},
|
||||
"theme": "Theme",
|
||||
"about": "About",
|
||||
"source": "Source",
|
||||
"donate": "Donate",
|
||||
"instance": "Instance"
|
||||
}
|
||||
},
|
||||
"account": {
|
||||
"login": "Log In",
|
||||
"logout": "Log Out",
|
||||
"signup": "Sign Up",
|
||||
"accounts": "Accounts",
|
||||
"changeinstance": "Change Instance",
|
||||
"resetColor": "Reset Color",
|
||||
"addGuest": "Add Guest",
|
||||
"moveUp": "Move Up",
|
||||
"moveDown": "Move Down",
|
||||
"guest": "Guest",
|
||||
"versionGate": "This version of Photon supports instances running {{version}} or higher."
|
||||
},
|
||||
"filter": {
|
||||
"location": {
|
||||
"label": "Location",
|
||||
"all": "All",
|
||||
"local": "Local",
|
||||
"subscribed": "Subscribed",
|
||||
"moderator": "Moderator"
|
||||
},
|
||||
"sort": {
|
||||
"label": "Sort",
|
||||
"active": "Active",
|
||||
"hot": "Hot",
|
||||
"top": {
|
||||
"label": "Top",
|
||||
"time": {
|
||||
"label": "Time",
|
||||
"all": "All",
|
||||
"9months": "9 Months",
|
||||
"6months": "6 Months",
|
||||
"3months": "3 Months",
|
||||
"month": "Month",
|
||||
"week": "Week",
|
||||
"day": "Day",
|
||||
"12hours": "12 Hours",
|
||||
"6hours": "6 Hours",
|
||||
"hour": "Hour"
|
||||
}
|
||||
},
|
||||
"new": "New",
|
||||
"old": "Old",
|
||||
"controversial": "Controversial",
|
||||
"scaled": "Scaled",
|
||||
"mostcomments": "Comments",
|
||||
"newcomments": "New Replies"
|
||||
},
|
||||
"view": {
|
||||
"label": "View",
|
||||
"cozy": "Cozy",
|
||||
"list": "List",
|
||||
"compact": "Compact",
|
||||
"legacy": "Legacy"
|
||||
},
|
||||
"type": "Type",
|
||||
"filter": "Filter",
|
||||
"unread": "Unread",
|
||||
"inbox": {
|
||||
"messages": "Messages",
|
||||
"replies": "Replies",
|
||||
"mentions": "Mentions"
|
||||
}
|
||||
},
|
||||
"form": {
|
||||
"username": "Username",
|
||||
"name": "Name",
|
||||
"instance": "Instance URL",
|
||||
"password": "Password",
|
||||
"confirmPassword": "Confirm Password",
|
||||
"2fa": "2FA Code",
|
||||
"forgotpassword": "Forgot Password",
|
||||
"submit": "Submit",
|
||||
"edit": "Edit",
|
||||
"preview": "Preview",
|
||||
"post": {
|
||||
"create": "Create Post",
|
||||
"edit": "Edit Post",
|
||||
"community": "Community",
|
||||
"title": "Title",
|
||||
"url": "URL",
|
||||
"body": "Body",
|
||||
"nsfw": "NSFW",
|
||||
"generateTitle": "Generate Title",
|
||||
"uploadImage": "Upload Image"
|
||||
},
|
||||
"profile": {
|
||||
"displayName": "Display name",
|
||||
"bio": "Bio",
|
||||
"avatar": "Avatar",
|
||||
"banner": "Banner",
|
||||
"email": "Email",
|
||||
"matrix": "Matrix User",
|
||||
"showNSFW": "Show NSFW content",
|
||||
"scores": "Show Scores",
|
||||
"bot": "Bot Account",
|
||||
"showBots": "Show Bots",
|
||||
"showRead": "Show Read Posts",
|
||||
"currentPassword": "Current Password",
|
||||
"newPassword": "New Password",
|
||||
"verifyNewPassword": "Verify New Password",
|
||||
"2fa": {
|
||||
"totp": "TOTP",
|
||||
"2fa": "2FA",
|
||||
"paste": "Paste this in your authenticator app."
|
||||
},
|
||||
"deleteAccount": {
|
||||
"label": "Delete account",
|
||||
"deleteContent": "Delete content",
|
||||
"warning": "This will delete ALL of your submissions."
|
||||
}
|
||||
},
|
||||
"email": "Email",
|
||||
"setup": "Setup",
|
||||
"signup": {
|
||||
"title": "Sign Up",
|
||||
"description": "Choose an instance that interests you, or type the URL manually.",
|
||||
"info": "An instance is the server that your account will be hosted on, but you can still access and interact with content from other instances.",
|
||||
"chooseInstance": "Choose an instance",
|
||||
"application": {
|
||||
"label": "Application",
|
||||
"info": "To join this instance, you must fill out this application, and wait to be accepted. You will receive an email if your application is accepted."
|
||||
},
|
||||
"closed": {
|
||||
"title": "Registrations closed",
|
||||
"description": "This instance has registrations closed. Find another instance.",
|
||||
"anotherInstance": "Find another instance"
|
||||
}
|
||||
},
|
||||
"description": "Description"
|
||||
},
|
||||
"routes": {
|
||||
"frontpage": {
|
||||
"title": "Frontpage",
|
||||
"footer": "{{users:number}} active {{users; 1:user; default:users;}}"
|
||||
},
|
||||
"modlog": "Modlog",
|
||||
"instances": "Instances",
|
||||
"legal": {
|
||||
"title": "Legal",
|
||||
"noLegal": "This instance does not have any legal information."
|
||||
},
|
||||
"profile": {
|
||||
"user": "User",
|
||||
"settings": "Settings",
|
||||
"blocks": "Blocks",
|
||||
"credentials": "Credentials",
|
||||
"moderates": "Moderates"
|
||||
},
|
||||
"translators": "Translators",
|
||||
"accounts": "Accounts",
|
||||
"communities": "Communities",
|
||||
"search": {
|
||||
"title": "Search",
|
||||
"federating": "Federating",
|
||||
"query": "Query",
|
||||
"noResults": {
|
||||
"title": "No Results",
|
||||
"description": "There are no results that match that filter. Try refining your search.",
|
||||
"alt": "Search across the fediverse"
|
||||
}
|
||||
},
|
||||
"saved": "Saved",
|
||||
"createPost": "Create Post",
|
||||
"createCommunity": "Create Community",
|
||||
"post": {
|
||||
"crosspostCount": "crossposts",
|
||||
"commentCount": "comments",
|
||||
"addComment": "Add a comment",
|
||||
"scrollToTop": "Scroll to top",
|
||||
"instanceWarning": "This post was requested from a different server than your account's. Many actions won't work.",
|
||||
"remoteView": "Remote View",
|
||||
"localView": "Local View",
|
||||
"thread": {
|
||||
"single": "You're viewing a single thread.",
|
||||
"allComments": "All Comments",
|
||||
"part": "You're viewing part of a thread.",
|
||||
"context": "Show Context"
|
||||
}
|
||||
},
|
||||
"inbox": {
|
||||
"title": "Inbox",
|
||||
"markAsRead": "Mark All Read",
|
||||
"empty": {
|
||||
"title": "No new notifications",
|
||||
"description": "Messages, replies, and mentions will appear here."
|
||||
}
|
||||
},
|
||||
"moderation": {
|
||||
"title": "Moderation",
|
||||
"empty": {
|
||||
"title": "No new reports",
|
||||
"description": "When submissions are reported, you can act on them here."
|
||||
},
|
||||
"reason": "Reason",
|
||||
"resolve": "Resolve",
|
||||
"unresolve": "Unresolve"
|
||||
},
|
||||
"admin": {
|
||||
"title": "Administration",
|
||||
"config": {
|
||||
"title": "Configuration",
|
||||
"sidebar": "Sidebar",
|
||||
"icon": "Icon",
|
||||
"banner": "Banner",
|
||||
"downvotesEnabled": "Enable Downvotes",
|
||||
"nsfwEnabled": "Enable NSFW",
|
||||
"registration": {
|
||||
"label": "Registration Mode",
|
||||
"open": "Open",
|
||||
"application": "Require Application",
|
||||
"closed": "Closed"
|
||||
},
|
||||
"applicationQuestion": "Application Question",
|
||||
"adminCommunityOnly": "Only admins can create communities",
|
||||
"requireVerifyEmail": "Require email verification",
|
||||
"emailAdminsOnApplication": "Email admins on receiving new applications",
|
||||
"emailAdminsOnReport": "Email admins on receiving new reports",
|
||||
"listingType": {
|
||||
"label": "Listing Type",
|
||||
"all": "All",
|
||||
"local": "Local"
|
||||
},
|
||||
"private": "Private instance",
|
||||
"hideModlogModNames": "Hide modlog mod names",
|
||||
"slurFilter": "Slur filter regex",
|
||||
"federation": "Federation enabled",
|
||||
"federationDebug": "Federation debug mode",
|
||||
"captcha": {
|
||||
"enabled": "Enabled"
|
||||
}
|
||||
},
|
||||
"applications": {
|
||||
"title": "Applications",
|
||||
"empty": {
|
||||
"title": "No new applications",
|
||||
"description": "Applications to join your instance will appear here."
|
||||
},
|
||||
"application": "Application",
|
||||
"approved": "Approved",
|
||||
"denied": "Denied",
|
||||
"user": "User",
|
||||
"deny": "Deny",
|
||||
"approve": "Approve",
|
||||
"reason": "Reason",
|
||||
"modalTitle": "Deny Application"
|
||||
},
|
||||
"taglines": {
|
||||
"title": "Taglines",
|
||||
"add": "Add a tagline",
|
||||
"empty": {
|
||||
"title": "No taglines",
|
||||
"description": "A random tagline will appear on the site card when users visit your instance."
|
||||
}
|
||||
},
|
||||
"team": {
|
||||
"title": "Admins",
|
||||
"empty": {
|
||||
"title": "No admins",
|
||||
"description": "Somehow there's no admins of this site. How??"
|
||||
}
|
||||
},
|
||||
"federation": {
|
||||
"title": "Federation",
|
||||
"csv": "Upload CSV",
|
||||
"blocked": "Blocked Instances",
|
||||
"block": "Block",
|
||||
"blockplaceholder": "Block an instance...",
|
||||
"allowed": "Whitelisted Instances",
|
||||
"allow": "Whitelist",
|
||||
"allowplaceholder": "Whitelist an instance",
|
||||
"emptyBlock": {
|
||||
"title": "No blocked instances",
|
||||
"description": "Blocking an instance will hide new submissions from that instance."
|
||||
},
|
||||
"emptyAllow": {
|
||||
"title": "No whitelisted instances",
|
||||
"description": "Whitelisting an instance will block every other instance."
|
||||
}
|
||||
}
|
||||
},
|
||||
"verifyEmail": {
|
||||
"message": "Your email was verified. You can now close this window.",
|
||||
"error": "Failed to verify your email."
|
||||
},
|
||||
"passwordChange": {
|
||||
"title": "Change Password",
|
||||
"description": "Choose your new password.",
|
||||
"instance": "Which instance is your account hosted on?"
|
||||
},
|
||||
"resetLogin": {
|
||||
"title": "Reset Password",
|
||||
"description": "Enter your account's email, and a password reset link will be sent. If your account does not have an email, contact your instance admins."
|
||||
},
|
||||
"theme": {
|
||||
"title": "Theme",
|
||||
"import": "Import",
|
||||
"export": "Export",
|
||||
"reset": "Reset",
|
||||
"accent": "Accent",
|
||||
"resetWarning": {
|
||||
"title": "Reset Theme",
|
||||
"description": "This will reset all of your colors to the default. It is recommended to export your theme before this."
|
||||
}
|
||||
}
|
||||
},
|
||||
"cards": {
|
||||
"site": {
|
||||
"about": "About",
|
||||
"stats": "Stats",
|
||||
"admins": "Admins"
|
||||
},
|
||||
"community": {
|
||||
"members": "Members",
|
||||
"moderators": "Moderators",
|
||||
"subscribe": "Subscribe",
|
||||
"subscribed": "Subscribed",
|
||||
"modlog": "Modlog",
|
||||
"block": "Block",
|
||||
"unblock": "Unblock",
|
||||
"blockInstance": "Block instance"
|
||||
}
|
||||
},
|
||||
"admin": {
|
||||
"purge": "Purge",
|
||||
"instance": "Instance",
|
||||
"label": "Administration",
|
||||
"purgeCommunity": {
|
||||
"title": "Purging Community",
|
||||
"warning": "This will delete all posts. Are you sure? (The button will enable in 3 seconds.)"
|
||||
}
|
||||
},
|
||||
"content": {
|
||||
"all": "All",
|
||||
"users": "Users",
|
||||
"posts": "Posts",
|
||||
"comments": "Comments",
|
||||
"communities": "Communities",
|
||||
"instances": "Instances",
|
||||
"message": "Message"
|
||||
},
|
||||
"post": {
|
||||
"actions": {
|
||||
"comments": "Comments",
|
||||
"save": "Save",
|
||||
"unsave": "Unsave",
|
||||
"more": {
|
||||
"label": "More Actions",
|
||||
"edit": "Edit",
|
||||
"creator": "Creator",
|
||||
"actions": "Actions",
|
||||
"markRead": "Mark as Read",
|
||||
"markUnread": "Mark as Unread",
|
||||
"translate": "Translate",
|
||||
"share": "Share",
|
||||
"crosspost": "Crosspost",
|
||||
"delete": "Delete",
|
||||
"restore": "Restore"
|
||||
}
|
||||
},
|
||||
"badges": {
|
||||
"nsfw": "NSFW",
|
||||
"locked": "Locked",
|
||||
"featured": "Featured",
|
||||
"removed": "Removed",
|
||||
"deleted": "Deleted",
|
||||
"saved": "Saved"
|
||||
}
|
||||
},
|
||||
"comment": {
|
||||
"reply": "Reply",
|
||||
"actions": {
|
||||
"label": "Actions",
|
||||
"link": "Copy Link"
|
||||
},
|
||||
"locked": "This post is locked."
|
||||
},
|
||||
"moderation": {
|
||||
"report": "Report",
|
||||
"ban": {
|
||||
"banning": "Banning User",
|
||||
"unbanning": "Unbanning User",
|
||||
"deleteData": "Delete data",
|
||||
"warning": "This will delete ALL of this user's submissions here.",
|
||||
"expires": "Expires (UTC)",
|
||||
"banFromCommunity": "Ban from community",
|
||||
"unbanFromCommunity": "Unban from community"
|
||||
},
|
||||
"removeSubmission": {
|
||||
"title": "Removing Submission",
|
||||
"titleRestore": "Restoring Submission",
|
||||
"titlePurge": "Purging Submission",
|
||||
"withReason": "Reply with reason",
|
||||
"comment": "Comment",
|
||||
"message": "Message",
|
||||
"failReply": "Failed to post reply. Removing anyway...",
|
||||
"failMessage": "Failed to message user. Removing anyway...",
|
||||
"failEmptyReply": "Your reply cannot be empty if 'Reply with reason' is enabled.",
|
||||
"successPurge": "Successfully purged that submission."
|
||||
},
|
||||
"reportModal": {
|
||||
"title": "Report",
|
||||
"success": "Reported that submission."
|
||||
},
|
||||
"reason": "Reason",
|
||||
"lock": "Lock",
|
||||
"unlock": "Unlock",
|
||||
"remove": "Remove",
|
||||
"restore": "Restore",
|
||||
"label": "Moderation",
|
||||
"labelInstanceOnly": "Moderation (Instance Only)",
|
||||
"feature": "Feature",
|
||||
"unfeature": "Unfeature"
|
||||
},
|
||||
"common": {
|
||||
"back": "Back",
|
||||
"next": "Next",
|
||||
"debug": "Debug",
|
||||
"refresh": "Refresh",
|
||||
"jump": "Jump",
|
||||
"save": "Save",
|
||||
"enabled": "Enabled",
|
||||
"disabled": "Disabled",
|
||||
"enable": "Enable",
|
||||
"disable": "Disable",
|
||||
"add": "Add",
|
||||
"cancel": "Cancel",
|
||||
"send": "Send"
|
||||
},
|
||||
"message": {
|
||||
"success": "Success",
|
||||
"error": "Error"
|
||||
},
|
||||
"toast": {
|
||||
"noComments": "The API returned no comments.",
|
||||
"loginVoteGate": "You must be logged in to vote.",
|
||||
"blockedCommunity": "Blocked that community.",
|
||||
"unblockedCommunity": "Unblocked that community.",
|
||||
"purgedCommunity": "Purged that community.",
|
||||
"blockedInstance": "Blocked that instance.",
|
||||
"updatedCommunity": "Your community was updated.",
|
||||
"sentMessage": "Sent that message.",
|
||||
"invalidDateAbsolute": "Invalid date. It must be an absolute date.",
|
||||
"invalidDateBeforeCurrent": "Invalid date. It is before the current time.",
|
||||
"bannedUser": "Banned that user.",
|
||||
"unbannedUser": "Unbanned that user.",
|
||||
"needCommunity": "You must set a community.",
|
||||
"invalidURL": "Invalid URL",
|
||||
"generatedTitle": "Generated title and body from the URL. Do you want to undo this?",
|
||||
"failGenerateTitle": "There was no usable title or description of that website.",
|
||||
"restoredFromDraft": "Restored your post from the draft.",
|
||||
"copied": "Copied to clipboard.",
|
||||
"approvedApplication": "Approved that application.",
|
||||
"deniedApplication": "Denied that application.",
|
||||
"updatedSite": "Updated your site.",
|
||||
"failCSV": "Failed to read CSV",
|
||||
"removeAdminWarning": "Are you sure you want to remove that admin?",
|
||||
"removeAdmin": "Removed that admin.",
|
||||
"failFindUser": "Could not find that user.",
|
||||
"addMod": "Added that moderator.",
|
||||
"updateMods": "Updated community moderators.",
|
||||
"logIn": "Successfully logged in.",
|
||||
"failInstanceURL": "Failed to contact that instance URL. Is it down?",
|
||||
"addAccount": "Added that account.",
|
||||
"resetLink": "A password reset link was sent to your email.",
|
||||
"resolveReport": "Resolved that report.",
|
||||
"unresolveReport": "Unresolved that report.",
|
||||
"passwordReset": "Your password was reset.",
|
||||
"fetchPostOnHome": "Attempting to fetch this post on your home instance...",
|
||||
"loginRefresh": "Your login was refreshed.",
|
||||
"invalidLogin": "Invalid credentials",
|
||||
"saveSettings": "Saved your user settings. If you changed your email, a verification link was sent.",
|
||||
"confirmDelete1": "Are you sure you want to delete your account?",
|
||||
"confirmDelete2": "Are you really sure?",
|
||||
"confirmDelete3": "Final warning. Are you really sure?",
|
||||
"needPassword": "You must provide your password.",
|
||||
"deleting": "Deleting your account...",
|
||||
"deleted": "Your account was deleted.",
|
||||
"resetSettings": "Do you want to reset your settings to the default?",
|
||||
"failFetchInstances": "Failed to fetch available instances.",
|
||||
"verifyEmail": "A verification link was sent to your email. Verify your email, then log in.",
|
||||
"failSignup": "Failed to sign up.",
|
||||
"successSignup": "Signed up.",
|
||||
"waitApplication": "Wait for your registration application to be accepted before logging in.",
|
||||
"blockUser": "Blocked that user.",
|
||||
"unblockUser": "Unblocked that user.",
|
||||
"purgeUser": "Purged that user."
|
||||
},
|
||||
"settings": {
|
||||
"title": "Settings",
|
||||
"navigation": {
|
||||
"title": "Navigation",
|
||||
"dockPos": {
|
||||
"title": "Dock position",
|
||||
"description": "Where the dock should be positioned on the screen.",
|
||||
"top": "Top",
|
||||
"bottom": "Bottom",
|
||||
"adaptive": "Adaptive"
|
||||
},
|
||||
"panel": {
|
||||
"title": "Panel mode",
|
||||
"description": "Extend the dock to the screen edges, similar to a panel.",
|
||||
"on": "On",
|
||||
"off": "Off",
|
||||
"adaptive": "Adaptive"
|
||||
}
|
||||
},
|
||||
"app": {
|
||||
"title": "Photon",
|
||||
"theming": {
|
||||
"title": "Theming",
|
||||
"description": "Customize Photon's colors.",
|
||||
"link": "Go to themes"
|
||||
},
|
||||
"lang": {
|
||||
"title": "Language",
|
||||
"description": "The language used for Photon's UI.",
|
||||
"note": "Languages other than English and Hebrew are community translated, and may be incomplete.",
|
||||
"en": "English",
|
||||
"en-US": "English",
|
||||
"he": "Hebrew",
|
||||
"ee": "Estonian",
|
||||
"fr": "French",
|
||||
"auto": "Auto",
|
||||
"credits": "Credits"
|
||||
},
|
||||
"view": {
|
||||
"title": "Post style",
|
||||
"list": "Show posts in a list, with post bodies and compact media.",
|
||||
"cozy": "Show posts with large images, rich embeds, and longer post bodies.",
|
||||
"compact": "Show posts in a list, without post bodies and with tighter spacing.",
|
||||
"legacy": "The old look of Photon."
|
||||
},
|
||||
"sort": {
|
||||
"title": "Default sort",
|
||||
"description": "The default sorting to use in feeds."
|
||||
},
|
||||
"postsInNewTab": {
|
||||
"title": "Open posts in new tab",
|
||||
"description": "Open posts in a separate tab instead of the current."
|
||||
},
|
||||
"displayName": {
|
||||
"title": "Use display name",
|
||||
"description": "Show users' display names instead of their actual usernames."
|
||||
},
|
||||
"limitLayoutWidth": {
|
||||
"title": "Limit layout width",
|
||||
"description": "Improve readability by limiting the main content width."
|
||||
},
|
||||
"placeholders": {
|
||||
"title": "Random placeholders",
|
||||
"description": "Show random placeholders for certain text inputs."
|
||||
},
|
||||
"expandImages": {
|
||||
"title": "Expand images",
|
||||
"description": "Clicking on a post's image brings you to an expanded view rather than the post page."
|
||||
},
|
||||
"duplicateTitles": {
|
||||
"title": "Hide duplicate titles/bodies",
|
||||
"description": "Hides the post title and body if they are identical to the embed."
|
||||
},
|
||||
"thumbnailSide": {
|
||||
"title": "Thumbnail alignment",
|
||||
"description": "Where thumbnails should be on the post in list/compact mode",
|
||||
"left": "Left",
|
||||
"right": "Right"
|
||||
},
|
||||
"font": {
|
||||
"title": "Font",
|
||||
"description": "What font Photon uses in the UI."
|
||||
},
|
||||
"translation": {
|
||||
"title": "Translation",
|
||||
"description": "The LibreTranslate instance to use for translation.",
|
||||
"instance": "Domain"
|
||||
}
|
||||
},
|
||||
"embeds": {
|
||||
"title": "Embeds",
|
||||
"clickToView": {
|
||||
"title": "Click to view",
|
||||
"description": "Only load embeds once you click on them."
|
||||
},
|
||||
"youtube": {
|
||||
"description": "The website to embed YouTube content in."
|
||||
}
|
||||
},
|
||||
"lemmy": {
|
||||
"title": "Lemmy",
|
||||
"compactFeatured": {
|
||||
"title": "Compact featured posts",
|
||||
"description": "Make featured posts more compact"
|
||||
},
|
||||
"markReadPosts": {
|
||||
"title": "Mark read posts",
|
||||
"description": "Mark a post as read when you click on it"
|
||||
},
|
||||
"fadeReadPosts": {
|
||||
"title": "Fade read posts",
|
||||
"description": "Fade the title of posts you've already read"
|
||||
},
|
||||
"crosspostMarker": {
|
||||
"title": "Mark crossposts",
|
||||
"description": "Show 'crossposted from' when crossposting."
|
||||
},
|
||||
"hideSubmissions": {
|
||||
"title": "Hide submissions",
|
||||
"description": "Hide certain types of submissions.",
|
||||
"deleted": "Deleted by user",
|
||||
"removed": "Removed by moderator"
|
||||
},
|
||||
"nsfwBlur": {
|
||||
"title": "NSFW blur",
|
||||
"description": "Blur images and remove post bodies of NSFW posts."
|
||||
},
|
||||
"instances": {
|
||||
"title": "Show instances",
|
||||
"description": "Show the instances where certain content is from."
|
||||
}
|
||||
},
|
||||
"moderation": {
|
||||
"title": "Moderation",
|
||||
"replyPresets": {
|
||||
"title": "Removal reply presets",
|
||||
"description": "Presets to use for 'reply reason' in the submission removal dialog.",
|
||||
"syntax": "Syntax"
|
||||
}
|
||||
},
|
||||
"other": {
|
||||
"title": "Other",
|
||||
"debug": {
|
||||
"title": "Debug info",
|
||||
"description": "Display debug information"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
import { browser } from '$app/environment'
|
||||
import type { Community } from 'lemmy-js-client'
|
||||
import { writable } from 'svelte/store'
|
||||
|
||||
@@ -20,6 +21,7 @@ export const setSessionStorage = (
|
||||
key: keyof SessionStorage,
|
||||
value: SessionStorage[typeof key]
|
||||
) => {
|
||||
if (!browser) return
|
||||
if (value == undefined) {
|
||||
sessionStorage.removeItem(key)
|
||||
} else {
|
||||
@@ -30,6 +32,7 @@ export const setSessionStorage = (
|
||||
export const getSessionStorage = (
|
||||
key: keyof SessionStorage
|
||||
): SessionStorage[typeof key] => {
|
||||
if (!browser) return
|
||||
return JSON.parse(sessionStorage.getItem(key)!)
|
||||
}
|
||||
|
||||
|
||||
+14
-3
@@ -1,6 +1,8 @@
|
||||
import type { CommentSortType, SortType } from 'lemmy-js-client'
|
||||
import { writable } from 'svelte/store'
|
||||
import { env } from '$env/dynamic/public'
|
||||
import { locale } from './translations'
|
||||
import { browser } from '$app/environment'
|
||||
|
||||
console.log('Using the following default settings from the environment:')
|
||||
console.log(env)
|
||||
@@ -77,6 +79,8 @@ interface Settings {
|
||||
deduplicateEmbed: boolean
|
||||
compactFeatured: boolean
|
||||
}
|
||||
language: string | null
|
||||
translator: string | undefined
|
||||
}
|
||||
|
||||
export const defaultSettings: Settings = {
|
||||
@@ -128,12 +132,14 @@ export const defaultSettings: Settings = {
|
||||
},
|
||||
dock: {
|
||||
noGap: toBool(env.PUBLIC_DOCK_PANEL) ?? null,
|
||||
top: toBool(env.PUBLIC_DOCK_TOP) ?? null
|
||||
top: toBool(env.PUBLIC_DOCK_TOP) ?? null,
|
||||
},
|
||||
posts: {
|
||||
deduplicateEmbed: toBool(env.PUBLIC_DEDUPLICATE_EMBED) ?? true,
|
||||
compactFeatured: toBool(env.PUBLIC_COMPACT_FEATURED) ?? true
|
||||
}
|
||||
compactFeatured: toBool(env.PUBLIC_COMPACT_FEATURED) ?? true,
|
||||
},
|
||||
language: null,
|
||||
translator: undefined,
|
||||
}
|
||||
|
||||
export const userSettings = writable(defaultSettings)
|
||||
@@ -166,4 +172,9 @@ userSettings.subscribe((settings) => {
|
||||
if (typeof window != 'undefined') {
|
||||
localStorage.setItem('settings', JSON.stringify(settings))
|
||||
}
|
||||
if (settings.language) {
|
||||
locale.set(settings.language)
|
||||
} else {
|
||||
if (browser) locale.set(navigator?.language)
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,16 @@
|
||||
import i18n, { type Config } from 'sveltekit-i18n'
|
||||
|
||||
const config: Config = {
|
||||
loaders: [
|
||||
{
|
||||
locale: 'en',
|
||||
key: '',
|
||||
loader: async () => (await import('./i18n/en.json')).default,
|
||||
},
|
||||
],
|
||||
fallbackLocale: 'en',
|
||||
}
|
||||
|
||||
export const { t, locale, locales, loading, loadTranslations } = new i18n(
|
||||
config
|
||||
)
|
||||
+13
-12
@@ -5,18 +5,19 @@
|
||||
import { Icon, XMark } from 'svelte-hero-icons'
|
||||
</script>
|
||||
|
||||
<div
|
||||
class="flex flex-col gap-2 mx-auto my-auto items-center h-full justify-center"
|
||||
>
|
||||
<div
|
||||
class="rounded-full bg-red-200 dark:bg-red-900 text-red-600 dark:text-red-300 p-3 w-max"
|
||||
>
|
||||
<Icon src={XMark} size="32" mini />
|
||||
</div>
|
||||
<h1 class="text-red-800 dark:text-red-300 text-4xl font-black">
|
||||
<div class="flex flex-col gap-4 mx-auto my-auto h-full justify-center">
|
||||
<h1 class="text-red-500 text-4xl font-black flex items-center flex-row gap-2">
|
||||
<div
|
||||
class="rounded-full bg-red-500 text-red-100 dark:text-red-900 p-1 w-max"
|
||||
>
|
||||
<Icon src={XMark} mini size="24" />
|
||||
</div>
|
||||
{$page.status}
|
||||
</h1>
|
||||
<p class="text-red-800 dark:text-red-300">Failed to fetch that page.</p>
|
||||
<code>{$page.error?.message}</code>
|
||||
<Button on:click={() => goto($page.url)}>Retry</Button>
|
||||
<code class="rounded-md dark:!bg-zinc-950 px-2 py-1 min-w-48">
|
||||
{$page.error?.message}
|
||||
</code>
|
||||
<Button size="sm" class="w-max" on:click={() => goto($page.url)}>
|
||||
Retry
|
||||
</Button>
|
||||
</div>
|
||||
@@ -0,0 +1,22 @@
|
||||
import { loadTranslations, locales } from '$lib/translations.js'
|
||||
import { get } from 'svelte/store'
|
||||
|
||||
export const load = async ({ url, request }) => {
|
||||
const languages = request.headers.get('Accept-Language')?.split(',')
|
||||
const availableLangs = get(locales)
|
||||
|
||||
let preferredLanguage = 'en'
|
||||
|
||||
if (!languages) {
|
||||
await loadTranslations(preferredLanguage)
|
||||
return
|
||||
}
|
||||
for (const lang of languages.reverse()) {
|
||||
const splitLang = lang.split(';')[0]
|
||||
if (availableLangs.includes(splitLang)) {
|
||||
preferredLanguage = splitLang
|
||||
}
|
||||
}
|
||||
await loadTranslations(preferredLanguage)
|
||||
return
|
||||
}
|
||||
+18
-1
@@ -1,3 +1,20 @@
|
||||
import { browser } from '$app/environment'
|
||||
import { env } from '$env/dynamic/public'
|
||||
import { userSettings } from '$lib/settings.js'
|
||||
import { loadTranslations } from '$lib/translations.js'
|
||||
import { get } from 'svelte/store'
|
||||
|
||||
export let ssr = (env.PUBLIC_SSR_ENABLED?.toLowerCase() ?? 'false') == 'true'
|
||||
export let ssr = (env.PUBLIC_SSR_ENABLED?.toLowerCase() ?? 'false') == 'true'
|
||||
|
||||
export const load = async ({}) => {
|
||||
if (browser) {
|
||||
const initLocale =
|
||||
get(userSettings)?.language ?? navigator?.language ?? 'en'
|
||||
|
||||
console.log(`Loading locale ${initLocale}`)
|
||||
|
||||
await loadTranslations(initLocale)
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
+6
-22
@@ -17,29 +17,14 @@
|
||||
import FormattedNumber from '$lib/components/util/FormattedNumber.svelte'
|
||||
import Location from '$lib/components/lemmy/dropdowns/Location.svelte'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import { t } from '$lib/translations.js'
|
||||
|
||||
export let data
|
||||
|
||||
let sidebar = false
|
||||
</script>
|
||||
|
||||
<Modal bind:open={sidebar}>
|
||||
<span slot="title">About</span>
|
||||
<div class="mx-auto">
|
||||
{#if $site}
|
||||
<SiteCard
|
||||
site={$site.site_view}
|
||||
taglines={$site.taglines}
|
||||
admins={$site.admins}
|
||||
version={$site.version}
|
||||
/>
|
||||
{/if}
|
||||
</div>
|
||||
</Modal>
|
||||
|
||||
<div class="flex flex-col gap-4 max-w-full w-full min-w-0">
|
||||
<header>
|
||||
<Header>Frontpage</Header>
|
||||
<Header>{$t('routes.frontpage.title')}</Header>
|
||||
</header>
|
||||
<div class="flex items-center gap-2">
|
||||
<Location changeDefault selected={data.listingType} />
|
||||
@@ -60,11 +45,10 @@
|
||||
>
|
||||
<span class="flex flex-row items-center gap-1">
|
||||
<Icon src={ChartBar} size="16" mini />
|
||||
<FormattedNumber
|
||||
number={$site?.site_view.counts.users_active_day ?? 0}
|
||||
class="text-black dark:text-white font-medium"
|
||||
/>
|
||||
<span class="font-normal">active users</span>
|
||||
{$t('routes.frontpage.footer', {
|
||||
// @ts-ignore
|
||||
users: $site?.site_view.counts.users_active_day ?? '??',
|
||||
})}
|
||||
</span>
|
||||
</Pageination>
|
||||
</div>
|
||||
|
||||
@@ -38,41 +38,12 @@
|
||||
} from 'svelte-hero-icons'
|
||||
import { flip } from 'svelte/animate'
|
||||
import { expoInOut, expoOut } from 'svelte/easing'
|
||||
import { t } from '$lib/translations'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
|
||||
let newInstance: string = $profileData.defaultInstance ?? DEFAULT_INSTANCE_URL
|
||||
let loading = false
|
||||
|
||||
async function changeGuestInstance() {
|
||||
loading = true
|
||||
try {
|
||||
const valid = await validateInstance(newInstance.trim())
|
||||
|
||||
if (!valid) {
|
||||
throw new Error('invalid instance')
|
||||
}
|
||||
|
||||
toast({
|
||||
content: 'Changed guest instance.',
|
||||
type: 'success',
|
||||
})
|
||||
} catch (err) {
|
||||
toast({
|
||||
content: 'Failed to contact that instance URL. Is it down?',
|
||||
type: 'error',
|
||||
})
|
||||
|
||||
loading = false
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
$profileData.defaultInstance = newInstance
|
||||
if ($currentProfile && $currentProfile.id == -1) {
|
||||
$instance = newInstance
|
||||
}
|
||||
loading = false
|
||||
}
|
||||
|
||||
let debugging = false
|
||||
let debugProfile: Profile | undefined = undefined
|
||||
|
||||
@@ -85,7 +56,7 @@
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>Accounts</title>
|
||||
<title>{$t('routes.accounts')}</title>
|
||||
</svelte:head>
|
||||
|
||||
{#if debugging}
|
||||
@@ -159,31 +130,12 @@
|
||||
Sign up
|
||||
</Button>
|
||||
</div>
|
||||
{#if LINKED_INSTANCE_URL === undefined}
|
||||
<div class="flex flex-row font-normal gap-2">
|
||||
<TextInput
|
||||
label="Guest instance"
|
||||
on:change={changeGuestInstance}
|
||||
placeholder="Instance URL"
|
||||
bind:value={newInstance}
|
||||
/>
|
||||
<Button
|
||||
color="primary"
|
||||
class="h-max self-end"
|
||||
size="lg"
|
||||
{loading}
|
||||
disabled={loading}
|
||||
>
|
||||
Change
|
||||
</Button>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{:else}
|
||||
<div class="flex flex-col h-full gap-4">
|
||||
<div class="flex flex-row justify-between">
|
||||
<h1 class="text-2xl font-bold">Accounts</h1>
|
||||
<Header>{$t('routes.accounts')}</Header>
|
||||
</div>
|
||||
<EditableList
|
||||
on:action={(acc) => {
|
||||
@@ -256,6 +208,7 @@
|
||||
<Button
|
||||
size="square-md"
|
||||
color="secondary"
|
||||
title={$t('account.moveUp')}
|
||||
on:click={() => moveProfile(profile.id, true)}
|
||||
>
|
||||
<Icon src={ChevronUp} size="16" mini slot="prefix" />
|
||||
@@ -263,6 +216,7 @@
|
||||
<Button
|
||||
size="square-md"
|
||||
color="secondary"
|
||||
title={$t('account.moveDown')}
|
||||
on:click={() => moveProfile(profile.id, false)}
|
||||
>
|
||||
<Icon src={ChevronDown} size="16" mini slot="prefix" />
|
||||
@@ -273,7 +227,7 @@
|
||||
on:click={() => (profile.color = undefined)}
|
||||
>
|
||||
<Icon src={ArrowUturnLeft} size="16" mini slot="prefix" />
|
||||
Reset Color
|
||||
{$t('account.resetColor')}
|
||||
</MenuButton>
|
||||
{#if $userSettings.debugInfo}
|
||||
<MenuButton
|
||||
@@ -283,12 +237,12 @@
|
||||
}}
|
||||
>
|
||||
<Icon src={BugAnt} size="16" mini slot="prefix" />
|
||||
Debug Info
|
||||
{$t('common.debug')}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
<MenuButton on:click={() => action(profile)} color="danger-subtle">
|
||||
<Icon slot="prefix" src={ArrowRightOnRectangle} size="16" mini />
|
||||
Log Out
|
||||
{$t('account.logout')}
|
||||
</MenuButton>
|
||||
</Menu>
|
||||
</div>
|
||||
@@ -298,11 +252,11 @@
|
||||
<div class="flex items-center gap-2">
|
||||
<Button href="/login" size="lg" class="flex-1">
|
||||
<Icon slot="prefix" src={ArrowLeftOnRectangle} size="16" mini />
|
||||
Log In
|
||||
{$t('account.login')}
|
||||
</Button>
|
||||
<Button href="/login/guest" size="lg">
|
||||
<Icon slot="prefix" src={Plus} size="16" mini />
|
||||
Add Guest
|
||||
{$t('account.addGuest')}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
import { page } from '$app/stores'
|
||||
import { profile } from '$lib/auth'
|
||||
import MultiSelect from '$lib/components/input/Switch.svelte'
|
||||
import { t } from '$lib/translations'
|
||||
import { Badge } from 'mono-svelte'
|
||||
</script>
|
||||
|
||||
@@ -24,11 +25,11 @@
|
||||
'/admin/federation',
|
||||
]}
|
||||
optionNames={[
|
||||
'Configuration',
|
||||
'Applications',
|
||||
'Taglines',
|
||||
'Team',
|
||||
'Federation',
|
||||
$t('routes.admin.config.title'),
|
||||
$t('routes.admin.applications.title'),
|
||||
$t('routes.admin.taglines.title'),
|
||||
$t('routes.admin.team.title'),
|
||||
$t('routes.admin.federation.title'),
|
||||
]}
|
||||
selected={$page.url.pathname}
|
||||
on:select={(e) => {
|
||||
|
||||
@@ -6,15 +6,17 @@
|
||||
import { ClipboardDocumentCheck, Icon } from 'svelte-hero-icons'
|
||||
import Application from './Application.svelte'
|
||||
import MultiSelect from '$lib/components/input/Switch.svelte'
|
||||
import { t } from '$lib/translations'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
|
||||
export let data
|
||||
</script>
|
||||
|
||||
<h1 class="font-bold text-2xl">Applications</h1>
|
||||
<Header>{$t('routes.admin.applications.title')}</Header>
|
||||
<MultiSelect
|
||||
options={[false, true]}
|
||||
selected={data.unreadOnly ?? true}
|
||||
optionNames={['All', 'Unread']}
|
||||
optionNames={[$t('filter.location.all'), $t('filter.unread')]}
|
||||
on:select={(e) =>
|
||||
searchParam($page.url, 'unreadOnly', e.detail.toString(), 'page')}
|
||||
/>
|
||||
@@ -35,7 +37,7 @@
|
||||
{:else}
|
||||
<Placeholder
|
||||
icon={ClipboardDocumentCheck}
|
||||
title="No new applications"
|
||||
description="Applications to join your instance will appear here."
|
||||
title={$t('routes.admin.applications.empty.title')}
|
||||
description={$t('routes.admin.applications.empty.description')}
|
||||
/>
|
||||
{/if}
|
||||
@@ -4,12 +4,16 @@
|
||||
import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
|
||||
import { Material, toast } from 'mono-svelte'
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import type {ApproveRegistrationApplication, RegistrationApplicationView} from 'lemmy-js-client'
|
||||
import type {
|
||||
ApproveRegistrationApplication,
|
||||
RegistrationApplicationView,
|
||||
} from 'lemmy-js-client'
|
||||
import { Button } from 'mono-svelte'
|
||||
import { Check, Icon, XMark } from 'svelte-hero-icons'
|
||||
import RelativeDate from '$lib/components/util/RelativeDate.svelte'
|
||||
import { publishedToDate } from '$lib/components/util/date'
|
||||
import ApplicationDenyModal from "$lib/components/lemmy/modal/ApplicationDenyModal.svelte";
|
||||
import ApplicationDenyModal from '$lib/components/lemmy/modal/ApplicationDenyModal.svelte'
|
||||
import { t } from '$lib/translations'
|
||||
|
||||
export let application: RegistrationApplicationView
|
||||
|
||||
@@ -31,25 +35,25 @@
|
||||
} else {
|
||||
reviewing = true
|
||||
while (reviewing) {
|
||||
await new Promise(res => setTimeout(res, 1000))
|
||||
await new Promise((res) => setTimeout(res, 1000))
|
||||
}
|
||||
if (!denying) {
|
||||
denyReason = ""
|
||||
denyReason = ''
|
||||
return
|
||||
}
|
||||
if (denyReason != "") {
|
||||
if (denyReason != '') {
|
||||
registrationApplicationAnswer.deny_reason = denyReason
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
try {
|
||||
await getClient().approveRegistrationApplication(registrationApplicationAnswer)
|
||||
await getClient().approveRegistrationApplication(
|
||||
registrationApplicationAnswer
|
||||
)
|
||||
toast({
|
||||
content: `Successfully ${
|
||||
approve ? 'approved' : 'denied'
|
||||
} that application.`,
|
||||
content: approve
|
||||
? $t('toast.approvedApplication')
|
||||
: $t('toast.deniedApplication'),
|
||||
type: 'success',
|
||||
})
|
||||
application.creator_local_user.accepted_application = approve
|
||||
@@ -71,7 +75,12 @@
|
||||
</script>
|
||||
|
||||
{#if reviewing}
|
||||
<ApplicationDenyModal bind:open={reviewing} bind:denying bind:denyReason user={application.creator}/>
|
||||
<ApplicationDenyModal
|
||||
bind:open={reviewing}
|
||||
bind:denying
|
||||
bind:denyReason
|
||||
user={application.creator}
|
||||
/>
|
||||
{/if}
|
||||
<Material class="flex flex-col gap-2">
|
||||
<div class="flex flex-col gap-1">
|
||||
@@ -81,7 +90,7 @@
|
||||
/>
|
||||
</span>
|
||||
|
||||
<SectionTitle>User</SectionTitle>
|
||||
<SectionTitle>{$t('routes.admin.applications.user')}</SectionTitle>
|
||||
<span class="text-sm">
|
||||
<UserLink user={application.creator} avatar avatarSize={20} />
|
||||
</span>
|
||||
@@ -95,12 +104,12 @@
|
||||
{#if typeof application.registration_application.deny_reason !== 'undefined' && application.registration_application.deny_reason !== ''}
|
||||
<div>
|
||||
<div class="flex items-center gap-1 text-sm">
|
||||
<UserLink avatar user={application.admin} />
|
||||
<SectionTitle>
|
||||
{application.creator_local_user.accepted_application
|
||||
? 'Approved'
|
||||
: 'Denied'} by
|
||||
? $t('routes.admin.applications.approved')
|
||||
: $t('routes.admin.applications.denied')}
|
||||
</SectionTitle>
|
||||
<UserLink avatar user={application.admin} />
|
||||
<SectionTitle>:</SectionTitle>
|
||||
</div>
|
||||
<p>{application.registration_application.deny_reason}</p>
|
||||
@@ -108,12 +117,12 @@
|
||||
<div class="md:ml-auto" />
|
||||
{:else}
|
||||
<div class="flex items-center gap-1 text-sm">
|
||||
<SectionTitle>
|
||||
{application.creator_local_user.accepted_application
|
||||
? 'Approved'
|
||||
: 'Denied'} by
|
||||
</SectionTitle>
|
||||
<UserLink avatar user={application.admin} />
|
||||
<SectionTitle>
|
||||
{application.creator_local_user.accepted_application
|
||||
? $t('routes.admin.applications.approved')
|
||||
: $t('routes.admin.applications.denied')}}
|
||||
</SectionTitle>
|
||||
</div>
|
||||
<div class="md:ml-auto" />
|
||||
{/if}
|
||||
@@ -125,7 +134,7 @@
|
||||
.accepted_application === false && application.admin
|
||||
? '!text-red-500'
|
||||
: ''}"
|
||||
aria-label="Deny"
|
||||
aria-label={$t('routes.admin.applications.deny')}
|
||||
on:click={() => review(false)}
|
||||
loading={denying || reviewing}
|
||||
disabled={approving || denying || reviewing}
|
||||
@@ -138,7 +147,7 @@
|
||||
.accepted_application
|
||||
? '!text-green-500'
|
||||
: ''}"
|
||||
aria-label="Approve"
|
||||
title={$t('routes.admin.applications.approve')}
|
||||
on:click={() => review(true)}
|
||||
loading={approving}
|
||||
disabled={approving || denying || reviewing}
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
<script lang="ts">
|
||||
import { profile } from '$lib/auth.js'
|
||||
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||
import { Label, toast } from 'mono-svelte'
|
||||
import { Label, Switch, toast } from 'mono-svelte'
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import type { EditSite } from 'lemmy-js-client'
|
||||
import type { PageData } from './$types.js'
|
||||
import { Button, Checkbox, Select, TextInput } from 'mono-svelte'
|
||||
import ImageUploadModal from '$lib/components/lemmy/modal/ImageUploadModal.svelte';
|
||||
import { DocumentPlus, Icon } from 'svelte-hero-icons';
|
||||
import ImageUploadModal from '$lib/components/lemmy/modal/ImageUploadModal.svelte'
|
||||
import { DocumentPlus, Icon } from 'svelte-hero-icons'
|
||||
import { t } from '$lib/translations.js'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
|
||||
export let data: PageData
|
||||
|
||||
@@ -29,7 +31,7 @@
|
||||
...formData,
|
||||
})
|
||||
toast({
|
||||
content: 'Updated your site.',
|
||||
content: $t('toast.updatedSite'),
|
||||
type: 'success',
|
||||
})
|
||||
} catch (err) {
|
||||
@@ -46,136 +48,163 @@
|
||||
|
||||
let uploading = {
|
||||
icon: false,
|
||||
banner: false
|
||||
banner: false,
|
||||
}
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>Administration</title>
|
||||
<title>{$t('routes.admin.title')}</title>
|
||||
</svelte:head>
|
||||
|
||||
<form class="flex flex-col gap-4" on:submit|preventDefault={save}>
|
||||
<h1 class="font-bold text-2xl">Site configuration</h1>
|
||||
<Header>{$t('routes.admin.config.title')}</Header>
|
||||
{#if formData}
|
||||
<TextInput bind:value={formData.name} label="Name" />
|
||||
<TextInput bind:value={formData.description} label="Description" />
|
||||
<TextInput bind:value={formData.name} label={$t('form.name')} />
|
||||
<TextInput
|
||||
bind:value={formData.description}
|
||||
label={$t('form.description')}
|
||||
/>
|
||||
<MarkdownEditor
|
||||
previewButton
|
||||
bind:value={formData.sidebar}
|
||||
label="Sidebar"
|
||||
label={$t('routes.admin.config.sidebar')}
|
||||
/>
|
||||
<MarkdownEditor
|
||||
previewButton
|
||||
bind:value={formData.legal_information}
|
||||
label="Legal"
|
||||
label={$t('routes.legal.title')}
|
||||
/>
|
||||
<div class="flex flex-col gap-1">
|
||||
<Label>Icon</Label>
|
||||
<button type="button" on:click={() => uploading.icon = !uploading.icon} class="flex flex-col gap-4 bg-white dark:bg-black border border-slate-300 dark:border-zinc-800 p-4 w-full h-32 rounded-xl">
|
||||
<Label>{$t('routes.admin.config.icon')}</Label>
|
||||
<button
|
||||
type="button"
|
||||
on:click={() => (uploading.icon = !uploading.icon)}
|
||||
class="flex flex-col gap-4 bg-white dark:bg-black border border-slate-300 dark:border-zinc-800 p-4 w-full h-32 rounded-xl"
|
||||
>
|
||||
{#if formData.icon}
|
||||
<img src={formData.icon} class="rounded-md mx-auto h-full" />
|
||||
{:else}
|
||||
<Icon src={DocumentPlus} size="48" class="text-slate-500 dark:text-zinc-500 mx-auto my-auto" />
|
||||
<Icon
|
||||
src={DocumentPlus}
|
||||
size="48"
|
||||
class="text-slate-500 dark:text-zinc-500 mx-auto my-auto"
|
||||
/>
|
||||
{/if}
|
||||
</button>
|
||||
{#if uploading.icon}
|
||||
<ImageUploadModal
|
||||
bind:open={uploading.icon}
|
||||
bind:output={formData.icon}
|
||||
on:upload={() => uploading.icon = false}
|
||||
on:upload={() => (uploading.icon = false)}
|
||||
/>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="flex flex-col gap-1">
|
||||
<Label>Banner</Label>
|
||||
<button type="button" on:click={() => uploading.banner = !uploading.banner} class="flex flex-col gap-4 bg-white dark:bg-black border border-slate-300 dark:border-zinc-800 p-4 w-full h-32 rounded-xl">
|
||||
<Label>{$t('routes.admin.config.banner')}</Label>
|
||||
<button
|
||||
type="button"
|
||||
on:click={() => (uploading.banner = !uploading.banner)}
|
||||
class="flex flex-col gap-4 bg-white dark:bg-black border border-slate-300 dark:border-zinc-800 p-4 w-full h-32 rounded-xl"
|
||||
>
|
||||
{#if formData.banner}
|
||||
<img src={formData.banner} class="rounded-md mx-auto h-full" />
|
||||
{:else}
|
||||
<Icon src={DocumentPlus} size="48" class="text-slate-500 dark:text-zinc-500 mx-auto my-auto" />
|
||||
<Icon
|
||||
src={DocumentPlus}
|
||||
size="48"
|
||||
class="text-slate-500 dark:text-zinc-500 mx-auto my-auto"
|
||||
/>
|
||||
{/if}
|
||||
</button>
|
||||
{#if uploading.banner}
|
||||
<ImageUploadModal
|
||||
bind:open={uploading.banner}
|
||||
bind:output={formData.banner}
|
||||
on:upload={() => uploading.banner = false}
|
||||
on:upload={() => (uploading.banner = false)}
|
||||
/>
|
||||
{/if}
|
||||
</div>
|
||||
<Checkbox bind:checked={formData.enable_downvotes} defaultValue={true}>
|
||||
Enable downvotes
|
||||
</Checkbox>
|
||||
<Checkbox checked={formData.enable_nsfw} defaultValue={true}>
|
||||
Enable NSFW
|
||||
</Checkbox>
|
||||
<Switch bind:checked={formData.enable_downvotes} defaultValue={true}>
|
||||
{$t('routes.admin.config.downvotesEnabled')}
|
||||
</Switch>
|
||||
<Switch checked={formData.enable_nsfw} defaultValue={true}>
|
||||
{$t('routes.admin.config.nsfwEnabled')}
|
||||
</Switch>
|
||||
<Select
|
||||
label="Registration Mode"
|
||||
label={$t('routes.admin.config.registration.label')}
|
||||
bind:value={formData.registration_mode}
|
||||
class="w-max"
|
||||
>
|
||||
<option value="Open">Open</option>
|
||||
<option value="RequireApplication">Require Application</option>
|
||||
<option value="Closed">Closed</option>
|
||||
<option value="Open">
|
||||
{$t('routes.admin.config.registration.open')}
|
||||
</option>
|
||||
<option value="RequireApplication">
|
||||
{$t('routes.admin.config.registration.application')}
|
||||
</option>
|
||||
<option value="Closed">
|
||||
{$t('routes.admin.config.registration.closed')}
|
||||
</option>
|
||||
</Select>
|
||||
{#if formData.registration_mode == 'RequireApplication'}
|
||||
<MarkdownEditor
|
||||
previewButton
|
||||
label="Application question"
|
||||
label={$t('routes.admin.config.applicationQuestion')}
|
||||
bind:value={formData.application_question}
|
||||
/>
|
||||
{/if}
|
||||
<Checkbox
|
||||
<Switch
|
||||
bind:checked={formData.community_creation_admin_only}
|
||||
defaultValue={true}
|
||||
>
|
||||
Only admins can create communities
|
||||
</Checkbox>
|
||||
<Checkbox
|
||||
{$t('routes.admin.config.adminCommunityOnly')}
|
||||
</Switch>
|
||||
<Switch
|
||||
bind:checked={formData.require_email_verification}
|
||||
defaultValue={true}
|
||||
>
|
||||
Require email verification
|
||||
</Checkbox>
|
||||
<Checkbox
|
||||
{$t('routes.admin.config.requireVerifyEmail')}
|
||||
</Switch>
|
||||
<Switch
|
||||
bind:checked={formData.application_email_admins}
|
||||
defaultValue={true}
|
||||
>
|
||||
Email admins on receiving new applications
|
||||
</Checkbox>
|
||||
<Checkbox bind:checked={formData.reports_email_admins} defaultValue={true}>
|
||||
Email admins on receiving new reports
|
||||
</Checkbox>
|
||||
{$t('routes.admin.config.emailAdminsOnApplication')}
|
||||
</Switch>
|
||||
<Switch bind:checked={formData.reports_email_admins} defaultValue={true}>
|
||||
{$t('routes.admin.config.emailAdminsOnReport')}
|
||||
</Switch>
|
||||
<Select
|
||||
label="Listing Type"
|
||||
label={$t('routes.admin.config.listingType.label')}
|
||||
bind:value={formData.default_post_listing_type}
|
||||
class="w-max"
|
||||
>
|
||||
<option value="All">All</option>
|
||||
<option value="Local">Local</option>
|
||||
<option value="All">{$t('routes.admin.config.listingType.all')}</option>
|
||||
<option value="Local">
|
||||
{$t('routes.admin.config.listingType.local')}
|
||||
</option>
|
||||
</Select>
|
||||
<Checkbox bind:checked={formData.private_instance} defaultValue={true}>
|
||||
Private instance
|
||||
</Checkbox>
|
||||
<Checkbox bind:checked={formData.hide_modlog_mod_names} defaultValue={true}>
|
||||
Hide modlog mod names
|
||||
</Checkbox>
|
||||
<Switch bind:checked={formData.private_instance} defaultValue={true}>
|
||||
{$t('routes.admin.config.private')}
|
||||
</Switch>
|
||||
<Switch bind:checked={formData.hide_modlog_mod_names} defaultValue={true}>
|
||||
{$t('routes.admin.config.hideModlogModNames')}
|
||||
</Switch>
|
||||
<TextInput
|
||||
bind:value={formData.slur_filter_regex}
|
||||
label="Slur filter regex"
|
||||
label={$t('routes.admin.config.slurFilter')}
|
||||
placeholder="(word1|word2)"
|
||||
/>
|
||||
<Checkbox bind:checked={formData.federation_enabled} defaultValue={true}>
|
||||
Federation enabled
|
||||
</Checkbox>
|
||||
<Checkbox bind:checked={formData.federation_debug} defaultValue={false}>
|
||||
Federation debug mode
|
||||
</Checkbox>
|
||||
<Checkbox bind:checked={formData.captcha_enabled} defaultValue={false}>
|
||||
Captcha enabled
|
||||
</Checkbox>
|
||||
<Switch bind:checked={formData.federation_enabled} defaultValue={true}>
|
||||
{$t('routes.admin.config.federation')}
|
||||
</Switch>
|
||||
<Switch bind:checked={formData.federation_debug} defaultValue={false}>
|
||||
{$t('routes.admin.config.federationDebug')}
|
||||
</Switch>
|
||||
<Switch bind:checked={formData.captcha_enabled} defaultValue={false}>
|
||||
{$t('routes.admin.config.captcha.enabled')}
|
||||
</Switch>
|
||||
{/if}
|
||||
<Button color="primary" size="lg" loading={saving} disabled={saving} submit>
|
||||
Save
|
||||
{$t('common.save')}
|
||||
</Button>
|
||||
</form>
|
||||
@@ -5,6 +5,7 @@
|
||||
import RelativeDate from '$lib/components/util/RelativeDate.svelte'
|
||||
import { publishedToDate } from '$lib/components/util/date.js'
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import { t } from '$lib/translations.js'
|
||||
import { trycatch } from '$lib/util.js'
|
||||
import type { Instance } from 'lemmy-js-client'
|
||||
import {
|
||||
@@ -108,7 +109,7 @@
|
||||
|
||||
if (res) {
|
||||
toast({
|
||||
content: 'Edited your site.',
|
||||
content: $t('toast.updatedSite'),
|
||||
type: 'success',
|
||||
})
|
||||
}
|
||||
@@ -126,8 +127,7 @@
|
||||
if (!data.federated_instances?.federated_instances?.blocked)
|
||||
throw new Error('Missing instance')
|
||||
const content = e.target?.result
|
||||
if (!content)
|
||||
toast({ content: 'No content in that file', type: 'warning' })
|
||||
if (!content) toast({ content: $t('toast.failCSV'), type: 'warning' })
|
||||
|
||||
try {
|
||||
const instances: Instance[] = []
|
||||
@@ -151,12 +151,12 @@
|
||||
|
||||
data.federated_instances.federated_instances.blocked = instances
|
||||
} catch (err) {
|
||||
toast({ content: err as 'Failed to parse CSV', type: 'error' })
|
||||
toast({ content: $t('toast.failCSV'), type: 'error' })
|
||||
}
|
||||
}
|
||||
|
||||
reader.onerror = (e) =>
|
||||
toast({ content: 'Failed to read file.', type: 'error' })
|
||||
toast({ content: $t('toast.failCSV'), type: 'error' })
|
||||
|
||||
reader.readAsText(files[0])
|
||||
}
|
||||
@@ -167,24 +167,20 @@
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>Federation</title>
|
||||
<title>{$t('routes.admin.federation.title')}</title>
|
||||
</svelte:head>
|
||||
|
||||
<h1 class="font-bold text-2xl flex items-center justify-between">
|
||||
Federation <Button
|
||||
color="primary"
|
||||
on:click={save}
|
||||
loading={saving}
|
||||
disabled={saving}
|
||||
>
|
||||
Save
|
||||
{$t('routes.admin.federation.title')}
|
||||
<Button color="primary" on:click={save} loading={saving} disabled={saving}>
|
||||
{$t('common.save')}
|
||||
</Button>
|
||||
</h1>
|
||||
{#if data.site && data.federated_instances?.federated_instances?.blocked}
|
||||
<FileInput preview={false} bind:files={csv}>
|
||||
<Button class="w-max" slot="button">
|
||||
<Icon src={Plus} mini size="18" slot="prefix" />
|
||||
Upload a CSV
|
||||
{$t('routes.admin.federation.csv')}
|
||||
</Button>
|
||||
<svelte:fragment slot="choose">
|
||||
{''}
|
||||
@@ -192,14 +188,14 @@
|
||||
</FileInput>
|
||||
<div class="flex flex-col md:flex-row gap-4">
|
||||
<div class="flex-1 w-full max-h-[42rem] h-full flex flex-col gap-2">
|
||||
<h2 class="font-bold text-lg">Blocked Instances</h2>
|
||||
<h2 class="font-bold text-lg">{$t('routes.admin.federation.blocked')}</h2>
|
||||
<form
|
||||
on:submit|preventDefault={() =>
|
||||
moderateInstance(blockInstance.instance, true)}
|
||||
class="flex flex-row gap-2"
|
||||
>
|
||||
<TextInput
|
||||
placeholder="Block an instance..."
|
||||
placeholder={$t('routes.admin.federation.blockplaceholder')}
|
||||
class="flex-1"
|
||||
bind:value={blockInstance.instance}
|
||||
/>
|
||||
@@ -208,7 +204,7 @@
|
||||
loading={blockInstance.loading}
|
||||
disabled={blockInstance.loading}
|
||||
>
|
||||
Block
|
||||
{$t('routes.admin.federation.block')}
|
||||
</Button>
|
||||
</form>
|
||||
<Material class="h-full overflow-auto" color="distinct">
|
||||
@@ -252,8 +248,8 @@
|
||||
{:else}
|
||||
<Placeholder
|
||||
icon={Check}
|
||||
title="No blocked instances"
|
||||
description="Blocking an instance will hide submissions from that instance."
|
||||
title={$t('routes.admin.federation.emptyBlock.title')}
|
||||
description={$t('routes.admin.federation.emptyBlock.description')}
|
||||
/>
|
||||
{/if}
|
||||
</EditableList>
|
||||
@@ -261,7 +257,7 @@
|
||||
</div>
|
||||
<div class="md:flex-1 w-full max-h-[42rem] flex flex-col gap-2">
|
||||
<h2 class="font-bold text-lg flex items-center space-x-1">
|
||||
<span>Allowed Instances</span>
|
||||
<span>{$t('routes.admin.federation.allowed')}</span>
|
||||
{#if allowInstance.instance || !(data.federated_instances.federated_instances.allowed?.length == 0)}
|
||||
<Popover openOnHover placement="bottom-end">
|
||||
<Icon
|
||||
@@ -272,9 +268,7 @@
|
||||
size="20"
|
||||
/>
|
||||
<p class="font-normal">
|
||||
Adding items to "Allowed Instances" will <strong>
|
||||
block every other instance.
|
||||
</strong>
|
||||
{$t('routes.admin.federation.emptyAllow.description')}
|
||||
</p>
|
||||
</Popover>
|
||||
{/if}
|
||||
@@ -285,7 +279,7 @@
|
||||
class="flex flex-row gap-2"
|
||||
>
|
||||
<TextInput
|
||||
placeholder="Allow an instance..."
|
||||
placeholder={$t('routes.admin.federation.allowplaceholder')}
|
||||
class="flex-1"
|
||||
bind:value={allowInstance.instance}
|
||||
/>
|
||||
@@ -294,7 +288,7 @@
|
||||
loading={allowInstance.loading}
|
||||
disabled={allowInstance.loading}
|
||||
>
|
||||
Allow
|
||||
{$t('routes.admin.federation.allow')}
|
||||
</Button>
|
||||
</form>
|
||||
<Material class="h-full overflow-auto" color="distinct">
|
||||
@@ -335,8 +329,10 @@
|
||||
<div class="my-auto h-max">
|
||||
<Placeholder
|
||||
icon={Check}
|
||||
title="No allowed instances"
|
||||
description="Adding an item to this will block every other instance."
|
||||
title={$t('routes.admin.federation.emptyAllow.title')}
|
||||
description={$t(
|
||||
'routes.admin.federation.emptyAllow.description'
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
import type { Tagline } from 'lemmy-js-client'
|
||||
import { Button } from 'mono-svelte'
|
||||
import { Icon, Plus, QuestionMarkCircle, Trash } from 'svelte-hero-icons'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import { t } from '$lib/translations.js'
|
||||
|
||||
export let data
|
||||
|
||||
@@ -27,7 +29,7 @@
|
||||
taglines: taglines,
|
||||
})
|
||||
toast({
|
||||
content: 'Successfully saved taglines.',
|
||||
content: $t('toast.updatedSite'),
|
||||
type: 'success',
|
||||
})
|
||||
} catch (err) {
|
||||
@@ -43,7 +45,7 @@
|
||||
|
||||
{#if taglines.length > 0}
|
||||
<div class="flex flex-row justify-between items-center">
|
||||
<h1 class="font-bold text-2xl">Taglines</h1>
|
||||
<Header>{$t('routes.admin.taglines.title')}</Header>
|
||||
<Button
|
||||
color="primary"
|
||||
on:click={save}
|
||||
@@ -52,7 +54,7 @@
|
||||
size="lg"
|
||||
class="h-max"
|
||||
>
|
||||
Save
|
||||
{$t('common.save')}
|
||||
</Button>
|
||||
</div>
|
||||
<EditableList
|
||||
@@ -89,23 +91,19 @@
|
||||
newTagline = ''
|
||||
}}
|
||||
>
|
||||
<MarkdownEditor
|
||||
bind:value={newTagline}
|
||||
placeholder="Add a tagline"
|
||||
images={false}
|
||||
/>
|
||||
<MarkdownEditor bind:value={newTagline} images={false} />
|
||||
|
||||
<Button size="lg" submit>
|
||||
<Icon src={Plus} size="16" mini slot="prefix" />
|
||||
Add
|
||||
{$t('common.add')}
|
||||
</Button>
|
||||
</form>
|
||||
{:else}
|
||||
<div class="my-auto">
|
||||
<Placeholder
|
||||
icon={Plus}
|
||||
title="No taglines"
|
||||
description="A random tagline will appear when users visit your instance."
|
||||
title={$t('routes.admin.taglines.empty.title')}
|
||||
description={$t('routes.admin.taglines.empty.description')}
|
||||
>
|
||||
<div class="mt-4 max-w-xl w-full flex flex-col gap-2">
|
||||
<form
|
||||
@@ -120,18 +118,18 @@
|
||||
>
|
||||
<MarkdownEditor
|
||||
bind:value={newTagline}
|
||||
placeholder="Add a tagline"
|
||||
placeholder={$t('routes.admin.taglines.add')}
|
||||
images={false}
|
||||
/>
|
||||
|
||||
<Button size="lg" submit>
|
||||
<Icon src={Plus} size="16" mini slot="prefix" />
|
||||
Add
|
||||
{$t('common.add')}
|
||||
</Button>
|
||||
</form>
|
||||
|
||||
<Button on:click={save} color="primary" size="lg" class="w-full">
|
||||
Save
|
||||
{$t('common.save')}
|
||||
</Button>
|
||||
</div>
|
||||
</Placeholder>
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
import { removeItem, trycatch } from '$lib/util.js'
|
||||
import { Button, TextInput } from 'mono-svelte'
|
||||
import { Icon, Plus, QuestionMarkCircle, Trash } from 'svelte-hero-icons'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import { t } from '$lib/translations.js'
|
||||
|
||||
export let data
|
||||
|
||||
@@ -19,7 +21,7 @@
|
||||
async function removeAdmin(id: number, confirm: boolean): Promise<any> {
|
||||
if (!confirm)
|
||||
return toast({
|
||||
content: 'Are you sure you want to remove that admin?',
|
||||
content: $t('toast.removeAdminWarning'),
|
||||
action: () => removeAdmin(id, true),
|
||||
})
|
||||
|
||||
@@ -35,25 +37,21 @@
|
||||
if (result) {
|
||||
data.site!.admins = result.admins
|
||||
toast({
|
||||
content: 'Removed that admin.',
|
||||
content: $t('toast.removeAdmin'),
|
||||
type: 'success',
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>Admin Team</title>
|
||||
</svelte:head>
|
||||
|
||||
<h1 class="font-bold text-2xl">Admins</h1>
|
||||
<Header>{$t('routes.admin.team.title')}</Header>
|
||||
{#if data.site}
|
||||
<EditableList let:action on:action={(e) => removeAdmin(e.detail, false)}>
|
||||
{#if data.site.admins.length <= 0}
|
||||
<Placeholder
|
||||
icon={QuestionMarkCircle}
|
||||
title="No admins"
|
||||
description="Somehow there's no admins of this site. How?!"
|
||||
title={$t('routes.admin.team.empty.title')}
|
||||
description={$t('routes.admin.team.empty.description')}
|
||||
/>
|
||||
{:else}
|
||||
{#each data.site?.admins ?? [] as admin}
|
||||
@@ -96,7 +94,7 @@
|
||||
/>
|
||||
<Button loading={adding} disabled={adding} size="md" class="h-full" submit>
|
||||
<Icon src={Plus} mini size="16" slot="prefix" />
|
||||
Add Admin
|
||||
{$t('common.add')}
|
||||
</Button>
|
||||
</form>
|
||||
{/if}
|
||||
@@ -22,6 +22,7 @@
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
import { profile } from '$lib/auth'
|
||||
import { addResumable } from '$lib/lemmy/item.js'
|
||||
import { t } from '$lib/translations.js'
|
||||
|
||||
export let data
|
||||
|
||||
@@ -94,7 +95,7 @@
|
||||
}`
|
||||
)
|
||||
|
||||
toast({ content: 'Copied to clipboard.' })
|
||||
toast({ content: $t('toast.copied') })
|
||||
}}
|
||||
class="dark:text-zinc-400 text-slate-600 text-sm text-left"
|
||||
>
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import { flip } from 'svelte/animate'
|
||||
import { Button, TextInput } from 'mono-svelte'
|
||||
import { t } from '$lib/translations.js'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
|
||||
export let data: PageData
|
||||
|
||||
@@ -37,14 +39,14 @@
|
||||
data.community.moderators = addModRes.moderators
|
||||
|
||||
toast({
|
||||
content: 'Added that user as a moderator.',
|
||||
content: $t('toast.addMod'),
|
||||
type: 'success',
|
||||
})
|
||||
|
||||
formData.newModerator = ''
|
||||
} else {
|
||||
toast({
|
||||
content: 'Could not find that user.',
|
||||
content: $t('toast.failFindUser'),
|
||||
type: 'warning',
|
||||
})
|
||||
}
|
||||
@@ -71,7 +73,7 @@
|
||||
data.community.moderators = res.moderators
|
||||
|
||||
toast({
|
||||
content: 'Successfully updated community moderators.',
|
||||
content: $t('toast.updateMods'),
|
||||
type: 'success',
|
||||
})
|
||||
} catch (err) {
|
||||
@@ -83,11 +85,7 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>Moderator Team</title>
|
||||
</svelte:head>
|
||||
|
||||
<h1 class="text-2xl font-bold">Moderators</h1>
|
||||
<Header>Moderators</Header>
|
||||
<EditableList
|
||||
let:action
|
||||
on:action={(e) => {
|
||||
|
||||
@@ -13,6 +13,9 @@
|
||||
import Sort from '$lib/components/lemmy/dropdowns/Sort.svelte'
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
import CommunityItem from '$lib/components/lemmy/community/CommunityItem.svelte'
|
||||
import Location from '$lib/components/lemmy/dropdowns/Location.svelte'
|
||||
import { t } from '$lib/translations.js'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
|
||||
export let data
|
||||
|
||||
@@ -24,8 +27,8 @@
|
||||
<title>Communities</title>
|
||||
</svelte:head>
|
||||
|
||||
<h1 class="text-3xl font-bold">
|
||||
<span>Communities</span>
|
||||
<Header>
|
||||
<span>{$t('routes.communities')}</span>
|
||||
<Popover
|
||||
openOnHover
|
||||
class="!inline-flex"
|
||||
@@ -52,20 +55,9 @@
|
||||
</p>
|
||||
</Material>
|
||||
</Popover>
|
||||
</h1>
|
||||
</Header>
|
||||
<div class="flex flex-row flex-wrap gap-4 mt-4 items-center">
|
||||
<Select
|
||||
bind:value={data.type}
|
||||
on:change={() => searchParam($page.url, 'type', data.type ?? 'All', 'page')}
|
||||
>
|
||||
<span slot="label" class="flex items-center gap-1">
|
||||
<Icon src={GlobeAmericas} mini size="15" />
|
||||
Location
|
||||
</span>
|
||||
<option value="All">All</option>
|
||||
<option value="Local">Local</option>
|
||||
<option value="Subscribed">Subscribed</option>
|
||||
</Select>
|
||||
<Location selected={data.type} />
|
||||
<Sort selected={data.sort} />
|
||||
<form
|
||||
on:submit|preventDefault={() => searchParam($page.url, 'q', search, 'page')}
|
||||
@@ -73,8 +65,7 @@
|
||||
>
|
||||
<TextInput
|
||||
bind:value={search}
|
||||
placeholder="Search for a community..."
|
||||
label="Query"
|
||||
label={$t('routes.search.query')}
|
||||
size="md"
|
||||
/>
|
||||
<Button
|
||||
@@ -93,9 +84,8 @@
|
||||
{#if data.communities.length == 0}
|
||||
<Placeholder
|
||||
icon={QuestionMarkCircle}
|
||||
title="No communities"
|
||||
description="There are no communities that match this filter. Try refining your
|
||||
search."
|
||||
title={$t('routes.search.noResults.title')}
|
||||
description={$t('routes.search.noResults.description')}
|
||||
/>
|
||||
{/if}
|
||||
{#each data.communities as community}
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
subscribing = false
|
||||
return res
|
||||
} catch (error) {
|
||||
toast({ content: 'Failed to subscribe to community', type: 'error' })
|
||||
toast({ content: error as any, type: 'error' })
|
||||
}
|
||||
|
||||
subscribing = false
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
import { profile } from '$lib/auth.js'
|
||||
import { onDestroy, onMount } from 'svelte'
|
||||
import { getSessionStorage, setSessionStorage } from '$lib/session.js'
|
||||
import { t } from '$lib/translations.js'
|
||||
|
||||
export let data = {
|
||||
crosspost: false,
|
||||
@@ -27,7 +28,7 @@
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>Create post</title>
|
||||
<title>{$t('form.post.create')}</title>
|
||||
</svelte:head>
|
||||
|
||||
<div class="w-full max-w-5xl mx-auto h-full">
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
import { searchParam } from '$lib/util.js'
|
||||
import { Button, Select } from 'mono-svelte'
|
||||
import EndPlaceholder from '$lib/components/ui/EndPlaceholder.svelte'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import { t } from '$lib/translations'
|
||||
|
||||
export let data
|
||||
|
||||
@@ -51,11 +53,11 @@
|
||||
</svelte:head>
|
||||
|
||||
<div class="flex flex-row gap-2">
|
||||
<h1 class="font-bold text-3xl mr-auto">Inbox</h1>
|
||||
<Header class="mr-auto">{$t('routes.inbox.title')}</Header>
|
||||
<Button
|
||||
on:click={() => goto($page.url, { invalidateAll: true })}
|
||||
size="square-md"
|
||||
title="Refresh"
|
||||
title={$t('common.refresh')}
|
||||
>
|
||||
<Icon src={ArrowPath} size="16" mini slot="prefix" />
|
||||
</Button>
|
||||
@@ -67,7 +69,7 @@
|
||||
class="!h-8"
|
||||
>
|
||||
<Icon src={Check} width={16} mini slot="prefix" />
|
||||
Mark All Read
|
||||
{$t('routes.inbox.markAsRead')}
|
||||
</Button>
|
||||
</div>
|
||||
<div class="mt-4" />
|
||||
@@ -84,10 +86,10 @@
|
||||
>
|
||||
<span slot="label" class="flex items-center gap-1">
|
||||
<Icon src={Funnel} size="15" mini />
|
||||
Filter
|
||||
{$t('filter.filter')}
|
||||
</span>
|
||||
<option value="false">All</option>
|
||||
<option value="true">Unread</option>
|
||||
<option value="false">{$t('filter.location.all')}</option>
|
||||
<option value="true">{$t('filter.unread')}</option>
|
||||
</Select>
|
||||
<Select
|
||||
bind:value={data.type}
|
||||
@@ -95,20 +97,20 @@
|
||||
>
|
||||
<span slot="label" class="flex items-center gap-1">
|
||||
<Icon src={AdjustmentsHorizontal} size="15" mini />
|
||||
Type
|
||||
{$t('filter.type')}
|
||||
</span>
|
||||
<option value="all">All</option>
|
||||
<option value="mentions">Mentions</option>
|
||||
<option value="replies">Replies</option>
|
||||
<option value="messages">Messages</option>
|
||||
<option value="all">{$t('filter.location.all')}</option>
|
||||
<option value="mentions">{$t('filter.inbox.mentions')}</option>
|
||||
<option value="replies">{$t('filter.inbox.replies')}</option>
|
||||
<option value="messages">{$t('filter.inbox.messages')}</option>
|
||||
</Select>
|
||||
</div>
|
||||
<div class="flex flex-col gap-4 list-none my-4 flex-1 h-full">
|
||||
{#if !data.data || (data.data?.length ?? 0) == 0}
|
||||
<Placeholder
|
||||
icon={Inbox}
|
||||
title="No new notifications"
|
||||
description="Messages, replies, and mentions will appear here."
|
||||
title={$t('routes.inbox.empty.title')}
|
||||
description={$t('routes.inbox.empty.description')}
|
||||
/>
|
||||
{:else}
|
||||
{#each data.data as item}
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
import type { InboxItem } from '$lib/lemmy/inbox.js'
|
||||
import PrivateMessage from '$lib/components/lemmy/inbox/PrivateMessage.svelte'
|
||||
import PrivateMessageModal from '$lib/components/lemmy/modal/PrivateMessageModal.svelte'
|
||||
import { t } from '$lib/translations'
|
||||
|
||||
export let item: InboxItem
|
||||
|
||||
@@ -104,6 +105,7 @@
|
||||
{loading}
|
||||
disabled={loading}
|
||||
on:click={() => markAsRead(!item.read)}
|
||||
title={$t('post.actions.more.markRead')}
|
||||
>
|
||||
<Icon slot="prefix" src={Check} mini size="16" />
|
||||
</Button>
|
||||
@@ -117,7 +119,7 @@
|
||||
{/if}
|
||||
{:else}
|
||||
<Button
|
||||
title="Jump"
|
||||
title={$t('common.jump')}
|
||||
href="/comment/{item.item.comment.id}"
|
||||
size="square-md"
|
||||
>
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
<script lang="ts">
|
||||
import SiteCard from '$lib/components/lemmy/SiteCard.svelte'
|
||||
import Markdown from '$lib/components/markdown/Markdown.svelte'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import { site } from '$lib/lemmy'
|
||||
import { t } from '$lib/translations'
|
||||
import { Button, Modal, Spinner } from 'mono-svelte'
|
||||
|
||||
let siteOpen: boolean = false
|
||||
@@ -9,23 +11,11 @@
|
||||
|
||||
<div class="flex flex-row w-full">
|
||||
{#if $site}
|
||||
<Modal bind:open={siteOpen}>
|
||||
<SiteCard
|
||||
site={$site.site_view}
|
||||
admins={$site.admins}
|
||||
taglines={$site.taglines}
|
||||
/>
|
||||
</Modal>
|
||||
|
||||
<div class="flex flex-col flex-1 gap-4">
|
||||
<h1 class="font-bold text-2xl w-full flex items-center justify-between">
|
||||
Legal <span class="lg:hidden">
|
||||
<Button on:click={() => (siteOpen = !siteOpen)}>Site</Button>
|
||||
</span>
|
||||
</h1>
|
||||
<Header>{$t('routes.legal.title')}</Header>
|
||||
<Markdown
|
||||
source={$site.site_view.local_site.legal_information ??
|
||||
'This instance does not have any legal information.'}
|
||||
$t('routes.legal.noLegal')}
|
||||
/>
|
||||
</div>
|
||||
{:else}
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
} from 'svelte-hero-icons'
|
||||
import { DOMAIN_REGEX_FORMS } from '$lib/util.js'
|
||||
import { MINIMUM_VERSION } from '$lib/version.js'
|
||||
import { t } from '$lib/translations'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
|
||||
let data = {
|
||||
instance: DEFAULT_INSTANCE_URL,
|
||||
@@ -46,7 +48,7 @@
|
||||
const result = await setUser(response.jwt, data.instance, data.username)
|
||||
|
||||
if (result) {
|
||||
toast({ content: 'Successfully logged in.', type: 'success' })
|
||||
toast({ content: $t('toast.logIn'), type: 'success' })
|
||||
goto('/')
|
||||
}
|
||||
} else {
|
||||
@@ -69,14 +71,13 @@
|
||||
<div class="max-w-xl w-full mx-auto h-max my-auto">
|
||||
<form on:submit|preventDefault={logIn} class="flex flex-col gap-5">
|
||||
<div class="flex flex-col gap-2">
|
||||
<h1 class="font-bold text-3xl">Log In</h1>
|
||||
<Header>{$t('account.login')}</Header>
|
||||
{#if $site && mayBeIncompatible(MINIMUM_VERSION, $site.version.replace('v', ''))}
|
||||
<Note>
|
||||
This version of Photon supports instances running
|
||||
<span style="font-family: monospace;">
|
||||
v{MINIMUM_VERSION}
|
||||
</span>
|
||||
or higher.
|
||||
{$t('account.versionGate', {
|
||||
//@ts-ignore
|
||||
version: `v${MINIMUM_VERSION}`,
|
||||
})}
|
||||
</Note>
|
||||
{/if}
|
||||
</div>
|
||||
@@ -84,14 +85,14 @@
|
||||
<TextInput
|
||||
id="username"
|
||||
bind:value={data.username}
|
||||
label="Username"
|
||||
label={$t('form.username')}
|
||||
class="flex-1"
|
||||
required
|
||||
/>
|
||||
{#if !LINKED_INSTANCE_URL}
|
||||
<TextInput
|
||||
id="instance_url"
|
||||
label="Instance URL"
|
||||
label={$t('form.instance')}
|
||||
placeholder={DEFAULT_INSTANCE_URL}
|
||||
disabled={LINKED_INSTANCE_URL != undefined}
|
||||
bind:value={data.instance}
|
||||
@@ -105,7 +106,7 @@
|
||||
<TextInput
|
||||
id="password"
|
||||
bind:value={data.password}
|
||||
label="Password"
|
||||
label={$t('form.password')}
|
||||
type="password"
|
||||
minlength={10}
|
||||
maxlength={60}
|
||||
@@ -115,7 +116,7 @@
|
||||
<TextInput
|
||||
id="totp"
|
||||
bind:value={data.totp}
|
||||
label="2FA Code"
|
||||
label={$t('form.2fa')}
|
||||
placeholder="123456"
|
||||
pattern={'\\d{6}'}
|
||||
minlength={6}
|
||||
@@ -130,21 +131,21 @@
|
||||
size="lg"
|
||||
submit
|
||||
>
|
||||
Log In
|
||||
{$t('account.login')}
|
||||
</Button>
|
||||
<hr class="dark:border-zinc-700" />
|
||||
<div class="flex flex-row items-center gap-2">
|
||||
<Button color="tertiary" href="/signup">
|
||||
<Icon src={Identification} mini size="16" />
|
||||
Sign Up
|
||||
{$t('account.signup')}
|
||||
</Button>
|
||||
<Button color="tertiary" href="/login_reset">
|
||||
<Icon src={QuestionMarkCircle} mini size="16" />
|
||||
Forgot Password
|
||||
{$t('form.forgotpassword')}
|
||||
</Button>
|
||||
<Button color="tertiary" href="/login/guest">
|
||||
<Icon src={UserCircle} mini size="16" />
|
||||
Guest
|
||||
{$t('account.guest')}
|
||||
</Button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -7,17 +7,19 @@
|
||||
import { profile, profileData, type Profile } from '$lib/auth'
|
||||
import { LINKED_INSTANCE_URL } from '$lib/instance'
|
||||
import { goto } from '$app/navigation'
|
||||
import { t } from '$lib/translations'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
|
||||
let form = {
|
||||
instance: '',
|
||||
username: `Guest ${$profileData.profiles.filter((p) => p.jwt == undefined).length + 1}`,
|
||||
username: `${$t('account.guest')} ${$profileData.profiles.filter((p) => p.jwt == undefined).length + 1}`,
|
||||
loading: false,
|
||||
}
|
||||
|
||||
async function addGuest() {
|
||||
form.loading = true
|
||||
if (!(await validateInstance(form.instance))) {
|
||||
toast({ content: 'Failed to contact that instance URL.', type: 'error' })
|
||||
toast({ content: $t('toast.failInstanceURL'), type: 'error' })
|
||||
form.loading = false
|
||||
return
|
||||
}
|
||||
@@ -42,7 +44,7 @@
|
||||
}
|
||||
})
|
||||
|
||||
toast({ content: 'Added that account.', type: 'success' })
|
||||
toast({ content: $t('toast.addAccount'), type: 'success' })
|
||||
|
||||
goto('/')
|
||||
|
||||
@@ -53,21 +55,20 @@
|
||||
<div class="max-w-xl w-full mx-auto h-max my-auto">
|
||||
<form on:submit|preventDefault={addGuest} class="flex flex-col gap-5">
|
||||
<div class="flex flex-col gap-2">
|
||||
<h1 class="font-bold text-3xl">Add Guest</h1>
|
||||
<Header>{$t('account.addGuest')}</Header>
|
||||
{#if $site && mayBeIncompatible(MINIMUM_VERSION, $site.version.replace('v', ''))}
|
||||
<Note>
|
||||
This version of Photon supports instances running
|
||||
<span style="font-family: monospace;">
|
||||
v{MINIMUM_VERSION}
|
||||
</span>
|
||||
or higher.
|
||||
{$t('account.versionGate', {
|
||||
//@ts-ignore
|
||||
version: `v${MINIMUM_VERSION}`,
|
||||
})}
|
||||
</Note>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="inline-flex items-center gap-2">
|
||||
<TextInput
|
||||
required
|
||||
label="Name"
|
||||
label={$t('form.name')}
|
||||
bind:value={form.username}
|
||||
placeholder="Guest 2"
|
||||
minlength={1}
|
||||
@@ -76,7 +77,7 @@
|
||||
{#if !LINKED_INSTANCE_URL}
|
||||
<TextInput
|
||||
required
|
||||
label="Instance URL"
|
||||
label={$t('form.instance')}
|
||||
bind:value={form.instance}
|
||||
pattern={DOMAIN_REGEX_FORMS}
|
||||
placeholder="example.com"
|
||||
@@ -92,7 +93,7 @@
|
||||
loading={form.loading}
|
||||
disabled={form.loading}
|
||||
>
|
||||
Submit
|
||||
{$t('form.submit')}
|
||||
</Button>
|
||||
</form>
|
||||
</div>
|
||||
@@ -5,6 +5,7 @@
|
||||
instance as currentInstance,
|
||||
} from '$lib/instance.js'
|
||||
import { getClient, validateInstance } from '$lib/lemmy.js'
|
||||
import { t } from '$lib/translations'
|
||||
import { Button, TextInput, toast } from 'mono-svelte'
|
||||
|
||||
let instance = LINKED_INSTANCE_URL || $currentInstance || ''
|
||||
@@ -15,14 +16,14 @@
|
||||
loading = true
|
||||
try {
|
||||
if (!(await validateInstance(instance)))
|
||||
throw new Error('Failed to contact instance url')
|
||||
throw new Error($t('toast.failInstanceURL'))
|
||||
|
||||
await getClient(instance).passwordReset({
|
||||
email: email,
|
||||
})
|
||||
|
||||
toast({
|
||||
content: 'A password reset link was sent to your email.',
|
||||
content: $t('toast.resetLink'),
|
||||
type: 'success',
|
||||
})
|
||||
} catch (err) {
|
||||
@@ -36,29 +37,28 @@
|
||||
</script>
|
||||
|
||||
<div class="my-auto max-w-xl mx-auto flex flex-col gap-2">
|
||||
<h1 class="font-bold text-3xl">Reset Password</h1>
|
||||
<h1 class="font-bold text-3xl">{$t('routes.resetLogin.title')}</h1>
|
||||
<p>
|
||||
Enter the email of your account, and a password reset link will be sent. If
|
||||
you did not have an email set up, contact your instance admins.
|
||||
{$t('routes.resetLogin.description')}
|
||||
</p>
|
||||
<form class="mt-2 flex flex-col gap-4" on:submit|preventDefault={submit}>
|
||||
{#if !LINKED_INSTANCE_URL}
|
||||
<TextInput
|
||||
bind:value={instance}
|
||||
label="Instance URL"
|
||||
label={$t('form.instance')}
|
||||
placeholder={DEFAULT_INSTANCE_URL}
|
||||
required
|
||||
/>
|
||||
{/if}
|
||||
<TextInput
|
||||
bind:value={email}
|
||||
label="Email"
|
||||
label={$t('form.email')}
|
||||
type="email"
|
||||
required
|
||||
placeholder="example@example.com"
|
||||
/>
|
||||
<Button color="primary" size="lg" {loading} disabled={loading} submit>
|
||||
Submit
|
||||
{$t('form.submit')}
|
||||
</Button>
|
||||
</form>
|
||||
</div>
|
||||
@@ -14,12 +14,14 @@
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
import { searchParam } from '$lib/util.js'
|
||||
import { Button, Material, Select } from 'mono-svelte'
|
||||
import { t } from '$lib/translations'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
|
||||
export let data
|
||||
</script>
|
||||
|
||||
<div class="mb-4 flex flex-col gap-4">
|
||||
<h1 class="font-bold text-3xl">Moderation</h1>
|
||||
<Header>{$t('routes.moderation.title')}</Header>
|
||||
<div class="flex flex-row gap-2 flex-wrap items-center">
|
||||
<Select
|
||||
bind:value={data.type}
|
||||
@@ -27,14 +29,14 @@
|
||||
>
|
||||
<span slot="label" class="flex items-center gap-1">
|
||||
<Icon src={Funnel} size="15" mini />
|
||||
Filter
|
||||
{$t('filter.filter')}
|
||||
</span>
|
||||
<option value="all">All</option>
|
||||
<option value="unread">Unread</option>
|
||||
<option value="all">{$t('filter.location.all')}</option>
|
||||
<option value="unread">{$t('filter.unread')}</option>
|
||||
</Select>
|
||||
<Button href="/modlog" class="h-max ml-auto">
|
||||
<Icon src={Newspaper} size="16" mini />
|
||||
Modlog
|
||||
{$t('routes.modlog')}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -60,7 +62,7 @@
|
||||
{:else}
|
||||
<Placeholder
|
||||
icon={Inbox}
|
||||
title="No new reports"
|
||||
description="When submissions are reported, you can act on them here."
|
||||
title={$t('routes.moderation.empty.title')}
|
||||
description={$t('routes.moderation.empty.description')}
|
||||
/>
|
||||
{/if}
|
||||
@@ -14,6 +14,7 @@
|
||||
import { Button } from 'mono-svelte'
|
||||
import type { ReportView } from '$lib/lemmy/report.js'
|
||||
import PrivateMessage from '$lib/components/lemmy/inbox/PrivateMessage.svelte'
|
||||
import { t } from '$lib/translations'
|
||||
|
||||
export let item: ReportView
|
||||
|
||||
@@ -33,9 +34,9 @@
|
||||
item.resolved = res.comment_report_view.comment_report.resolved
|
||||
|
||||
toast({
|
||||
content: `${
|
||||
item.resolved ? 'Resolved' : 'Unresolved'
|
||||
} that report.`,
|
||||
content: item.resolved
|
||||
? $t('toast.resolveReport')
|
||||
: $t('toast.unresolveReport'),
|
||||
type: 'success',
|
||||
})
|
||||
|
||||
@@ -49,9 +50,9 @@
|
||||
|
||||
item.resolved = res.post_report_view.post_report.resolved
|
||||
toast({
|
||||
content: `${
|
||||
item.resolved ? 'Resolved' : 'Unresolved'
|
||||
} that report.`,
|
||||
content: item.resolved
|
||||
? $t('toast.resolveReport')
|
||||
: $t('toast.unresolveReport'),
|
||||
type: 'success',
|
||||
})
|
||||
|
||||
@@ -66,9 +67,9 @@
|
||||
item.resolved =
|
||||
res.private_message_report_view.private_message_report.resolved
|
||||
toast({
|
||||
content: `${
|
||||
item.resolved ? 'Resolved' : 'Unresolved'
|
||||
} that report.`,
|
||||
content: item.resolved
|
||||
? $t('toast.resolveReport')
|
||||
: $t('toast.unresolveReport'),
|
||||
type: 'success',
|
||||
})
|
||||
|
||||
@@ -105,7 +106,7 @@
|
||||
<div class="flex flex-row gap-4 items-center">
|
||||
<div>
|
||||
<span class="text-xs font-bold dark:text-zinc-400 text-slate-600">
|
||||
Reason
|
||||
{$t('routes.moderation.reason')}
|
||||
</span>
|
||||
<p>
|
||||
{item.reason}
|
||||
@@ -116,8 +117,7 @@
|
||||
class="w-8 h-8 !p-1 ml-auto {item.resolved
|
||||
? '!text-green-600 dark:!text-green-400'
|
||||
: ''}"
|
||||
aria-label="Resolve"
|
||||
title="Resolve"
|
||||
title={$t('routes.moderation.resolve')}
|
||||
loading={resolving}
|
||||
disabled={resolving}
|
||||
>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<script>
|
||||
import { page } from '$app/stores'
|
||||
import { t } from '$lib/translations'
|
||||
import { XMark, Icon } from 'svelte-hero-icons'
|
||||
</script>
|
||||
|
||||
@@ -9,9 +10,8 @@
|
||||
>
|
||||
<Icon src={XMark} size="32" mini />
|
||||
</div>
|
||||
<h1 class="text-red-800 dark:text-red-300 text-2xl font-semibold">Error</h1>
|
||||
<p class="text-red-800 dark:text-red-300">
|
||||
That password reset token doesn't exist.
|
||||
</p>
|
||||
<h1 class="text-red-800 dark:text-red-300 text-2xl font-semibold">
|
||||
{$t('message.error')}
|
||||
</h1>
|
||||
<code>{$page.error?.message}</code>
|
||||
</div>
|
||||
@@ -6,6 +6,7 @@
|
||||
instance as currentInstance,
|
||||
} from '$lib/instance.js'
|
||||
import { getClient, validateInstance } from '$lib/lemmy.js'
|
||||
import { t } from '$lib/translations'
|
||||
import { Button, TextInput, toast } from 'mono-svelte'
|
||||
|
||||
export let data: {
|
||||
@@ -21,7 +22,7 @@
|
||||
loading = true
|
||||
try {
|
||||
if (!(await validateInstance(instance)))
|
||||
throw new Error('Failed to contact instance url')
|
||||
throw new Error($t('toast.failInstanceURL'))
|
||||
|
||||
await getClient(instance).passwordChangeAfterReset({
|
||||
password: password,
|
||||
@@ -30,7 +31,7 @@
|
||||
})
|
||||
|
||||
toast({
|
||||
content: 'Your password was reset.',
|
||||
content: $t('toast.passwordReset'),
|
||||
type: 'success',
|
||||
})
|
||||
|
||||
@@ -46,38 +47,37 @@
|
||||
</script>
|
||||
|
||||
<div class="my-auto max-w-xl mx-auto flex flex-col gap-2">
|
||||
<h1 class="font-bold text-3xl">Reset Password</h1>
|
||||
<h1 class="font-bold text-3xl">{$t('routes.passwordChange.title')}</h1>
|
||||
<p>
|
||||
You've clicked an email with the password reset link in it. Now, choose your
|
||||
new password.
|
||||
{$t('routes.passwordChange.description')}
|
||||
</p>
|
||||
<form class="mt-2 flex flex-col gap-4" on:submit|preventDefault={submit}>
|
||||
{#if !LINKED_INSTANCE_URL}
|
||||
<TextInput
|
||||
bind:value={instance}
|
||||
label="Instance URL"
|
||||
label={$t('form.password')}
|
||||
placeholder={DEFAULT_INSTANCE_URL}
|
||||
required
|
||||
>
|
||||
<span class="font-normal text-xs">
|
||||
What instance did you reset your password for?
|
||||
{$t('routes.passwordChange.instance')}
|
||||
</span>
|
||||
</TextInput>
|
||||
{/if}
|
||||
<TextInput
|
||||
bind:value={password}
|
||||
label="New Password"
|
||||
label={$t('form.profile.newPassword')}
|
||||
type="password"
|
||||
required
|
||||
/>
|
||||
<TextInput
|
||||
bind:value={password_verify}
|
||||
label="New Password (Verify)"
|
||||
label={$t('form.profile.verifyNewPassword')}
|
||||
type="password"
|
||||
required
|
||||
/>
|
||||
<Button color="primary" size="lg" {loading} disabled={loading} submit>
|
||||
Submit
|
||||
{$t('form.submit')}
|
||||
</Button>
|
||||
</form>
|
||||
</div>
|
||||
@@ -42,6 +42,7 @@
|
||||
import Expandable from '$lib/components/ui/Expandable.svelte'
|
||||
import { addResumable } from '$lib/lemmy/item.js'
|
||||
import { Popover } from 'mono-svelte'
|
||||
import { t } from '$lib/translations.js'
|
||||
|
||||
export let data
|
||||
|
||||
@@ -81,7 +82,7 @@
|
||||
|
||||
const fetchOnHome = async (jwt: string) => {
|
||||
const id = toast({
|
||||
content: 'Attempting to fetch this post on your home instance...',
|
||||
content: $t('toast.fetchPostOnHome'),
|
||||
loading: true,
|
||||
})
|
||||
|
||||
@@ -161,11 +162,10 @@
|
||||
slot="target"
|
||||
class="bg-slate-200 dark:bg-zinc-700 p-0.5 rounded-full text-primary-900 dark:text-primary-100"
|
||||
/>
|
||||
This post was fetched from a different server than your account's. Many actions
|
||||
won't work.
|
||||
{$t('routes.post.instanceWarning')}
|
||||
</Popover>
|
||||
<span class="text-primary-900 dark:text-primary-100 font-bold">
|
||||
Remote View
|
||||
{$t('routes.post.remoteView')}
|
||||
</span>
|
||||
{#if $profile?.jwt}
|
||||
<Button
|
||||
@@ -177,7 +177,7 @@
|
||||
}}
|
||||
>
|
||||
<Icon src={Home} mini size="16" />
|
||||
Local View
|
||||
{$t('routes.post.localView')}
|
||||
</Button>
|
||||
{/if}
|
||||
</div>
|
||||
@@ -243,7 +243,7 @@
|
||||
class="inline-block w-full text-left text-base font-normal"
|
||||
>
|
||||
<span class="font-bold">{post.cross_posts.length}</span>
|
||||
crossposts
|
||||
{$t('routes.post.crosspostCount')}
|
||||
</div>
|
||||
<div
|
||||
class="!divide-y divide-slate-200 dark:divide-zinc-800 flex flex-col"
|
||||
@@ -265,14 +265,14 @@ flex-wrap gap-4 sticky top-20 w-full box-border z-20 mt-4"
|
||||
>
|
||||
<p class="font-medium text-sm flex items-center gap-2">
|
||||
<Icon src={InformationCircle} mini size="20" />
|
||||
You're viewing part of a thread.
|
||||
{$t('routes.post.thread.part')}
|
||||
</p>
|
||||
<Button
|
||||
{loading}
|
||||
disabled={loading}
|
||||
href="/comment/{$page.params.instance}/{data.thread.showContext}"
|
||||
>
|
||||
Show Context
|
||||
{$t('routes.post.thread.context')}
|
||||
</Button>
|
||||
</Material>
|
||||
{:else if data.thread.singleThread}
|
||||
@@ -285,10 +285,10 @@ flex-wrap gap-4 sticky top-20 w-full box-border z-20 mt-4"
|
||||
>
|
||||
<p class="font-medium text-sm flex items-center gap-2">
|
||||
<Icon src={InformationCircle} mini size="20" />
|
||||
You're viewing a single thread.
|
||||
{$t('routes.post.thread.single')}
|
||||
</p>
|
||||
<Button {loading} disabled={loading} on:click={reloadComments}>
|
||||
All comments
|
||||
{$t('routes.post.thread.allComments')}
|
||||
</Button>
|
||||
</Material>
|
||||
{/if}
|
||||
@@ -298,7 +298,7 @@ flex-wrap gap-4 sticky top-20 w-full box-border z-20 mt-4"
|
||||
<span class="font-bold">
|
||||
<FormattedNumber number={post.post_view.counts.comments} />
|
||||
</span>
|
||||
comments
|
||||
{$t('routes.post.commentCount')}
|
||||
</div>
|
||||
<div class="gap-2 flex items-center h-8">
|
||||
<Select
|
||||
@@ -307,13 +307,11 @@ flex-wrap gap-4 sticky top-20 w-full box-border z-20 mt-4"
|
||||
bind:value={commentSort}
|
||||
on:change={reloadComments}
|
||||
>
|
||||
<option value="Hot">Hot</option>
|
||||
<option value="Top">Top</option>
|
||||
<option value="New">New</option>
|
||||
<option value="Old">Old</option>
|
||||
{#if feature('controversialSort', $page.params.instance == $instance ? $site?.version : '0.0.0')}
|
||||
<option value="Controversial">Controversial</option>
|
||||
{/if}
|
||||
<option value="Hot">{$t('filter.sort.hot')}</option>
|
||||
<option value="Top">{$t('filter.sort.top.label')}</option>
|
||||
<option value="New">{$t('filter.sort.new')}</option>
|
||||
<option value="Old">{$t('filter.sort.old')}</option>
|
||||
<option value="Controversial">{$t('filter.sort.controversial')}</option>
|
||||
</Select>
|
||||
<Button size="square-md" on:click={reloadComments}>
|
||||
<Icon src={ArrowPath} size="16" mini slot="prefix" />
|
||||
@@ -333,7 +331,7 @@ flex-wrap gap-4 sticky top-20 w-full box-border z-20 mt-4"
|
||||
on:focus={() => (commenting = true)}
|
||||
tools={commenting}
|
||||
preview={commenting}
|
||||
placeholder={commenting ? undefined : 'Add a comment'}
|
||||
placeholder={commenting ? undefined : $t('routes.post.addComment')}
|
||||
rows={commenting ? 7 : 1}
|
||||
/>
|
||||
{/if}
|
||||
@@ -355,7 +353,7 @@ flex-wrap gap-4 sticky top-20 w-full box-border z-20 mt-4"
|
||||
<span class="text-black dark:text-white font-bold">
|
||||
{post.post_view.counts.comments}
|
||||
</span>
|
||||
comments
|
||||
{$t('routes.post.commentCount')}
|
||||
|
||||
<Button
|
||||
color="tertiary"
|
||||
@@ -363,7 +361,7 @@ flex-wrap gap-4 sticky top-20 w-full box-border z-20 mt-4"
|
||||
slot="action"
|
||||
>
|
||||
<Icon src={ChevronDoubleUp} mini size="16" slot="prefix" />
|
||||
Scroll to top
|
||||
{$t('routes.post.scrollToTop')}
|
||||
</Button>
|
||||
</EndPlaceholder>
|
||||
{/if}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
import { Button } from 'mono-svelte'
|
||||
import Entity from '$lib/components/ui/Entity.svelte'
|
||||
import { t } from '$lib/translations.js'
|
||||
|
||||
// sveltekit doesn't feel like making types work right now
|
||||
export let data: PageData & {
|
||||
@@ -81,7 +82,7 @@
|
||||
{#if data.community_blocks?.length > 0 || data.person_blocks?.length > 0 || (data.my_user?.instance_blocks?.length ?? 0) > 0}
|
||||
{#if data.my_user?.instance_blocks && (data.my_user?.instance_blocks?.length ?? 0) > 0}
|
||||
<div>
|
||||
<SectionTitle>Instances</SectionTitle>
|
||||
<SectionTitle>{$t('content.instances')}</SectionTitle>
|
||||
<EditableList let:action on:action={(i) => unblockInstances(i.detail)}>
|
||||
{#each data.my_user?.instance_blocks as block (block.instance.id)}
|
||||
<div
|
||||
@@ -105,17 +106,10 @@
|
||||
{/each}
|
||||
</EditableList>
|
||||
</div>
|
||||
{:else}
|
||||
<Placeholder
|
||||
description="Go to a community's page and click 'block instance' to stop seeing posts and
|
||||
comments from its instance."
|
||||
title="No blocked instances"
|
||||
center={false}
|
||||
/>
|
||||
{/if}
|
||||
{#if data.community_blocks?.length > 0}
|
||||
<div>
|
||||
<SectionTitle>Communities</SectionTitle>
|
||||
<SectionTitle>{$t('content.communities')}</SectionTitle>
|
||||
<EditableList let:action on:action={(i) => unblockCommunity(i.detail)}>
|
||||
{#each data.community_blocks as block (block.community.id)}
|
||||
<div
|
||||
@@ -135,17 +129,10 @@
|
||||
{/each}
|
||||
</EditableList>
|
||||
</div>
|
||||
{:else}
|
||||
<Placeholder
|
||||
description="Go to a community's page and click 'block' to stop seeing posts and
|
||||
comments from it."
|
||||
title="No blocked communities"
|
||||
center={false}
|
||||
/>
|
||||
{/if}
|
||||
{#if data.person_blocks?.length > 0}
|
||||
<div>
|
||||
<SectionTitle>Users</SectionTitle>
|
||||
<SectionTitle>{$t('content.users')}</SectionTitle>
|
||||
<EditableList let:action on:action={(i) => unblockUser(i.detail)}>
|
||||
{#each data.person_blocks as block (block.target.id)}
|
||||
<div
|
||||
@@ -165,20 +152,5 @@
|
||||
{/each}
|
||||
</EditableList>
|
||||
</div>
|
||||
{:else}
|
||||
<Placeholder
|
||||
description="Go to a user's profile and click 'block' to stop seeing posts and
|
||||
comments from them."
|
||||
title="No blocked users"
|
||||
center={false}
|
||||
/>
|
||||
{/if}
|
||||
{:else}
|
||||
<div class="my-auto">
|
||||
<Placeholder
|
||||
description="Go to a community or user's page and click 'block' to stop seeing submissions from it."
|
||||
title="No blocks"
|
||||
center={false}
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
@@ -9,6 +9,8 @@
|
||||
import { page } from '$app/stores'
|
||||
import Switch from '$lib/components/input/Switch.svelte'
|
||||
import { feature } from '$lib/version.js'
|
||||
import { t } from '$lib/translations.js'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
|
||||
export let data
|
||||
|
||||
@@ -39,12 +41,12 @@
|
||||
await setUser(res.jwt, instance, username!)
|
||||
$currentInstance = instance
|
||||
|
||||
toast({ content: 'Your login was refreshed.', type: 'success' })
|
||||
toast({ content: $t('toast.loginRefresh'), type: 'success' })
|
||||
} else {
|
||||
throw new Error('Invalid credentials')
|
||||
throw new Error($t('toast.invalidLogin'))
|
||||
}
|
||||
|
||||
toast({ content: 'Successfully changed your password. ' })
|
||||
toast({ content: $t('toast.passwordReset') })
|
||||
} catch (e) {
|
||||
toast({
|
||||
content: e as any,
|
||||
@@ -82,63 +84,68 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<h1 class="font-bold text-3xl">Credentials</h1>
|
||||
<h1 class="font-bold text-3xl">{$t('routes.profile.credentials')}</h1>
|
||||
<div class="flex flex-row flex-wrap gap-8">
|
||||
<div class="flex flex-col gap-2 max-w-sm w-full">
|
||||
<h1 class="font-bold text-2xl">Password</h1>
|
||||
<h1 class="font-bold text-2xl">{$t('form.password')}</h1>
|
||||
<form
|
||||
on:submit|preventDefault={changePassword}
|
||||
class="max-w-sm flex flex-col gap-4"
|
||||
>
|
||||
<TextInput
|
||||
bind:value={oldPassword}
|
||||
label="Current Password"
|
||||
label={$t('form.profile.currentPassword')}
|
||||
type="password"
|
||||
minlength={10}
|
||||
required
|
||||
/>
|
||||
<TextInput
|
||||
bind:value={newPassword}
|
||||
label="New Password"
|
||||
label={$t('form.profile.newPassword')}
|
||||
type="password"
|
||||
minlength={10}
|
||||
required
|
||||
/>
|
||||
<TextInput
|
||||
bind:value={newPasswordVerify}
|
||||
label="New Password (Verify)"
|
||||
label={$t('form.profile.verifyNewPassword')}
|
||||
type="password"
|
||||
minlength={10}
|
||||
required
|
||||
/>
|
||||
<Button size="lg" color="primary" submit {loading} disabled={loading}>
|
||||
Submit
|
||||
{$t('form.submit')}
|
||||
</Button>
|
||||
</form>
|
||||
</div>
|
||||
<div class="flex flex-col gap-4 max-w-sm w-full">
|
||||
<h1 class="font-bold text-2xl">2FA</h1>
|
||||
<Header>{$t('form.profile.2fa.2fa')}</Header>
|
||||
<p>
|
||||
2FA is <span class="font-bold">
|
||||
{totpEnabled ? 'enabled' : 'disabled'}
|
||||
<span class="font-bold">
|
||||
{totpEnabled ? $t('common.enabled') : $t('common.disabled')}
|
||||
</span>
|
||||
</p>
|
||||
{#if totpEnabled || totpLink}
|
||||
{#if totpLink && !totpEnabled}
|
||||
<TextInput disabled type="password" value={totpLink} label="TOTP Link">
|
||||
<TextInput
|
||||
disabled
|
||||
type="password"
|
||||
value={totpLink}
|
||||
label={$t('form.profile.2fa.totp')}
|
||||
>
|
||||
<button
|
||||
slot="suffix"
|
||||
class="contents"
|
||||
on:click={() => {
|
||||
if (!totpLink) return
|
||||
navigator.clipboard?.writeText(totpLink)
|
||||
toast({ content: 'Copied to clipboard.' })
|
||||
toast({ content: $t('toast.copied') })
|
||||
}}
|
||||
>
|
||||
<Icon src={ClipboardDocument} size="20" mini />
|
||||
</button>
|
||||
<span class="font-normal text-xs">
|
||||
Paste this in your authenticator app.
|
||||
{$t('form.profile.2fa.paste')}
|
||||
</span>
|
||||
</TextInput>
|
||||
{/if}
|
||||
@@ -146,21 +153,21 @@
|
||||
<TextInput
|
||||
bind:value={verify_totp}
|
||||
placeholder="012345"
|
||||
label="2FA Code"
|
||||
label={$t('form.2fa')}
|
||||
/>
|
||||
{#if totpEnabled}
|
||||
<Button on:click={() => twofa(false, true)} size="lg" color="primary">
|
||||
Disable
|
||||
{$t('common.disabled')}
|
||||
</Button>
|
||||
{:else}
|
||||
<Button on:click={() => twofa(true, true)} size="lg" color="primary">
|
||||
Enable
|
||||
{$t('common.enabled')}
|
||||
</Button>
|
||||
{/if}
|
||||
</form>
|
||||
{:else}
|
||||
<Button on:click={() => twofa(true)} size="lg" color="primary">
|
||||
Setup
|
||||
{$t('form.setup')}
|
||||
</Button>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
import type { SaveUserSettings } from 'lemmy-js-client'
|
||||
import { Button, Checkbox, Modal, TextInput } from 'mono-svelte'
|
||||
import { uploadImage } from '$lib/util.js'
|
||||
import { t } from '$lib/translations.js'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
|
||||
export let data
|
||||
|
||||
@@ -39,8 +41,7 @@
|
||||
})
|
||||
|
||||
toast({
|
||||
content:
|
||||
'Saved your user settings. If you changed your email, a verification email will have been sent.',
|
||||
content: $t('toast.saveSettings'),
|
||||
type: 'success',
|
||||
})
|
||||
} catch (err) {
|
||||
@@ -63,21 +64,21 @@
|
||||
switch (level) {
|
||||
case 0: {
|
||||
toast({
|
||||
content: 'Are you sure you want to delete your account?',
|
||||
content: $t('toast.confirmDelete1'),
|
||||
action: () => deleteAccount(1),
|
||||
})
|
||||
return
|
||||
}
|
||||
case 1: {
|
||||
toast({
|
||||
content: 'Are you really sure?',
|
||||
content: $t('toast.confirmDelete2'),
|
||||
action: () => deleteAccount(2),
|
||||
})
|
||||
return
|
||||
}
|
||||
case 2: {
|
||||
toast({
|
||||
content: 'Final warning. Are you reeeeeeally sure?',
|
||||
content: $t('toast.confirmDelete3'),
|
||||
action: () => deleteAccount(3),
|
||||
})
|
||||
return
|
||||
@@ -91,13 +92,13 @@
|
||||
|
||||
if (!(deletion.password || null)) {
|
||||
toast({
|
||||
content: 'You must provide your password.',
|
||||
content: $t('toast.needPassword'),
|
||||
type: 'warning',
|
||||
})
|
||||
}
|
||||
|
||||
const id = toast({
|
||||
content: 'You did this. Deleting account...',
|
||||
content: $t('toast.deleting'),
|
||||
loading: true,
|
||||
})
|
||||
|
||||
@@ -119,7 +120,7 @@
|
||||
|
||||
setUserID(-1)
|
||||
toast({
|
||||
content: 'Your account was deleted.',
|
||||
content: $t('toast.deleted'),
|
||||
})
|
||||
goto('/')
|
||||
} catch (err) {
|
||||
@@ -141,50 +142,58 @@
|
||||
action="Submit"
|
||||
on:action={() => deleteAccount(4)}
|
||||
>
|
||||
<span slot="title">Delete account</span>
|
||||
<span slot="title">{$t('form.profile.deleteAccount.label')}</span>
|
||||
<TextInput
|
||||
label="Password"
|
||||
label={$t('form.password')}
|
||||
type="password"
|
||||
bind:value={deletion.password}
|
||||
/>
|
||||
<Checkbox bind:checked={deletion.deleteContent}>
|
||||
Delete content
|
||||
{$t('form.profile.deleteAccount.deleteContent')}
|
||||
<span slot="description">
|
||||
This will delete ALL of your account's posts and comments.
|
||||
{$t('form.profile.deleteAccount.warning')}
|
||||
</span>
|
||||
</Checkbox>
|
||||
</Modal>
|
||||
{/if}
|
||||
|
||||
<form class="flex flex-col gap-4 h-full" on:submit|preventDefault={save}>
|
||||
<h1 class="font-bold text-2xl">User settings</h1>
|
||||
<Header>{$t('routes.profile.settings')}</Header>
|
||||
{#if data.my_user?.local_user_view?.local_user && formData}
|
||||
<TextInput
|
||||
label="Display name"
|
||||
label={$t('form.profile.displayName')}
|
||||
bind:value={formData.display_name}
|
||||
placeholder="Optional"
|
||||
/>
|
||||
<MarkdownEditor
|
||||
images={false}
|
||||
bind:value={formData.bio}
|
||||
label="Bio"
|
||||
label={$t('form.profile.bio')}
|
||||
previewButton
|
||||
/>
|
||||
<ImageInput label="Profile Image" bind:files={profileImage} />
|
||||
<ImageInput label="Banner Image" bind:files={bannerImage} />
|
||||
<TextInput label="Email" bind:value={formData.email} />
|
||||
<ImageInput label={$t('form.profile.avatar')} bind:files={profileImage} />
|
||||
<ImageInput label={$t('form.profile.banner')} bind:files={bannerImage} />
|
||||
<TextInput label={$t('form.profile.email')} bind:value={formData.email} />
|
||||
<TextInput
|
||||
label="Matrix User"
|
||||
label={$t('form.profile.matrix')}
|
||||
bind:value={formData.matrix_user_id}
|
||||
placeholder="@user:example.com"
|
||||
/>
|
||||
<Checkbox bind:checked={formData.show_nsfw}>Show NSFW content</Checkbox>
|
||||
<Checkbox bind:checked={formData.show_scores}>Show Scores</Checkbox>
|
||||
<Checkbox bind:checked={formData.bot_account}>Bot Account</Checkbox>
|
||||
<Checkbox bind:checked={formData.show_nsfw}>
|
||||
{$t('form.profile.showNSFW')}
|
||||
</Checkbox>
|
||||
<Checkbox bind:checked={formData.show_scores}>
|
||||
{$t('form.profile.scores')}
|
||||
</Checkbox>
|
||||
<Checkbox bind:checked={formData.bot_account}>
|
||||
{$t('form.profile.bot')}
|
||||
</Checkbox>
|
||||
<Checkbox bind:checked={formData.show_bot_accounts}>
|
||||
Show Bot Accounts
|
||||
{$t('form.profile.showBots')}
|
||||
</Checkbox>
|
||||
<Checkbox bind:checked={formData.show_read_posts}>
|
||||
{$t('form.profile.showRead')}
|
||||
</Checkbox>
|
||||
<Checkbox bind:checked={formData.show_read_posts}>Show Read Posts</Checkbox>
|
||||
|
||||
<Button
|
||||
submit
|
||||
@@ -194,10 +203,8 @@
|
||||
{loading}
|
||||
disabled={loading}
|
||||
>
|
||||
Save
|
||||
{$t('common.save')}
|
||||
</Button>
|
||||
{:else}
|
||||
<Material padding="lg">The API didn't return your user settings.</Material>
|
||||
{/if}
|
||||
<Button
|
||||
on:click={() => deleteAccount(0)}
|
||||
@@ -205,6 +212,6 @@
|
||||
size="lg"
|
||||
class="ml-auto"
|
||||
>
|
||||
Delete account
|
||||
{$t('form.profile.deleteAccount.label')}
|
||||
</Button>
|
||||
</form>
|
||||
@@ -3,10 +3,11 @@
|
||||
import { page } from '$app/stores'
|
||||
|
||||
import MultiSelect from '$lib/components/input/Switch.svelte'
|
||||
import { t } from '$lib/translations'
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>Profile</title>
|
||||
<title>{$t('profile.profile')}</title>
|
||||
</svelte:head>
|
||||
|
||||
<div class="flex flex-col gap-4 h-full z-0">
|
||||
@@ -17,7 +18,12 @@
|
||||
'/profile/blocks',
|
||||
'/profile/password',
|
||||
]}
|
||||
optionNames={['User', 'Settings', 'Blocks', 'Credentials']}
|
||||
optionNames={[
|
||||
$t('routes.profile.user'),
|
||||
$t('routes.profile.settings'),
|
||||
$t('routes.profile.blocks'),
|
||||
$t('routes.profile.credentials'),
|
||||
]}
|
||||
selected={$page.url.pathname}
|
||||
on:select={(e) => {
|
||||
goto(e.detail)
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
import { page } from '$app/stores'
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
import { Bookmark } from 'svelte-hero-icons'
|
||||
import { t } from '$lib/translations.js'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
|
||||
export let data
|
||||
|
||||
@@ -17,10 +19,10 @@
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>Saved</title>
|
||||
<title>{$t('routes.saved')}</title>
|
||||
</svelte:head>
|
||||
|
||||
<h1 class="text-3xl font-bold">Saved</h1>
|
||||
<Header>{$t('routes.saved')}</Header>
|
||||
<div
|
||||
class="flex flex-col list-none my-4 divide-slate-200 dark:divide-zinc-800"
|
||||
class:gap-4={$userSettings.view == 'card'}
|
||||
|
||||
@@ -33,6 +33,8 @@
|
||||
} from 'svelte-hero-icons'
|
||||
import { expoOut } from 'svelte/easing'
|
||||
import { slide } from 'svelte/transition'
|
||||
import { t } from '$lib/translations.js'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
|
||||
type Result = PostView | CommentView | PersonView | CommunityView
|
||||
|
||||
@@ -46,10 +48,10 @@
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>Search</title>
|
||||
<title>{$t('routes.search.title')}</title>
|
||||
</svelte:head>
|
||||
|
||||
<h1 class="font-bold text-3xl">Search</h1>
|
||||
<Header>{$t('routes.search.title')}</Header>
|
||||
<div class="flex flex-row flex-wrap items-center gap-4 mt-4">
|
||||
<Select
|
||||
bind:value={data.type}
|
||||
@@ -57,25 +59,20 @@
|
||||
>
|
||||
<span slot="label" class="flex items-center gap-1">
|
||||
<Icon src={AdjustmentsHorizontal} mini size="15" />
|
||||
Filter
|
||||
{$t('filter.type')}
|
||||
</span>
|
||||
<option value="All">All</option>
|
||||
<option value="Posts">Posts</option>
|
||||
<option value="Comments">Comments</option>
|
||||
<option value="Communities">Communities</option>
|
||||
<option value="Users">Users</option>
|
||||
<option value="All">{$t('content.all')}</option>
|
||||
<option value="Posts">{$t('content.posts')}</option>
|
||||
<option value="Comments">{$t('content.comments')}</option>
|
||||
<option value="Communities">{$t('content.communities')}</option>
|
||||
<option value="Users">{$t('content.users')}</option>
|
||||
</Select>
|
||||
<Sort navigate bind:selected={data.sort} />
|
||||
<form
|
||||
on:submit|preventDefault={() => searchParam($page.url, 'q', query, 'page')}
|
||||
class="flex flex-col sm:flex-row gap-2 sm:ml-auto items-center"
|
||||
>
|
||||
<TextInput
|
||||
bind:value={query}
|
||||
placeholder="Search for a keyword..."
|
||||
label="Query"
|
||||
size="md"
|
||||
/>
|
||||
<TextInput bind:value={query} label={$t('routes.search.query')} size="md" />
|
||||
<Button
|
||||
submit
|
||||
color="secondary"
|
||||
@@ -100,7 +97,7 @@
|
||||
{#if moreOptions}
|
||||
<div transition:slide={{ axis: 'y', easing: expoOut }} class="max-w-sm">
|
||||
<ObjectAutocomplete
|
||||
label="Community"
|
||||
label={$t('nav.create.community')}
|
||||
jwt={$profile?.jwt}
|
||||
listing_type={'All'}
|
||||
showWhenEmpty={true}
|
||||
@@ -112,8 +109,10 @@
|
||||
{#if !data.results}
|
||||
<Placeholder
|
||||
icon={MagnifyingGlass}
|
||||
title="No results"
|
||||
description="Search across the fediverse"
|
||||
title={$t('routes.search.noResults.title')}
|
||||
description={query == ''
|
||||
? $t('routes.search.noResults.alt')
|
||||
: $t('routes.search.noResults.description')}
|
||||
class="pt-4"
|
||||
/>
|
||||
{:else}
|
||||
@@ -123,7 +122,7 @@
|
||||
out:slide={{ axis: 'y', easing: expoOut }}
|
||||
>
|
||||
<Spinner width={24} />
|
||||
<span>Federating...</span>
|
||||
<span>{$t('routes.search.federating')}</span>
|
||||
</div>
|
||||
{:then object}
|
||||
{#if object}
|
||||
|
||||
+151
-112
@@ -3,7 +3,14 @@
|
||||
import Setting from './Setting.svelte'
|
||||
import MultiSelect from '$lib/components/input/Switch.svelte'
|
||||
import Sort from '$lib/components/lemmy/dropdowns/Sort.svelte'
|
||||
import { Disclosure, Material, Switch, TextInput, toast } from 'mono-svelte'
|
||||
import {
|
||||
Disclosure,
|
||||
Material,
|
||||
Note,
|
||||
Switch,
|
||||
TextInput,
|
||||
toast,
|
||||
} from 'mono-svelte'
|
||||
import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
|
||||
import Link from '$lib/components/input/Link.svelte'
|
||||
import {
|
||||
@@ -22,102 +29,129 @@
|
||||
import { Button, Checkbox, Select } from 'mono-svelte'
|
||||
import ViewSelect from '$lib/components/lemmy/dropdowns/ViewSelect.svelte'
|
||||
import { LINKED_INSTANCE_URL } from '$lib/instance.js'
|
||||
import { removeItem } from '$lib/util.js'
|
||||
import { DOMAIN_REGEX_FORMS, removeItem } from '$lib/util.js'
|
||||
import Section from './Section.svelte'
|
||||
import ToggleSetting from './ToggleSetting.svelte'
|
||||
import { locales, t } from '$lib/translations'
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>Settings</title>
|
||||
<title>{$t('settings.title')}</title>
|
||||
</svelte:head>
|
||||
|
||||
<h1 class="text-3xl font-bold flex justify-between">
|
||||
Settings <Button
|
||||
{$t('settings.title')}
|
||||
<Button
|
||||
size="square-md"
|
||||
on:click={() => {
|
||||
toast({
|
||||
content: 'Are you sure you want to reset your settings to the default?',
|
||||
content: $t('toast.resetSettings'),
|
||||
action: () => ($userSettings = defaultSettings),
|
||||
})
|
||||
}}
|
||||
class="font-normal"
|
||||
>
|
||||
<Icon src={ArrowPath} mini size="16" slot="prefix" />
|
||||
Reset
|
||||
</Button>
|
||||
</h1>
|
||||
|
||||
<div class="flex flex-col gap-4" style="scroll-behavior: smooth;">
|
||||
<Section title="Navigation">
|
||||
<div>
|
||||
<Button
|
||||
color="ghost"
|
||||
on:click={() => {
|
||||
$userSettings.dock.noGap = true
|
||||
$userSettings.dock.top = true
|
||||
}}
|
||||
disabled={$userSettings.dock.noGap && $userSettings.dock.top}
|
||||
>
|
||||
Legacy Navigation Style
|
||||
</Button>
|
||||
</div>
|
||||
<Section title={$t('settings.navigation.title')}>
|
||||
<Setting>
|
||||
<span slot="title">Dock position</span>
|
||||
<span slot="description">Where the dock should be put</span>
|
||||
<span slot="title">{$t('settings.navigation.dockPos.title')}</span>
|
||||
<span slot="description">
|
||||
{$t('settings.navigation.dockPos.description')}
|
||||
</span>
|
||||
<MultiSelect
|
||||
options={[true, false, null]}
|
||||
optionNames={['Top', 'Bottom', 'Adaptive']}
|
||||
optionNames={[
|
||||
$t('settings.navigation.dockPos.top'),
|
||||
$t('settings.navigation.dockPos.bottom'),
|
||||
$t('settings.navigation.dockPos.adaptive'),
|
||||
]}
|
||||
bind:selected={$userSettings.dock.top}
|
||||
/>
|
||||
</Setting>
|
||||
<Setting>
|
||||
<span slot="title">Panel mode</span>
|
||||
<span slot="title">{$t('settings.navigation.panel.title')}</span>
|
||||
<span slot="description">
|
||||
Extend the dock to screen edges, similar to a panel.
|
||||
{$t('settings.navigation.panel.description')}
|
||||
</span>
|
||||
<MultiSelect
|
||||
options={[true, false, null]}
|
||||
optionNames={['On', 'Off', 'Adaptive']}
|
||||
optionNames={[
|
||||
$t('settings.navigation.panel.on'),
|
||||
$t('settings.navigation.panel.off'),
|
||||
$t('settings.navigation.panel.adaptive'),
|
||||
]}
|
||||
bind:selected={$userSettings.dock.noGap}
|
||||
/>
|
||||
</Setting>
|
||||
</Section>
|
||||
|
||||
<Section title="Photon">
|
||||
<Section title={$t('settings.app.title')}>
|
||||
<Setting>
|
||||
<span slot="title">Theming</span>
|
||||
<span slot="description">Customize Photon's colors.</span>
|
||||
<span slot="title">{$t('settings.app.theming.title')}</span>
|
||||
<span slot="description">{$t('settings.app.theming.description')}</span>
|
||||
<Button href="/theme">
|
||||
Go to themes <Icon src={ArrowRight} size="16" mini slot="suffix" />
|
||||
{$t('settings.app.theming.link')}
|
||||
<Icon src={ArrowRight} size="16" mini slot="suffix" />
|
||||
</Button>
|
||||
</Setting>
|
||||
<Setting>
|
||||
<span slot="title">Post style</span>
|
||||
<span slot="title">{$t('settings.app.lang.title')}</span>
|
||||
<p slot="description">
|
||||
{$t('settings.app.lang.description')}
|
||||
<Note>
|
||||
{$t('settings.app.lang.note')}
|
||||
</Note>
|
||||
<Link href="/translators" highlight class="text-base font-semibold">
|
||||
{$t('settings.app.lang.credits')}
|
||||
</Link>
|
||||
</p>
|
||||
<Select bind:value={$userSettings.language}>
|
||||
<option value={null}>{$t('settings.app.lang.auto')}</option>
|
||||
{#each $locales as locale}
|
||||
<option value={locale}>
|
||||
{$t(`settings.app.lang.${locale}`, { default: locale })}
|
||||
</option>
|
||||
{/each}
|
||||
{#if $userSettings.debugInfo}
|
||||
<option value="dev">Raw Strings</option>
|
||||
{/if}
|
||||
</Select>
|
||||
</Setting>
|
||||
<Setting>
|
||||
<span slot="title">{$t('settings.app.view.title')}</span>
|
||||
<ViewSelect showLabel={false} />
|
||||
<p slot="description">
|
||||
{#if $userSettings.view == 'list'}
|
||||
Show posts in a list, with post bodies and compact images.
|
||||
{$t('settings.app.view.list')}
|
||||
{:else if $userSettings.view == 'cozy'}
|
||||
Show posts with large images, rich embeds and longer post bodies.
|
||||
{$t('settings.app.view.cozy')}
|
||||
{:else if $userSettings.view == 'compact'}
|
||||
Show posts in a list, without post bodies and with tighter spacing.
|
||||
{$t('settings.app.view.compact')}
|
||||
{:else if $userSettings.view == 'card'}
|
||||
Photon's old post style.
|
||||
{$t('settings.app.view.legacy')}
|
||||
{/if}
|
||||
</p>
|
||||
</Setting>
|
||||
<Setting optionClass="flex-[2] max-w-full flex-wrap min-w-0">
|
||||
<span slot="title">Default sort</span>
|
||||
<span slot="description">The default sort to use for feeds.</span>
|
||||
<span slot="title">{$t('settings.app.sort.title')}</span>
|
||||
<span slot="description">{$t('settings.app.sort.description')}</span>
|
||||
<div class="flex max-[500px]:flex-col flex-wrap gap-2 w-max max-w-full">
|
||||
<div class="max-w-full">
|
||||
<Select bind:value={$userSettings.defaultSort.feed}>
|
||||
<span slot="label" class="flex items-center gap-1">
|
||||
<Icon src={GlobeAmericas} size="16" mini />
|
||||
Location
|
||||
{$t('filter.location.label')}
|
||||
</span>
|
||||
<option value="All">All</option>
|
||||
<option value="Local">Local</option>
|
||||
<option value="Subscribed">Subscribed</option>
|
||||
<option value="All">{$t('filter.location.all')}</option>
|
||||
<option value="Local">{$t('filter.location.local')}</option>
|
||||
<option value="Subscribed">
|
||||
{$t('filter.location.subscribed')}
|
||||
</option>
|
||||
<option value="Moderator">{$t('filter.location.moderator')}</option>
|
||||
</Select>
|
||||
</div>
|
||||
<div class="max-w-full">
|
||||
@@ -130,70 +164,92 @@
|
||||
<Select bind:value={$userSettings.defaultSort.comments}>
|
||||
<span slot="label" class="flex items-center gap-1">
|
||||
<Icon src={ChatBubbleOvalLeftEllipsis} size="14" mini />
|
||||
Comments
|
||||
{$t('content.comments')}
|
||||
</span>
|
||||
|
||||
<option value="Hot">Hot</option>
|
||||
<option value="Top">Top</option>
|
||||
<option value="New">New</option>
|
||||
<option value="Hot">{$t('filter.sort.hot')}</option>
|
||||
<option value="Top">{$t('filter.sort.top.label')}</option>
|
||||
<option value="New">{$t('filter.sort.new')}</option>
|
||||
</Select>
|
||||
</div>
|
||||
</div>
|
||||
</Setting>
|
||||
<ToggleSetting
|
||||
bind:checked={$userSettings.openLinksInNewTab}
|
||||
title="Open posts in new tab"
|
||||
description="Rather than opening posts in the same tab, open a separate one."
|
||||
title={$t('settings.app.postsInNewTab.title')}
|
||||
description={$t('settings.app.postsInNewTab.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
bind:checked={$userSettings.displayNames}
|
||||
title="Use display name"
|
||||
description="Show a user's display name instead of their account username."
|
||||
title={$t('settings.app.displayName.title')}
|
||||
description={$t('settings.app.displayName.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
bind:checked={$userSettings.newWidth}
|
||||
title="Limit layout width"
|
||||
description="Improve readability by limiting main content width."
|
||||
title={$t('settings.app.limitLayoutWidth.title')}
|
||||
description={$t('settings.app.limitLayoutWidth.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
bind:checked={$userSettings.randomPlaceholders}
|
||||
title="Random placeholders"
|
||||
description="Show a random placeholder for forms for comments, posts, etc."
|
||||
title={$t('settings.app.placeholders.title')}
|
||||
description={$t('settings.app.placeholders.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
bind:checked={$userSettings.expandImages}
|
||||
title="Expand images"
|
||||
description="Clicking on a post's image brings you to an expanded view rather than
|
||||
sending you to the post page."
|
||||
title={$t('settings.app.expandImages.title')}
|
||||
description={$t('settings.app.expandImages.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
bind:checked={$userSettings.posts.deduplicateEmbed}
|
||||
title="Hide duplicate titles/bodies"
|
||||
description="Hides the post title and body if they're the same as the embed."
|
||||
title={$t('settings.app.duplicateTitles.title')}
|
||||
description={$t('settings.app.duplicateTitles.description')}
|
||||
/>
|
||||
<Setting>
|
||||
<span slot="title">Thumbnail alignment</span>
|
||||
<span slot="title">{$t('settings.app.thumbnailSide.title')}</span>
|
||||
<span slot="description">
|
||||
Where thumbnails should be on the post in list/compact view.
|
||||
{$t('settings.app.thumbnailSide.title')}
|
||||
</span>
|
||||
<MultiSelect
|
||||
options={[true, false]}
|
||||
optionNames={['Left', 'Right']}
|
||||
optionNames={[
|
||||
$t('settings.app.thumbnailSide.left'),
|
||||
$t('settings.app.thumbnailSide.right'),
|
||||
]}
|
||||
bind:selected={$userSettings.leftAlign}
|
||||
/>
|
||||
</Setting>
|
||||
<Setting vertical>
|
||||
<span slot="title">{$t('settings.app.font.title')}</span>
|
||||
<span slot="description">{$t('settings.app.font.description')}</span>
|
||||
<MultiSelect
|
||||
options={['inter', 'satoshi/nunito', 'system', 'browser']}
|
||||
optionNames={['Inter', 'Satoshi/Nunito', 'System UI', 'Browser Font']}
|
||||
bind:selected={$userSettings.font}
|
||||
/>
|
||||
</Setting>
|
||||
<Setting>
|
||||
<span slot="title">{$t('settings.app.translation.title')}</span>
|
||||
<span slot="description">
|
||||
{$t('settings.app.translation.description')}
|
||||
</span>
|
||||
<TextInput
|
||||
bind:value={$userSettings.translator}
|
||||
label={$t('settings.app.translation.instance')}
|
||||
pattern={DOMAIN_REGEX_FORMS}
|
||||
/>
|
||||
</Setting>
|
||||
</Section>
|
||||
|
||||
<Section title="Embeds">
|
||||
<Section title={$t('settings.embeds.title')}>
|
||||
<ToggleSetting
|
||||
title="Click to view"
|
||||
description="Don't load an embed until you click it. (It is recommended to leave this on, to not load a video you don't want to load.)"
|
||||
title={$t('settings.embeds.clickToView.title')}
|
||||
description={$t('settings.embeds.clickToView.description')}
|
||||
bind:checked={$userSettings.embeds.clickToView}
|
||||
/>
|
||||
<Setting>
|
||||
<span slot="title">YouTube</span>
|
||||
<span slot="description">
|
||||
The website to use to embed YouTube content.
|
||||
{$t('settings.embeds.youtube.description')}
|
||||
</span>
|
||||
<Select bind:value={$userSettings.embeds.youtube}>
|
||||
<option value="youtube">YouTube</option>
|
||||
@@ -201,102 +257,85 @@
|
||||
<option value="piped">Piped</option>
|
||||
</Select>
|
||||
</Setting>
|
||||
<Setting vertical>
|
||||
<span slot="title">Font</span>
|
||||
<span slot="description">What font Photon should use.</span>
|
||||
<MultiSelect
|
||||
options={['inter', 'satoshi/nunito', 'system', 'browser']}
|
||||
optionNames={['Inter', 'Satoshi/Nunito', 'System UI', 'Browser Font']}
|
||||
bind:selected={$userSettings.font}
|
||||
/>
|
||||
</Setting>
|
||||
</Section>
|
||||
|
||||
<Section title="Lemmy">
|
||||
<Section title={$t('settings.lemmy.title')}>
|
||||
<ToggleSetting
|
||||
bind:checked={$userSettings.posts.compactFeatured}
|
||||
title="Compact featured posts"
|
||||
description="Make featured posts more compact."
|
||||
title={$t('settings.lemmy.compactFeatured.title')}
|
||||
description={$t('settings.lemmy.compactFeatured.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
bind:checked={$userSettings.markPostsAsRead}
|
||||
title="Mark read posts"
|
||||
description="Mark a post as read when you click on it."
|
||||
title={$t('settings.lemmy.markReadPosts.title')}
|
||||
description={$t('settings.lemmy.markReadPosts.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
bind:checked={$userSettings.markReadPosts}
|
||||
title="Fade read posts"
|
||||
description="Fade the title of posts you've already read."
|
||||
title={$t('settings.lemmy.fadeReadPosts.title')}
|
||||
description={$t('settings.lemmy.fadeReadPosts.title')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
bind:checked={$userSettings.crosspostOriginalLink}
|
||||
title="'Crossposted from' when crossposting"
|
||||
description="If enabled, crossposts will include a link to the original post."
|
||||
title={$t('settings.lemmy.crosspostMarker.title')}
|
||||
description={$t('settings.lemmy.crosspostMarker.description')}
|
||||
/>
|
||||
<Setting>
|
||||
<span slot="title">Hide Submissions</span>
|
||||
<span slot="title">{$t('settings.lemmy.hideSubmissions.title')}</span>
|
||||
<span slot="description">
|
||||
<p>Hide certain types of submissions.</p>
|
||||
<p>
|
||||
Looking to hide read posts? That was moved to your <Link
|
||||
href="/profile/settings"
|
||||
highlight
|
||||
>
|
||||
profile settings.
|
||||
</Link>
|
||||
</p>
|
||||
<p>{$t('settings.lemmy.hideSubmissions.description')}</p>
|
||||
</span>
|
||||
<div class="flex flex-col items-start gap-4 flex-wrap">
|
||||
<Switch bind:checked={$userSettings.hidePosts.deleted}>Deleted</Switch>
|
||||
<Switch bind:checked={$userSettings.hidePosts.deleted}>
|
||||
{$t('settings.lemmy.hideSubmissions.deleted')}
|
||||
</Switch>
|
||||
<Switch bind:checked={$userSettings.hidePosts.removed}>
|
||||
Removed by Moderator
|
||||
{$t('settings.lemmy.hideSubmissions.removed')}
|
||||
</Switch>
|
||||
</div>
|
||||
</Setting>
|
||||
<ToggleSetting
|
||||
bind:checked={$userSettings.nsfwBlur}
|
||||
title="NSFW blur"
|
||||
description="Blur images and remove post bodies of content tagged NSFW."
|
||||
title={$t('settings.lemmy.nsfwBlur.title')}
|
||||
description={$t('settings.lemmy.nsfwBlur.description')}
|
||||
/>
|
||||
<Setting>
|
||||
<span slot="title">Show instances</span>
|
||||
<span slot="description">Show items' instances.</span>
|
||||
<span slot="title">{$t('settings.lemmy.instances.title')}</span>
|
||||
<span slot="description">
|
||||
{$t('settings.lemmy.instances.description')}
|
||||
</span>
|
||||
<div class="flex flex-row flex-wrap items-center gap-4">
|
||||
<Checkbox bind:checked={$userSettings.showInstances.user}>
|
||||
Users
|
||||
{$t('content.users')}
|
||||
</Checkbox>
|
||||
<Checkbox bind:checked={$userSettings.showInstances.comments}>
|
||||
Comments
|
||||
{$t('content.comments')}
|
||||
</Checkbox>
|
||||
<Checkbox bind:checked={$userSettings.showInstances.community}>
|
||||
Communities
|
||||
{$t('content.communities')}
|
||||
</Checkbox>
|
||||
</div>
|
||||
</Setting>
|
||||
</Section>
|
||||
|
||||
<Section title="Moderation">
|
||||
<Section title={$t('settings.moderation.title')}>
|
||||
<Setting mainClass="md:flex-row flex-col !items-start">
|
||||
<span slot="title">Removal reply presets</span>
|
||||
<span slot="title">{$t('settings.moderation.replyPresets.title')}</span>
|
||||
<span slot="description">
|
||||
<p>Presets to use for "Reply reason" in a submission removal.</p>
|
||||
<p>{$t('settings.moderation.replyPresets.description')}</p>
|
||||
<ul class="leading-6">
|
||||
<li>Syntax:</li>
|
||||
<li>{$t('settings.moderation.replyPresets.syntax')}</li>
|
||||
<li>
|
||||
<code>{'{{reason}}'}</code>
|
||||
: The provided reason
|
||||
</li>
|
||||
<li>
|
||||
<code>{'{{post}}'}</code>
|
||||
: The title of the post
|
||||
</li>
|
||||
<li>
|
||||
<code>{'{{community}}'}</code>
|
||||
: The community the submission was removed in.
|
||||
</li>
|
||||
<li>
|
||||
<code>{'{{username}}'}</code>
|
||||
: The username of the creator of the submission.
|
||||
</li>
|
||||
</ul>
|
||||
</span>
|
||||
@@ -371,11 +410,11 @@
|
||||
</Setting>
|
||||
</Section>
|
||||
|
||||
<Section title="Other">
|
||||
<Section title={$t('settings.other.title')}>
|
||||
<ToggleSetting
|
||||
bind:checked={$userSettings.debugInfo}
|
||||
title="Debug info"
|
||||
description="Display debug information"
|
||||
title={$t('settings.other.debug.title')}
|
||||
description={$t('settings.other.debug.description')}
|
||||
/>
|
||||
</Section>
|
||||
</div>
|
||||
@@ -21,6 +21,7 @@
|
||||
import { Button, TextInput } from 'mono-svelte'
|
||||
import { onMount } from 'svelte'
|
||||
import Avatar from '$lib/components/ui/Avatar.svelte'
|
||||
import { t } from '$lib/translations'
|
||||
|
||||
let selectedInstance: string = ''
|
||||
let validating: boolean = false
|
||||
@@ -64,7 +65,7 @@
|
||||
// ]
|
||||
} catch (e) {
|
||||
toast({
|
||||
content: 'Failed to fetch available instances.',
|
||||
content: $t('toast.failFetchInstances'),
|
||||
type: 'error',
|
||||
})
|
||||
}
|
||||
@@ -78,15 +79,14 @@
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>Sign up | Choose Instance</title>
|
||||
<title>{$t('form.signup.title')}</title>
|
||||
</svelte:head>
|
||||
|
||||
<div class="mx-auto max-w-xl flex flex-col gap-4 my-auto h-max w-full">
|
||||
<h1 class="font-bold text-4xl">Sign Up</h1>
|
||||
<p>Choose an instance that interests you, or type the URL manually.</p>
|
||||
<h1 class="font-bold text-4xl">{$t('form.signup.title')}</h1>
|
||||
<p>{$t('form.signup.description')}</p>
|
||||
<p>
|
||||
An instance is the server that your account will be hosted on, but you can
|
||||
still access and interact with content from other instances.
|
||||
{$t('form.signup.info')}
|
||||
</p>
|
||||
<Material color="distinct" class="h-64 overflow-auto">
|
||||
<div
|
||||
@@ -129,7 +129,7 @@
|
||||
goto(`/signup/${selectedInstance}`)
|
||||
} else {
|
||||
toast({
|
||||
content: 'Could not contact that instance URL',
|
||||
content: $t('toast.failInstanceURL'),
|
||||
type: 'error',
|
||||
})
|
||||
}
|
||||
@@ -140,7 +140,7 @@
|
||||
>
|
||||
<TextInput
|
||||
bind:value={selectedInstance}
|
||||
label="Choose an instance"
|
||||
label={$t('form.signup.chooseInstance')}
|
||||
required
|
||||
{placeholder}
|
||||
on:input={() => {
|
||||
@@ -154,7 +154,7 @@
|
||||
loading={validating}
|
||||
disabled={validating}
|
||||
>
|
||||
Go
|
||||
{$t('form.submit')}
|
||||
</Button>
|
||||
</form>
|
||||
</div>
|
||||
@@ -20,6 +20,8 @@
|
||||
XCircle,
|
||||
} from 'svelte-hero-icons'
|
||||
import { instance as currentInstance } from '$lib/instance.js'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import { t } from '$lib/translations.js'
|
||||
|
||||
export let data
|
||||
|
||||
@@ -67,7 +69,7 @@
|
||||
if (res?.jwt) {
|
||||
await setUser(res.jwt, $page.params.instance, username)
|
||||
|
||||
toast({ content: 'Successfully logged in.', type: 'success' })
|
||||
toast({ content: $t('toast.logIn'), type: 'success' })
|
||||
goto('/')
|
||||
} else if (
|
||||
res.verify_email_sent ||
|
||||
@@ -76,8 +78,7 @@
|
||||
currentInstance.set(instance)
|
||||
if (res.verify_email_sent) {
|
||||
toast({
|
||||
content:
|
||||
'A verification link was sent to your email. Verify your email, and then you can log in.',
|
||||
content: $t('toast.verifyEmail'),
|
||||
type: 'info',
|
||||
})
|
||||
}
|
||||
@@ -85,18 +86,17 @@
|
||||
data.site_view.local_site.registration_mode == 'RequireApplication'
|
||||
) {
|
||||
toast({
|
||||
content:
|
||||
'Please wait for your registration application to be approved before you can log in.',
|
||||
content: $t('toast.waitApplication'),
|
||||
type: 'info',
|
||||
})
|
||||
}
|
||||
goto('/')
|
||||
} else {
|
||||
throw new Error('Failed to sign up.')
|
||||
throw new Error($t('toast.failSignup'))
|
||||
}
|
||||
|
||||
toast({
|
||||
content: 'Signed up.',
|
||||
content: $t('toast.successSignup'),
|
||||
type: 'success',
|
||||
})
|
||||
} catch (err) {
|
||||
@@ -125,36 +125,39 @@
|
||||
</span>
|
||||
|
||||
{#if data.site_view.local_site.registration_mode != 'Closed'}
|
||||
<h1 class="font-bold text-3xl">Create account</h1>
|
||||
<Header>{$t('form.signup.title')}</Header>
|
||||
<TextInput
|
||||
bind:value={email}
|
||||
label="Email"
|
||||
label={$t('form.email')}
|
||||
required={data.site_view.local_site.require_email_verification}
|
||||
type="email"
|
||||
/>
|
||||
<TextInput bind:value={username} label="Username" required />
|
||||
<TextInput bind:value={username} label={$t('form.username')} required />
|
||||
<TextInput
|
||||
bind:value={password}
|
||||
label="Password"
|
||||
label={$t('form.password')}
|
||||
required
|
||||
type="password"
|
||||
/>
|
||||
<TextInput
|
||||
bind:value={passwordVerify}
|
||||
label="Confirm Password"
|
||||
label={$t('form.confirmPassword')}
|
||||
required
|
||||
type="password"
|
||||
/>
|
||||
{#if data.site_view.local_site.registration_mode == 'RequireApplication'}
|
||||
<Material class="dark:text-yellow-200 text-yellow-800 bg-yellow-500/20">
|
||||
<Icon src={ExclamationTriangle} mini size="20" />
|
||||
To join this instance, you must fill out this application, and wait to be
|
||||
accepted. You will receive an email if your application is accepted.
|
||||
{$t('form.signup.application.info')}
|
||||
</Material>
|
||||
{#if data.site_view.local_site.application_question}
|
||||
<Markdown source={data.site_view.local_site.application_question} />
|
||||
{/if}
|
||||
<MarkdownEditor label="Application" required bind:value={application} />
|
||||
<MarkdownEditor
|
||||
label={$t('form.signup.application.label')}
|
||||
required
|
||||
bind:value={application}
|
||||
/>
|
||||
{/if}
|
||||
{#if captchaRequired}
|
||||
<div>
|
||||
@@ -194,7 +197,7 @@
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
<Checkbox bind:checked={nsfw}>Show NSFW content</Checkbox>
|
||||
<Checkbox bind:checked={nsfw}>{$t('form.profile.showNSFW')}</Checkbox>
|
||||
<input type="dn" name="honeypot" bind:value={honeypot} class="hidden" />
|
||||
<Button
|
||||
submit
|
||||
@@ -204,17 +207,17 @@
|
||||
disabled={submitting}
|
||||
class="mt-auto"
|
||||
>
|
||||
Submit
|
||||
{$t('form.submit')}
|
||||
</Button>
|
||||
{:else}
|
||||
<div class="my-auto">
|
||||
<Placeholder
|
||||
icon={XCircle}
|
||||
title="Registrations closed"
|
||||
description="New account creation has been disabled on this instance."
|
||||
title={$t('form.signup.closed.title')}
|
||||
description={$t('form.signup.closed.description')}
|
||||
>
|
||||
<Button icon={Plus} href="https://join-lemmy.org">
|
||||
Find another instance
|
||||
<Button icon={Plus} href="/signup">
|
||||
{$t('form.signup.closed.anotherInstance')}
|
||||
</Button>
|
||||
</Placeholder>
|
||||
</div>
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
Icon,
|
||||
} from 'svelte-hero-icons'
|
||||
import ColorSwatch from './ColorSwatch.svelte'
|
||||
import { t } from '$lib/translations'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
|
||||
const c = defaultColors
|
||||
|
||||
@@ -36,22 +38,22 @@
|
||||
throw new Error('Import is empty')
|
||||
}
|
||||
$colors = JSON.parse(importText)
|
||||
toast({ content: 'Import successful', type: 'success' })
|
||||
toast({ content: $t('message.success'), type: 'success' })
|
||||
importing = false
|
||||
} catch (err) {
|
||||
// @ts-ignore
|
||||
toast({ content: err, type: 'error' })
|
||||
}
|
||||
}}
|
||||
title="Import"
|
||||
action="Import"
|
||||
title={$t('routes.theme.import')}
|
||||
action={$t('routes.theme.import')}
|
||||
>
|
||||
<TextArea bind:value={importText} style="font-family: monospace;" />
|
||||
</Modal>
|
||||
{/if}
|
||||
|
||||
<div class="flex flex-col gap-4 h-full">
|
||||
<h1 class="font-bold text-3xl">Theme</h1>
|
||||
<Header>Theme</Header>
|
||||
<div class="flex items-center gap-4">
|
||||
<Button
|
||||
on:click={() => {
|
||||
@@ -60,7 +62,7 @@
|
||||
size="lg"
|
||||
>
|
||||
<Icon src={ArrowUpTray} size="16" mini />
|
||||
Import
|
||||
{$t('routes.theme.import')}
|
||||
</Button>
|
||||
<Button
|
||||
on:click={() => {
|
||||
@@ -70,37 +72,37 @@
|
||||
size="lg"
|
||||
>
|
||||
<Icon src={ArrowDownTray} size="16" mini />
|
||||
Export
|
||||
{$t('routes.theme.export')}
|
||||
</Button>
|
||||
<Button
|
||||
on:click={() => {
|
||||
modal({
|
||||
actions: [
|
||||
action({
|
||||
content: 'Close',
|
||||
content: $t('common.cancel'),
|
||||
close: true,
|
||||
}),
|
||||
action({
|
||||
action: () => {
|
||||
$colors = { other: {}, primary: {}, zinc: {}, slate: {} }
|
||||
},
|
||||
content: 'Reset',
|
||||
content: $t('routes.theme.reset'),
|
||||
close: true,
|
||||
type: 'danger',
|
||||
}),
|
||||
],
|
||||
title: 'Reset Theme',
|
||||
body: 'This will reset all your colors to the default. We recommend exporting your theme first.',
|
||||
title: $t('routes.theme.resetWarning.title'),
|
||||
body: $t('routes.theme.resetWarning.description'),
|
||||
})
|
||||
}}
|
||||
size="lg"
|
||||
>
|
||||
<Icon src={ArrowPath} size="16" mini />
|
||||
Reset
|
||||
{$t('routes.theme.reset')}
|
||||
</Button>
|
||||
</div>
|
||||
<Material color="transparent" class="items-center gap-x-4 color-grid gap-y-2">
|
||||
<h1 class="text-2xl font-bold col-span-2">Accent</h1>
|
||||
<h1 class="text-2xl font-bold col-span-2">{$t('routes.theme.accent')}</h1>
|
||||
<ColorSwatch
|
||||
backgroundColor={defaultColors.primary[900]}
|
||||
bind:value={$colors.primary[900]}
|
||||
@@ -111,8 +113,12 @@
|
||||
bind:value={$colors.primary[100]}
|
||||
class="!w-12 !h-12 col-span-1"
|
||||
/>
|
||||
<span class="font-semibold text-base">Light</span>
|
||||
<span class="font-semibold text-base">Dark</span>
|
||||
<span class="font-semibold text-base">
|
||||
{$t('nav.menu.colorscheme.light')}
|
||||
</span>
|
||||
<span class="font-semibold text-base">
|
||||
{$t('nav.menu.colorscheme.dark')}
|
||||
</span>
|
||||
</Material>
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-2">
|
||||
{#each svelteIntellisenseSucks() as category}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
<script lang="ts">
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import { t } from '$lib/translations'
|
||||
import { Heart, Icon } from 'svelte-hero-icons'
|
||||
</script>
|
||||
|
||||
<Header class="mb-4">
|
||||
{$t('routes.translators')}
|
||||
</Header>
|
||||
<ul class="divide-y divide-slate-200 dark:divide-zinc-900 list">
|
||||
<li class="flex flex-col">
|
||||
<span class="font-bold text-lg">Estonian</span>
|
||||
<span>pewgar_seemsimandroid@lemmy.blahaj.zone</span>
|
||||
</li>
|
||||
<li class="flex flex-col">
|
||||
<span class="font-bold text-lg">French</span>
|
||||
<span>Blisterexe@lemmy.zip</span>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<style>
|
||||
.list > *:not(:first-child) {
|
||||
padding-top: 0.5rem;
|
||||
}
|
||||
.list > *:not(:last-child) {
|
||||
padding-bottom: 0.5rem;
|
||||
}
|
||||
</style>
|
||||
@@ -44,6 +44,7 @@
|
||||
import Expandable from '$lib/components/ui/Expandable.svelte'
|
||||
import { communityLink } from '$lib/lemmy/generic.js'
|
||||
import ItemList from '$lib/components/lemmy/generic/ItemList.svelte'
|
||||
import { t } from '$lib/translations.js'
|
||||
|
||||
export let data
|
||||
|
||||
@@ -69,7 +70,7 @@
|
||||
}
|
||||
|
||||
toast({
|
||||
content: `Successfully ${blocked ? 'unblocked' : 'blocked'} that user.`,
|
||||
content: blocked ? $t('toast.unblockUser') : $t('toast.blockUser'),
|
||||
type: 'success',
|
||||
})
|
||||
|
||||
@@ -98,14 +99,14 @@
|
||||
|
||||
async function purgeUser() {
|
||||
purgingUser = false
|
||||
const purgeToast = toast({ content: 'Purging user...', loading: true })
|
||||
const purgeToast = toast({ content: '', loading: true })
|
||||
|
||||
try {
|
||||
await client().purgePerson({
|
||||
person_id: data.person_view.person.id,
|
||||
})
|
||||
removeToast(purgeToast)
|
||||
toast({ content: 'Purged that user.', type: 'success' })
|
||||
toast({ content: $t('toast.purgeUser'), type: 'success' })
|
||||
} catch (e) {
|
||||
toast({ content: e as any, type: 'error' })
|
||||
}
|
||||
@@ -158,59 +159,7 @@
|
||||
alt="User banner"
|
||||
/>
|
||||
{/if}
|
||||
<div class="flex flex-col-reverse gap-4 max-w-full w-full">
|
||||
<div class="flex flex-col gap-4 max-w-full w-full min-w-0">
|
||||
<div class="flex flex-row gap-4 flex-wrap justify-between">
|
||||
<Select
|
||||
bind:value={data.sort}
|
||||
on:change={() => searchParam($page.url, 'sort', data.sort, 'page')}
|
||||
>
|
||||
<span slot="label" class="flex items-center gap-1">
|
||||
<Icon src={ChartBar} size="14" mini />
|
||||
Sort
|
||||
</span>
|
||||
<option value="New">New</option>
|
||||
<option value="TopAll">Top</option>
|
||||
<option value="Old">Old</option>
|
||||
</Select>
|
||||
<Select
|
||||
bind:value={data.type}
|
||||
on:change={() => searchParam($page.url, 'type', data.type, 'page')}
|
||||
>
|
||||
<span slot="label" class="flex items-center gap-1">
|
||||
<Icon src={AdjustmentsHorizontal} size="15" mini />
|
||||
Type
|
||||
</span>
|
||||
<option value="all">All</option>
|
||||
<option value="posts">Posts</option>
|
||||
<option value="comments">Comments</option>
|
||||
</Select>
|
||||
</div>
|
||||
{#if data.items.length == 0}
|
||||
<Placeholder
|
||||
icon={PencilSquare}
|
||||
title="No submissions"
|
||||
description="This user has no submissions that match this filter."
|
||||
/>
|
||||
{:else}
|
||||
<div
|
||||
class="!divide-y divide-slate-200 dark:divide-zinc-800 flex flex-col"
|
||||
>
|
||||
{#each data.items as item}
|
||||
{#if isCommentView(item) && (data.type == 'all' || data.type == 'comments')}
|
||||
<CommentItem comment={item} />
|
||||
{:else if !isCommentView(item) && (data.type == 'all' || data.type == 'posts')}
|
||||
<Post post={item} />
|
||||
{/if}
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
<Pageination
|
||||
page={data.page}
|
||||
on:change={(p) => searchParam($page.url, 'page', p.detail.toString())}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col gap-4 max-w-full w-full">
|
||||
<div class="flex flex-col gap-4">
|
||||
<Avatar
|
||||
width={64}
|
||||
@@ -237,12 +186,12 @@
|
||||
<LabelStat
|
||||
content={data.person_view.counts.post_count.toString()}
|
||||
formatted
|
||||
label="Posts"
|
||||
label={$t('content.posts')}
|
||||
/>
|
||||
<LabelStat
|
||||
content={data.person_view.counts.comment_count.toString()}
|
||||
formatted
|
||||
label="Comments"
|
||||
label={$t('content.comments')}
|
||||
/>
|
||||
</div>
|
||||
{#if (data.moderates ?? []).length > 0}
|
||||
@@ -252,7 +201,7 @@
|
||||
>
|
||||
<span slot="title" class="flex items-center gap-1">
|
||||
<ShieldIcon width={14} filled />
|
||||
Moderates
|
||||
{$t('routes.profile.moderates')}
|
||||
</span>
|
||||
<ItemList
|
||||
items={data.moderates.map((m) => ({
|
||||
@@ -324,4 +273,56 @@
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col gap-4 max-w-full w-full min-w-0">
|
||||
<div class="flex flex-row gap-4 flex-wrap justify-between">
|
||||
<Select
|
||||
bind:value={data.sort}
|
||||
on:change={() => searchParam($page.url, 'sort', data.sort, 'page')}
|
||||
>
|
||||
<span slot="label" class="flex items-center gap-1">
|
||||
<Icon src={ChartBar} size="14" mini />
|
||||
{$t('filter.sort.label')}
|
||||
</span>
|
||||
<option value="New">{$t('filter.sort.new')}</option>
|
||||
<option value="TopAll">{$t('filter.sort.top.label')}</option>
|
||||
<option value="Old">{$t('filter.sort.old')}</option>
|
||||
</Select>
|
||||
<Select
|
||||
bind:value={data.type}
|
||||
on:change={() => searchParam($page.url, 'type', data.type, 'page')}
|
||||
>
|
||||
<span slot="label" class="flex items-center gap-1">
|
||||
<Icon src={AdjustmentsHorizontal} size="15" mini />
|
||||
{$t('filter.type')}
|
||||
</span>
|
||||
<option value="all">{$t('content.all')}</option>
|
||||
<option value="posts">{$t('content.posts')}</option>
|
||||
<option value="comments">{$t('content.comments')}</option>
|
||||
</Select>
|
||||
</div>
|
||||
{#if data.items.length == 0}
|
||||
<Placeholder
|
||||
icon={PencilSquare}
|
||||
title="No submissions"
|
||||
description="This user has no submissions that match this filter."
|
||||
/>
|
||||
{:else}
|
||||
<div
|
||||
class="!divide-y divide-slate-200 dark:divide-zinc-800 flex flex-col"
|
||||
>
|
||||
{#each data.items as item}
|
||||
{#if isCommentView(item) && (data.type == 'all' || data.type == 'comments')}
|
||||
<CommentItem comment={item} />
|
||||
{:else if !isCommentView(item) && (data.type == 'all' || data.type == 'posts')}
|
||||
<Post post={item} />
|
||||
{/if}
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
<Pageination
|
||||
page={data.page}
|
||||
on:change={(p) => searchParam($page.url, 'page', p.detail.toString())}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,5 +1,6 @@
|
||||
<script>
|
||||
import { page } from '$app/stores'
|
||||
import { t } from '$lib/translations'
|
||||
import { XMark, Icon } from 'svelte-hero-icons'
|
||||
</script>
|
||||
|
||||
@@ -9,7 +10,9 @@
|
||||
>
|
||||
<Icon src={XMark} size="32" mini />
|
||||
</div>
|
||||
<h1 class="text-red-800 dark:text-red-300 text-2xl font-semibold">Error</h1>
|
||||
<p class="text-red-800 dark:text-red-300">Failed to verify your email.</p>
|
||||
<h1 class="text-red-800 dark:text-red-300 text-2xl font-semibold">
|
||||
{$t('message.error')}
|
||||
</h1>
|
||||
<p class="text-red-800 dark:text-red-300">{$t('routes.verifyEmail.error')}</p>
|
||||
<code>{$page.error?.message}</code>
|
||||
</div>
|
||||
@@ -1,5 +1,6 @@
|
||||
<script>
|
||||
import { LINKED_INSTANCE_URL } from '$lib/instance'
|
||||
import { t } from '$lib/translations'
|
||||
import { Check, Icon } from 'svelte-hero-icons'
|
||||
</script>
|
||||
|
||||
@@ -10,10 +11,10 @@
|
||||
<Icon src={Check} size="32" mini />
|
||||
</div>
|
||||
<h1 class="text-green-800 dark:text-green-200 text-2xl font-semibold">
|
||||
Success
|
||||
{$t('message.success')}
|
||||
</h1>
|
||||
<p class="text-green-800 dark:text-green-200">
|
||||
Your email was verified. You can safely close this window.
|
||||
{$t('routes.verifyEmail.message')}
|
||||
</p>
|
||||
{#if !LINKED_INSTANCE_URL}
|
||||
<p>
|
||||
|
||||
Reference in new issue
Block a user