i18n: localize toasts
This commit is contained in:
1 parent
b57baa3769
commit
e89d2aaddb
35 files changed
+169
-177
No files matched your search
@@ -51,11 +51,6 @@
|
|||||||
node.comment_view.comment.content = newComment
|
node.comment_view.comment.content = newComment
|
||||||
|
|
||||||
editing = false
|
editing = false
|
||||||
|
|
||||||
toast({
|
|
||||||
content: 'Successfully edited comment.',
|
|
||||||
type: 'success',
|
|
||||||
})
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
toast({
|
toast({
|
||||||
// @ts-ignore i hate this
|
// @ts-ignore i hate this
|
||||||
|
|||||||
@@ -41,10 +41,6 @@
|
|||||||
dispatch('comment', response)
|
dispatch('comment', response)
|
||||||
|
|
||||||
value = ''
|
value = ''
|
||||||
toast({
|
|
||||||
content: 'Your comment was submitted.',
|
|
||||||
type: 'success',
|
|
||||||
})
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
toast({
|
toast({
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
import { shouldShowVoteColor } from '../post/PostVote.svelte'
|
import { shouldShowVoteColor } from '../post/PostVote.svelte'
|
||||||
import { fly } from 'svelte/transition'
|
import { fly } from 'svelte/transition'
|
||||||
import { backOut } from 'svelte/easing'
|
import { backOut } from 'svelte/easing'
|
||||||
|
import { t } from '$lib/translations'
|
||||||
|
|
||||||
export let vote: number = 0
|
export let vote: number = 0
|
||||||
export let upvotes: number
|
export let upvotes: number
|
||||||
@@ -25,7 +26,7 @@
|
|||||||
|
|
||||||
const castVote = async (newVote: number) => {
|
const castVote = async (newVote: number) => {
|
||||||
if (!$profile?.jwt) {
|
if (!$profile?.jwt) {
|
||||||
toast({ content: 'You must be logged in to vote.', type: 'warning' })
|
toast({ content: $t('toast.loginVoteGate'), type: 'warning' })
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
import { Button } from 'mono-svelte'
|
import { Button } from 'mono-svelte'
|
||||||
import { afterNavigate } from '$app/navigation'
|
import { afterNavigate } from '$app/navigation'
|
||||||
import { backOut } from 'svelte/easing'
|
import { backOut } from 'svelte/easing'
|
||||||
|
import { t } from '$lib/translations'
|
||||||
|
|
||||||
export let nodes: CommentNodeI[]
|
export let nodes: CommentNodeI[]
|
||||||
export let isParent: boolean
|
export let isParent: boolean
|
||||||
@@ -62,7 +63,7 @@
|
|||||||
if (newComments.comments.length == 0) {
|
if (newComments.comments.length == 0) {
|
||||||
loadingChildren = false
|
loadingChildren = false
|
||||||
toast({
|
toast({
|
||||||
content: 'The API returned no comments.',
|
content: $t('toast.noComments'),
|
||||||
type: 'error',
|
type: 'error',
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
@@ -81,7 +82,7 @@
|
|||||||
parent.children = treeParent.children
|
parent.children = treeParent.children
|
||||||
if (treeParent.children.length == 0) {
|
if (treeParent.children.length == 0) {
|
||||||
toast({
|
toast({
|
||||||
content: 'The API returned no comments.',
|
content: $t('toast.noComments'),
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -90,7 +91,7 @@
|
|||||||
parent.children = tree
|
parent.children = tree
|
||||||
if (tree.length == 0) {
|
if (tree.length == 0) {
|
||||||
toast({
|
toast({
|
||||||
content: 'The API returned no comments.',
|
content: $t('toast.noComments'),
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -99,7 +100,7 @@
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
toast({
|
toast({
|
||||||
content: `Failed to fetch comments. ${error as any}`,
|
content: error as any,
|
||||||
type: 'error',
|
type: 'error',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,7 +84,7 @@
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const loading = toast({
|
const loading = toast({
|
||||||
content: `${blocked ? 'Unblocking' : 'blocking'} community...`,
|
content: ``,
|
||||||
loading: true,
|
loading: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -96,9 +96,9 @@
|
|||||||
removeToast(loading)
|
removeToast(loading)
|
||||||
|
|
||||||
toast({
|
toast({
|
||||||
content: `Successfully ${
|
content: blocked
|
||||||
blocked ? 'unblocked' : 'blocked'
|
? $t('toast.unblockedCommunity')
|
||||||
} that community.`,
|
: $t('toast.blockedCommunity'),
|
||||||
type: 'success',
|
type: 'success',
|
||||||
})
|
})
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -120,14 +120,14 @@
|
|||||||
|
|
||||||
async function purgeCommunity() {
|
async function purgeCommunity() {
|
||||||
purgingCommunity = false
|
purgingCommunity = false
|
||||||
const purgeToast = toast({ content: 'Purging community...', loading: true })
|
const purgeToast = toast({ content: '', loading: true })
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await client().purgeCommunity({
|
await client().purgeCommunity({
|
||||||
community_id: community_view.community.id,
|
community_id: community_view.community.id,
|
||||||
})
|
})
|
||||||
removeToast(purgeToast)
|
removeToast(purgeToast)
|
||||||
toast({ content: 'Purged that community.', type: 'success' })
|
toast({ content: $t('toast.purgedCommunity'), type: 'success' })
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
toast({ content: e as any, type: 'error' })
|
toast({ content: e as any, type: 'error' })
|
||||||
}
|
}
|
||||||
@@ -137,7 +137,7 @@
|
|||||||
if (!$profile?.jwt) return
|
if (!$profile?.jwt) return
|
||||||
try {
|
try {
|
||||||
const loading = toast({
|
const loading = toast({
|
||||||
content: `Blocking instance...`,
|
content: ``,
|
||||||
loading: true,
|
loading: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -160,14 +160,12 @@
|
|||||||
|
|
||||||
{#if purgingCommunity}
|
{#if purgingCommunity}
|
||||||
<Modal bind:open={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>
|
<p>
|
||||||
Purging community <span class="font-bold">
|
{$t('admin.purgeCommunity.warning')}
|
||||||
{community_view.community.title}
|
|
||||||
</span>
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
Are you sure you want to do this? (The button will enable in 3 seconds.)
|
|
||||||
</p>
|
</p>
|
||||||
<div class="flex flex-row gap-2">
|
<div class="flex flex-row gap-2">
|
||||||
<Button
|
<Button
|
||||||
@@ -175,7 +173,7 @@
|
|||||||
on:click={() => (purgingCommunity = false)}
|
on:click={() => (purgingCommunity = false)}
|
||||||
class="flex-1"
|
class="flex-1"
|
||||||
>
|
>
|
||||||
Cancel
|
{$t('common.cancel')}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
size="lg"
|
size="lg"
|
||||||
@@ -184,7 +182,7 @@
|
|||||||
disabled={!purgeEnabled}
|
disabled={!purgeEnabled}
|
||||||
class="flex-1"
|
class="flex-1"
|
||||||
>
|
>
|
||||||
Purge
|
{$t('admin.purge')}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
import { addSubscription } from '$lib/lemmy/user.js'
|
import { addSubscription } from '$lib/lemmy/user.js'
|
||||||
import { Button, Checkbox, TextInput } from 'mono-svelte'
|
import { Button, Checkbox, TextInput } from 'mono-svelte'
|
||||||
import { uploadImage } from '$lib/util.js'
|
import { uploadImage } from '$lib/util.js'
|
||||||
|
import { t } from '$lib/translations'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The community ID to edit.
|
* The community ID to edit.
|
||||||
@@ -68,7 +69,7 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
toast({
|
toast({
|
||||||
content: `Your community was ${edit ? 'saved' : 'created'}.`,
|
content: $t('toast.updatedCommunity'),
|
||||||
type: 'success',
|
type: 'success',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,10 @@
|
|||||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||||
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||||
import { getClient } from '$lib/lemmy.js'
|
import { getClient } from '$lib/lemmy.js'
|
||||||
|
import { t } from '$lib/translations'
|
||||||
import type { Person } from 'lemmy-js-client'
|
import type { Person } from 'lemmy-js-client'
|
||||||
import { Button, Modal, toast } from 'mono-svelte'
|
import { Button, Modal, toast } from 'mono-svelte'
|
||||||
|
import { Icon, PaperAirplane } from 'svelte-hero-icons'
|
||||||
|
|
||||||
export let open: boolean = false
|
export let open: boolean = false
|
||||||
export let user: Person
|
export let user: Person
|
||||||
@@ -25,7 +27,7 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
toast({
|
toast({
|
||||||
content: 'Successfully sent that person a message.',
|
content: $t('toast.sentMessage'),
|
||||||
type: 'success',
|
type: 'success',
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -45,16 +47,16 @@
|
|||||||
<h1 class="text-2xl font-bold" slot="title">Message</h1>
|
<h1 class="text-2xl font-bold" slot="title">Message</h1>
|
||||||
<form on:submit|preventDefault={sendMessage} class="flex flex-col gap-4">
|
<form on:submit|preventDefault={sendMessage} class="flex flex-col gap-4">
|
||||||
<p class="inline-flex flex-row gap-2 items-center">
|
<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>
|
</p>
|
||||||
<MarkdownEditor
|
<MarkdownEditor
|
||||||
bind:value={message}
|
bind:value={message}
|
||||||
label="Message"
|
label={$t('content.message')}
|
||||||
placeholder="your hair looks nice today"
|
|
||||||
rows={4}
|
rows={4}
|
||||||
/>
|
/>
|
||||||
<Button color="primary" size="lg" submit {loading} disabled={loading}>
|
<Button color="primary" size="lg" submit {loading} disabled={loading}>
|
||||||
Send
|
{$t('common.send')}
|
||||||
</Button>
|
</Button>
|
||||||
</form>
|
</form>
|
||||||
</Modal>
|
</Modal>
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
date = Date.parse(expires)
|
date = Date.parse(expires)
|
||||||
if (Number.isNaN(date)) {
|
if (Number.isNaN(date)) {
|
||||||
toast({
|
toast({
|
||||||
content: 'Invalid date. It must be an absolute date.',
|
content: $t('toast.invalidDateAbsolute'),
|
||||||
type: 'error',
|
type: 'error',
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
|
|
||||||
if (date < Date.now()) {
|
if (date < Date.now()) {
|
||||||
toast({
|
toast({
|
||||||
content: 'Invalid date. It is before the current time.',
|
content: $t('toast.invalidDateBeforeCurrent'),
|
||||||
type: 'error',
|
type: 'error',
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -84,9 +84,7 @@
|
|||||||
open = false
|
open = false
|
||||||
|
|
||||||
toast({
|
toast({
|
||||||
content: `Successfully ${
|
content: banned ? $t('toast.unbannedUser') : $t('toast.bannedUser'),
|
||||||
banned ? 'unbanned' : 'banned'
|
|
||||||
} that user. You may need to refresh to see changes.`,
|
|
||||||
type: 'success',
|
type: 'success',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -107,16 +107,7 @@
|
|||||||
<PostBody body={post.post.body} {view} style="grid-area: body" />
|
<PostBody body={post.post.body} {view} style="grid-area: body" />
|
||||||
{/if}
|
{/if}
|
||||||
{#if actions}
|
{#if actions}
|
||||||
<PostActions
|
<PostActions bind:post style="grid-area: actions;" />
|
||||||
bind:post
|
|
||||||
on:edit={(e) => {
|
|
||||||
toast({
|
|
||||||
content: 'The post was edited successfully.',
|
|
||||||
type: 'success',
|
|
||||||
})
|
|
||||||
}}
|
|
||||||
style="grid-area: actions;"
|
|
||||||
/>
|
|
||||||
{:else if view == 'compact'}
|
{:else if view == 'compact'}
|
||||||
<div class="flex flex-row items-center gap-2 text-sm">
|
<div class="flex flex-row items-center gap-2 text-sm">
|
||||||
<Badge>
|
<Badge>
|
||||||
|
|||||||
@@ -86,7 +86,7 @@
|
|||||||
if (!data.community && !edit) {
|
if (!data.community && !edit) {
|
||||||
toast({
|
toast({
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
content: 'You need to set a community.',
|
content: $t('toast.needCommunity'),
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -96,7 +96,7 @@
|
|||||||
new URL(data.url)
|
new URL(data.url)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
toast({
|
toast({
|
||||||
content: 'Invalid URL',
|
content: $t('toast.invalidURL'),
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
@@ -171,14 +171,14 @@
|
|||||||
.join('\n')
|
.join('\n')
|
||||||
|
|
||||||
toast({
|
toast({
|
||||||
content: `Generated title and body from that website. Would you like to undo this action?`,
|
content: $t('toast.generatedTitle'),
|
||||||
type: 'info',
|
type: 'info',
|
||||||
action: () => (data = oldData),
|
action: () => (data = oldData),
|
||||||
duration: 15 * 1000,
|
duration: 15 * 1000,
|
||||||
})
|
})
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
toast({
|
toast({
|
||||||
content: 'There was no usable title or description of that website.',
|
content: $t('toast.failGenerateTitle'),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
generation.loading = false
|
generation.loading = false
|
||||||
@@ -328,7 +328,7 @@
|
|||||||
{#if !edit}
|
{#if !edit}
|
||||||
<Button
|
<Button
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
toast({ content: 'Restored from draft' })
|
toast({ content: $t('toast.restoredFromDraft') })
|
||||||
const draft = getSessionStorage('postDraft')
|
const draft = getSessionStorage('postDraft')
|
||||||
if (draft && !edit) {
|
if (draft && !edit) {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
import { site } from '$lib/lemmy.js'
|
import { site } from '$lib/lemmy.js'
|
||||||
import { fly } from 'svelte/transition'
|
import { fly } from 'svelte/transition'
|
||||||
import { backOut } from 'svelte/easing'
|
import { backOut } from 'svelte/easing'
|
||||||
|
import { t } from '$lib/translations'
|
||||||
|
|
||||||
export let post: Post
|
export let post: Post
|
||||||
export let vote: number = 0
|
export let vote: number = 0
|
||||||
@@ -42,7 +43,7 @@
|
|||||||
|
|
||||||
const castVote = async (newVote: number) => {
|
const castVote = async (newVote: number) => {
|
||||||
if (!$profile?.jwt) {
|
if (!$profile?.jwt) {
|
||||||
toast({ content: 'You must be logged in to vote.', type: 'warning' })
|
toast({ content: $t('toast.loginVoteGate'), type: 'warning' })
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
loading = true
|
loading = true
|
||||||
|
|||||||
@@ -168,7 +168,7 @@
|
|||||||
class="hover:brightness-110 transition-all"
|
class="hover:brightness-110 transition-all"
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
navigator?.clipboard?.writeText(__VERSION__)
|
navigator?.clipboard?.writeText(__VERSION__)
|
||||||
toast({ content: 'Copied version to clipboard.' })
|
toast({ content: $t('toast.copied') })
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Badge color="blue-subtle">{__VERSION__}</Badge>
|
<Badge color="blue-subtle">{__VERSION__}</Badge>
|
||||||
|
|||||||
+65
-3
@@ -347,7 +347,11 @@
|
|||||||
"admin": {
|
"admin": {
|
||||||
"purge": "Purge",
|
"purge": "Purge",
|
||||||
"instance": "Instance",
|
"instance": "Instance",
|
||||||
"label": "Administration"
|
"label": "Administration",
|
||||||
|
"purgeCommunity": {
|
||||||
|
"title": "Purging Community",
|
||||||
|
"warning": "This will delete all posts. Are you sure? (The button will enable in 3 seconds.)"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"content": {
|
"content": {
|
||||||
"all": "All",
|
"all": "All",
|
||||||
@@ -355,7 +359,8 @@
|
|||||||
"posts": "Posts",
|
"posts": "Posts",
|
||||||
"comments": "Comments",
|
"comments": "Comments",
|
||||||
"communities": "Communities",
|
"communities": "Communities",
|
||||||
"instances": "Instances"
|
"instances": "Instances",
|
||||||
|
"message": "Message"
|
||||||
},
|
},
|
||||||
"post": {
|
"post": {
|
||||||
"actions": {
|
"actions": {
|
||||||
@@ -440,10 +445,67 @@
|
|||||||
"disabled": "Disabled",
|
"disabled": "Disabled",
|
||||||
"enable": "Enable",
|
"enable": "Enable",
|
||||||
"disable": "Disable",
|
"disable": "Disable",
|
||||||
"add": "Add"
|
"add": "Add",
|
||||||
|
"cancel": "Cancel",
|
||||||
|
"send": "Send"
|
||||||
},
|
},
|
||||||
"message": {
|
"message": {
|
||||||
"success": "Success",
|
"success": "Success",
|
||||||
"error": "Error"
|
"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."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -44,37 +44,6 @@
|
|||||||
let newInstance: string = $profileData.defaultInstance ?? DEFAULT_INSTANCE_URL
|
let newInstance: string = $profileData.defaultInstance ?? DEFAULT_INSTANCE_URL
|
||||||
let loading = false
|
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 debugging = false
|
||||||
let debugProfile: Profile | undefined = undefined
|
let debugProfile: Profile | undefined = undefined
|
||||||
|
|
||||||
@@ -161,25 +130,6 @@
|
|||||||
Sign up
|
Sign up
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</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>
|
||||||
</div>
|
</div>
|
||||||
{:else}
|
{:else}
|
||||||
|
|||||||
@@ -51,9 +51,9 @@
|
|||||||
registrationApplicationAnswer
|
registrationApplicationAnswer
|
||||||
)
|
)
|
||||||
toast({
|
toast({
|
||||||
content: `Successfully ${
|
content: approve
|
||||||
approve ? 'approved' : 'denied'
|
? $t('toast.approvedApplication')
|
||||||
} that application.`,
|
: $t('toast.deniedApplication'),
|
||||||
type: 'success',
|
type: 'success',
|
||||||
})
|
})
|
||||||
application.creator_local_user.accepted_application = approve
|
application.creator_local_user.accepted_application = approve
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
...formData,
|
...formData,
|
||||||
})
|
})
|
||||||
toast({
|
toast({
|
||||||
content: 'Updated your site.',
|
content: $t('toast.updatedSite'),
|
||||||
type: 'success',
|
type: 'success',
|
||||||
})
|
})
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
@@ -109,7 +109,7 @@
|
|||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
toast({
|
toast({
|
||||||
content: 'Edited your site.',
|
content: $t('toast.updatedSite'),
|
||||||
type: 'success',
|
type: 'success',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -127,8 +127,7 @@
|
|||||||
if (!data.federated_instances?.federated_instances?.blocked)
|
if (!data.federated_instances?.federated_instances?.blocked)
|
||||||
throw new Error('Missing instance')
|
throw new Error('Missing instance')
|
||||||
const content = e.target?.result
|
const content = e.target?.result
|
||||||
if (!content)
|
if (!content) toast({ content: $t('toast.failCSV'), type: 'warning' })
|
||||||
toast({ content: 'No content in that file', type: 'warning' })
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const instances: Instance[] = []
|
const instances: Instance[] = []
|
||||||
@@ -152,12 +151,12 @@
|
|||||||
|
|
||||||
data.federated_instances.federated_instances.blocked = instances
|
data.federated_instances.federated_instances.blocked = instances
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
toast({ content: err as 'Failed to parse CSV', type: 'error' })
|
toast({ content: $t('toast.failCSV'), type: 'error' })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
reader.onerror = (e) =>
|
reader.onerror = (e) =>
|
||||||
toast({ content: 'Failed to read file.', type: 'error' })
|
toast({ content: $t('toast.failCSV'), type: 'error' })
|
||||||
|
|
||||||
reader.readAsText(files[0])
|
reader.readAsText(files[0])
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
taglines: taglines,
|
taglines: taglines,
|
||||||
})
|
})
|
||||||
toast({
|
toast({
|
||||||
content: 'Successfully saved taglines.',
|
content: $t('toast.updatedSite'),
|
||||||
type: 'success',
|
type: 'success',
|
||||||
})
|
})
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
async function removeAdmin(id: number, confirm: boolean): Promise<any> {
|
async function removeAdmin(id: number, confirm: boolean): Promise<any> {
|
||||||
if (!confirm)
|
if (!confirm)
|
||||||
return toast({
|
return toast({
|
||||||
content: 'Are you sure you want to remove that admin?',
|
content: $t('toast.removeAdminWarning'),
|
||||||
action: () => removeAdmin(id, true),
|
action: () => removeAdmin(id, true),
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
if (result) {
|
if (result) {
|
||||||
data.site!.admins = result.admins
|
data.site!.admins = result.admins
|
||||||
toast({
|
toast({
|
||||||
content: 'Removed that admin.',
|
content: $t('toast.removeAdmin'),
|
||||||
type: 'success',
|
type: 'success',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||||
import { profile } from '$lib/auth'
|
import { profile } from '$lib/auth'
|
||||||
import { addResumable } from '$lib/lemmy/item.js'
|
import { addResumable } from '$lib/lemmy/item.js'
|
||||||
|
import { t } from '$lib/translations.js'
|
||||||
|
|
||||||
export let data
|
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"
|
class="dark:text-zinc-400 text-slate-600 text-sm text-left"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
import { getClient } from '$lib/lemmy.js'
|
import { getClient } from '$lib/lemmy.js'
|
||||||
import { flip } from 'svelte/animate'
|
import { flip } from 'svelte/animate'
|
||||||
import { Button, TextInput } from 'mono-svelte'
|
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
|
export let data: PageData
|
||||||
|
|
||||||
@@ -37,14 +39,14 @@
|
|||||||
data.community.moderators = addModRes.moderators
|
data.community.moderators = addModRes.moderators
|
||||||
|
|
||||||
toast({
|
toast({
|
||||||
content: 'Added that user as a moderator.',
|
content: $t('toast.addMod'),
|
||||||
type: 'success',
|
type: 'success',
|
||||||
})
|
})
|
||||||
|
|
||||||
formData.newModerator = ''
|
formData.newModerator = ''
|
||||||
} else {
|
} else {
|
||||||
toast({
|
toast({
|
||||||
content: 'Could not find that user.',
|
content: $t('toast.failFindUser'),
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -71,7 +73,7 @@
|
|||||||
data.community.moderators = res.moderators
|
data.community.moderators = res.moderators
|
||||||
|
|
||||||
toast({
|
toast({
|
||||||
content: 'Successfully updated community moderators.',
|
content: $t('toast.updateMods'),
|
||||||
type: 'success',
|
type: 'success',
|
||||||
})
|
})
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -83,11 +85,7 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:head>
|
<Header>Moderators</Header>
|
||||||
<title>Moderator Team</title>
|
|
||||||
</svelte:head>
|
|
||||||
|
|
||||||
<h1 class="text-2xl font-bold">Moderators</h1>
|
|
||||||
<EditableList
|
<EditableList
|
||||||
let:action
|
let:action
|
||||||
on:action={(e) => {
|
on:action={(e) => {
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
subscribing = false
|
subscribing = false
|
||||||
return res
|
return res
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
toast({ content: 'Failed to subscribe to community', type: 'error' })
|
toast({ content: error as any, type: 'error' })
|
||||||
}
|
}
|
||||||
|
|
||||||
subscribing = false
|
subscribing = false
|
||||||
|
|||||||
@@ -48,7 +48,7 @@
|
|||||||
const result = await setUser(response.jwt, data.instance, data.username)
|
const result = await setUser(response.jwt, data.instance, data.username)
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
toast({ content: 'Successfully logged in.', type: 'success' })
|
toast({ content: $t('toast.logIn'), type: 'success' })
|
||||||
goto('/')
|
goto('/')
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
async function addGuest() {
|
async function addGuest() {
|
||||||
form.loading = true
|
form.loading = true
|
||||||
if (!(await validateInstance(form.instance))) {
|
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
|
form.loading = false
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
toast({ content: 'Added that account.', type: 'success' })
|
toast({ content: $t('toast.addAccount'), type: 'success' })
|
||||||
|
|
||||||
goto('/')
|
goto('/')
|
||||||
|
|
||||||
|
|||||||
@@ -16,14 +16,14 @@
|
|||||||
loading = true
|
loading = true
|
||||||
try {
|
try {
|
||||||
if (!(await validateInstance(instance)))
|
if (!(await validateInstance(instance)))
|
||||||
throw new Error('Failed to contact instance url')
|
throw new Error($t('toast.failInstanceURL'))
|
||||||
|
|
||||||
await getClient(instance).passwordReset({
|
await getClient(instance).passwordReset({
|
||||||
email: email,
|
email: email,
|
||||||
})
|
})
|
||||||
|
|
||||||
toast({
|
toast({
|
||||||
content: 'A password reset link was sent to your email.',
|
content: $t('toast.resetLink'),
|
||||||
type: 'success',
|
type: 'success',
|
||||||
})
|
})
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
@@ -34,9 +34,9 @@
|
|||||||
item.resolved = res.comment_report_view.comment_report.resolved
|
item.resolved = res.comment_report_view.comment_report.resolved
|
||||||
|
|
||||||
toast({
|
toast({
|
||||||
content: `${
|
content: item.resolved
|
||||||
item.resolved ? 'Resolved' : 'Unresolved'
|
? $t('toast.resolveReport')
|
||||||
} that report.`,
|
: $t('toast.unresolveReport'),
|
||||||
type: 'success',
|
type: 'success',
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -50,9 +50,9 @@
|
|||||||
|
|
||||||
item.resolved = res.post_report_view.post_report.resolved
|
item.resolved = res.post_report_view.post_report.resolved
|
||||||
toast({
|
toast({
|
||||||
content: `${
|
content: item.resolved
|
||||||
item.resolved ? 'Resolved' : 'Unresolved'
|
? $t('toast.resolveReport')
|
||||||
} that report.`,
|
: $t('toast.unresolveReport'),
|
||||||
type: 'success',
|
type: 'success',
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -67,9 +67,9 @@
|
|||||||
item.resolved =
|
item.resolved =
|
||||||
res.private_message_report_view.private_message_report.resolved
|
res.private_message_report_view.private_message_report.resolved
|
||||||
toast({
|
toast({
|
||||||
content: `${
|
content: item.resolved
|
||||||
item.resolved ? 'Resolved' : 'Unresolved'
|
? $t('toast.resolveReport')
|
||||||
} that report.`,
|
: $t('toast.unresolveReport'),
|
||||||
type: 'success',
|
type: 'success',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
loading = true
|
loading = true
|
||||||
try {
|
try {
|
||||||
if (!(await validateInstance(instance)))
|
if (!(await validateInstance(instance)))
|
||||||
throw new Error('Failed to contact instance url')
|
throw new Error($t('toast.failInstanceURL'))
|
||||||
|
|
||||||
await getClient(instance).passwordChangeAfterReset({
|
await getClient(instance).passwordChangeAfterReset({
|
||||||
password: password,
|
password: password,
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
toast({
|
toast({
|
||||||
content: 'Your password was reset.',
|
content: $t('toast.passwordReset'),
|
||||||
type: 'success',
|
type: 'success',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -82,7 +82,7 @@
|
|||||||
|
|
||||||
const fetchOnHome = async (jwt: string) => {
|
const fetchOnHome = async (jwt: string) => {
|
||||||
const id = toast({
|
const id = toast({
|
||||||
content: 'Attempting to fetch this post on your home instance...',
|
content: $t('toast.fetchPostOnHome'),
|
||||||
loading: true,
|
loading: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -41,12 +41,12 @@
|
|||||||
await setUser(res.jwt, instance, username!)
|
await setUser(res.jwt, instance, username!)
|
||||||
$currentInstance = instance
|
$currentInstance = instance
|
||||||
|
|
||||||
toast({ content: 'Your login was refreshed.', type: 'success' })
|
toast({ content: $t('toast.loginRefresh'), type: 'success' })
|
||||||
} else {
|
} 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) {
|
} catch (e) {
|
||||||
toast({
|
toast({
|
||||||
content: e as any,
|
content: e as any,
|
||||||
@@ -139,7 +139,7 @@
|
|||||||
on:click={() => {
|
on:click={() => {
|
||||||
if (!totpLink) return
|
if (!totpLink) return
|
||||||
navigator.clipboard?.writeText(totpLink)
|
navigator.clipboard?.writeText(totpLink)
|
||||||
toast({ content: 'Copied to clipboard.' })
|
toast({ content: $t('toast.copied') })
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Icon src={ClipboardDocument} size="20" mini />
|
<Icon src={ClipboardDocument} size="20" mini />
|
||||||
|
|||||||
@@ -41,8 +41,7 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
toast({
|
toast({
|
||||||
content:
|
content: $t('toast.saveSettings'),
|
||||||
'Saved your user settings. If you changed your email, a verification email will have been sent.',
|
|
||||||
type: 'success',
|
type: 'success',
|
||||||
})
|
})
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -65,21 +64,21 @@
|
|||||||
switch (level) {
|
switch (level) {
|
||||||
case 0: {
|
case 0: {
|
||||||
toast({
|
toast({
|
||||||
content: 'Are you sure you want to delete your account?',
|
content: $t('toast.confirmDelete1'),
|
||||||
action: () => deleteAccount(1),
|
action: () => deleteAccount(1),
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
case 1: {
|
case 1: {
|
||||||
toast({
|
toast({
|
||||||
content: 'Are you really sure?',
|
content: $t('toast.confirmDelete2'),
|
||||||
action: () => deleteAccount(2),
|
action: () => deleteAccount(2),
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
case 2: {
|
case 2: {
|
||||||
toast({
|
toast({
|
||||||
content: 'Final warning. Are you reeeeeeally sure?',
|
content: $t('toast.confirmDelete3'),
|
||||||
action: () => deleteAccount(3),
|
action: () => deleteAccount(3),
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
@@ -93,13 +92,13 @@
|
|||||||
|
|
||||||
if (!(deletion.password || null)) {
|
if (!(deletion.password || null)) {
|
||||||
toast({
|
toast({
|
||||||
content: 'You must provide your password.',
|
content: $t('toast.needPassword'),
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const id = toast({
|
const id = toast({
|
||||||
content: 'You did this. Deleting account...',
|
content: $t('toast.deleting'),
|
||||||
loading: true,
|
loading: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -121,7 +120,7 @@
|
|||||||
|
|
||||||
setUserID(-1)
|
setUserID(-1)
|
||||||
toast({
|
toast({
|
||||||
content: 'Your account was deleted.',
|
content: $t('toast.deleted'),
|
||||||
})
|
})
|
||||||
goto('/')
|
goto('/')
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
import { removeItem } from '$lib/util.js'
|
import { removeItem } from '$lib/util.js'
|
||||||
import Section from './Section.svelte'
|
import Section from './Section.svelte'
|
||||||
import ToggleSetting from './ToggleSetting.svelte'
|
import ToggleSetting from './ToggleSetting.svelte'
|
||||||
import { locales } from '$lib/translations'
|
import { locales, t } from '$lib/translations'
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:head>
|
<svelte:head>
|
||||||
@@ -43,7 +43,7 @@
|
|||||||
Settings <Button
|
Settings <Button
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
toast({
|
toast({
|
||||||
content: 'Are you sure you want to reset your settings to the default?',
|
content: $t('toast.resetSettings'),
|
||||||
action: () => ($userSettings = defaultSettings),
|
action: () => ($userSettings = defaultSettings),
|
||||||
})
|
})
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -65,7 +65,7 @@
|
|||||||
// ]
|
// ]
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
toast({
|
toast({
|
||||||
content: 'Failed to fetch available instances.',
|
content: $t('toast.failFetchInstances'),
|
||||||
type: 'error',
|
type: 'error',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -129,7 +129,7 @@
|
|||||||
goto(`/signup/${selectedInstance}`)
|
goto(`/signup/${selectedInstance}`)
|
||||||
} else {
|
} else {
|
||||||
toast({
|
toast({
|
||||||
content: 'Could not contact that instance URL',
|
content: $t('toast.failInstanceURL'),
|
||||||
type: 'error',
|
type: 'error',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,7 +69,7 @@
|
|||||||
if (res?.jwt) {
|
if (res?.jwt) {
|
||||||
await setUser(res.jwt, $page.params.instance, username)
|
await setUser(res.jwt, $page.params.instance, username)
|
||||||
|
|
||||||
toast({ content: 'Successfully logged in.', type: 'success' })
|
toast({ content: $t('toast.logIn'), type: 'success' })
|
||||||
goto('/')
|
goto('/')
|
||||||
} else if (
|
} else if (
|
||||||
res.verify_email_sent ||
|
res.verify_email_sent ||
|
||||||
@@ -78,8 +78,7 @@
|
|||||||
currentInstance.set(instance)
|
currentInstance.set(instance)
|
||||||
if (res.verify_email_sent) {
|
if (res.verify_email_sent) {
|
||||||
toast({
|
toast({
|
||||||
content:
|
content: $t('toast.verifyEmail'),
|
||||||
'A verification link was sent to your email. Verify your email, and then you can log in.',
|
|
||||||
type: 'info',
|
type: 'info',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -87,18 +86,17 @@
|
|||||||
data.site_view.local_site.registration_mode == 'RequireApplication'
|
data.site_view.local_site.registration_mode == 'RequireApplication'
|
||||||
) {
|
) {
|
||||||
toast({
|
toast({
|
||||||
content:
|
content: $t('toast.waitApplication'),
|
||||||
'Please wait for your registration application to be approved before you can log in.',
|
|
||||||
type: 'info',
|
type: 'info',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
goto('/')
|
goto('/')
|
||||||
} else {
|
} else {
|
||||||
throw new Error('Failed to sign up.')
|
throw new Error($t('toast.failSignup'))
|
||||||
}
|
}
|
||||||
|
|
||||||
toast({
|
toast({
|
||||||
content: 'Signed up.',
|
content: $t('toast.successSignup'),
|
||||||
type: 'success',
|
type: 'success',
|
||||||
})
|
})
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
Icon,
|
Icon,
|
||||||
} from 'svelte-hero-icons'
|
} from 'svelte-hero-icons'
|
||||||
import ColorSwatch from './ColorSwatch.svelte'
|
import ColorSwatch from './ColorSwatch.svelte'
|
||||||
|
import { t } from '$lib/translations'
|
||||||
|
|
||||||
const c = defaultColors
|
const c = defaultColors
|
||||||
|
|
||||||
@@ -36,7 +37,7 @@
|
|||||||
throw new Error('Import is empty')
|
throw new Error('Import is empty')
|
||||||
}
|
}
|
||||||
$colors = JSON.parse(importText)
|
$colors = JSON.parse(importText)
|
||||||
toast({ content: 'Import successful', type: 'success' })
|
toast({ content: $t('message.success'), type: 'success' })
|
||||||
importing = false
|
importing = false
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
|||||||
@@ -70,7 +70,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
toast({
|
toast({
|
||||||
content: `Successfully ${blocked ? 'unblocked' : 'blocked'} that user.`,
|
content: blocked ? $t('toast.unblockUser') : $t('toast.blockUser'),
|
||||||
type: 'success',
|
type: 'success',
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -99,14 +99,14 @@
|
|||||||
|
|
||||||
async function purgeUser() {
|
async function purgeUser() {
|
||||||
purgingUser = false
|
purgingUser = false
|
||||||
const purgeToast = toast({ content: 'Purging user...', loading: true })
|
const purgeToast = toast({ content: '', loading: true })
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await client().purgePerson({
|
await client().purgePerson({
|
||||||
person_id: data.person_view.person.id,
|
person_id: data.person_view.person.id,
|
||||||
})
|
})
|
||||||
removeToast(purgeToast)
|
removeToast(purgeToast)
|
||||||
toast({ content: 'Purged that user.', type: 'success' })
|
toast({ content: $t('toast.purgeUser'), type: 'success' })
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
toast({ content: e as any, type: 'error' })
|
toast({ content: e as any, type: 'error' })
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user