Merge pull request #640 from Xyphyn/profile-exp-fixes
design: update profiles/user experience
This commit is contained in:
91 files changed
+2036
-2189
No files matched your search
+2
-1
@@ -1 +1,2 @@
|
||||
*.json
|
||||
*.json
|
||||
app.html
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"i18n-ally.localesPaths": [
|
||||
"src/lib/i18n",
|
||||
"src/routes/inbox/messages"
|
||||
]
|
||||
}
|
||||
@@ -28,6 +28,7 @@ export default ts.config(
|
||||
'svelte/require-each-key': 'off',
|
||||
'svelte/prefer-writable-derived': 'off',
|
||||
'no-console': 'off',
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "photon-lemmy",
|
||||
"version": "2.0.1",
|
||||
"version": "2.0.2",
|
||||
"license": "AGPL-3.0-only",
|
||||
"devDependencies": {
|
||||
"@dicebear/core": "^8.0.1",
|
||||
|
||||
+3
-28
@@ -5,40 +5,15 @@
|
||||
<link rel="icon" href="%sveltekit.assets%/img/logo-background.svg" />
|
||||
<link rel="manifest" href="/manifest.json" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="keywords" content="lemmy, client" />
|
||||
%sveltekit.head%
|
||||
</head>
|
||||
<body>
|
||||
<div
|
||||
style="
|
||||
z-index: -50;
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
color: #fafafe;
|
||||
"
|
||||
style="z-index:-50;position:absolute;inset:0;display:grid;place-items:center; "
|
||||
>
|
||||
<svg
|
||||
width="40"
|
||||
height="40"
|
||||
viewBox="15 15 70 70"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
fill="currentColor"
|
||||
>
|
||||
<path
|
||||
d="M45 20.8868C48.094 19.1004 51.906 19.1004 55 20.8868L72.7128 31.1132C75.8068 32.8996 77.7128 36.2008 77.7128 39.7735V60.2265C77.7128 63.7992 75.8068 67.1004 72.7128 68.8867L55 79.1133C51.906 80.8996 48.094 80.8996 45 79.1133L27.2872 68.8867C24.1932 67.1004 22.2872 63.7992 22.2872 60.2265V39.7735C22.2872 36.2008 24.1932 32.8996 27.2872 31.1132L45 20.8868Z"
|
||||
/>
|
||||
</svg>
|
||||
<svg width="50" height="50"><use width="50" height="50" xlink:href='/img/logo-isolated.svg' href="/img/logo-isolated.svg"></use></svg>
|
||||
</div>
|
||||
<div
|
||||
style="
|
||||
display: contents;
|
||||
flex-direction: column;
|
||||
display: flex;
|
||||
min-height: 100vh;
|
||||
"
|
||||
>
|
||||
<div style="display: contents;">
|
||||
%sveltekit.body%
|
||||
</div>
|
||||
</body>
|
||||
|
||||
@@ -237,7 +237,7 @@ class Profile {
|
||||
|
||||
const id = Math.max(...this.meta.profiles.map(p => p.id)) + 1
|
||||
this.meta.profile = id
|
||||
this.meta.profiles.push({
|
||||
this.meta.profiles.unshift({
|
||||
id: id,
|
||||
instance: instance,
|
||||
jwt: jwt,
|
||||
|
||||
+58
-67
@@ -1,17 +1,15 @@
|
||||
<script lang="ts">
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import ProgressBar from '$lib/components/ui/ProgressBar.svelte'
|
||||
import { errorMessage } from '$lib/lemmy/error'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { errorMessage } from '$lib/lemmy/error'
|
||||
import { uploadImage } from '$lib/util.svelte.js'
|
||||
import { toast } from 'mono-svelte'
|
||||
import { Button, Modal } from 'mono-svelte'
|
||||
import { Button, toast } from 'mono-svelte'
|
||||
import { DocumentPlus, Icon } from 'svelte-hero-icons'
|
||||
import { expoOut } from 'svelte/easing'
|
||||
import { slide } from 'svelte/transition'
|
||||
|
||||
interface Props {
|
||||
open: boolean
|
||||
image?: FileList | null
|
||||
preview?: boolean
|
||||
multiple?: boolean
|
||||
@@ -19,7 +17,6 @@
|
||||
}
|
||||
|
||||
let {
|
||||
open = $bindable(),
|
||||
image = $bindable(null),
|
||||
preview = true,
|
||||
multiple = true,
|
||||
@@ -57,7 +54,6 @@
|
||||
|
||||
onupload?.(uploaded)
|
||||
progress = 1
|
||||
open = false
|
||||
} catch (err) {
|
||||
toast({
|
||||
content: errorMessage(err),
|
||||
@@ -69,69 +65,64 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<Modal bind:open>
|
||||
{#snippet customTitle()}
|
||||
<div class="flex items-center gap-2">Upload image</div>
|
||||
{/snippet}
|
||||
{#if progress != 1}
|
||||
<div transition:slide={{ duration: 500, easing: expoOut }} class="w-full">
|
||||
<ProgressBar {progress} />
|
||||
</div>
|
||||
{/if}
|
||||
<form
|
||||
class="flex flex-col gap-4"
|
||||
onsubmit={e => {
|
||||
e.preventDefault()
|
||||
upload()
|
||||
}}
|
||||
>
|
||||
<label
|
||||
for="image-input"
|
||||
class="p-4 border-2 border-dashed rounded-xl cursor-pointer transition-colors
|
||||
{#if progress != 1}
|
||||
<div transition:slide={{ duration: 500, easing: expoOut }} class="w-full">
|
||||
<ProgressBar {progress} />
|
||||
</div>
|
||||
{/if}
|
||||
<form
|
||||
class="flex flex-col gap-4"
|
||||
onsubmit={e => {
|
||||
e.preventDefault()
|
||||
upload()
|
||||
}}
|
||||
>
|
||||
<label
|
||||
for="image-input"
|
||||
class="p-4 border-2 border-dashed rounded-xl cursor-pointer transition-colors
|
||||
border-slate-300 dark:border-zinc-700 hover:border-primary-900 dark:hover:border-primary-100"
|
||||
>
|
||||
{#if previewURLs}
|
||||
<div
|
||||
class="grid gap-x-2 gap-y-px max-h-64 overflow-auto
|
||||
>
|
||||
{#if previewURLs}
|
||||
<div
|
||||
class="grid gap-x-2 gap-y-px max-h-64 overflow-auto
|
||||
{multiple ? 'grid-cols-3 grid-rows-2' : 'grid-cols-1 grid-rows-1'}"
|
||||
>
|
||||
{#each previewURLs as file}
|
||||
<img
|
||||
src={file}
|
||||
onload={() => URL.revokeObjectURL(file)}
|
||||
alt={file}
|
||||
class="w-full rounded-md h-full object-cover transition-all
|
||||
>
|
||||
{#each previewURLs as file}
|
||||
<img
|
||||
src={file}
|
||||
onload={() => URL.revokeObjectURL(file)}
|
||||
alt={file}
|
||||
class="w-full rounded-md h-full object-cover transition-all
|
||||
border border-slate-200 dark:border-zinc-800 ring-1
|
||||
ring-slate-50 dark:ring-zinc-950 bg-white dark:bg-zinc-950"
|
||||
/>
|
||||
{/each}
|
||||
</div>
|
||||
{:else}
|
||||
<div
|
||||
class="flex flex-col justify-center w-full items-center gap-2
|
||||
/>
|
||||
{/each}
|
||||
</div>
|
||||
{:else}
|
||||
<div
|
||||
class="flex flex-col justify-center w-full items-center gap-2
|
||||
text-slate-600 dark:text-zinc-400"
|
||||
>
|
||||
<Icon src={DocumentPlus} size="32" />
|
||||
<span class="font-medium text-sm">{$t('form.post.selectFile')}</span>
|
||||
</div>
|
||||
{/if}
|
||||
<input
|
||||
{multiple}
|
||||
type="file"
|
||||
accept="image/*"
|
||||
class="hidden"
|
||||
id="image-input"
|
||||
bind:files={image}
|
||||
/>
|
||||
</label>
|
||||
<Button
|
||||
loading={progress != 1}
|
||||
disabled={progress != 1 || image == null}
|
||||
submit
|
||||
color="primary"
|
||||
size="lg"
|
||||
>
|
||||
Upload
|
||||
</Button>
|
||||
</form>
|
||||
</Modal>
|
||||
>
|
||||
<Icon src={DocumentPlus} size="32" />
|
||||
<span class="font-medium text-sm">{$t('form.post.selectFile')}</span>
|
||||
</div>
|
||||
{/if}
|
||||
<input
|
||||
{multiple}
|
||||
type="file"
|
||||
accept="image/*"
|
||||
class="hidden"
|
||||
id="image-input"
|
||||
bind:files={image}
|
||||
/>
|
||||
</label>
|
||||
<Button
|
||||
loading={progress != 1}
|
||||
disabled={progress != 1 || image == null}
|
||||
submit
|
||||
color="primary"
|
||||
size="lg"
|
||||
>
|
||||
Upload
|
||||
</Button>
|
||||
</form>
|
||||
@@ -0,0 +1,69 @@
|
||||
<script lang="ts">
|
||||
import { Button, Modal, TextInput } from 'mono-svelte'
|
||||
import Switch from '../input/Switch.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import ImageAttachForm from './ImageAttachForm.svelte'
|
||||
|
||||
let {
|
||||
open = $bindable(),
|
||||
imageUrl: passedImageUrl = $bindable(),
|
||||
}: { open: boolean; imageUrl?: string } = $props()
|
||||
|
||||
let imageUrl = $derived(passedImageUrl)
|
||||
let customUrl = $state(false)
|
||||
</script>
|
||||
|
||||
<Modal bind:open title={$t('form.post.uploadImage')}>
|
||||
<div class="flex justify-between gap-1 flex-wrap">
|
||||
<Switch
|
||||
options={[false, true]}
|
||||
optionNames={[$t('common.attach'), $t('content.url')]}
|
||||
bind:selected={customUrl}
|
||||
/>
|
||||
|
||||
<Button
|
||||
onclick={() => {
|
||||
passedImageUrl = undefined
|
||||
open = false
|
||||
}}
|
||||
size="xs"
|
||||
rounding="xl"
|
||||
>
|
||||
{$t('common.remove')}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
{#if customUrl}
|
||||
<form
|
||||
onsubmit={e => {
|
||||
e.preventDefault()
|
||||
if (!imageUrl) throw new Error('missing imageurl')
|
||||
|
||||
if (URL.canParse != undefined) {
|
||||
if (!URL.canParse(imageUrl)) throw new Error('invalid URL')
|
||||
}
|
||||
|
||||
passedImageUrl = imageUrl
|
||||
open = false
|
||||
}}
|
||||
class="contents"
|
||||
>
|
||||
<TextInput
|
||||
label={$t('content.url')}
|
||||
bind:value={imageUrl}
|
||||
pattern="http(s)?:\/\/(.*).(png|jpg|gif|avif|webp|jpeg|jxl|svg|bmp)"
|
||||
/>
|
||||
<Button submit color="primary" size="lg">
|
||||
{$t('form.submit')}
|
||||
</Button>
|
||||
</form>
|
||||
{:else}
|
||||
<ImageAttachForm
|
||||
multiple={false}
|
||||
onupload={uploaded => {
|
||||
open = false
|
||||
passedImageUrl = uploaded[0]
|
||||
}}
|
||||
/>
|
||||
{/if}
|
||||
</Modal>
|
||||
@@ -1,11 +1,18 @@
|
||||
<script lang="ts">
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { DocumentPlus, Icon, Plus } from 'svelte-hero-icons'
|
||||
import ImageUploadModal from '../lemmy/modal/ImageUploadModal.svelte'
|
||||
import { Label } from 'mono-svelte'
|
||||
import { DocumentPlus, Icon, Plus } from 'svelte-hero-icons'
|
||||
import ImageInputModal from './ImageInputModal.svelte'
|
||||
|
||||
let { imageUrl = $bindable(), label }: { imageUrl?: string; label?: string } =
|
||||
$props()
|
||||
let {
|
||||
imageUrl: passedImageUrl = $bindable(),
|
||||
label,
|
||||
}: {
|
||||
imageUrl?: string
|
||||
label?: string
|
||||
} = $props()
|
||||
|
||||
let imageUrl = $derived(passedImageUrl)
|
||||
|
||||
let open = $state(false)
|
||||
</script>
|
||||
@@ -43,15 +50,6 @@
|
||||
{$t('common.attach')}
|
||||
</p>
|
||||
{/if}
|
||||
{#if open}
|
||||
<ImageUploadModal
|
||||
bind:open
|
||||
multiple={false}
|
||||
onupload={uploaded => {
|
||||
open = false
|
||||
imageUrl = uploaded[0]
|
||||
}}
|
||||
/>
|
||||
{/if}
|
||||
<ImageInputModal bind:open bind:imageUrl={passedImageUrl} />
|
||||
</button>
|
||||
</div>
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { tick } from 'svelte'
|
||||
import type { HTMLTextareaAttributes } from 'svelte/elements'
|
||||
import type { HTMLAttributes } from 'svelte/elements'
|
||||
|
||||
let textarea: HTMLTextAreaElement | undefined = $state()
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
textarea.style.height = `${textarea.scrollHeight}px` // Set height to the scrollHeight
|
||||
}
|
||||
}
|
||||
interface Props extends HTMLTextareaAttributes {
|
||||
interface Props extends HTMLAttributes<HTMLTextAreaElement> {
|
||||
label?: string | undefined
|
||||
value: string
|
||||
required?: boolean
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<script lang="ts">
|
||||
import TabButton from './switch/TabButton.svelte'
|
||||
|
||||
type T = $$Generic
|
||||
|
||||
interface Props {
|
||||
@@ -29,22 +31,14 @@
|
||||
>
|
||||
{#each options as option, index}
|
||||
{@const slctd = selected == option}
|
||||
<button
|
||||
class={[
|
||||
'px-2.5 py-1 rounded-xl text-sm font-medium transition-colors duration-75 relative cursor-pointer',
|
||||
slctd
|
||||
? 'bg-primary-900 dark:bg-primary-100 text-slate-50 dark:text-zinc-900 hover:brightness-90 active:brightness-75'
|
||||
: ' border dark:bg-zinc-900/50 bg-white border-slate-200 dark:border-zinc-800 hover:bg-slate-100 hover:dark:bg-zinc-800 active:bg-slate-200 active:dark:bg-zinc-900',
|
||||
]}
|
||||
onclick={e => {
|
||||
e.preventDefault()
|
||||
selected = option
|
||||
}}
|
||||
disabled={disabled[index] ?? false}
|
||||
<TabButton
|
||||
selected={slctd}
|
||||
onselect={() => (selected = option)}
|
||||
disabled={disabled[index]}
|
||||
type="button"
|
||||
>
|
||||
{optionNames[index] || option}
|
||||
</button>
|
||||
</TabButton>
|
||||
{/each}
|
||||
</div>
|
||||
{@render children?.({ selected })}
|
||||
@@ -0,0 +1,43 @@
|
||||
<script lang="ts">
|
||||
import type { Snippet } from 'svelte'
|
||||
import type { HTMLButtonAttributes } from 'svelte/elements'
|
||||
|
||||
const sizes = {
|
||||
sm: 'px-2.5 py-1',
|
||||
md: 'py-1.5 px-3.5',
|
||||
}
|
||||
|
||||
interface Props extends HTMLButtonAttributes {
|
||||
selected?: boolean
|
||||
children: Snippet
|
||||
size?: keyof typeof sizes
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
let {
|
||||
selected = false,
|
||||
onselect,
|
||||
disabled,
|
||||
children,
|
||||
href,
|
||||
size = 'sm',
|
||||
...rest
|
||||
}: Props = $props()
|
||||
</script>
|
||||
|
||||
<svelte:element
|
||||
this={href ? 'a' : 'button'}
|
||||
class={[
|
||||
sizes[size],
|
||||
'rounded-xl text-sm font-medium transition-colors duration-75 relative cursor-pointer border shadow-xs',
|
||||
selected
|
||||
? 'border-transparent bg-primary-900 dark:bg-primary-100 text-slate-50 dark:text-zinc-900 hover:brightness-90 active:brightness-75'
|
||||
: ' dark:bg-zinc-900/50 bg-white border-slate-200 dark:border-zinc-800 hover:bg-slate-100 hover:dark:bg-zinc-800 active:bg-slate-200 active:dark:bg-zinc-900',
|
||||
]}
|
||||
onclick={href ? undefined : onselect}
|
||||
{disabled}
|
||||
{href}
|
||||
{...rest}
|
||||
>
|
||||
{@render children?.()}
|
||||
</svelte:element>
|
||||
@@ -10,16 +10,16 @@
|
||||
import Link from '../input/Link.svelte'
|
||||
import Expandable from '../ui/Expandable.svelte'
|
||||
import LabelStat from '../ui/LabelStat.svelte'
|
||||
import CommonList from '../ui/layout/CommonList.svelte'
|
||||
import SidebarButton from '../ui/sidebar/SidebarButton.svelte'
|
||||
import ItemList from './generic/ItemList.svelte'
|
||||
import { optimizeImageURL } from './post/helpers'
|
||||
import type { ClassValue, HTMLAttributes } from 'svelte/elements'
|
||||
|
||||
interface Props {
|
||||
interface Props extends HTMLAttributes<HTMLDivElement> {
|
||||
site: SiteView
|
||||
taglines?: Tagline[] | undefined
|
||||
admins?: PersonView[] | undefined
|
||||
version?: string | undefined
|
||||
class?: string
|
||||
class?: ClassValue
|
||||
}
|
||||
|
||||
let {
|
||||
@@ -31,7 +31,7 @@
|
||||
}: Props = $props()
|
||||
</script>
|
||||
|
||||
<div
|
||||
<aside
|
||||
class={[
|
||||
'w-full text-slate-600 dark:text-zinc-400 flex flex-col gap-4 text-sm',
|
||||
clazz,
|
||||
@@ -115,36 +115,15 @@
|
||||
{$t('cards.site.admins')}
|
||||
</span>
|
||||
{/snippet}
|
||||
<CommonList
|
||||
animate={false}
|
||||
size="xs"
|
||||
items={admins}
|
||||
class="px-1 py-0.5"
|
||||
>
|
||||
{#snippet item(admin)}
|
||||
<SidebarButton
|
||||
class="font-normal w-full h-max"
|
||||
color="none"
|
||||
alignment="left"
|
||||
href={userLink(admin.person)}
|
||||
>
|
||||
{#snippet customIcon()}
|
||||
<Avatar
|
||||
url={admin.person.avatar}
|
||||
alt={admin.person.name}
|
||||
width={28}
|
||||
/>{/snippet}
|
||||
{#snippet label()}
|
||||
<div class="flex flex-col max-w-full break-words">
|
||||
<span>{admin.person.display_name ?? admin.person.name}</span>
|
||||
<span class="text-xs text-slate-600 dark:text-zinc-400">
|
||||
{new URL(admin.person.actor_id).hostname}
|
||||
</span>
|
||||
</div>
|
||||
{/snippet}
|
||||
</SidebarButton>
|
||||
{/snippet}
|
||||
</CommonList>
|
||||
<ItemList
|
||||
items={admins.map(i => ({
|
||||
id: i.person.id,
|
||||
name: i.person.display_name || i.person.name,
|
||||
url: userLink(i.person),
|
||||
avatar: i.person.avatar,
|
||||
instance: new URL(i.person.actor_id).hostname,
|
||||
}))}
|
||||
/>
|
||||
</Expandable>
|
||||
{/if}
|
||||
|
||||
@@ -162,4 +141,4 @@
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</aside>
|
||||
@@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { page } from '$app/state'
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import CommentActions from '$lib/components/lemmy/comment/CommentActions.svelte'
|
||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||
@@ -8,6 +9,7 @@
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { getClient } from '$lib/lemmy.svelte.js'
|
||||
import { errorMessage } from '$lib/lemmy/error'
|
||||
import { settings } from '$lib/settings.svelte'
|
||||
import { Button, Modal, toast } from 'mono-svelte'
|
||||
import {
|
||||
Bookmark,
|
||||
@@ -24,8 +26,6 @@
|
||||
import ShieldIcon from '../moderation/ShieldIcon.svelte'
|
||||
import CommentForm from './CommentForm.svelte'
|
||||
import type { CommentNodeI } from './comments.svelte'
|
||||
import { page } from '$app/state'
|
||||
import { settings } from '$lib/settings.svelte'
|
||||
|
||||
interface Props {
|
||||
node: CommentNodeI
|
||||
@@ -208,7 +208,7 @@
|
||||
source={node.comment_view.comment.content}
|
||||
noStyle
|
||||
class={[
|
||||
'text-sm sm:text-base text-slate-700 dark:text-zinc-300 *:leading-[1.6] break-words space-y-3',
|
||||
'text-[15px] sm:text-base text-slate-700 dark:text-zinc-300 *:leading-[1.6] break-words space-y-3',
|
||||
node.comment_view.comment.distinguished
|
||||
? 'bg-green-400/10 p-2 rounded-xl max-w-max font-medium'
|
||||
: page.url.hash.slice(1) ==
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
size="sm"
|
||||
class="text-slate-500 dark:text-zinc-400"
|
||||
onclick={() => (replying = !replying)}
|
||||
disabled={comment.post.locked || disabled}
|
||||
disabled={comment.post.locked || disabled || !profile.current.jwt}
|
||||
>
|
||||
<Icon src={ChatBubbleOvalLeft} size="15" micro />
|
||||
{$t('comment.reply')}
|
||||
|
||||
@@ -76,8 +76,6 @@
|
||||
import Entity from '$lib/components/ui/Entity.svelte'
|
||||
import Expandable from '$lib/components/ui/Expandable.svelte'
|
||||
import LabelStat from '$lib/components/ui/LabelStat.svelte'
|
||||
import CommonList from '$lib/components/ui/layout/CommonList.svelte'
|
||||
import SidebarButton from '$lib/components/ui/sidebar/SidebarButton.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { client, getClient } from '$lib/lemmy.svelte.js'
|
||||
import { errorMessage } from '$lib/lemmy/error'
|
||||
@@ -107,6 +105,7 @@
|
||||
NoSymbol,
|
||||
Plus,
|
||||
} from 'svelte-hero-icons'
|
||||
import ItemList from '../generic/ItemList.svelte'
|
||||
|
||||
let loading = $state({
|
||||
blocking: false,
|
||||
@@ -147,11 +146,15 @@
|
||||
</script>
|
||||
|
||||
{#await community_view}
|
||||
<div class="w-full h-full grid place-items-center">
|
||||
<div
|
||||
class="w-full h-full grid place-items-center"
|
||||
role="status"
|
||||
aria-label={$t('aria.loading')}
|
||||
>
|
||||
<Spinner width={24} />
|
||||
</div>
|
||||
{:then community_view}
|
||||
<div
|
||||
<aside
|
||||
class={[
|
||||
'min-w-full pt-0 text-slate-600 dark:text-zinc-400 flex flex-col gap-4 text-sm',
|
||||
clazz,
|
||||
@@ -214,40 +217,15 @@
|
||||
{$t('cards.community.moderators')}
|
||||
</span>
|
||||
{/snippet}
|
||||
<CommonList
|
||||
animate={false}
|
||||
size="xs"
|
||||
items={moderators}
|
||||
class="px-1 py-0.5"
|
||||
>
|
||||
{#snippet item(moderator)}
|
||||
<SidebarButton
|
||||
class="font-normal w-full h-max"
|
||||
color="none"
|
||||
alignment="left"
|
||||
href={userLink(moderator.moderator)}
|
||||
>
|
||||
{#snippet customIcon()}
|
||||
<Avatar
|
||||
url={moderator.moderator.avatar}
|
||||
alt={moderator.moderator.name}
|
||||
width={28}
|
||||
/>
|
||||
{/snippet}
|
||||
{#snippet label()}
|
||||
<div class="flex flex-col max-w-full break-words">
|
||||
<span>
|
||||
{moderator.moderator.display_name ??
|
||||
moderator.moderator.name}
|
||||
</span>
|
||||
<span class="text-xs text-slate-600 dark:text-zinc-400">
|
||||
{new URL(moderator.moderator.actor_id).hostname}
|
||||
</span>
|
||||
</div>
|
||||
{/snippet}
|
||||
</SidebarButton>
|
||||
{/snippet}
|
||||
</CommonList>
|
||||
<ItemList
|
||||
items={moderators.map(i => ({
|
||||
id: i.moderator.id,
|
||||
name: i.moderator.display_name || i.moderator.name,
|
||||
url: userLink(i.moderator),
|
||||
avatar: i.moderator.avatar,
|
||||
instance: new URL(i.moderator.actor_id).hostname,
|
||||
}))}
|
||||
/>
|
||||
</Expandable>
|
||||
{/if}
|
||||
</div>
|
||||
@@ -363,5 +341,5 @@
|
||||
{/if}
|
||||
</Menu>
|
||||
</div>
|
||||
</div>
|
||||
</aside>
|
||||
{/await}
|
||||
@@ -1,8 +1,7 @@
|
||||
<script lang="ts">
|
||||
import Avatar from '$lib/components/ui/Avatar.svelte'
|
||||
import CommonList from '$lib/components/ui/layout/CommonList.svelte'
|
||||
import { Button } from 'mono-svelte'
|
||||
import { flip } from 'svelte/animate'
|
||||
import { expoOut } from 'svelte/easing'
|
||||
|
||||
interface Props {
|
||||
items: {
|
||||
@@ -17,14 +16,11 @@
|
||||
let { items }: Props = $props()
|
||||
</script>
|
||||
|
||||
{#each items.sort((a, b) => a.name.localeCompare(b.name)) as item (item.id)}
|
||||
<div
|
||||
class="inline-flex w-full"
|
||||
animate:flip={{ duration: 500, easing: expoOut }}
|
||||
>
|
||||
<CommonList animate={false} class="px-1 py-0.5" size="xs" {items}>
|
||||
{#snippet item(item)}
|
||||
<Button
|
||||
class="font-normal w-full h-max"
|
||||
color="tertiary"
|
||||
class="font-normal w-full h-max block"
|
||||
color="none"
|
||||
alignment="left"
|
||||
href={item.url}
|
||||
>
|
||||
@@ -45,5 +41,5 @@
|
||||
{/if}
|
||||
</div>
|
||||
</Button>
|
||||
</div>
|
||||
{/each}
|
||||
{/snippet}
|
||||
</CommonList>
|
||||
@@ -1,10 +1,9 @@
|
||||
<script lang="ts">
|
||||
import { goto } from '$app/navigation'
|
||||
import { profile } from '$lib/auth.svelte'
|
||||
import { mediaType, postLink } from '$lib/components/lemmy/post/helpers.js'
|
||||
import PostActions from '$lib/components/lemmy/post/actions/PostActions.svelte'
|
||||
import { mediaType } from '$lib/components/lemmy/post/helpers.js'
|
||||
import PostMedia from '$lib/components/lemmy/post/media/PostMedia.svelte'
|
||||
import PostMediaCompact from '$lib/components/lemmy/post/media/PostMediaCompact.svelte'
|
||||
import PostActions from '$lib/components/lemmy/post/actions/PostActions.svelte'
|
||||
import PostMeta, {
|
||||
parseTags,
|
||||
type Tag,
|
||||
@@ -28,15 +27,6 @@
|
||||
return rule
|
||||
}
|
||||
|
||||
function onClick(e: Event) {
|
||||
const event = e as Event
|
||||
const parent = document.getElementById(post.post.id.toString())
|
||||
|
||||
if (event.target == parent) {
|
||||
goto(postLink(post.post))
|
||||
}
|
||||
}
|
||||
|
||||
interface Props {
|
||||
post: PostView
|
||||
actions?: boolean
|
||||
@@ -86,9 +76,7 @@
|
||||
This is the sole component for displaying posts.
|
||||
It adapts to all kinds of form factors for different contexts, such as feeds, full post view, and crosspost list.
|
||||
-->
|
||||
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
||||
<!-- svelte-ignore a11y_no_noninteractive_tabindex -->
|
||||
<div
|
||||
<article
|
||||
class={[
|
||||
'post relative max-w-full min-w-0 w-full cursor-pointer outline-hidden group/post',
|
||||
settings.leftAlign && 'left-align',
|
||||
@@ -97,13 +85,6 @@
|
||||
clazz,
|
||||
]}
|
||||
id={post.post.id.toString()}
|
||||
onclick={e => {
|
||||
onClick(e)
|
||||
}}
|
||||
onkeydown={e => {
|
||||
if (e.key == 'Enter') onClick(e)
|
||||
}}
|
||||
tabindex="0"
|
||||
{style}
|
||||
>
|
||||
<PostMeta
|
||||
@@ -167,7 +148,7 @@
|
||||
group-hover/post:inset-y-0.5 group-hover/post:-inset-x-3 sm:group-hover/post:-inset-x-5 group-hover/post:opacity-100
|
||||
duration-150"
|
||||
></div>
|
||||
</div>
|
||||
</article>
|
||||
|
||||
<style lang="postcss">
|
||||
.list-type {
|
||||
|
||||
@@ -343,7 +343,6 @@
|
||||
view == 'compact' ? 'text-base' : 'text-lg',
|
||||
]}
|
||||
style="grid-area: title;"
|
||||
data-sveltekit-preload-data="tap"
|
||||
>
|
||||
{#if title}
|
||||
<Markdown
|
||||
|
||||
@@ -94,7 +94,7 @@
|
||||
buttonColor.secondary,
|
||||
'rounded-full h-full font-medium flex items-center *:p-2 relative',
|
||||
'hover:bg-white dark:hover:bg-zinc-900 overflow-hidden transition-colors shrink-0',
|
||||
'text-inherit! divide-x divide-slate-200 dark:divide-zinc-800 shadow-xs',
|
||||
'text-inherit! divide-x divide-slate-200 dark:divide-zinc-800',
|
||||
loading && 'animate-pulse opacity-75 pointer-events-none',
|
||||
voteRatio < 85 && settings.voteRatioBar && 'vote-ratio',
|
||||
]}
|
||||
|
||||
@@ -89,8 +89,6 @@
|
||||
bind:score={post.counts.score}
|
||||
bind:upvotes={post.counts.upvotes}
|
||||
bind:downvotes={post.counts.downvotes}
|
||||
showCounts={profile.current?.user?.local_user_view?.local_user
|
||||
?.show_scores ?? true}
|
||||
/>
|
||||
|
||||
<Button
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
<div class="flex flex-row">
|
||||
<MenuButton
|
||||
onclick={() => share()}
|
||||
class={['flex-1', !post.post.local && 'rounded-r-xl']}
|
||||
class={['flex-1', !post.post.local && 'rounded-r-lg']}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Share} size="16" micro />
|
||||
@@ -84,11 +84,11 @@
|
||||
</MenuButton>
|
||||
<!--svelte-ignore a11y_no_static_element_interactions -->
|
||||
<!--svelte-ignore a11y_click_events_have_key_events-->
|
||||
<div
|
||||
class="aspect-square w-max m-1 grid place-items-center"
|
||||
onclick={e => e.stopPropagation()}
|
||||
>
|
||||
{#if !post.post.local}
|
||||
{#if !post.post.local}
|
||||
<div
|
||||
class="aspect-square w-max m-1 grid place-items-center"
|
||||
onclick={e => e.stopPropagation()}
|
||||
>
|
||||
<Menu>
|
||||
{#snippet target()}
|
||||
<Button
|
||||
@@ -120,8 +120,8 @@
|
||||
{$t('filter.location.local')}
|
||||
</MenuButton>
|
||||
</Menu>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{#if profile.current?.jwt}
|
||||
<MenuButton
|
||||
|
||||
@@ -190,7 +190,7 @@
|
||||
{:else}
|
||||
<VirtualList
|
||||
id="feed"
|
||||
class="divide-y-2 -mx-3 sm:-mx-6 divide-slate-200 dark:divide-zinc-900"
|
||||
class="divide-y-2 -mx-3 sm:-mx-6 divide-slate-100 dark:divide-zinc-900"
|
||||
items={posts}
|
||||
{initialOffset}
|
||||
overscan={3}
|
||||
|
||||
@@ -251,14 +251,10 @@
|
||||
</script>
|
||||
|
||||
{#if uploadingImage}
|
||||
{#await import('$lib/components/lemmy/modal/ImageUploadModal.svelte') then { default: UploadModal }}
|
||||
{#await import('$lib/components/form/ImageInputModal.svelte') then { default: UploadModal }}
|
||||
<UploadModal
|
||||
bind:open={uploadingImage}
|
||||
multiple={false}
|
||||
onupload={e => {
|
||||
if (e) data.url = e[0]
|
||||
uploadingImage = false
|
||||
}}
|
||||
bind:imageUrl={() => '', v => (data.url = v)}
|
||||
/>
|
||||
{/await}
|
||||
{/if}
|
||||
@@ -341,7 +337,6 @@
|
||||
{/if}
|
||||
{/if}
|
||||
<FreeTextInput
|
||||
type="text"
|
||||
required
|
||||
bind:value={data.title}
|
||||
placeholder={placeholders.get('post')}
|
||||
|
||||
@@ -29,65 +29,65 @@
|
||||
For embed-type posts. Displays embed card or a compact link.
|
||||
-->
|
||||
{#if embed_title && view == 'cozy'}
|
||||
<a target="_blank" href={url} class="group/link">
|
||||
<Material
|
||||
color="uniform"
|
||||
class={[
|
||||
'flex flex-col-reverse sm:flex-row overflow-hidden gap-4 embed-card z-0 relative',
|
||||
'dark:bg-zinc-950 group-hover/link:bg-slate-50 dark:group-hover/link:bg-zinc-900 transition-colors',
|
||||
'shadow-xs',
|
||||
]}
|
||||
rounding="2xl"
|
||||
element="article"
|
||||
padding="sm"
|
||||
>
|
||||
{#if thumbnail_url}
|
||||
<img
|
||||
src={optimizeImageURL(thumbnail_url, 32)}
|
||||
alt=""
|
||||
class="-z-10 absolute w-full object-cover h-full opacity-5 brightness-150
|
||||
<Material
|
||||
color="uniform"
|
||||
class={[
|
||||
'flex flex-col-reverse sm:flex-row overflow-hidden gap-4 z-0 relative',
|
||||
'dark:bg-zinc-950 hover:bg-slate-50 hover:dark:bg-zinc-900 transition-colors',
|
||||
'group/link',
|
||||
]}
|
||||
rounding="2xl"
|
||||
element="a"
|
||||
padding="sm"
|
||||
href={url}
|
||||
target="_blank"
|
||||
>
|
||||
{#if thumbnail_url}
|
||||
<img
|
||||
src={optimizeImageURL(thumbnail_url, 32)}
|
||||
alt=""
|
||||
class="-z-10 absolute w-full object-cover h-full opacity-5 brightness-150
|
||||
dark:brightness-70 dark:opacity-10 blur-2xl -inset-px"
|
||||
/>
|
||||
/>
|
||||
{/if}
|
||||
<div class={['flex flex-col gap-1 p-2', thumbnail_url && '-mt-2 sm:mt-0']}>
|
||||
{#if richURL}
|
||||
<div
|
||||
class="text-slate-600 dark:text-zinc-400 inline-flex items-center gap-1 text-xs font-medium"
|
||||
>
|
||||
{richURL.hostname}
|
||||
</div>
|
||||
{/if}
|
||||
<div class="flex flex-col gap-1 p-3 -mt-2 sm:mt-0">
|
||||
{#if richURL}
|
||||
<div
|
||||
class="text-slate-600 dark:text-zinc-400 inline-flex items-center gap-1 text-xs font-medium"
|
||||
>
|
||||
{richURL.hostname}
|
||||
</div>
|
||||
{/if}
|
||||
<p class="font-medium text-base">{embed_title}</p>
|
||||
</div>
|
||||
{#if thumbnail_url}
|
||||
<picture class="mb-auto sm:ml-auto shrink-0 sm:w-1/3 sm:max-w-60">
|
||||
{#each ['webp'] as format}
|
||||
<source
|
||||
srcset="{optimizeImageURL(
|
||||
thumbnail_url,
|
||||
256,
|
||||
format as 'avif' | 'webp',
|
||||
)} 256w, {optimizeImageURL(
|
||||
thumbnail_url,
|
||||
512,
|
||||
format as 'avif' | 'webp',
|
||||
)} 512w"
|
||||
media="(min-width: 0px)"
|
||||
type="image/{format}"
|
||||
/>
|
||||
{/each}
|
||||
<img
|
||||
src={optimizeImageURL(thumbnail_url, -1)}
|
||||
class="object-cover w-full sm:max-w-96 h-32 sm:min-h-16 bg-slate-200 dark:bg-zinc-800 rounded-xl"
|
||||
width={600}
|
||||
height={400}
|
||||
alt=""
|
||||
class:blur-3xl={nsfw}
|
||||
<p class="font-medium text-base">{embed_title}</p>
|
||||
</div>
|
||||
{#if thumbnail_url}
|
||||
<picture class="mb-auto sm:ml-auto shrink-0 sm:w-1/3 sm:max-w-60">
|
||||
{#each ['webp'] as format}
|
||||
<source
|
||||
srcset="{optimizeImageURL(
|
||||
thumbnail_url,
|
||||
256,
|
||||
format as 'avif' | 'webp',
|
||||
)} 256w, {optimizeImageURL(
|
||||
thumbnail_url,
|
||||
512,
|
||||
format as 'avif' | 'webp',
|
||||
)} 512w"
|
||||
media="(min-width: 0px)"
|
||||
type="image/{format}"
|
||||
/>
|
||||
</picture>
|
||||
{/if}
|
||||
</Material>
|
||||
</a>
|
||||
{/each}
|
||||
<img
|
||||
src={optimizeImageURL(thumbnail_url, -1)}
|
||||
class="object-cover w-full sm:max-w-96 h-32 sm:min-h-16 bg-slate-200 dark:bg-zinc-800 rounded-xl"
|
||||
width={600}
|
||||
height={400}
|
||||
alt=""
|
||||
class:blur-3xl={nsfw}
|
||||
/>
|
||||
</picture>
|
||||
{/if}
|
||||
</Material>
|
||||
{:else}
|
||||
<a
|
||||
href={url}
|
||||
|
||||
@@ -151,7 +151,7 @@
|
||||
|
||||
<article
|
||||
dir="auto"
|
||||
class={[!noStyle && 'break-words space-y-2 leading-normal', clazz]}
|
||||
class={[!noStyle && 'break-words space-y-4 leading-normal', clazz]}
|
||||
{style}
|
||||
>
|
||||
<SvelteMarkdown
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import MultiSelect from '$lib/components/input/Switch.svelte'
|
||||
import Markdown from '$lib/components/markdown/Markdown.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { Button, Label, TextArea } from 'mono-svelte'
|
||||
import { Button, Label, Modal, TextArea } from 'mono-svelte'
|
||||
import type { TextAreaProps } from 'mono-svelte/forms/TextArea.svelte'
|
||||
import { tick } from 'svelte'
|
||||
import {
|
||||
@@ -17,8 +17,8 @@
|
||||
Photo,
|
||||
Strikethrough,
|
||||
} from 'svelte-hero-icons'
|
||||
import ImageUploadModal from '../lemmy/modal/ImageUploadModal.svelte'
|
||||
import type { ClassValue } from 'svelte/elements'
|
||||
import ImageAttachForm from '../form/ImageAttachForm.svelte'
|
||||
|
||||
let textArea: HTMLTextAreaElement | undefined = $state()
|
||||
|
||||
@@ -122,15 +122,16 @@
|
||||
</script>
|
||||
|
||||
{#if uploadingImage && images}
|
||||
<ImageUploadModal
|
||||
bind:open={uploadingImage}
|
||||
bind:image
|
||||
onupload={e => {
|
||||
e.forEach(i => {
|
||||
wrapSelection(`\n\n`, '')
|
||||
})
|
||||
}}
|
||||
/>
|
||||
<Modal title={$t('form.post.uploadImage')} bind:open={uploadingImage}>
|
||||
<ImageAttachForm
|
||||
bind:image
|
||||
onupload={e => {
|
||||
e.forEach(i => {
|
||||
wrapSelection(`\n\n`, '')
|
||||
})
|
||||
}}
|
||||
/>
|
||||
</Modal>
|
||||
{/if}
|
||||
|
||||
<div>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<a
|
||||
href={photonified ?? href}
|
||||
{title}
|
||||
class="hover:underline text-sky-600 dark:text-sky-500"
|
||||
class="hover:underline text-blue-600 dark:text-blue-400"
|
||||
>
|
||||
{@render children?.()}
|
||||
</a>
|
||||
@@ -9,12 +9,12 @@
|
||||
let { children } = $props()
|
||||
</script>
|
||||
|
||||
<p class="leading-normal break-words {options.inline ? '' : 'max-w'}">
|
||||
<p class="leading-[1.7] break-words {options.inline ? '' : 'max-w'}">
|
||||
{@render children?.()}
|
||||
</p>
|
||||
|
||||
<style>
|
||||
.max-w {
|
||||
max-width: 80ch;
|
||||
max-width: 70ch;
|
||||
}
|
||||
</style>
|
||||
@@ -2,11 +2,19 @@
|
||||
import type { ClassValue } from 'svelte/elements'
|
||||
|
||||
const sizes = {
|
||||
xs: 'text-xs',
|
||||
sm: 'text-sm',
|
||||
md: 'text-base',
|
||||
lg: 'text-lg',
|
||||
}
|
||||
|
||||
const margins = {
|
||||
none: '',
|
||||
sm: 'mt-3 mb-1 px-3',
|
||||
md: 'mt-4 mb-2',
|
||||
lg: 'mt-6 mb-2',
|
||||
}
|
||||
|
||||
const colors = {
|
||||
subtle: 'text-slate-600 dark:text-zinc-400',
|
||||
none: '',
|
||||
@@ -16,6 +24,7 @@
|
||||
class?: ClassValue
|
||||
size?: keyof typeof sizes
|
||||
color?: keyof typeof colors
|
||||
margin?: keyof typeof margins
|
||||
border?: boolean
|
||||
children?: import('svelte').Snippet
|
||||
action?: import('svelte').Snippet
|
||||
@@ -28,6 +37,7 @@
|
||||
border = true,
|
||||
size = 'sm',
|
||||
color = 'subtle',
|
||||
margin = 'none',
|
||||
}: Props = $props()
|
||||
</script>
|
||||
|
||||
@@ -36,17 +46,18 @@
|
||||
'flex flex-row items-center gap-2 flex-wrap',
|
||||
sizes[size],
|
||||
colors[color],
|
||||
margins[margin],
|
||||
clazz,
|
||||
]}
|
||||
>
|
||||
<span class="font-medium text-left">
|
||||
<h3 class="font-medium text-left flex flex-row gap-1 items-center">
|
||||
{@render children?.()}
|
||||
</span>
|
||||
<hr
|
||||
</h3>
|
||||
<div
|
||||
class={[
|
||||
'flex-1 border-slate-200 dark:border-zinc-800',
|
||||
'flex-1 border-slate-200/70 dark:border-zinc-800 border-b',
|
||||
!border && 'opacity-0',
|
||||
]}
|
||||
/>
|
||||
></div>
|
||||
{@render action?.()}
|
||||
</div>
|
||||
@@ -40,90 +40,66 @@
|
||||
}: Props = $props()
|
||||
</script>
|
||||
|
||||
<div {...rest} class={['z-10 relative text-sm contents', clazz]}>
|
||||
{#if banner}
|
||||
<div {...rest} class={['z-10 text-sm contents w-full', clazz]}>
|
||||
<div class="absolute inset-0 h-96 overflow-x-hidden -z-10">
|
||||
<img
|
||||
src={banner}
|
||||
class="w-full object-cover h-48 rounded-t-xl bg-white dark:bg-zinc-900 rounded-xl"
|
||||
class:blur-3xl={!banner}
|
||||
src={banner || avatar}
|
||||
class="w-full h-64 object-cover blur-3xl opacity-30 dark:opacity-30"
|
||||
height="192"
|
||||
alt="User banner"
|
||||
/>
|
||||
{/if}
|
||||
<div class="py-4 flex flex-col gap-4">
|
||||
<div class="flex-1 flex flex-row items-center text-left gap-4">
|
||||
<Avatar
|
||||
width={64}
|
||||
url={avatar}
|
||||
alt={name}
|
||||
class=" ring-slate-25 dark:ring-zinc-925 bg-slate-25 dark:bg-zinc-925"
|
||||
/>
|
||||
<div class="flex flex-col">
|
||||
<svelte:element
|
||||
this={url ? 'a' : 'span'}
|
||||
href={url}
|
||||
class="text-xl font-semibold {url
|
||||
? 'hover:underline hover:text-primary-900 dark:hover:text-primary-100'
|
||||
: ''}"
|
||||
>
|
||||
{name}
|
||||
</svelte:element>
|
||||
<span
|
||||
class="flex items-center gap-0 text-sm text-slate-600 dark:text-zinc-400 max-w-full w-max"
|
||||
>
|
||||
{@render nameDetail?.()}
|
||||
</span>
|
||||
|
||||
{#if actions}
|
||||
<div class="flex flex-col mt-2">
|
||||
{@render actions?.()}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{#if bio}
|
||||
<div class="relative w-full {center ? 'text-center' : 'text-left'}">
|
||||
<Expandable class="py-2">
|
||||
{#snippet title(open)}
|
||||
{#if bio.split('\n')?.[0]?.startsWith('#') || open}
|
||||
{$t('nav.menu.about')}
|
||||
{:else}
|
||||
<div
|
||||
class={[
|
||||
'overflow-hidden whitespace-nowrap',
|
||||
'bg-linear-to-r from-slate-700 via-slate-700 to-slate-700/0',
|
||||
'dark:from-zinc-400 dark:via-zinc-400 dark:to-zinc-400/0',
|
||||
'text-transparent bg-clip-text',
|
||||
'max-w-[50%] overflow-hidden',
|
||||
]}
|
||||
>
|
||||
{bio.split('\n')?.[0].slice(0, 75)}
|
||||
</div>
|
||||
{/if}
|
||||
<hr class="flex-1 border-slate-200 dark:border-zinc-800 mx-2" />
|
||||
<div class="mr-2 text-primary-900 dark:text-primary-100">
|
||||
{$t('form.post.readMore')}
|
||||
</div>
|
||||
{/snippet}
|
||||
<Markdown source={bio} class="font-normal" />
|
||||
</Expandable>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="space-y-3 py-4 pt-0">
|
||||
{#if stats.length > 0}
|
||||
<div
|
||||
class="text-sm flex flex-row flex-wrap mx-auto rounded-lg
|
||||
overflow-hidden gap-4"
|
||||
{#if banner || avatar}
|
||||
<div class="relative overflow-hidden rounded-xl">
|
||||
<img
|
||||
src={banner || avatar}
|
||||
class="w-full object-cover h-48 rounded-t-xl bg-white dark:bg-zinc-900 rounded-xl"
|
||||
class:blur-xl={!banner}
|
||||
height="192"
|
||||
alt="User banner"
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<Avatar
|
||||
width={96}
|
||||
url={avatar}
|
||||
alt={name}
|
||||
class="ring-slate-25 bg-slate-25 dark:bg-zinc-925 -mt-12 ml-4 ring-6 relative dark:ring-zinc-950"
|
||||
/>
|
||||
<div class="py-4 flex flex-col xl:flex-row gap-4">
|
||||
<div class="flex flex-col flex-1">
|
||||
<svelte:element
|
||||
this={url ? 'a' : 'span'}
|
||||
href={url}
|
||||
class="text-2xl font-medium tracking-tight {url
|
||||
? 'hover:underline hover:text-primary-900 dark:hover:text-primary-100'
|
||||
: ''}"
|
||||
>
|
||||
{name}
|
||||
</svelte:element>
|
||||
<span
|
||||
class="flex items-center gap-0 text-sm text-slate-600 dark:text-zinc-400 max-w-full w-max"
|
||||
>
|
||||
{@render nameDetail?.()}
|
||||
</span>
|
||||
|
||||
{#if actions}
|
||||
<div class="flex flex-col mt-2">
|
||||
{@render actions?.()}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{#if stats.length > 0}
|
||||
<div class="text-sm flex flex-row flex-wrap overflow-hidden gap-4 h-full">
|
||||
{#each stats as stat}
|
||||
<div class="">
|
||||
<div
|
||||
class="text-primary-900 dark:text-primary-100 text-xs font-medium"
|
||||
>
|
||||
<div class="text-slate-600 dark:text-zinc-500 text-sm font-medium">
|
||||
{stat.name}
|
||||
</div>
|
||||
<div class="text-lg font-semibold">
|
||||
<div
|
||||
class="text-xl font-medium text-primary-900 dark:text-primary-100 text-right"
|
||||
>
|
||||
{#if stat.format ?? true}
|
||||
<FormattedNumber
|
||||
number={Number(stat.value)}
|
||||
@@ -137,6 +113,27 @@
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{#if bio}
|
||||
<div
|
||||
class={[
|
||||
'relative w-full mb-4 text-base',
|
||||
center ? 'text-center' : 'text-left',
|
||||
]}
|
||||
>
|
||||
{#if bio.length > 300}
|
||||
<Expandable>
|
||||
{#snippet title()}
|
||||
{$t('cards.site.about')}
|
||||
{/snippet}
|
||||
<Markdown source={bio} class="font-normal" />
|
||||
</Expandable>
|
||||
{:else}
|
||||
<Markdown source={bio} class="font-normal" />
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
<div class="space-y-3 py-4 pt-0">
|
||||
{@render children?.()}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -10,13 +10,12 @@
|
||||
{width}
|
||||
height={width}
|
||||
viewBox="0 0 100 100"
|
||||
fill="none"
|
||||
fill="currentColor"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
class="inline fill-black dark:fill-white hover:fill-slate-700 dark:hover:fill-zinc-300 transition-colors"
|
||||
class="inline hover:fill-slate-700 dark:hover:fill-zinc-300 transition-colors"
|
||||
>
|
||||
<path
|
||||
id="hexagon"
|
||||
d="M45.5 10.8868C48.594 9.10042 52.406 9.10042 55.5 10.8868L82.3061 26.3632C85.4001 28.1496 87.3061 31.4508 87.3061 35.0235V65.9765C87.3061 69.5492 85.4001 72.8504 82.3061 74.6368L55.5 90.1132C52.406 91.8996 48.594 91.8996 45.5 90.1132L18.6939 74.6368C15.5999 72.8504 13.6939 69.5492 13.6939 65.9765V35.0235C13.6939 31.4508 15.5999 28.1496 18.6939 26.3632L45.5 10.8868Z"
|
||||
class=""
|
||||
/>
|
||||
</svg>
|
||||
@@ -44,7 +44,7 @@
|
||||
|
||||
<nav
|
||||
aria-label={$t('aria.pagination.nav')}
|
||||
class="flex flex-row w-full gap-4 items-center justify-center backdrop-blur-xl border border-slate-200 dark:border-zinc-800 rounded-full overflow-hidden"
|
||||
class="flex flex-row gap-2 items-center justify-center backdrop-blur-xl border border-slate-200 dark:border-zinc-800 rounded-full overflow-hidden w-max mx-auto p-0.5"
|
||||
>
|
||||
{#if children}
|
||||
<span class="text-sm text-slate-600 dark:text-zinc-400 font-medium">
|
||||
@@ -55,15 +55,14 @@
|
||||
{#if back}
|
||||
<Button
|
||||
href={customHref(href?.(cursor?.back ?? page - 1))}
|
||||
color="ghost"
|
||||
color="tertiary"
|
||||
onclick={() => invalidate(pageData.url)}
|
||||
title={$t('common.back')}
|
||||
rounding="none"
|
||||
rounding="pill"
|
||||
size="custom"
|
||||
class="text-inherit dark:text-inherit border-0 border-r p-2"
|
||||
class="text-inherit dark:text-inherit p-1"
|
||||
disabled={(cursor?.back == undefined && cursor?.next != undefined) ||
|
||||
page <= 1}
|
||||
data-sveltekit-preload-data="off"
|
||||
>
|
||||
{#snippet suffix()}
|
||||
<Icon src={ChevronLeft} size="24" mini />
|
||||
@@ -88,14 +87,13 @@
|
||||
|
||||
<Button
|
||||
href={customHref(href?.(cursor?.next ?? page + 1))}
|
||||
color="ghost"
|
||||
color="tertiary"
|
||||
onclick={() => invalidate(pageData.url)}
|
||||
title={$t('common.next')}
|
||||
size="custom"
|
||||
rounding="none"
|
||||
class="text-inherit dark:text-inherit border-0 border-l p-2"
|
||||
rounding="pill"
|
||||
class="text-inherit dark:text-inherit p-1"
|
||||
disabled={!hasMore}
|
||||
data-sveltekit-preload-data="off"
|
||||
>
|
||||
{#snippet suffix()}
|
||||
<Icon src={ChevronRight} size="24" mini />
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
<script lang="ts">
|
||||
import { Icon, type IconSource } from 'svelte-hero-icons'
|
||||
import type { ClassValue } from 'svelte/elements'
|
||||
|
||||
interface Props {
|
||||
icon?: IconSource | undefined
|
||||
title: string
|
||||
description?: string | undefined
|
||||
class?: string
|
||||
class?: ClassValue
|
||||
children?: import('svelte').Snippet
|
||||
iconClass?: ClassValue
|
||||
}
|
||||
|
||||
let {
|
||||
@@ -15,6 +17,7 @@
|
||||
description = undefined,
|
||||
class: clazz = '',
|
||||
children,
|
||||
iconClass,
|
||||
}: Props = $props()
|
||||
</script>
|
||||
|
||||
@@ -24,7 +27,12 @@
|
||||
<div class="flex flex-col gap-2 items-center max-w-sm">
|
||||
{#if icon}
|
||||
<div
|
||||
class="bg-slate-100 dark:bg-zinc-900 p-3 rounded-2xl text-primary-900 dark:text-primary-100"
|
||||
class={[
|
||||
,
|
||||
iconClass
|
||||
? iconClass
|
||||
: 'bg-slate-100 dark:bg-zinc-900 p-3 rounded-2xl text-primary-900 dark:text-primary-100',
|
||||
]}
|
||||
>
|
||||
<Icon src={icon} size="28" solid />
|
||||
</div>
|
||||
|
||||
@@ -35,43 +35,47 @@
|
||||
<svelte:window {onscroll} />
|
||||
|
||||
{@render children?.()}
|
||||
<div
|
||||
class={[
|
||||
'fixed lg:sticky bottom-0 lg:top-0',
|
||||
!dockVisible && 'max-lg:-bottom-24',
|
||||
'max-w-3xl p-4 left-1/2 -translate-x-1/2 lg:max-w-full lg:p-0 lg:left-0 lg:translate-x-0',
|
||||
'w-full z-50 pointer-events-none',
|
||||
]}
|
||||
style="transition: bottom .4s cubic-bezier(0.075, 0.82, 0.165, 1);"
|
||||
>
|
||||
{@render navbar?.({
|
||||
class: [
|
||||
'bg-slate-100/70 dark:bg-zinc-950/90 border-slate-200/50 dark:border-zinc-900',
|
||||
'pointer-events-auto backdrop-blur-xl border lg:border-t-0 lg:border-x-0',
|
||||
'rounded-full lg:rounded-none',
|
||||
],
|
||||
style: '',
|
||||
})}
|
||||
</div>
|
||||
<div class={['content flex-1', settings.newWidth && 'limit-width']}>
|
||||
{@render sidebar?.({
|
||||
class: `hidden md:flex sticky top-0 lg:top-16 left-0 h-max bg-slate-100 dark:bg-zinc-950 z-40 max-h-screen`,
|
||||
style: 'grid-area: sidebar; width: 100% !important;',
|
||||
})}
|
||||
{@render main?.({
|
||||
class: `w-full bg-slate-50 dark:bg-zinc-925 justify-self-center border-x border-slate-200 dark:border-zinc-900 max-lg:pb-22 pb-3 sm:pb-6`,
|
||||
style: 'grid-area: main',
|
||||
})}
|
||||
{@render suffix?.({
|
||||
class: `max-lg:hidden w-full sticky lg:top-16 h-max max-h-screen overflow-auto left-0 bg-slate-100 dark:bg-zinc-950 z-40`,
|
||||
style: 'grid-area: suffix;',
|
||||
})}
|
||||
<div class="min-h-screen flex flex-col">
|
||||
<div
|
||||
class={[
|
||||
'fixed lg:sticky bottom-0 lg:top-0',
|
||||
!dockVisible && 'max-lg:-bottom-24',
|
||||
'max-w-3xl p-4 left-1/2 -translate-x-1/2 lg:max-w-full lg:p-0 lg:left-0 lg:translate-x-0',
|
||||
'w-full z-50 pointer-events-none',
|
||||
]}
|
||||
style="transition: bottom .4s cubic-bezier(0.075, 0.82, 0.165, 1);"
|
||||
aria-hidden="true"
|
||||
>
|
||||
{@render navbar?.({
|
||||
class: [
|
||||
'bg-slate-100/70 dark:bg-zinc-950/90 border-slate-200/50 dark:border-zinc-900',
|
||||
'pointer-events-auto backdrop-blur-xl border lg:border-t-0 lg:border-x-0',
|
||||
'rounded-full lg:rounded-none',
|
||||
],
|
||||
style: '',
|
||||
})}
|
||||
</div>
|
||||
<div class={['content flex-1', settings.newWidth && 'limit-width']}>
|
||||
{@render sidebar?.({
|
||||
class: `hidden md:flex sticky top-0 lg:top-16 left-0 max-h-[calc(100vh-4rem)] bg-slate-100 dark:bg-zinc-950 z-40`,
|
||||
style: 'grid-area: sidebar; width: 100% !important;',
|
||||
})}
|
||||
{@render main?.({
|
||||
class: `w-full bg-slate-50 dark:bg-zinc-925 justify-self-center border-x border-slate-200 dark:border-zinc-900 max-lg:pb-22 pb-3 sm:pb-6`,
|
||||
style: 'grid-area: main',
|
||||
})}
|
||||
{@render suffix?.({
|
||||
class: `max-lg:hidden w-full sticky lg:top-16 h-max max-h-screen overflow-auto left-0 bg-slate-100 dark:bg-zinc-950 z-40`,
|
||||
style: 'grid-area: suffix;',
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.content {
|
||||
width: 100%;
|
||||
display: grid;
|
||||
height: 100%;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
grid-area: content;
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { t } from '$lib/i18n/translations'
|
||||
|
||||
const sizes = {
|
||||
sm: 'text-2xl',
|
||||
md: 'text-3xl',
|
||||
@@ -25,14 +27,15 @@
|
||||
}: Props = $props()
|
||||
</script>
|
||||
|
||||
<div
|
||||
<header
|
||||
class={[
|
||||
pageHeader &&
|
||||
`w-[calc(100%+1.5rem)] sm:w-[calc(100%+3rem)]
|
||||
bg-slate-100 dark:bg-zinc-950 -mx-3 sm:-mx-6 sm:px-6 sm:pb-6 px-4 pb-4 -mt-24 pt-24
|
||||
border-b border-slate-200/50 dark:border-zinc-900 margin`,
|
||||
bg-slate-100 dark:bg-zinc-950 -mx-3 sm:-mx-6 sm:px-6 sm:pb-6 px-4 pb-4 -mt-64 pt-64
|
||||
border-b border-slate-200 dark:border-zinc-900 margin z-0`,
|
||||
]}
|
||||
{style}
|
||||
aria-label={$t('aria.element.pageHeader')}
|
||||
>
|
||||
<h1
|
||||
class={[sizes[size], 'flex gap-2 w-full tracking-tight font-medium', clazz]}
|
||||
@@ -44,4 +47,4 @@
|
||||
{@render extended?.()}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</header>
|
||||
@@ -1,6 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { invalidateAll } from '$app/navigation'
|
||||
import { page } from '$app/state'
|
||||
import TabButton from '$lib/components/input/switch/TabButton.svelte'
|
||||
import { SvelteURL } from 'svelte/reactivity'
|
||||
|
||||
interface Props {
|
||||
@@ -11,6 +12,7 @@
|
||||
currentRoute?: SvelteURL | undefined
|
||||
buildUrl?: (currentRoute: SvelteURL | undefined, href: string) => string
|
||||
children?: import('svelte').Snippet
|
||||
style?: 'header' | 'subpage'
|
||||
}
|
||||
|
||||
let {
|
||||
@@ -18,6 +20,7 @@
|
||||
currentRoute = undefined,
|
||||
buildUrl = (_, href) => href,
|
||||
children,
|
||||
style = 'header',
|
||||
}: Props = $props()
|
||||
|
||||
function isSelected(url: URL, href?: SvelteURL) {
|
||||
@@ -27,25 +30,34 @@
|
||||
</script>
|
||||
|
||||
<nav
|
||||
class="flex flex-row items-center gap-x-8 gap-y-4 p-1 justify-center sm:justify-start my-2 sm:mt-0 flex-wrap"
|
||||
class={[
|
||||
'flex flex-row items-center justify-center sm:justify-start my-2 sm:mt-0 flex-wrap z-20',
|
||||
style == 'header' ? 'p-1 gap-x-8 gap-y-4' : 'gap-2',
|
||||
]}
|
||||
>
|
||||
{#each routes as route (route.href)}
|
||||
{@const selected = isSelected(
|
||||
page.url,
|
||||
new SvelteURL(`${page.url.origin}${route.href}`),
|
||||
)}
|
||||
<a
|
||||
onclick={() => invalidateAll()}
|
||||
href={buildUrl(currentRoute, route.href)}
|
||||
class={[
|
||||
'rounded-full font-medium transition-colors duration-100 relative z-0 shrink-0 hover:text-slate-900 hover:dark:text-zinc-100',
|
||||
selected
|
||||
? 'text-primary-900 dark:text-primary-100'
|
||||
: 'text-slate-500 dark:text-zinc-500',
|
||||
]}
|
||||
>
|
||||
{route.name}
|
||||
</a>
|
||||
{#if style == 'header'}
|
||||
<a
|
||||
onclick={() => invalidateAll()}
|
||||
href={buildUrl(currentRoute, route.href)}
|
||||
class={[
|
||||
'rounded-full font-medium transition-colors duration-100 relative z-0 shrink-0 hover:text-slate-900 hover:dark:text-zinc-100',
|
||||
selected
|
||||
? 'text-primary-900 dark:text-primary-100'
|
||||
: 'text-slate-500 dark:text-zinc-500',
|
||||
]}
|
||||
>
|
||||
{route.name}
|
||||
</a>
|
||||
{:else}
|
||||
<TabButton href={buildUrl(currentRoute, route.href)} {selected}>
|
||||
{route.name}
|
||||
</TabButton>
|
||||
{/if}
|
||||
{/each}
|
||||
{@render children?.()}
|
||||
</nav>
|
||||
@@ -35,12 +35,14 @@
|
||||
color="none"
|
||||
{...rest}
|
||||
class={[
|
||||
'shrink-0 rounded-full w-10 h-10 lg:w-max lg:h-8 lg:rounded-xl',
|
||||
'shrink-0 lg:rounded-xl w-10 h-10 rounded-full',
|
||||
adaptive ? 'lg:w-max lg:h-8' : 'lg:w-8 lg:h-8',
|
||||
!rest.color &&
|
||||
'hover:text-slate-900 dark:hover:text-zinc-50 transition-colors',
|
||||
isSelected
|
||||
? 'text-primary-900 dark:text-primary-100 max-lg:bg-slate-100 max-lg:dark:bg-zinc-800'
|
||||
: 'text-slate-500 dark:text-zinc-400',
|
||||
!rest.color &&
|
||||
(isSelected
|
||||
? 'text-primary-900 dark:text-primary-100 max-lg:bg-slate-100 max-lg:dark:bg-zinc-800'
|
||||
: 'text-slate-500 dark:text-zinc-400'),
|
||||
clazz,
|
||||
]}
|
||||
shadow="none"
|
||||
@@ -54,7 +56,7 @@
|
||||
{#snippet prefix()}
|
||||
<div class={(icon || customIcon) && adaptive ? 'lg:hidden' : ''}>
|
||||
{#if icon}
|
||||
<Icon src={icon} size="20" mini />
|
||||
<Icon src={icon} size="18" micro />
|
||||
{:else}
|
||||
{@render customIcon?.({ size: 16, isSelected })}
|
||||
{/if}
|
||||
|
||||
@@ -8,16 +8,12 @@
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { LINKED_INSTANCE_URL } from '$lib/instance.svelte'
|
||||
import { site } from '$lib/lemmy.svelte.js'
|
||||
import { Badge, Menu, MenuButton, MenuDivider, Spinner } from 'mono-svelte'
|
||||
import { Menu, Spinner } from 'mono-svelte'
|
||||
import {
|
||||
Bars3,
|
||||
Bell,
|
||||
GlobeAlt,
|
||||
Icon,
|
||||
Inbox,
|
||||
MagnifyingGlass,
|
||||
Newspaper,
|
||||
PencilSquare,
|
||||
Plus,
|
||||
ServerStack,
|
||||
ShieldCheck,
|
||||
@@ -36,15 +32,6 @@
|
||||
let { style = '', class: clazz = '' }: Props = $props()
|
||||
</script>
|
||||
|
||||
{#snippet notifBadge(number: number)}
|
||||
<Badge
|
||||
color={number > 0 ? 'red-subtle' : 'gray-subtle'}
|
||||
class="min-w-5 h-5 p-0! px-0.5 grid place-items-center ml-auto"
|
||||
>
|
||||
{number > 99 ? '∞' : number}
|
||||
</Badge>
|
||||
{/snippet}
|
||||
|
||||
<CommandsWrapper bind:open={promptOpen} />
|
||||
<nav
|
||||
class={[
|
||||
@@ -61,7 +48,7 @@
|
||||
}}
|
||||
href="/"
|
||||
label={$t('nav.home')}
|
||||
class="ml-2 lg:ml-2 logo border-0 lg:rounded-full! lg:w-10! lg:h-10 lg:px-0!"
|
||||
class="ml-2 lg:ml-2 logo border-0 lg:rounded-full! lg:w-10! lg:h-10 lg:px-0! text-primary-900! dark:text-primary-100!"
|
||||
adaptive={false}
|
||||
>
|
||||
{#snippet customIcon()}
|
||||
@@ -109,93 +96,14 @@
|
||||
icon={GlobeAlt}
|
||||
/>
|
||||
<NavButton href="/search" label={$t('nav.search')} icon={MagnifyingGlass} />
|
||||
{#if profile.current.jwt}
|
||||
{@const linkOnly =
|
||||
!profile.current.user ||
|
||||
!(isAdmin(profile.current.user) || amModOfAny(profile.current.user))}
|
||||
<Menu manual={linkOnly} placement="top">
|
||||
{#snippet target()}
|
||||
<NavButton
|
||||
label={$t('nav.notifications')}
|
||||
icon={Bell}
|
||||
class="relative"
|
||||
adaptive={false}
|
||||
href={linkOnly ? '/inbox' : undefined}
|
||||
>
|
||||
{#if Math.max(...Object.values($notifications)) > 0}
|
||||
<div
|
||||
class="rounded-full w-2 h-2 bg-red-500 absolute top-1 left-3 z-10"
|
||||
></div>
|
||||
{/if}
|
||||
</NavButton>
|
||||
{/snippet}
|
||||
<MenuButton href="/inbox" icon={Inbox}>
|
||||
{$t('profile.inbox')}
|
||||
{#snippet suffix()}
|
||||
{@render notifBadge($notifications.inbox)}
|
||||
{/snippet}
|
||||
</MenuButton>
|
||||
{#if amModOfAny(profile.current.user)}
|
||||
<MenuButton href="/moderation" icon={ShieldCheck}>
|
||||
{$t('routes.moderation.feed')}
|
||||
{#snippet suffix()}
|
||||
{@render notifBadge($notifications.reports)}
|
||||
{/snippet}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
{#if profile.current.user && isAdmin(profile.current.user)}
|
||||
<MenuButton href="/admin/applications" icon={ServerStack}>
|
||||
{$t('routes.admin.applications.title')}
|
||||
{#snippet suffix()}
|
||||
{@render notifBadge($notifications.applications)}
|
||||
{/snippet}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
</Menu>
|
||||
{/if}
|
||||
<Menu
|
||||
manual={site.data?.site_view.local_site.community_creation_admin_only &&
|
||||
!(profile.current.user && isAdmin(profile.current.user))}
|
||||
placement="top"
|
||||
>
|
||||
{#snippet target()}
|
||||
<NavButton
|
||||
class="relative"
|
||||
label={$t('nav.create.label')}
|
||||
icon={Plus}
|
||||
adaptive={false}
|
||||
href={site.data?.site_view.local_site.community_creation_admin_only &&
|
||||
!(profile.current.user && isAdmin(profile.current.user))
|
||||
? '/create/post'
|
||||
: undefined}
|
||||
/>
|
||||
{/snippet}
|
||||
<MenuDivider>{$t('nav.create.label')}</MenuDivider>
|
||||
<MenuButton link href="/create/post" disabled={!profile.current?.jwt}>
|
||||
{#snippet prefix()}
|
||||
<Icon src={PencilSquare} size="16" micro />
|
||||
{/snippet}
|
||||
{$t('nav.create.post')}
|
||||
</MenuButton>
|
||||
<MenuButton
|
||||
link
|
||||
href="/create/community"
|
||||
disabled={!profile.current?.jwt ||
|
||||
!profile.current?.user ||
|
||||
(site.data?.site_view.local_site.community_creation_admin_only &&
|
||||
!isAdmin(profile.current.user))}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Newspaper} size="16" micro />
|
||||
{/snippet}
|
||||
{$t('nav.create.community')}
|
||||
</MenuButton>
|
||||
{#if !profile.current?.jwt}
|
||||
<span class="text-sm mx-4 my-1 py-1">
|
||||
{$t('nav.create.logingate')}
|
||||
</span>
|
||||
{/if}
|
||||
</Menu>
|
||||
<NavButton
|
||||
class="relative"
|
||||
label={$t('nav.create.label')}
|
||||
icon={Plus}
|
||||
adaptive={false}
|
||||
color="primary"
|
||||
href="/create"
|
||||
/>
|
||||
<Menu placement="bottom">
|
||||
{#snippet target()}
|
||||
<button
|
||||
@@ -219,6 +127,11 @@
|
||||
<Icon src={Bars3} micro size="18" />
|
||||
</div>
|
||||
{/if}
|
||||
{#if Math.max(...Object.values($notifications)) > 0}
|
||||
<div
|
||||
class="w-2 h-2 absolute top-0.5 right-0.5 bg-red-500 rounded-full"
|
||||
></div>
|
||||
{/if}
|
||||
</button>
|
||||
{/snippet}
|
||||
{#snippet children(open)}
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
<script lang="ts">
|
||||
import { env } from '$env/dynamic/public'
|
||||
import { notifications, profile } from '$lib/auth.svelte'
|
||||
import {
|
||||
amModOfAny,
|
||||
isAdmin,
|
||||
} from '$lib/components/lemmy/moderation/moderation'
|
||||
|
||||
import SiteCard from '$lib/components/lemmy/SiteCard.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
@@ -29,6 +34,7 @@
|
||||
Inbox,
|
||||
Moon,
|
||||
ServerStack,
|
||||
ShieldCheck,
|
||||
Sun,
|
||||
Swatch,
|
||||
UserCircle,
|
||||
@@ -53,13 +59,18 @@
|
||||
</Modal>
|
||||
{/if}
|
||||
|
||||
{#snippet notifBadge(number: number)}
|
||||
{#if number > 0}
|
||||
<Badge
|
||||
color="red-subtle"
|
||||
class="min-w-5 h-5 p-0! px-0.5 grid place-items-center ml-auto"
|
||||
>
|
||||
{number > 99 ? '∞' : number}
|
||||
</Badge>
|
||||
{/if}
|
||||
{/snippet}
|
||||
|
||||
{#if profile.current?.jwt}
|
||||
<MenuButton href="/profile">
|
||||
{#snippet prefix()}
|
||||
<Icon src={UserCircle} micro size="16" />
|
||||
{/snippet}
|
||||
{$t('profile.profile')}
|
||||
</MenuButton>
|
||||
<MenuButton href="/inbox">
|
||||
{#snippet prefix()}
|
||||
<Icon src={Inbox} micro size="16" />
|
||||
@@ -71,6 +82,29 @@
|
||||
</Badge>
|
||||
{/if}
|
||||
</MenuButton>
|
||||
{#if amModOfAny(profile.current.user)}
|
||||
<MenuButton href="/moderation" icon={ShieldCheck}>
|
||||
{$t('routes.moderation.feed')}
|
||||
{#snippet suffix()}
|
||||
{@render notifBadge($notifications.reports)}
|
||||
{/snippet}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
{#if profile.current.user && isAdmin(profile.current.user)}
|
||||
<MenuButton href="/admin/applications" icon={ServerStack}>
|
||||
{$t('routes.admin.applications.title')}
|
||||
{#snippet suffix()}
|
||||
{@render notifBadge($notifications.applications)}
|
||||
{/snippet}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
<MenuDivider>{$t('profile.profile')}</MenuDivider>
|
||||
<MenuButton href="/profile">
|
||||
{#snippet prefix()}
|
||||
<Icon src={UserCircle} micro size="16" />
|
||||
{/snippet}
|
||||
{$t('profile.profile')}
|
||||
</MenuButton>
|
||||
<MenuButton href="/saved">
|
||||
{#snippet prefix()}
|
||||
<Icon src={Bookmark} micro size="16" />
|
||||
@@ -169,13 +203,15 @@
|
||||
>
|
||||
<Icon src={ServerStack} size="16" micro />
|
||||
</Button>
|
||||
<Button
|
||||
color="tertiary"
|
||||
href="https://github.com/Xyphyn/Photon"
|
||||
title={$t('nav.menu.source')}
|
||||
size="square-md"
|
||||
>
|
||||
<Icon src={CodeBracketSquare} size="16" micro />
|
||||
</Button>
|
||||
{#if env.PUBLIC_XYLIGHT_MODE.toLowerCase() == 'true'}
|
||||
<Button
|
||||
color="tertiary"
|
||||
href="https://github.com/Xyphyn/Photon"
|
||||
title={$t('nav.menu.source')}
|
||||
size="square-md"
|
||||
>
|
||||
<Icon src={CodeBracketSquare} size="16" micro />
|
||||
</Button>
|
||||
{/if}
|
||||
</div>
|
||||
</li>
|
||||
@@ -21,6 +21,7 @@
|
||||
alignment="left"
|
||||
color="none"
|
||||
size="custom"
|
||||
class="block w-full"
|
||||
data-sveltekit-preload-code="viewport"
|
||||
data-sveltekit-preload-data="tap"
|
||||
{...rest}
|
||||
@@ -28,21 +29,27 @@
|
||||
{#if typeof action.icon === 'string'}
|
||||
<Avatar url={action.icon} width={20} />
|
||||
{:else}
|
||||
<Icon src={action.icon ?? QuestionMarkCircle} size="20" />
|
||||
<Icon
|
||||
src={action.icon ?? QuestionMarkCircle}
|
||||
solid
|
||||
size="20"
|
||||
class="text-slate-600 dark:text-zinc-400"
|
||||
/>
|
||||
{/if}
|
||||
{@render children?.()}
|
||||
<span class="mr-auto inline-flex flex-col">
|
||||
<div class="inline-flex flex-col">
|
||||
<span>{action.name}</span>
|
||||
{#if action.detail}
|
||||
<span class="font-normal text-xs">{action.detail}</span>
|
||||
{/if}
|
||||
</span>
|
||||
</div>
|
||||
<div class="flex-1"></div>
|
||||
{#if action.shortcut}
|
||||
<div class="flex items-center gap-0.5 text-xs font-medium">
|
||||
⌘ {action.shortcut}
|
||||
</div>
|
||||
{/if}
|
||||
{#if action.subActions}
|
||||
<Icon src={ArrowUturnDown} size="16" micro />
|
||||
<Icon src={ArrowUturnDown} size="16" micro class="" />
|
||||
{/if}
|
||||
</Button>
|
||||
@@ -13,6 +13,7 @@
|
||||
import CommandItem from './CommandItem.svelte'
|
||||
import { fuzzySearch } from '$lib/util.svelte'
|
||||
import CommonList from '../../layout/CommonList.svelte'
|
||||
import EndPlaceholder from '../../EndPlaceholder.svelte'
|
||||
|
||||
interface Props {
|
||||
open?: boolean
|
||||
@@ -253,7 +254,7 @@
|
||||
<div class="space-y-1" bind:this={container}>
|
||||
{#each filteredGroups as group, groupIndex}
|
||||
<div class="space-y-1">
|
||||
<span class="text-sm font-medium">{group.name}</span>
|
||||
<EndPlaceholder margin="md" size="sm">{group.name}</EndPlaceholder>
|
||||
<CommonList size="xs" class="p-0! sm:p-0! lg:p-0!">
|
||||
{#each group.actions as action, actionIndex}
|
||||
{@const globalIndex =
|
||||
@@ -263,7 +264,8 @@
|
||||
<li
|
||||
class={[
|
||||
'custom-size',
|
||||
globalIndex == selectedIndex && 'brightness-125',
|
||||
globalIndex == selectedIndex &&
|
||||
'brightness-95 dark:brightness-125',
|
||||
]}
|
||||
>
|
||||
<CommandItem
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
<script lang="ts">
|
||||
import { Badge, Button, Menu, MenuButton } from 'mono-svelte'
|
||||
import {
|
||||
CheckCircle,
|
||||
ChevronUpDown,
|
||||
Icon,
|
||||
QuestionMarkCircle,
|
||||
UserGroup,
|
||||
} from 'svelte-hero-icons'
|
||||
import Avatar from '../Avatar.svelte'
|
||||
import { profile, type ProfileInfo } from '$lib/auth.svelte'
|
||||
import { goto } from '$app/navigation'
|
||||
import { page } from '$app/state'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
|
||||
let { profiles }: { profiles: ProfileInfo[] } = $props()
|
||||
|
||||
function switchTo(id: number) {
|
||||
profile.meta.profile = id
|
||||
|
||||
goto(page.url, {
|
||||
invalidateAll: true,
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<Menu placement="bottom">
|
||||
{#snippet target()}
|
||||
<Button
|
||||
color="tertiary"
|
||||
alignment="left"
|
||||
size="md"
|
||||
rounding="xl"
|
||||
class="flex flex-row gap-2 items-center"
|
||||
aria-label={$t('aria.sidebar.accounts')}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Avatar
|
||||
url={profile.current.avatar}
|
||||
alt={profile.current.username}
|
||||
width={24}
|
||||
/>
|
||||
{/snippet}
|
||||
<div class="flex-1">
|
||||
<div class="font-medium">{profile.current.username}</div>
|
||||
<div class="text-xs text-slate-500 dark:text-zinc-500">
|
||||
{profile.current.instance}
|
||||
</div>
|
||||
</div>
|
||||
{#snippet suffix()}
|
||||
<Icon
|
||||
src={ChevronUpDown}
|
||||
size="16"
|
||||
micro
|
||||
class="block justify-self-end"
|
||||
/>
|
||||
{/snippet}
|
||||
</Button>
|
||||
{/snippet}
|
||||
{#each profiles as p}
|
||||
{@const selected = profile.meta.profile == p.id}
|
||||
<MenuButton
|
||||
onclick={() => switchTo(p.id)}
|
||||
class={[selected && 'bg-slate-100! dark:bg-zinc-800!']}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Avatar url={p.avatar} alt={p.username} width={24} />
|
||||
{/snippet}
|
||||
<div>
|
||||
<div class="font-medium text-sm">{p.username}</div>
|
||||
<div class="text-xs text-slate-500 dark:text-zinc-500">
|
||||
{p.instance}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex-1"></div>
|
||||
{#if !p.jwt}
|
||||
<Badge color="gray-subtle" class="p-1!">
|
||||
<Icon src={QuestionMarkCircle} size="16" micro />
|
||||
</Badge>
|
||||
{/if}
|
||||
{#if selected}
|
||||
<Icon
|
||||
src={CheckCircle}
|
||||
class="text-primary-900 dark:text-primary-100"
|
||||
size="16"
|
||||
micro
|
||||
/>
|
||||
{/if}
|
||||
</MenuButton>
|
||||
{/each}
|
||||
<MenuButton href="/accounts">
|
||||
{#snippet prefix()}
|
||||
<Icon src={UserGroup} size="16" micro />
|
||||
{/snippet}
|
||||
{$t('account.accounts')}
|
||||
</MenuButton>
|
||||
</Menu>
|
||||
@@ -1,25 +1,31 @@
|
||||
<script lang="ts">
|
||||
import { notifications, profile } from '$lib/auth.svelte.js'
|
||||
import ItemList from '$lib/components/lemmy/generic/ItemList.svelte'
|
||||
import Expandable from '$lib/components/ui/Expandable.svelte'
|
||||
import ProfileButton from '$lib/components/ui/sidebar/ProfileButton.svelte'
|
||||
import SidebarButton from '$lib/components/ui/sidebar/SidebarButton.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { communityLink } from '$lib/lemmy/generic'
|
||||
import { settings } from '$lib/settings.svelte.js'
|
||||
import { Badge } from 'mono-svelte'
|
||||
import { theme } from '$lib/ui/colors.svelte'
|
||||
import { Badge, Option, Select } from 'mono-svelte'
|
||||
import {
|
||||
ArrowLeftOnRectangle,
|
||||
Bookmark,
|
||||
Cog6Tooth,
|
||||
ComputerDesktop,
|
||||
Identification,
|
||||
Inbox,
|
||||
Moon,
|
||||
Sun,
|
||||
Swatch,
|
||||
UserCircle,
|
||||
UserGroup,
|
||||
} from 'svelte-hero-icons'
|
||||
import type { ClassValue } from 'svelte/elements'
|
||||
import Avatar from '../Avatar.svelte'
|
||||
import EndPlaceholder from '../EndPlaceholder.svelte'
|
||||
import CommonList from '../layout/CommonList.svelte'
|
||||
import ProfileSelection from './ProfileSelection.svelte'
|
||||
import Logo from '../Logo.svelte'
|
||||
import { PUBLIC_XYLIGHT_MODE } from '$env/static/public'
|
||||
|
||||
interface Props {
|
||||
style?: string
|
||||
@@ -29,202 +35,160 @@
|
||||
let { style = '', class: clazz = '' }: Props = $props()
|
||||
</script>
|
||||
|
||||
<nav class={['flex flex-col overflow-auto gap-1', clazz]} {style}>
|
||||
<nav
|
||||
aria-label={$t('aria.sidebar.title')}
|
||||
class={['flex flex-col overflow-auto gap-1', clazz]}
|
||||
{style}
|
||||
>
|
||||
<ProfileSelection profiles={profile.meta.profiles} />
|
||||
<EndPlaceholder margin="sm" size="xs">{$t('profile.profile')}</EndPlaceholder>
|
||||
{#if profile.current?.jwt}
|
||||
<SidebarButton icon={UserCircle} href="/profile">
|
||||
{#snippet label()}
|
||||
<span>
|
||||
{$t('profile.profile')}
|
||||
</span>
|
||||
{/snippet}
|
||||
</SidebarButton>
|
||||
<SidebarButton icon={Inbox} href="/inbox">
|
||||
{#snippet label()}
|
||||
<span class="flex items-center gap-2">
|
||||
{$t('profile.inbox')}
|
||||
{#if $notifications.inbox}
|
||||
<Badge
|
||||
class="min-w-5 h-5 p-0! px-0.5 grid place-items-center ml-auto"
|
||||
color="red-subtle"
|
||||
>
|
||||
{$notifications.inbox > 99 ? '∞' : $notifications.inbox}
|
||||
</Badge>
|
||||
{/if}
|
||||
</span>
|
||||
{/snippet}
|
||||
</SidebarButton>
|
||||
<SidebarButton icon={Bookmark} href="/saved">
|
||||
{#snippet label()}
|
||||
<span>{$t('profile.saved')}</span>
|
||||
{/snippet}
|
||||
<SidebarButton
|
||||
icon={UserCircle}
|
||||
href="/profile"
|
||||
label={$t('profile.profile')}
|
||||
/>
|
||||
<SidebarButton icon={Inbox} href="/inbox" label={$t('profile.inbox')}>
|
||||
{#if $notifications.inbox}
|
||||
<Badge
|
||||
class="min-w-5 h-5 p-0! px-0.5 grid place-items-center ml-auto"
|
||||
color="red-subtle"
|
||||
>
|
||||
{$notifications.inbox > 99 ? '∞' : $notifications.inbox}
|
||||
</Badge>
|
||||
{/if}
|
||||
</SidebarButton>
|
||||
<SidebarButton icon={Bookmark} href="/saved" label={$t('profile.saved')} />
|
||||
{:else}
|
||||
<SidebarButton
|
||||
href="/login"
|
||||
title={$t('account.login')}
|
||||
label={$t('account.login')}
|
||||
icon={ArrowLeftOnRectangle}
|
||||
>
|
||||
{#snippet label()}
|
||||
<span>{$t('account.login')}</span>
|
||||
{/snippet}
|
||||
</SidebarButton>
|
||||
/>
|
||||
<SidebarButton
|
||||
href="/signup"
|
||||
title={$t('account.signup')}
|
||||
label={$t('account.signup')}
|
||||
icon={Identification}
|
||||
>
|
||||
{#snippet label()}
|
||||
<span>{$t('account.signup')}</span>
|
||||
{/snippet}
|
||||
</SidebarButton>
|
||||
/>
|
||||
<SidebarButton
|
||||
href="/settings"
|
||||
title={$t('nav.menu.settings')}
|
||||
icon={Cog6Tooth}
|
||||
>
|
||||
{#snippet label()}
|
||||
<span>{$t('nav.menu.settings')}</span>
|
||||
{/snippet}
|
||||
</SidebarButton>
|
||||
href="/accounts"
|
||||
label={$t('account.accounts')}
|
||||
icon={UserGroup}
|
||||
/>
|
||||
{/if}
|
||||
{#if profile.meta.profiles.length >= 1}
|
||||
<hr class="border-slate-200 dark:border-zinc-900 my-1" />
|
||||
|
||||
<Expandable
|
||||
class="max-w-full min-w-0 w-full"
|
||||
bind:open={settings.expand.accounts}
|
||||
>
|
||||
{#snippet title()}
|
||||
<span class="px-2 py-1 w-full">
|
||||
<EndPlaceholder border={false}>
|
||||
{$t('account.accounts')}
|
||||
{#snippet action()}
|
||||
<span class="dark:text-white text-black">
|
||||
{profile.meta.profiles.length}
|
||||
</span>
|
||||
{/snippet}
|
||||
</EndPlaceholder>
|
||||
</span>
|
||||
{/snippet}
|
||||
<CommonList
|
||||
size="xs"
|
||||
animate={false}
|
||||
items={profile.meta.profiles}
|
||||
class="px-1 py-0.5"
|
||||
selected={prof => prof.id == profile.meta.profile}
|
||||
<EndPlaceholder margin="sm" size="xs">{$t('nav.menu.app')}</EndPlaceholder>
|
||||
<SidebarButton
|
||||
href="/settings"
|
||||
label={$t('nav.menu.settings')}
|
||||
icon={Cog6Tooth}
|
||||
/>
|
||||
<Select bind:value={theme.colorScheme} size="sm">
|
||||
{#snippet target()}
|
||||
<SidebarButton
|
||||
label={$t('nav.menu.colorscheme.label')}
|
||||
icon={theme.colorScheme == 'system'
|
||||
? ComputerDesktop
|
||||
: theme.colorScheme == 'light'
|
||||
? Sun
|
||||
: Moon}
|
||||
class=" w-full"
|
||||
>
|
||||
{#snippet item(prof, index)}
|
||||
<ProfileButton {index} {prof} />
|
||||
{/snippet}
|
||||
<li class="xs px-1 py-0.5">
|
||||
<SidebarButton href="/accounts" icon={UserGroup}>
|
||||
{$t('account.accounts')}
|
||||
</SidebarButton>
|
||||
</li>
|
||||
</CommonList>
|
||||
</Expandable>
|
||||
{/if}
|
||||
<hr class="border-slate-200 dark:border-zinc-900 my-1" />
|
||||
<Option value="system" class="hidden" icon={ComputerDesktop}>
|
||||
{$t('nav.menu.colorscheme.system')}
|
||||
</Option>
|
||||
<Option value="light" class="hidden" icon={Sun}>
|
||||
{$t('nav.menu.colorscheme.light')}
|
||||
</Option>
|
||||
<Option value="dark" class="hidden" icon={Moon}>
|
||||
{$t('nav.menu.colorscheme.dark')}
|
||||
</Option>
|
||||
</SidebarButton>
|
||||
{/snippet}
|
||||
</Select>
|
||||
<SidebarButton href="/theme" label={$t('nav.menu.theme')} icon={Swatch} />
|
||||
{#if profile.current?.user}
|
||||
{#if profile.current?.user.moderates.length > 0}
|
||||
<Expandable
|
||||
class="max-w-full min-w-0 w-full"
|
||||
bind:open={settings.expand.moderates}
|
||||
>
|
||||
<EndPlaceholder margin="sm" size="xs">
|
||||
{$t('content.communities')}
|
||||
</EndPlaceholder>
|
||||
|
||||
<div class="space-y-3">
|
||||
{#if profile.current?.user.moderates.length > 0}
|
||||
<Expandable class="px-1.5" bind:open={settings.expand.moderates}>
|
||||
{#snippet title()}
|
||||
<span class="px-2 py-1 w-full">
|
||||
<EndPlaceholder border={false}>
|
||||
{$t('routes.profile.moderates')}
|
||||
{#snippet action()}
|
||||
<span class="dark:text-white text-black">
|
||||
{profile.current.user?.moderates.length}
|
||||
</span>
|
||||
{/snippet}
|
||||
</EndPlaceholder>
|
||||
</span>
|
||||
{/snippet}
|
||||
<ItemList
|
||||
items={profile.current.user.moderates.map(i => ({
|
||||
id: i.community.id,
|
||||
name: i.community.title,
|
||||
url: communityLink(i.community),
|
||||
avatar: i.community.icon,
|
||||
instance: new URL(i.community.actor_id).hostname,
|
||||
}))}
|
||||
/>
|
||||
</Expandable>
|
||||
{/if}
|
||||
|
||||
<Expandable class="px-1.5" bind:open={settings.expand.communities}>
|
||||
{#snippet title()}
|
||||
<span class="px-2 py-1 w-full">
|
||||
<EndPlaceholder border={false}>
|
||||
{$t('routes.profile.moderates')}
|
||||
{$t('profile.subscribed')}
|
||||
{#snippet action()}
|
||||
<span class="dark:text-white text-black">
|
||||
{profile.current.user?.moderates.length}
|
||||
{profile.current.user?.follows.length}
|
||||
</span>
|
||||
{/snippet}
|
||||
</EndPlaceholder>
|
||||
</span>
|
||||
{/snippet}
|
||||
<CommonList
|
||||
animate={false}
|
||||
size="xs"
|
||||
items={profile.current.user.moderates}
|
||||
class="px-1 py-0.5"
|
||||
>
|
||||
{#snippet item(moderate)}
|
||||
<SidebarButton
|
||||
class="font-normal w-full h-max"
|
||||
color="none"
|
||||
alignment="left"
|
||||
href={communityLink(moderate.community)}
|
||||
>
|
||||
{#snippet customIcon()}
|
||||
<Avatar
|
||||
url={moderate.community.icon}
|
||||
alt={moderate.community.name}
|
||||
title={moderate.community.title}
|
||||
width={28}
|
||||
/>{/snippet}
|
||||
{#snippet label()}
|
||||
<div class="flex flex-col max-w-full break-words">
|
||||
<span>{moderate.community.title}</span>
|
||||
<span class="text-xs text-slate-600 dark:text-zinc-400">
|
||||
{new URL(moderate.community.actor_id).hostname}
|
||||
</span>
|
||||
</div>
|
||||
{/snippet}
|
||||
</SidebarButton>
|
||||
{/snippet}
|
||||
</CommonList>
|
||||
</Expandable>
|
||||
<hr class="border-slate-200 dark:border-zinc-900 my-1" />
|
||||
{/if}
|
||||
|
||||
<Expandable
|
||||
class="max-w-full min-w-0 w-full"
|
||||
bind:open={settings.expand.communities}
|
||||
>
|
||||
{#snippet title()}
|
||||
<span class="px-2 py-1 w-full">
|
||||
<EndPlaceholder border={false}>
|
||||
{$t('profile.subscribed')}
|
||||
{#snippet action()}
|
||||
<span class="dark:text-white text-black">
|
||||
{profile.current.user?.follows.length}
|
||||
</span>
|
||||
{/snippet}
|
||||
</EndPlaceholder>
|
||||
</span>
|
||||
{/snippet}
|
||||
<CommonList
|
||||
animate={false}
|
||||
size="xs"
|
||||
items={profile.current.user.follows}
|
||||
class="px-1 py-0.5"
|
||||
>
|
||||
{#snippet item(follow)}
|
||||
<SidebarButton
|
||||
class="font-normal w-full h-max"
|
||||
color="none"
|
||||
alignment="left"
|
||||
href={communityLink(follow.community)}
|
||||
>
|
||||
{#snippet customIcon()}
|
||||
<Avatar
|
||||
url={follow.community.icon}
|
||||
alt={follow.community.name}
|
||||
title={follow.community.title}
|
||||
width={28}
|
||||
/>{/snippet}
|
||||
{#snippet label()}
|
||||
<div class="flex flex-col max-w-full break-words">
|
||||
<span>{follow.community.title}</span>
|
||||
<span class="text-xs text-slate-600 dark:text-zinc-400">
|
||||
{new URL(follow.community.actor_id).hostname}
|
||||
</span>
|
||||
</div>
|
||||
{/snippet}
|
||||
</SidebarButton>
|
||||
{/snippet}
|
||||
</CommonList>
|
||||
</Expandable>
|
||||
<ItemList
|
||||
items={profile.current.user.follows.map(i => ({
|
||||
id: i.community.id,
|
||||
name: i.community.title,
|
||||
url: communityLink(i.community),
|
||||
avatar: i.community.icon,
|
||||
instance: new URL(i.community.actor_id).hostname,
|
||||
}))}
|
||||
/>
|
||||
</Expandable>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div class="flex-1 h-full mt-auto"></div>
|
||||
|
||||
<footer
|
||||
class="flex gap-6 flex-col xl:flex-row text-sm text-slate-600 dark:text-zinc-300"
|
||||
>
|
||||
<div class="flex items-center gap-2">
|
||||
<Logo width={16} />
|
||||
<span class="font-medium">
|
||||
{__VERSION__}
|
||||
</span>
|
||||
</div>
|
||||
{#if PUBLIC_XYLIGHT_MODE.toLowerCase() == 'true'}
|
||||
<a
|
||||
href="https://github.com/xyphyn/photon"
|
||||
class="text-blue-600 dark:text-blue-400/60 hover:underline"
|
||||
>
|
||||
{$t('nav.menu.source')}
|
||||
</a>
|
||||
<a
|
||||
href="https://buymeacoffee.com/xylight"
|
||||
class="text-blue-600 dark:text-blue-400/60 hover:underline"
|
||||
>
|
||||
{$t('nav.menu.donate')}
|
||||
</a>
|
||||
{/if}
|
||||
</footer>
|
||||
</nav>
|
||||
@@ -8,9 +8,9 @@
|
||||
href?: string | undefined
|
||||
icon?: IconSource | undefined
|
||||
class?: string
|
||||
label?: string
|
||||
customIcon?: import('svelte').Snippet<[{ selected: boolean }]>
|
||||
children?: import('svelte').Snippet
|
||||
label?: import('svelte').Snippet
|
||||
}
|
||||
|
||||
let {
|
||||
@@ -27,9 +27,9 @@
|
||||
</script>
|
||||
|
||||
<Button
|
||||
color="none"
|
||||
color="tertiary"
|
||||
alignment="left"
|
||||
rounding="pill"
|
||||
rounding="xl"
|
||||
{...rest}
|
||||
{href}
|
||||
class={[
|
||||
@@ -46,11 +46,9 @@
|
||||
{#if customIcon}
|
||||
{@render customIcon({ selected })}
|
||||
{:else if icon}
|
||||
<Icon src={icon} solid size="20" />
|
||||
<Icon src={icon} solid size="18" />
|
||||
{/if}
|
||||
{/snippet}
|
||||
{label}
|
||||
{@render children?.()}
|
||||
<div class="contents">
|
||||
{@render label?.()}
|
||||
</div>
|
||||
</Button>
|
||||
+16
-13
@@ -162,7 +162,8 @@
|
||||
"2fa": {
|
||||
"totp": "TOTP",
|
||||
"2fa": "2FA",
|
||||
"paste": "Paste this in your authenticator app."
|
||||
"paste": "Paste this in your authenticator app.",
|
||||
"disabled": "2FA is disabled"
|
||||
},
|
||||
"deleteAccount": {
|
||||
"label": "Delete account",
|
||||
@@ -172,6 +173,10 @@
|
||||
"languages": {
|
||||
"title": "Languages",
|
||||
"description": "If any are set, you will only see content explicitly tagged as that language. Most content, untagged, falls under 'Undetermined'."
|
||||
},
|
||||
"credentials": {
|
||||
"title": "Manage how you log in",
|
||||
"description": "You can enable 2FA for greater security, change your password, view logged in devices, or delete your account here."
|
||||
}
|
||||
},
|
||||
"email": "Email",
|
||||
@@ -254,7 +259,8 @@
|
||||
"warning": "This is permanent. Are you sure you want to do this?"
|
||||
},
|
||||
"overview": "Overview",
|
||||
"submissions": "Submissions"
|
||||
"submissions": "Submissions",
|
||||
"edit": "Edit"
|
||||
},
|
||||
"translators": "Translators",
|
||||
"accounts": "Accounts",
|
||||
@@ -544,17 +550,6 @@
|
||||
"delete": "Delete",
|
||||
"restore": "Restore"
|
||||
},
|
||||
"mediaBias": {
|
||||
"description": "Description",
|
||||
"credibility": "Credibility",
|
||||
"reporting": "Factual Reporting",
|
||||
"noData": {
|
||||
"title": "No data",
|
||||
"description": "There is no bias data for this website."
|
||||
},
|
||||
"downloading": "Downloading dataset",
|
||||
"loading": "Loading source"
|
||||
},
|
||||
"link": {
|
||||
"title": "Alternative Links",
|
||||
"actions": "Link Actions"
|
||||
@@ -955,6 +950,14 @@
|
||||
"upvotes": "{{default}} upvotes",
|
||||
"downvotes": "{{default}} downvotes",
|
||||
"score": "Score: {{default}}"
|
||||
},
|
||||
"sidebar": {
|
||||
"title": "Sidebar",
|
||||
"accounts": "Accounts selector"
|
||||
},
|
||||
"loading": "Loading",
|
||||
"element": {
|
||||
"pageHeader": "Page header"
|
||||
}
|
||||
},
|
||||
"stats": {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { profile, type Profile } from '$lib/auth.svelte'
|
||||
import { profile, type ProfileInfo } from '$lib/auth.svelte'
|
||||
import { getClient } from '$lib/lemmy.svelte.js'
|
||||
import { trycatch } from '$lib/util.svelte'
|
||||
import type { Community, MyUserInfo } from 'lemmy-js-client'
|
||||
@@ -51,5 +51,5 @@ export const addAdmin = async (handle: string, added: boolean) =>
|
||||
})
|
||||
})
|
||||
|
||||
export const hasFavorite = (profile: Profile, id: number): boolean =>
|
||||
export const hasFavorite = (profile: ProfileInfo, id: number): boolean =>
|
||||
profile.favorites?.map(i => i.id).includes(id) ?? false
|
||||
@@ -18,7 +18,7 @@
|
||||
hover:bg-slate-100 dark:hover:bg-zinc-800 dark:hover:border-zinc-700 dark:active:bg-zinc-900 active:bg-slate-200`,
|
||||
|
||||
tertiary:
|
||||
'border border-transparent bg-transparent hover:bg-slate-100 dark:hover:bg-zinc-700/30 dark:text-zinc-200',
|
||||
' bg-transparent hover:bg-slate-200/50 dark:hover:bg-zinc-700/30 dark:text-zinc-200',
|
||||
|
||||
danger:
|
||||
'border border-red-500 bg-red-500 hover:text-red-500 hover:bg-transparent text-white',
|
||||
@@ -47,9 +47,9 @@
|
||||
export const buttonSize = {
|
||||
xs: 'px-2 py-1 text-xs',
|
||||
sm: 'px-3 py-1.5 text-[12px]',
|
||||
md: 'px-3 py-1.5',
|
||||
lg: 'px-4 py-2',
|
||||
xl: 'px-6 py-3',
|
||||
md: 'px-3 py-1.5 text-sm',
|
||||
lg: 'px-4 py-2 text-sm',
|
||||
xl: 'px-6 py-3 text-base',
|
||||
'square-sm': 'w-6 h-6',
|
||||
'square-md': 'w-8 h-8',
|
||||
'square-lg': 'w-10 h-10',
|
||||
@@ -105,7 +105,7 @@
|
||||
size = 'md',
|
||||
rounding = size == 'lg' ? 'xl' : 'lg',
|
||||
alignment = 'center',
|
||||
shadow = color != 'tertiary' ? 'sm' : 'none',
|
||||
shadow = color != 'tertiary' ? 'none' : 'none',
|
||||
column = false,
|
||||
disabled,
|
||||
loaderWidth = undefined,
|
||||
@@ -129,7 +129,7 @@
|
||||
buttonRounding[rounding],
|
||||
buttonShadow[shadow],
|
||||
buttonColor[color],
|
||||
'text-sm transition-all font-medium cursor-pointer duration-75 disabled:opacity-50 disabled:pointer-events-none disabled:shadow-none',
|
||||
'transition-all font-medium cursor-pointer duration-75 disabled:opacity-50 disabled:pointer-events-none disabled:shadow-none text-sm',
|
||||
(disabled || loading) && 'pointer-events-none opacity-50 shadow-none',
|
||||
alignment == 'center'
|
||||
? 'origin-center'
|
||||
@@ -144,7 +144,7 @@
|
||||
class={[
|
||||
'flex',
|
||||
column ? 'flex-col justify-center' : 'flex-row items-center',
|
||||
'h-full gap-1.5 button-content',
|
||||
'h-full gap-1.5 button-content w-full',
|
||||
buttonAlignment[alignment],
|
||||
]}
|
||||
>
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
},
|
||||
]
|
||||
>
|
||||
target?: Snippet
|
||||
oncontextmenu?: HTMLSelectAttributes['oncontextmenu']
|
||||
onchange?: HTMLSelectAttributes['onchange']
|
||||
placement?: Placement
|
||||
@@ -33,7 +34,7 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts" generics="T">
|
||||
import { setContext, tick } from 'svelte'
|
||||
import { setContext, tick, type Snippet } from 'svelte'
|
||||
import {
|
||||
CheckCircle,
|
||||
ChevronUpDown,
|
||||
@@ -76,7 +77,7 @@
|
||||
placeholder = undefined,
|
||||
label = undefined,
|
||||
size = 'md',
|
||||
shadow = 'sm',
|
||||
shadow = 'none',
|
||||
id = generateID(),
|
||||
class: clazz = '',
|
||||
baseClass = '',
|
||||
@@ -87,10 +88,43 @@
|
||||
oncontextmenu,
|
||||
onchange,
|
||||
placement = 'bottom',
|
||||
target,
|
||||
...rest
|
||||
}: Props<T> = $props()
|
||||
</script>
|
||||
|
||||
{#snippet selectTarget()}
|
||||
<select
|
||||
{...rest}
|
||||
{id}
|
||||
bind:this={element}
|
||||
class={[
|
||||
buttonSize[size],
|
||||
buttonShadow[shadow],
|
||||
buttonColor.secondary,
|
||||
'appearance-none transition-colors rounded-xl text-sm w-full min-w-full cursor-pointer pr-6',
|
||||
selectClass,
|
||||
clazz,
|
||||
]}
|
||||
bind:value
|
||||
onmousedown={e => {
|
||||
e.preventDefault()
|
||||
}}
|
||||
onkeypress={e => {
|
||||
e.preventDefault()
|
||||
open = !open
|
||||
}}
|
||||
{onchange}
|
||||
{oncontextmenu}
|
||||
{placeholder}
|
||||
>
|
||||
{#if placeholder}
|
||||
<option disabled selected value="">{placeholder}</option>
|
||||
{/if}
|
||||
{@render children?.()}
|
||||
</select>
|
||||
{/snippet}
|
||||
|
||||
<div class={['flex flex-col gap-1', clazz, baseClass]}>
|
||||
{#if customLabel || label}
|
||||
<Label for={id} text={label}>
|
||||
@@ -99,39 +133,7 @@
|
||||
{/if}
|
||||
|
||||
<div class="w-full relative">
|
||||
<Menu bind:open {placement}>
|
||||
{#snippet target()}
|
||||
<select
|
||||
{...rest}
|
||||
{id}
|
||||
bind:this={element}
|
||||
class={[
|
||||
buttonSize[size],
|
||||
buttonShadow[shadow],
|
||||
buttonColor.secondary,
|
||||
'appearance-none transition-colors rounded-xl text-sm w-full min-w-full cursor-pointer pr-6',
|
||||
selectClass,
|
||||
clazz,
|
||||
]}
|
||||
bind:value
|
||||
onmousedown={e => {
|
||||
e.preventDefault()
|
||||
}}
|
||||
onkeypress={e => {
|
||||
e.preventDefault()
|
||||
open = !open
|
||||
}}
|
||||
{onchange}
|
||||
{oncontextmenu}
|
||||
{placeholder}
|
||||
>
|
||||
{#if placeholder}
|
||||
<option disabled selected value="">{placeholder}</option>
|
||||
{/if}
|
||||
{@render children?.()}
|
||||
</select>
|
||||
{/snippet}
|
||||
|
||||
<Menu bind:open {placement} target={target ?? selectTarget}>
|
||||
{#each context.options as option (option)}
|
||||
{#if customOption}{@render customOption({
|
||||
option,
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
stroke-linejoin="round"
|
||||
class="animate-spin"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
aria-live="polite"
|
||||
role="status"
|
||||
>
|
||||
<line x1="12" y1="2" x2="12" y2="6"></line>
|
||||
<line x1="12" y1="18" x2="12" y2="22"></line>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
none: '',
|
||||
}
|
||||
|
||||
interface Props extends HTMLAttributes<HTMLDivElement> {
|
||||
interface Props extends HTMLAttributes<HTMLElement> {
|
||||
elevation?: Elevation
|
||||
padding?: Padding
|
||||
rounding?: Rounding
|
||||
@@ -53,6 +53,7 @@
|
||||
element?: string
|
||||
class?: ClassValue
|
||||
children?: import('svelte').Snippet
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
let {
|
||||
|
||||
@@ -77,6 +77,8 @@
|
||||
|
||||
<Portal>
|
||||
{#if open}
|
||||
<!--svelte-ignore a11y_interactive_supports_focus-->
|
||||
<!--svelte-ignore a11y_click_events_have_key_events-->
|
||||
<div
|
||||
role="dialog"
|
||||
class="overflow-hidden fixed top-0 left-0 w-screen h-screen z-100
|
||||
@@ -97,10 +99,10 @@ bg-white/50 dark:bg-black/50 box-border p-4"
|
||||
duration: 300,
|
||||
}}
|
||||
class="w-full border border-slate-200 border-b-slate-300
|
||||
dark:border-zinc-900 dark:border-t-zinc-800 dark:border-b-zinc-900
|
||||
rounded-2xl max-w-lg box-border mx-auto overscroll-contain shadow-lg overflow-auto
|
||||
p-5 flex flex-col gap-2 dark:bg-zinc-925
|
||||
bg-white relative {clazz}"
|
||||
dark:border-zinc-900
|
||||
rounded-3xl max-w-lg box-border mx-auto overscroll-contain shadow-lg overflow-auto
|
||||
p-5 flex flex-col gap-2 dark:bg-zinc-950
|
||||
bg-slate-50 relative {clazz}"
|
||||
>
|
||||
{#if dismissable}
|
||||
<Button
|
||||
|
||||
@@ -49,11 +49,11 @@
|
||||
>
|
||||
{#snippet popover()}
|
||||
<div
|
||||
class="w-full max-w-sm origin-top-left max-h-128 overflow-auto list-none shadow-lg rounded-xl"
|
||||
class="w-full max-w-sm max-h-128 overflow-auto list-none shadow-lg rounded-xl"
|
||||
>
|
||||
<div
|
||||
class="flex flex-col p-1 list-none bg-white/80 dark:bg-zinc-900/90 rounded-xl
|
||||
border border-slate-300 dark:border-zinc-800 border-opacity-50 gap-px"
|
||||
border border-slate-200 dark:border-zinc-800 gap-px"
|
||||
>
|
||||
{@render children?.(open)}
|
||||
</div>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
</script>
|
||||
|
||||
<div
|
||||
class="text-slate-800 dark:text-zinc-200 text-xs font-medium m-3 my-2 mb-1 flex items-center gap-1"
|
||||
class="text-slate-800 dark:text-zinc-200 text-xs font-medium mx-3 my-1.5 flex items-center gap-1"
|
||||
>
|
||||
<div class={[!showLabel && 'sr-only']}>{@render children?.()}</div>
|
||||
<hr
|
||||
|
||||
+21
-19
@@ -130,7 +130,7 @@
|
||||
<ModalContainer />
|
||||
|
||||
{#snippet sidebar({ style: s, class: c })}
|
||||
<Sidebar class={[c, 'p-3 sm:p-6']} style={s} />
|
||||
<Sidebar class={[c, 'p-3 sm:p-6 w-full']} style={s} />
|
||||
{/snippet}
|
||||
{#snippet main({ style: s, class: c })}
|
||||
<main
|
||||
@@ -144,23 +144,25 @@
|
||||
{#snippet navbar({ style: s, class: c })}
|
||||
<Navbar class={c} style={s} />
|
||||
{/snippet}
|
||||
{#snippet suffix({ class: c, style: s })}
|
||||
<div class={[c, 'p-3 sm:p-6']} style={s}>
|
||||
{#if page.data.slots?.sidebar?.component}
|
||||
{@const SvelteComponent = page.data.slots.sidebar.component}
|
||||
<SvelteComponent {...page.data.slots.sidebar.props} />
|
||||
{:else if site.data}
|
||||
<SiteCard
|
||||
site={site.data.site_view}
|
||||
taglines={site.data.taglines}
|
||||
admins={site.data.admins}
|
||||
version={site.data.version}
|
||||
/>
|
||||
{:else}
|
||||
<div class="h-64 w-full grid place-items-center">
|
||||
<Spinner width={32} />
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{#snippet suffix({ class: c })}
|
||||
{#if page.data.slots?.sidebar?.component}
|
||||
{@const SvelteComponent = page.data.slots.sidebar.component}
|
||||
<SvelteComponent
|
||||
{...page.data.slots.sidebar.props}
|
||||
class={[c, 'p-3 sm:p-6']}
|
||||
/>
|
||||
{:else if site.data}
|
||||
<SiteCard
|
||||
site={site.data.site_view}
|
||||
taglines={site.data.taglines}
|
||||
admins={site.data.admins}
|
||||
version={site.data.version}
|
||||
class={[c, 'p-3 sm:p-6']}
|
||||
/>
|
||||
{:else}
|
||||
<div class="h-64 w-full grid place-items-center">
|
||||
<Spinner width={32} />
|
||||
</div>
|
||||
{/if}
|
||||
{/snippet}
|
||||
</Shell>
|
||||
+34
-37
@@ -5,6 +5,7 @@
|
||||
import ViewSelect from '$lib/components/lemmy/dropdowns/ViewSelect.svelte'
|
||||
import PostFeed from '$lib/components/lemmy/post/feed/PostFeed.svelte'
|
||||
import VirtualFeed from '$lib/components/lemmy/post/feed/VirtualFeed.svelte'
|
||||
import EndPlaceholder from '$lib/components/ui/EndPlaceholder.svelte'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import Pageination from '$lib/components/ui/Pageination.svelte'
|
||||
import { t } from '$lib/i18n/translations.js'
|
||||
@@ -36,31 +37,25 @@
|
||||
</svelte:head>
|
||||
|
||||
<div class="flex flex-col gap-2 max-w-full w-full min-w-0">
|
||||
<header class="flex flex-col gap-4 relative">
|
||||
<Header pageHeader>
|
||||
{$t('routes.frontpage.title')}
|
||||
<Header pageHeader>
|
||||
{$t('routes.frontpage.title')}
|
||||
|
||||
{#snippet extended()}
|
||||
<form class="flex items-center gap-2" method="get" action="/">
|
||||
{#if type}
|
||||
<Location name="type" navigate bind:selected={type} />
|
||||
{/if}
|
||||
<Sort placement="bottom" name="sort" navigate bind:selected={sort} />
|
||||
<ViewSelect placement="bottom" />
|
||||
{#snippet extended()}
|
||||
<form class="flex items-center gap-2" method="get" action="/">
|
||||
{#if type}
|
||||
<Location name="type" navigate bind:selected={type} />
|
||||
{/if}
|
||||
<Sort placement="bottom" name="sort" navigate bind:selected={sort} />
|
||||
<ViewSelect placement="bottom" />
|
||||
|
||||
<noscript>
|
||||
<Button
|
||||
class="self-end h-[34px] aspect-square"
|
||||
size="custom"
|
||||
submit
|
||||
>
|
||||
<Icon src={ArrowRight} size="16" micro />
|
||||
</Button>
|
||||
</noscript>
|
||||
</form>
|
||||
{/snippet}
|
||||
</Header>
|
||||
</header>
|
||||
<noscript>
|
||||
<Button class="self-end h-[34px] aspect-square" size="custom" submit>
|
||||
<Icon src={ArrowRight} size="16" micro />
|
||||
</Button>
|
||||
</noscript>
|
||||
</form>
|
||||
{/snippet}
|
||||
</Header>
|
||||
|
||||
<FeedComponent
|
||||
bind:posts={data.feed.value.posts.posts}
|
||||
@@ -71,20 +66,22 @@
|
||||
this={settings.infiniteScroll && !settings.posts.noVirtualize
|
||||
? 'noscript'
|
||||
: 'div'}
|
||||
class="mt-auto"
|
||||
class="mt-auto flex flex-col"
|
||||
>
|
||||
<Pageination
|
||||
cursor={{ next: data.feed.value.cursor.next }}
|
||||
href={page =>
|
||||
typeof page == 'number' ? `?page=${page}` : `?cursor=${page}`}
|
||||
back={false}
|
||||
>
|
||||
<span class="flex flex-row items-center gap-1">
|
||||
<Icon src={ChartBar} size="16" mini />
|
||||
{$t('routes.frontpage.footer', {
|
||||
users: site.data?.site_view?.counts?.users_active_day ?? '??',
|
||||
})}
|
||||
</span>
|
||||
</Pageination>
|
||||
<EndPlaceholder>
|
||||
<Icon src={ChartBar} size="16" mini />
|
||||
|
||||
{$t('routes.frontpage.footer', {
|
||||
users: site.data?.site_view?.counts?.users_active_day ?? '??',
|
||||
})}
|
||||
{#snippet action()}
|
||||
<Pageination
|
||||
cursor={{ next: data.feed.value.cursor.next }}
|
||||
href={page =>
|
||||
typeof page == 'number' ? `?page=${page}` : `?cursor=${page}`}
|
||||
back={false}
|
||||
/>
|
||||
{/snippet}
|
||||
</EndPlaceholder>
|
||||
</svelte:element>
|
||||
</div>
|
||||
@@ -1,16 +1,16 @@
|
||||
<script lang="ts">
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import ImageUploadModal from '$lib/components/lemmy/modal/ImageUploadModal.svelte'
|
||||
import ImageInputUpload from '$lib/components/form/ImageInputUpload.svelte'
|
||||
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
|
||||
import { t } from '$lib/i18n/translations.js'
|
||||
import { getClient, site } from '$lib/lemmy.svelte.js'
|
||||
import { errorMessage } from '$lib/lemmy/error.js'
|
||||
import type { EditSite } from 'lemmy-js-client'
|
||||
import {
|
||||
Badge,
|
||||
Button,
|
||||
Label,
|
||||
Material,
|
||||
Menu,
|
||||
MenuButton,
|
||||
@@ -20,9 +20,8 @@
|
||||
toast,
|
||||
} from 'mono-svelte'
|
||||
import Option from 'mono-svelte/forms/select/Option.svelte'
|
||||
import { DocumentPlus, Icon, Plus } from 'svelte-hero-icons'
|
||||
import { Icon, Plus } from 'svelte-hero-icons'
|
||||
import type { PageData } from './$types.js'
|
||||
import { errorMessage } from '$lib/lemmy/error.js'
|
||||
|
||||
interface Props {
|
||||
data: PageData
|
||||
@@ -65,11 +64,6 @@
|
||||
}
|
||||
|
||||
let saving = $state(false)
|
||||
|
||||
let uploading = $state({
|
||||
icon: false,
|
||||
banner: false,
|
||||
})
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
@@ -108,66 +102,18 @@
|
||||
}
|
||||
label={$t('routes.legal.title')}
|
||||
/>
|
||||
<div class="flex flex-col gap-1">
|
||||
<Label>{$t('routes.admin.config.icon')}</Label>
|
||||
<button
|
||||
type="button"
|
||||
onclick={() => (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} alt="" 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"
|
||||
/>
|
||||
{/if}
|
||||
</button>
|
||||
{#if uploading.icon}
|
||||
<ImageUploadModal
|
||||
bind:open={uploading.icon}
|
||||
multiple={false}
|
||||
onupload={uploaded => {
|
||||
uploading.icon = false
|
||||
formData.icon = uploaded[0]
|
||||
}}
|
||||
/>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="flex flex-col gap-1">
|
||||
<Label>{$t('routes.admin.config.banner')}</Label>
|
||||
<button
|
||||
type="button"
|
||||
onclick={() => (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} alt="" 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"
|
||||
/>
|
||||
{/if}
|
||||
</button>
|
||||
{#if uploading.banner}
|
||||
<ImageUploadModal
|
||||
bind:open={uploading.banner}
|
||||
multiple={false}
|
||||
onupload={uploaded => {
|
||||
uploading.banner = false
|
||||
formData.banner = uploaded[0]
|
||||
}}
|
||||
/>
|
||||
{/if}
|
||||
</div>
|
||||
<Switch bind:checked={formData.enable_downvotes} defaultValue={true}>
|
||||
<ImageInputUpload
|
||||
label={$t('routes.admin.config.icon')}
|
||||
bind:imageUrl={formData.icon}
|
||||
/>
|
||||
<ImageInputUpload
|
||||
label={$t('routes.admin.config.banner')}
|
||||
bind:imageUrl={formData.banner}
|
||||
/>
|
||||
<Switch bind:checked={formData.enable_downvotes}>
|
||||
{$t('routes.admin.config.downvotesEnabled')}
|
||||
</Switch>
|
||||
<Switch bind:checked={formData.enable_nsfw} defaultValue={true}>
|
||||
<Switch bind:checked={formData.enable_nsfw}>
|
||||
{$t('routes.admin.config.nsfwEnabled')}
|
||||
</Switch>
|
||||
<Select
|
||||
@@ -192,25 +138,16 @@
|
||||
bind:value={formData.application_question}
|
||||
/>
|
||||
{/if}
|
||||
<Switch
|
||||
bind:checked={formData.community_creation_admin_only}
|
||||
defaultValue={true}
|
||||
>
|
||||
<Switch bind:checked={formData.community_creation_admin_only}>
|
||||
{$t('routes.admin.config.adminCommunityOnly')}
|
||||
</Switch>
|
||||
<Switch
|
||||
bind:checked={formData.require_email_verification}
|
||||
defaultValue={true}
|
||||
>
|
||||
<Switch bind:checked={formData.require_email_verification}>
|
||||
{$t('routes.admin.config.requireVerifyEmail')}
|
||||
</Switch>
|
||||
<Switch
|
||||
bind:checked={formData.application_email_admins}
|
||||
defaultValue={true}
|
||||
>
|
||||
<Switch bind:checked={formData.application_email_admins}>
|
||||
{$t('routes.admin.config.emailAdminsOnApplication')}
|
||||
</Switch>
|
||||
<Switch bind:checked={formData.reports_email_admins} defaultValue={true}>
|
||||
<Switch bind:checked={formData.reports_email_admins}>
|
||||
{$t('routes.admin.config.emailAdminsOnReport')}
|
||||
</Switch>
|
||||
<Select
|
||||
@@ -223,10 +160,10 @@
|
||||
{$t('routes.admin.config.listingType.local')}
|
||||
</Option>
|
||||
</Select>
|
||||
<Switch bind:checked={formData.private_instance} defaultValue={true}>
|
||||
<Switch bind:checked={formData.private_instance}>
|
||||
{$t('routes.admin.config.private')}
|
||||
</Switch>
|
||||
<Switch bind:checked={formData.hide_modlog_mod_names} defaultValue={true}>
|
||||
<Switch bind:checked={formData.hide_modlog_mod_names}>
|
||||
{$t('routes.admin.config.hideModlogModNames')}
|
||||
</Switch>
|
||||
<TextInput
|
||||
@@ -234,13 +171,13 @@
|
||||
label={$t('routes.admin.config.slurFilter')}
|
||||
placeholder="(word1|word2)"
|
||||
/>
|
||||
<Switch bind:checked={formData.federation_enabled} defaultValue={true}>
|
||||
<Switch bind:checked={formData.federation_enabled}>
|
||||
{$t('routes.admin.config.federation')}
|
||||
</Switch>
|
||||
<Switch bind:checked={formData.federation_debug} defaultValue={false}>
|
||||
<Switch bind:checked={formData.federation_debug}>
|
||||
{$t('routes.admin.config.federationDebug')}
|
||||
</Switch>
|
||||
<Switch bind:checked={formData.captcha_enabled} defaultValue={false}>
|
||||
<Switch bind:checked={formData.captcha_enabled}>
|
||||
{$t('routes.admin.config.captcha.enabled')}
|
||||
</Switch>
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
import { expoOut } from 'svelte/easing'
|
||||
import { fly } from 'svelte/transition'
|
||||
import SearchBar from '../search/SearchBar.svelte'
|
||||
import EndPlaceholder from '$lib/components/ui/EndPlaceholder.svelte'
|
||||
|
||||
let { data } = $props()
|
||||
|
||||
@@ -96,9 +97,7 @@
|
||||
{/each}
|
||||
</div>
|
||||
{:else}
|
||||
<ul
|
||||
class="flex flex-col divide-y divide-slate-100 dark:divide-zinc-925 my-6 h-full"
|
||||
>
|
||||
<ul class="flex flex-col h-full">
|
||||
{#if data.communities.value.length == 0}
|
||||
<Placeholder
|
||||
icon={QuestionMarkCircle}
|
||||
@@ -108,9 +107,9 @@
|
||||
{/if}
|
||||
|
||||
{#if showTop}
|
||||
<SectionTitle class="border-0! pb-2">
|
||||
<EndPlaceholder size="lg" margin="lg">
|
||||
{$t('routes.search.top')}
|
||||
</SectionTitle>
|
||||
</EndPlaceholder>
|
||||
<div
|
||||
class="grid md:grid-cols-2 lg:grid-cols-3 gap-4 items-center mb-6 border-0!"
|
||||
>
|
||||
@@ -138,9 +137,9 @@
|
||||
{/if}
|
||||
|
||||
{#if data.communities.value.slice(showTop ? 3 : 0).length > 0}
|
||||
<SectionTitle class="border-0! pb-2">
|
||||
<EndPlaceholder size="lg" margin="lg">
|
||||
{$t('routes.search.other')}
|
||||
</SectionTitle>
|
||||
</EndPlaceholder>
|
||||
{/if}
|
||||
{#if data.communities.value}
|
||||
{@const sliced = data.communities.value.slice(showTop ? 3 : 0)}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
<script lang="ts">
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
|
||||
let { children } = $props()
|
||||
</script>
|
||||
|
||||
<Header pageHeader>
|
||||
{$t('nav.create.label')}
|
||||
</Header>
|
||||
|
||||
<div class="h-3 sm:h-6"></div>
|
||||
<Tabs
|
||||
style="subpage"
|
||||
routes={[
|
||||
{
|
||||
href: '/create/post',
|
||||
name: $t('nav.create.post'),
|
||||
},
|
||||
{
|
||||
href: '/create/community',
|
||||
name: $t('nav.create.community'),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
<div class="h-3 sm:h-6"></div>
|
||||
|
||||
{@render children?.()}
|
||||
@@ -0,0 +1,5 @@
|
||||
import { redirect } from '@sveltejs/kit'
|
||||
|
||||
export function load() {
|
||||
redirect(302, '/create/post')
|
||||
}
|
||||
@@ -2,4 +2,6 @@
|
||||
import CommunityForm from '$lib/components/lemmy/community/CommunityForm.svelte'
|
||||
</script>
|
||||
|
||||
<CommunityForm />
|
||||
<CommunityForm>
|
||||
{#snippet formtitle()}{/snippet}
|
||||
</CommunityForm>
|
||||
@@ -32,26 +32,20 @@
|
||||
<title>{$t('form.post.create')}</title>
|
||||
</svelte:head>
|
||||
|
||||
<div class="w-full max-w-5xl mx-auto h-full">
|
||||
<PostForm
|
||||
passedData={data.crosspost == true
|
||||
? post
|
||||
: {
|
||||
body: '',
|
||||
community: null,
|
||||
image: null,
|
||||
loading: false,
|
||||
nsfw: false,
|
||||
title: '',
|
||||
url: undefined,
|
||||
}}
|
||||
passedCommunity={community}
|
||||
onsubmit={e => goto(`/post/${e.post.id}`)}
|
||||
>
|
||||
{#snippet formtitle()}
|
||||
<Header class="text-3xl font-bold" pageHeader>
|
||||
{$t('routes.createPost')}
|
||||
</Header>
|
||||
{/snippet}
|
||||
</PostForm>
|
||||
</div>
|
||||
<PostForm
|
||||
passedData={data.crosspost == true
|
||||
? post
|
||||
: {
|
||||
body: '',
|
||||
community: null,
|
||||
image: null,
|
||||
loading: false,
|
||||
nsfw: false,
|
||||
title: '',
|
||||
url: undefined,
|
||||
}}
|
||||
passedCommunity={community}
|
||||
onsubmit={e => goto(`/post/${e.post.id}`)}
|
||||
>
|
||||
{#snippet formtitle()}{/snippet}
|
||||
</PostForm>
|
||||
@@ -9,19 +9,18 @@
|
||||
<title>{$t('routes.moderation.title')}</title>
|
||||
</svelte:head>
|
||||
|
||||
<Tabs
|
||||
routes={[
|
||||
{
|
||||
href: '/moderation',
|
||||
name: $t('routes.moderation.feed'),
|
||||
},
|
||||
{
|
||||
href: '/moderation/communities',
|
||||
name: $t('routes.communities.title'),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
<div class="w-full space-y-4 pb-8">
|
||||
<Tabs
|
||||
class="overflow-auto"
|
||||
routes={[
|
||||
{
|
||||
href: '/moderation',
|
||||
name: $t('routes.moderation.feed'),
|
||||
},
|
||||
{
|
||||
href: '/moderation/communities',
|
||||
name: $t('routes.communities.title'),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
{@render children?.()}
|
||||
</div>
|
||||
@@ -2,7 +2,7 @@
|
||||
import { page } from '$app/state'
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import PostActions from '$lib/components/lemmy/post/actions/PostActions.svelte'
|
||||
import { mediaType } from '$lib/components/lemmy/post/helpers.js'
|
||||
import { mediaType, postLink } from '$lib/components/lemmy/post/helpers.js'
|
||||
import PostMedia from '$lib/components/lemmy/post/media/PostMedia.svelte'
|
||||
import Post from '$lib/components/lemmy/post/Post.svelte'
|
||||
import PostMeta, {
|
||||
@@ -227,11 +227,12 @@
|
||||
href={data.thread.value.showContext
|
||||
? `/comment/${
|
||||
// split first comment path to get 5 before
|
||||
comments.comments[0].comment.path.split('.').slice(-5)[0]
|
||||
comments.comments[0].comment.path.split('.').slice(-5)[1]
|
||||
}`
|
||||
: undefined}
|
||||
: data.thread.value.singleThread
|
||||
? postLink(data.post.value.post_view.post)
|
||||
: undefined}
|
||||
class="hover:bg-white/50 dark:hover:bg-zinc-800/30"
|
||||
onclick={data.thread.value.singleThread ? reloadComments : undefined}
|
||||
>
|
||||
{data.thread.value.showContext
|
||||
? $t('routes.post.thread.context')
|
||||
|
||||
@@ -19,10 +19,10 @@
|
||||
import {
|
||||
ArrowPath,
|
||||
ArrowTrendingDown,
|
||||
ChatBubbleOvalLeft,
|
||||
Clock,
|
||||
Fire,
|
||||
Icon,
|
||||
PlusCircle,
|
||||
Star,
|
||||
Trophy,
|
||||
} from 'svelte-hero-icons'
|
||||
@@ -77,7 +77,7 @@
|
||||
)}
|
||||
onclick={() => (commenting = true)}
|
||||
>
|
||||
<Icon src={PlusCircle} size="16" micro />
|
||||
<Icon src={ChatBubbleOvalLeft} size="16" micro />
|
||||
{$t('routes.post.addComment')}
|
||||
</Button>
|
||||
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import ProfileButton from '$lib/components/ui/sidebar/ProfileButton.svelte'
|
||||
import SidebarButton from '$lib/components/ui/sidebar/SidebarButton.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { client } from '$lib/lemmy.svelte'
|
||||
import { errorMessage } from '$lib/lemmy/error'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { toast } from 'mono-svelte'
|
||||
import Button from 'mono-svelte/button/Button.svelte'
|
||||
import Material from 'mono-svelte/materials/Material.svelte'
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
import Material from 'mono-svelte/materials/Material.svelte'
|
||||
import { Check, Icon, XMark } from 'svelte-hero-icons'
|
||||
import type { PageData } from './$types.js'
|
||||
import CommonList from '$lib/components/ui/layout/CommonList.svelte'
|
||||
import EndPlaceholder from '$lib/components/ui/EndPlaceholder.svelte'
|
||||
|
||||
interface Props {
|
||||
// sveltekit doesn't feel like making types work right now
|
||||
@@ -85,106 +87,109 @@
|
||||
{$t('routes.profile.blocks.title')}
|
||||
</Header>
|
||||
|
||||
{#if data.community_blocks?.length > 0 || data.person_blocks?.length > 0 || (data.my_user?.instance_blocks?.length ?? 0) > 0}
|
||||
{#if data.community_blocks?.length > 0}
|
||||
<div class="space-y-1">
|
||||
<SectionTitle>{$t('content.communities')}</SectionTitle>
|
||||
<Material
|
||||
color="uniform"
|
||||
class="bg-white dark:bg-zinc-950 max-h-96 overflow-auto"
|
||||
rounding="xl"
|
||||
>
|
||||
<ul class="divide-y divide-slate-200 dark:divide-zinc-900">
|
||||
{#each data.community_blocks as block (block.community.id)}
|
||||
<div class="flex flex-row gap-2 items-center py-1 -mx-4 px-4">
|
||||
<div>
|
||||
{#if data.community_blocks?.length > 0 || data.person_blocks?.length > 0 || (data.my_user?.instance_blocks?.length ?? 0) > 0}
|
||||
{#if data.community_blocks?.length > 0}
|
||||
<EndPlaceholder size="md" margin="md">
|
||||
{$t('content.communities')}
|
||||
</EndPlaceholder>
|
||||
<div class="max-h-96 overflow-auto rounded-2xl">
|
||||
<CommonList
|
||||
size="xs"
|
||||
class="px-3 py-2"
|
||||
animate={false}
|
||||
items={data.community_blocks}
|
||||
>
|
||||
{#snippet item(block)}
|
||||
<div class="flex flex-row gap-2 items-center">
|
||||
<CommunityLink community={block.community} avatar />
|
||||
<div class="flex-1"></div>
|
||||
<Button
|
||||
title="Unblock"
|
||||
size="square-md"
|
||||
rounding="pill"
|
||||
color="danger"
|
||||
onclick={() => unblockCommunity(block)}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={XMark} micro size="16" />
|
||||
{/snippet}
|
||||
</Button>
|
||||
<CommunityLink community={block.community} avatar />
|
||||
</div>
|
||||
{/each}
|
||||
</ul>
|
||||
</Material>
|
||||
</div>
|
||||
{/if}
|
||||
{#if data.person_blocks?.length > 0}
|
||||
<div class="space-y-1">
|
||||
<SectionTitle>{$t('content.users')}</SectionTitle>
|
||||
<Material
|
||||
color="uniform"
|
||||
class="bg-white dark:bg-zinc-950 max-h-96 overflow-auto"
|
||||
rounding="xl"
|
||||
>
|
||||
<ul class="divide-y divide-slate-200 dark:divide-zinc-900">
|
||||
{#each data.person_blocks as block (block.target.id)}
|
||||
<div class="flex flex-row gap-2 items-center py-1 -mx-4 px-4">
|
||||
{/snippet}
|
||||
</CommonList>
|
||||
</div>
|
||||
{/if}
|
||||
{#if data.person_blocks?.length > 0}
|
||||
<EndPlaceholder size="md" margin="md">
|
||||
{$t('content.users')}
|
||||
</EndPlaceholder>
|
||||
<div class="max-h-96 overflow-auto rounded-2xl">
|
||||
<CommonList
|
||||
size="xs"
|
||||
class="px-3 py-2"
|
||||
animate={false}
|
||||
items={data.person_blocks}
|
||||
>
|
||||
{#snippet item(block)}
|
||||
<div class="flex flex-row gap-2 items-center">
|
||||
<UserLink user={block.target} avatar badges />
|
||||
<div class="flex-1"></div>
|
||||
<Button
|
||||
title="Unblock"
|
||||
size="square-md"
|
||||
rounding="pill"
|
||||
color="danger"
|
||||
onclick={() => unblockUser(block)}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={XMark} micro size="16" />
|
||||
{/snippet}
|
||||
</Button>
|
||||
<UserLink user={block.target} avatar badges />
|
||||
</div>
|
||||
{/each}
|
||||
</ul>
|
||||
</Material>
|
||||
</div>
|
||||
{/if}
|
||||
{#if data.my_user?.instance_blocks && (data.my_user?.instance_blocks?.length ?? 0) > 0}
|
||||
<div class="space-y-1">
|
||||
<SectionTitle class="text-lg">
|
||||
{/snippet}
|
||||
</CommonList>
|
||||
</div>
|
||||
{/if}
|
||||
{#if data.my_user?.instance_blocks && (data.my_user?.instance_blocks?.length ?? 0) > 0}
|
||||
<EndPlaceholder size="md" margin="md" class="text-lg">
|
||||
{$t('content.instances')}
|
||||
</SectionTitle>
|
||||
<Material
|
||||
color="uniform"
|
||||
class="bg-white dark:bg-zinc-950 max-h-96 overflow-auto"
|
||||
rounding="xl"
|
||||
>
|
||||
<ul class="divide-y divide-slate-200 dark:divide-zinc-900">
|
||||
{#each data.my_user?.instance_blocks as block (block.instance.id)}
|
||||
<div class="flex flex-row gap-2 items-center py-1 -mx-4 px-4">
|
||||
</EndPlaceholder>
|
||||
<div class="max-h-96 overflow-auto rounded-2xl">
|
||||
<CommonList
|
||||
size="xs"
|
||||
animate={false}
|
||||
items={data.my_user.instance_blocks}
|
||||
class="px-3 py-2"
|
||||
>
|
||||
{#snippet item(block)}
|
||||
<div class="flex flex-row gap-2 items-center">
|
||||
<Entity
|
||||
icon={block.site?.icon}
|
||||
name={block.site?.name ?? block.instance.domain}
|
||||
label={block.instance.domain}
|
||||
/>
|
||||
<div class="flex-1"></div>
|
||||
<Button
|
||||
title="Unblock"
|
||||
size="square-md"
|
||||
rounding="pill"
|
||||
color="danger"
|
||||
onclick={() => unblockInstances(block)}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={XMark} micro size="16" />
|
||||
{/snippet}
|
||||
</Button>
|
||||
<Entity
|
||||
icon={block.site?.icon}
|
||||
name={block.site?.name ?? block.instance.domain}
|
||||
label={block.instance.domain}
|
||||
/>
|
||||
</div>
|
||||
{/each}
|
||||
</ul>
|
||||
</Material>
|
||||
{/snippet}
|
||||
</CommonList>
|
||||
</div>
|
||||
{/if}
|
||||
{:else}
|
||||
<div class="h-full w-full grid place-items-center">
|
||||
<Placeholder
|
||||
icon={Check}
|
||||
title={$t('routes.profile.blocks.empty.title')}
|
||||
description={$t('routes.profile.blocks.empty.description')}
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
{:else}
|
||||
<div class="h-full w-full grid place-items-center">
|
||||
<Placeholder
|
||||
icon={Check}
|
||||
title={$t('routes.profile.blocks.empty.title')}
|
||||
description={$t('routes.profile.blocks.empty.description')}
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
import { page } from '$app/state'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import SidebarButton from '$lib/components/ui/sidebar/SidebarButton.svelte'
|
||||
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
|
||||
/**
|
||||
* @typedef {Object} Props
|
||||
* @property {import('svelte').Snippet} [children]
|
||||
@@ -13,46 +13,36 @@
|
||||
let { children } = $props()
|
||||
|
||||
const routes = [
|
||||
{
|
||||
name: $t('routes.profile.credentials'),
|
||||
url: '/profile/password',
|
||||
},
|
||||
{
|
||||
name: $t('form.profile.2fa.2fa'),
|
||||
url: '/profile/password/2fa',
|
||||
href: '/profile/password/2fa',
|
||||
},
|
||||
{
|
||||
name: $t('routes.passwordChange.title'),
|
||||
url: '/profile/password/change',
|
||||
href: '/profile/password/change',
|
||||
},
|
||||
{
|
||||
name: $t('routes.profile.logins'),
|
||||
url: '/profile/password/logins',
|
||||
href: '/profile/password/logins',
|
||||
},
|
||||
{
|
||||
name: $t('routes.profile.delete.title'),
|
||||
url: '/profile/password/delete',
|
||||
href: '/profile/password/delete',
|
||||
},
|
||||
]
|
||||
</script>
|
||||
|
||||
<Header pageHeader>
|
||||
{routes.find(r => page.url.pathname == r.url)?.name}
|
||||
{routes.find(r => page.url.pathname == r.href)?.name ??
|
||||
$t('routes.profile.credentials')}
|
||||
</Header>
|
||||
<div class="flex flex-row gap-12">
|
||||
<nav class="flex flex-col gap-2 flex-1 max-sm:hidden">
|
||||
{#each routes as route (route)}
|
||||
<SidebarButton
|
||||
size="lg"
|
||||
rounding="lg"
|
||||
selected={page.url.pathname == route.url}
|
||||
href={route.url}
|
||||
>
|
||||
{route.name}
|
||||
</SidebarButton>
|
||||
{/each}
|
||||
</nav>
|
||||
<div class="flex-3 max-w-full w-full min-w-0">
|
||||
{@render children?.()}
|
||||
</div>
|
||||
|
||||
<Tabs style="subpage" {routes}></Tabs>
|
||||
<div
|
||||
class={[
|
||||
page.url.pathname == '/profile/password' && ' p-8',
|
||||
'flex flex-col justify-center items-center h-full',
|
||||
]}
|
||||
>
|
||||
{@render children?.()}
|
||||
</div>
|
||||
@@ -1,103 +1,13 @@
|
||||
<script lang="ts">
|
||||
import EntityHeader from '$lib/components/ui/EntityHeader.svelte'
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
import { t } from '$lib/i18n/translations.js'
|
||||
import { Material } from 'mono-svelte'
|
||||
import {
|
||||
Icon,
|
||||
Identification,
|
||||
Key,
|
||||
Trash,
|
||||
UserGroup,
|
||||
} from 'svelte-hero-icons'
|
||||
|
||||
let { data } = $props()
|
||||
import { Key } from 'svelte-hero-icons'
|
||||
</script>
|
||||
|
||||
<div
|
||||
class="grid grid-cols-1 lg:grid-cols-2 gap-4
|
||||
grid-rows-2"
|
||||
>
|
||||
<EntityHeader
|
||||
color="default"
|
||||
avatar={data.my_user?.local_user_view.person.avatar}
|
||||
name={$t('routes.profile.welcome', {
|
||||
default: data.my_user?.local_user_view.person.name,
|
||||
})}
|
||||
stats={[
|
||||
{
|
||||
name: $t('profile.subscribed'),
|
||||
value: data.my_user?.follows.length.toString() ?? '',
|
||||
},
|
||||
{
|
||||
name: $t('routes.profile.moderates'),
|
||||
value: data.my_user?.moderates.length.toString() ?? '',
|
||||
},
|
||||
]}
|
||||
rounding="2xl"
|
||||
class="row-span-2"
|
||||
<div class="h-full grid place-items-center">
|
||||
<Placeholder
|
||||
icon={Key}
|
||||
title={$t('form.profile.credentials.title')}
|
||||
description={$t('form.profile.credentials.description')}
|
||||
/>
|
||||
<a href="/profile/password/2fa" class="row-span-1">
|
||||
<Material
|
||||
class="hover:ring-primary-900 dark:hover:ring-primary-100 hover:ring-2 transition-all
|
||||
flex flex-col gap-2 h-full"
|
||||
rounding="2xl"
|
||||
>
|
||||
<Material
|
||||
rounding="full"
|
||||
padding="sm"
|
||||
color="default"
|
||||
class="h-max w-max"
|
||||
>
|
||||
<Icon src={Key} size="24" />
|
||||
</Material>
|
||||
<span class="font-medium text-lg">{$t('form.profile.2fa.2fa')}</span>
|
||||
<span class="text-sm">
|
||||
{data.my_user?.local_user_view.local_user.totp_2fa_enabled
|
||||
? $t('common.enabled')
|
||||
: $t('common.disabled')}
|
||||
</span>
|
||||
</Material>
|
||||
</a>
|
||||
<a href="/profile/password/change" class="row-span-1">
|
||||
<Material
|
||||
class="hover:ring-primary-900 dark:hover:ring-primary-100 hover:ring-2 transition-all
|
||||
flex flex-col gap-2 h-full"
|
||||
rounding="2xl"
|
||||
>
|
||||
<Material rounding="full" padding="sm" color="default" class="w-max">
|
||||
<Icon src={Identification} size="24" />
|
||||
</Material>
|
||||
<span class="font-medium text-lg">
|
||||
{$t('routes.passwordChange.title')}
|
||||
</span>
|
||||
</Material>
|
||||
</a>
|
||||
<a href="/profile/password/logins" class="sm:col-span-1">
|
||||
<Material
|
||||
class="hover:ring-primary-900 dark:hover:ring-primary-100 hover:ring-2 transition-all
|
||||
flex flex-col gap-2 h-full"
|
||||
rounding="2xl"
|
||||
>
|
||||
<Material rounding="full" padding="sm" color="default" class="w-max">
|
||||
<Icon src={UserGroup} size="24" />
|
||||
</Material>
|
||||
<span class="font-medium text-lg">
|
||||
{$t('routes.profile.logins')}
|
||||
</span>
|
||||
</Material>
|
||||
</a>
|
||||
<a href="/profile/password/delete" class="sm:col-span-1">
|
||||
<Material
|
||||
class="hover:ring-red-500 dark:hover:ring-red-500 hover:ring-2 transition-all
|
||||
flex flex-col gap-2 h-full text-red-500"
|
||||
rounding="2xl"
|
||||
>
|
||||
<Material rounding="full" padding="sm" color="default" class="w-max">
|
||||
<Icon src={Trash} size="24" />
|
||||
</Material>
|
||||
<span class="font-medium text-lg">
|
||||
{$t('routes.profile.delete.title')}
|
||||
</span>
|
||||
</Material>
|
||||
</a>
|
||||
</div>
|
||||
@@ -4,9 +4,10 @@
|
||||
import { client } from '$lib/lemmy.svelte.js'
|
||||
import { t } from '$lib/i18n/translations.js'
|
||||
import { qr } from '@svelte-put/qr/svg'
|
||||
import { Button, Material, TextInput, toast } from 'mono-svelte'
|
||||
import { ClipboardDocument, Icon } from 'svelte-hero-icons'
|
||||
import { Button, Material, Modal, TextInput, toast } from 'mono-svelte'
|
||||
import { ClipboardDocument, Icon, Key } from 'svelte-hero-icons'
|
||||
import { errorMessage } from '$lib/lemmy/error.js'
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
|
||||
let { data } = $props()
|
||||
|
||||
@@ -17,8 +18,18 @@
|
||||
|
||||
let verify_totp = $state('')
|
||||
|
||||
let openModal = $state(false)
|
||||
$effect(() => {
|
||||
if (!openModal) totpLink = undefined
|
||||
})
|
||||
|
||||
async function twofa(enabled: boolean, update: boolean = false) {
|
||||
try {
|
||||
if (!enabled && !update) {
|
||||
openModal = true
|
||||
return
|
||||
}
|
||||
|
||||
if (update) {
|
||||
await client().updateTotp({
|
||||
enabled: enabled,
|
||||
@@ -34,24 +45,23 @@
|
||||
} else {
|
||||
const res = await client().generateTotpSecret()
|
||||
totpLink = res.totp_secret_url
|
||||
totpEnabled = true
|
||||
openModal = true
|
||||
}
|
||||
} catch (e) {
|
||||
toast({ content: errorMessage(e as string), type: 'error' })
|
||||
} catch (err) {
|
||||
toast({ content: errorMessage(err as string), type: 'error' })
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="w-full flex flex-col">
|
||||
<p class="">
|
||||
<span class="font-medium text-lg">
|
||||
{totpEnabled ? $t('common.enabled') : $t('common.disabled')}
|
||||
</span>
|
||||
</p>
|
||||
{#if totpEnabled || totpLink}
|
||||
<div class="w-full flex flex-col h-full">
|
||||
<Modal
|
||||
dismissable={false}
|
||||
bind:open={openModal}
|
||||
title={$t('form.profile.2fa.2fa')}
|
||||
>
|
||||
{#if totpLink && !totpEnabled}
|
||||
<Material color="transparent" class="fill-white!">
|
||||
<svg use:qr={{ data: totpLink, logo: '/img/logo-isolated.svg' }} />
|
||||
<Material rounding="2xl" color="uniform" class="">
|
||||
<svg use:qr={{ data: totpLink, logo: '/img/logo-background.svg' }} />
|
||||
</Material>
|
||||
<TextInput
|
||||
disabled
|
||||
@@ -76,25 +86,60 @@
|
||||
</span>
|
||||
</TextInput>
|
||||
{/if}
|
||||
<form class="flex flex-col gap-2 w-full" onsubmit={e => e.preventDefault()}>
|
||||
<form
|
||||
class="flex flex-col gap-2 w-full"
|
||||
onsubmit={e => {
|
||||
e.preventDefault()
|
||||
twofa(!(totpEnabled == true), true)
|
||||
}}
|
||||
>
|
||||
<TextInput
|
||||
bind:value={verify_totp}
|
||||
placeholder="012345"
|
||||
label={$t('form.2fa')}
|
||||
pattern={'\\d{6}'}
|
||||
required
|
||||
/>
|
||||
{#if totpEnabled}
|
||||
<Button onclick={() => twofa(false, true)} size="lg" color="primary">
|
||||
<Button submit size="lg" color="primary">
|
||||
{$t('common.disable')}
|
||||
</Button>
|
||||
{:else}
|
||||
<Button onclick={() => twofa(true, true)} size="lg" color="primary">
|
||||
<Button submit size="lg" color="primary">
|
||||
{$t('common.enable')}
|
||||
</Button>
|
||||
{/if}
|
||||
</form>
|
||||
{:else}
|
||||
<Button onclick={() => twofa(true)} size="lg" color="primary">
|
||||
{$t('form.setup')}
|
||||
</Button>
|
||||
{/if}
|
||||
</Modal>
|
||||
<div class="flex flex-col items-center justify-center h-full gap-4 p-4">
|
||||
{#if totpEnabled}
|
||||
<Placeholder
|
||||
iconClass="p-3 bg-green-100 text-green-600 dark:bg-green-500/10 dark:text-green-400 rounded-full"
|
||||
icon={Key}
|
||||
title={$t('form.profile.2fa.enabled')}
|
||||
>
|
||||
<Button
|
||||
onclick={() => twofa(false, false)}
|
||||
rounding="pill"
|
||||
color="primary"
|
||||
>
|
||||
{$t('common.disable')}
|
||||
</Button>
|
||||
</Placeholder>
|
||||
{:else}
|
||||
<Placeholder
|
||||
iconClass="p-3 bg-red-100 text-red-600 dark:bg-red-500/10 dark:text-red-400 rounded-full"
|
||||
icon={Key}
|
||||
title={$t('form.profile.2fa.disabled')}
|
||||
>
|
||||
<Button
|
||||
onclick={() => twofa(true, false)}
|
||||
rounding="pill"
|
||||
color="primary"
|
||||
>
|
||||
{$t('form.setup')}
|
||||
</Button>
|
||||
</Placeholder>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,11 +1,9 @@
|
||||
<script lang="ts">
|
||||
import { preventDefault } from 'svelte/legacy'
|
||||
|
||||
import { client } from '$lib/lemmy.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { Button, TextInput, toast } from 'mono-svelte'
|
||||
import { errorMessage } from '$lib/lemmy/error'
|
||||
import { profile } from '$lib/auth.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { client } from '$lib/lemmy.svelte'
|
||||
import { errorMessage } from '$lib/lemmy/error'
|
||||
import { Button, TextInput, toast } from 'mono-svelte'
|
||||
|
||||
let oldPassword = $state(''),
|
||||
newPassword = $state(''),
|
||||
@@ -42,7 +40,13 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<form onsubmit={preventDefault(changePassword)} class="flex flex-col gap-4">
|
||||
<form
|
||||
onsubmit={e => {
|
||||
e.preventDefault()
|
||||
changePassword()
|
||||
}}
|
||||
class="flex flex-col gap-4 w-full max-w-xl"
|
||||
>
|
||||
<TextInput
|
||||
bind:value={oldPassword}
|
||||
label={$t('form.profile.currentPassword')}
|
||||
@@ -64,14 +68,7 @@
|
||||
minlength={10}
|
||||
required
|
||||
/>
|
||||
<Button
|
||||
class="sm:ml-auto"
|
||||
size="lg"
|
||||
color="primary"
|
||||
submit
|
||||
{loading}
|
||||
disabled={loading}
|
||||
>
|
||||
<Button size="lg" color="primary" submit {loading} disabled={loading}>
|
||||
{$t('form.submit')}
|
||||
</Button>
|
||||
</form>
|
||||
@@ -1,19 +1,9 @@
|
||||
<script lang="ts">
|
||||
import { goto } from '$app/navigation'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import { client } from '$lib/lemmy.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import {
|
||||
Button,
|
||||
Checkbox,
|
||||
Material,
|
||||
Modal,
|
||||
removeToast,
|
||||
Switch,
|
||||
TextInput,
|
||||
toast,
|
||||
} from 'mono-svelte'
|
||||
import { profile } from '$lib/auth.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { client } from '$lib/lemmy.svelte'
|
||||
import { Button, removeToast, Switch, TextInput, toast } from 'mono-svelte'
|
||||
|
||||
let deletion = $state({
|
||||
modal: false,
|
||||
@@ -70,9 +60,7 @@
|
||||
delete_content: deletion.deleteContent,
|
||||
})
|
||||
|
||||
profile.meta.profiles.splice(
|
||||
profile.meta.profiles.findIndex(p => profile.meta.profile == p.id),
|
||||
)
|
||||
profile.remove(profile.current.id)
|
||||
|
||||
profile.meta.profile = -1
|
||||
toast({
|
||||
@@ -90,43 +78,18 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if deletion.modal}
|
||||
<Modal
|
||||
bind:open={deletion.modal}
|
||||
action="Submit"
|
||||
onaction={() => deleteAccount(4)}
|
||||
>
|
||||
{#snippet customTitle()}
|
||||
<span>{$t('form.profile.deleteAccount.label')}</span>
|
||||
{/snippet}
|
||||
<TextInput
|
||||
label={$t('form.password')}
|
||||
type="password"
|
||||
bind:value={deletion.password}
|
||||
/>
|
||||
<Checkbox bind:checked={deletion.deleteContent}>
|
||||
{$t('form.profile.deleteAccount.deleteContent')}
|
||||
{#snippet description()}
|
||||
<span>
|
||||
{$t('form.profile.deleteAccount.warning')}
|
||||
</span>
|
||||
{/snippet}
|
||||
</Checkbox>
|
||||
</Modal>
|
||||
{/if}
|
||||
|
||||
<Material
|
||||
color="distinct"
|
||||
class="border-2 border-red-500! text-red-600 dark:text-red-400 flex flex-col gap-4"
|
||||
padding="xl"
|
||||
rounding="2xl"
|
||||
<form
|
||||
onsubmit={e => {
|
||||
e.preventDefault()
|
||||
deleteAccount(4)
|
||||
}}
|
||||
class="w-full flex flex-col gap-4 max-w-xl"
|
||||
>
|
||||
<Header class="mx-auto w-max font-bold!">
|
||||
{$t('routes.profile.delete.title')}
|
||||
</Header>
|
||||
<p class="text-base">
|
||||
{$t('routes.profile.delete.warning')}
|
||||
</p>
|
||||
<TextInput
|
||||
label={$t('form.password')}
|
||||
type="password"
|
||||
bind:value={deletion.password}
|
||||
/>
|
||||
<Switch bind:checked={deletion.deleteContent}>
|
||||
{$t('form.profile.deleteAccount.deleteContent')}
|
||||
{#snippet description()}
|
||||
@@ -135,7 +98,7 @@
|
||||
</span>
|
||||
{/snippet}
|
||||
</Switch>
|
||||
<Button size="lg" color="danger" onclick={() => deleteAccount(3)}>
|
||||
{$t('routes.profile.delete.title')}
|
||||
<Button submit color="danger" size="lg">
|
||||
{$t('form.submit')}
|
||||
</Button>
|
||||
</Material>
|
||||
</form>
|
||||
@@ -1,18 +1,15 @@
|
||||
<script lang="ts">
|
||||
import { preventDefault } from 'svelte/legacy'
|
||||
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import ImageInputUpload from '$lib/components/form/ImageInputUpload.svelte'
|
||||
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
|
||||
import { t } from '$lib/i18n/translations.js'
|
||||
import { getClient, site } from '$lib/lemmy.svelte.js'
|
||||
import { uploadImage } from '$lib/util.svelte.js'
|
||||
import type { SaveUserSettings } from 'lemmy-js-client'
|
||||
import {
|
||||
Badge,
|
||||
Button,
|
||||
ImageInput,
|
||||
Material,
|
||||
Menu,
|
||||
MenuButton,
|
||||
@@ -37,35 +34,14 @@
|
||||
discussion_languages: data.my_user?.discussion_languages,
|
||||
})
|
||||
|
||||
let profileImage: FileList | undefined = $state()
|
||||
let bannerImage: FileList | undefined = $state()
|
||||
|
||||
async function save() {
|
||||
if (!formData || !profile.current?.jwt) return
|
||||
|
||||
loading = true
|
||||
|
||||
try {
|
||||
let pfp = profileImage
|
||||
? await uploadImage(
|
||||
profileImage[0],
|
||||
profile.current.instance,
|
||||
profile.current.jwt,
|
||||
)
|
||||
: undefined
|
||||
|
||||
let banner = bannerImage
|
||||
? await uploadImage(
|
||||
bannerImage[0],
|
||||
profile.current.instance,
|
||||
profile.current.jwt,
|
||||
)
|
||||
: undefined
|
||||
|
||||
await getClient().saveUserSettings({
|
||||
...formData,
|
||||
avatar: pfp,
|
||||
banner: banner,
|
||||
})
|
||||
|
||||
toast({
|
||||
@@ -84,9 +60,15 @@
|
||||
let loading = $state(false)
|
||||
</script>
|
||||
|
||||
<form class="flex flex-col gap-4 h-full" onsubmit={preventDefault(save)}>
|
||||
<form
|
||||
class="flex flex-col gap-4 h-full"
|
||||
onsubmit={e => {
|
||||
e.preventDefault()
|
||||
save()
|
||||
}}
|
||||
>
|
||||
{#if !inline}
|
||||
<Header pageHeader>{$t('routes.profile.settings')}</Header>
|
||||
<Header pageHeader>{$t('routes.profile.edit')}</Header>
|
||||
{/if}
|
||||
{@render children?.()}
|
||||
{#if data.my_user?.local_user_view?.local_user && formData}
|
||||
@@ -103,8 +85,14 @@
|
||||
previewButton
|
||||
/>
|
||||
<div class="flex gap-2 items-center *:flex-1">
|
||||
<ImageInput label={$t('form.profile.avatar')} bind:files={profileImage} />
|
||||
<ImageInput label={$t('form.profile.banner')} bind:files={bannerImage} />
|
||||
<ImageInputUpload
|
||||
label={$t('form.profile.avatar')}
|
||||
bind:imageUrl={formData.avatar}
|
||||
/>
|
||||
<ImageInputUpload
|
||||
label={$t('form.profile.banner')}
|
||||
bind:imageUrl={formData.banner}
|
||||
/>
|
||||
</div>
|
||||
<TextInput
|
||||
label={$t('form.profile.matrix')}
|
||||
@@ -114,9 +102,6 @@
|
||||
<Switch bind:checked={formData.show_nsfw}>
|
||||
{$t('form.profile.showNSFW')}
|
||||
</Switch>
|
||||
<Switch bind:checked={formData.show_scores}>
|
||||
{$t('form.profile.scores')}
|
||||
</Switch>
|
||||
<Switch bind:checked={formData.bot_account}>
|
||||
{$t('form.profile.bot')}
|
||||
</Switch>
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
<script>
|
||||
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { site } from '$lib/lemmy.svelte'
|
||||
import { feature } from '$lib/version'
|
||||
import { Button, Menu, MenuButton } from 'mono-svelte'
|
||||
import {
|
||||
ArrowDown,
|
||||
@@ -27,12 +25,7 @@
|
||||
<div class="flex flex-col gap-4 h-full z-0">
|
||||
<div class="flex flex-row justify-between">
|
||||
<Tabs
|
||||
class="overflow-auto"
|
||||
routes={[
|
||||
{
|
||||
href: '/profile',
|
||||
name: $t('routes.profile.overview'),
|
||||
},
|
||||
{
|
||||
href: '/profile/user',
|
||||
name: $t('routes.profile.submissions'),
|
||||
@@ -40,7 +33,7 @@
|
||||
|
||||
{
|
||||
href: '/profile/settings',
|
||||
name: $t('routes.profile.settings'),
|
||||
name: $t('routes.profile.edit'),
|
||||
},
|
||||
|
||||
{
|
||||
@@ -53,21 +46,16 @@
|
||||
name: $t('routes.profile.credentials'),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
{#if feature('mediaAndVotes', site.data?.version)}
|
||||
>
|
||||
<Menu class="flex-1" placement="bottom-end">
|
||||
{#snippet target()}
|
||||
<Button
|
||||
title={$t('post.actions.more.label')}
|
||||
size="square-lg"
|
||||
rounding="pill"
|
||||
aria-label={$t('post.actions.more.label')}
|
||||
size="square-sm"
|
||||
color="none"
|
||||
class="bg-white/60 dark:bg-zinc-800/60
|
||||
border border-slate-200/60 dark:border-zinc-800
|
||||
backdrop-blur-xl shadow-xl hover:bg-slate-100 dark:hover:bg-zinc-800
|
||||
shrink-0"
|
||||
class="z-0 text-slate-600 dark:text-zinc-500 hover:bg-slate-100 hover:dark:bg-zinc-800"
|
||||
>
|
||||
<Icon src={EllipsisHorizontal} size="16" mini />
|
||||
<Icon src={EllipsisHorizontal} size="16" micro />
|
||||
</Button>
|
||||
{/snippet}
|
||||
<MenuButton href="/profile/media">
|
||||
@@ -89,7 +77,7 @@
|
||||
{$t('routes.profile.downvoted')}
|
||||
</MenuButton>
|
||||
</Menu>
|
||||
{/if}
|
||||
</Tabs>
|
||||
</div>
|
||||
{@render children?.()}
|
||||
</div>
|
||||
@@ -1,78 +0,0 @@
|
||||
<script lang="ts">
|
||||
import ItemList from '$lib/components/lemmy/generic/ItemList.svelte'
|
||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||
import EntityHeader from '$lib/components/ui/EntityHeader.svelte'
|
||||
import Expandable from '$lib/components/ui/Expandable.svelte'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import { publishedToDate } from '$lib/components/util/date.js'
|
||||
import { formatRelativeDate } from '$lib/components/util/RelativeDate.svelte'
|
||||
import { t } from '$lib/i18n/translations.js'
|
||||
import { communityLink } from '$lib/lemmy/generic.js'
|
||||
import { settings } from '$lib/settings.svelte.js'
|
||||
let { data } = $props()
|
||||
|
||||
let my_user = $derived(data.my_user!.local_user_view)
|
||||
</script>
|
||||
|
||||
<Header pageHeader>
|
||||
{$t('routes.profile.overview')}
|
||||
</Header>
|
||||
|
||||
<EntityHeader
|
||||
avatar={my_user.person.avatar}
|
||||
name={my_user.person.display_name || my_user.person.name}
|
||||
banner={my_user.person.banner}
|
||||
bio={my_user.person.bio}
|
||||
stats={[
|
||||
{
|
||||
name: $t('content.posts'),
|
||||
value: my_user.counts.post_count.toString(),
|
||||
},
|
||||
{
|
||||
name: $t('content.comments'),
|
||||
value: my_user.counts.comment_count.toString(),
|
||||
},
|
||||
{
|
||||
name: $t('stats.joined'),
|
||||
value: formatRelativeDate(publishedToDate(my_user.person.published), {
|
||||
style: 'short',
|
||||
}).toString(),
|
||||
format: false,
|
||||
},
|
||||
]}
|
||||
>
|
||||
{#snippet nameDetail()}
|
||||
<span class="text-sm flex gap-0 items-center w-max">
|
||||
@
|
||||
<UserLink
|
||||
showInstance
|
||||
user={my_user.person}
|
||||
displayName={false}
|
||||
class="font-normal"
|
||||
/>
|
||||
</span>
|
||||
{/snippet}
|
||||
{#if data.moderates && data.moderates.length > 0}
|
||||
<Expandable class="">
|
||||
{#snippet title()}
|
||||
{$t('routes.profile.moderates')}
|
||||
<hr class="flex-1 w-full border-slate-200 dark:border-zinc-800 mx-3" />
|
||||
{/snippet}
|
||||
<ItemList
|
||||
items={data.moderates.map(m => ({
|
||||
id: m.community.id,
|
||||
name: m.community.title,
|
||||
url: communityLink(m.community),
|
||||
avatar: m.community.icon,
|
||||
instance: new URL(m.community.actor_id).hostname,
|
||||
}))}
|
||||
/>
|
||||
</Expandable>
|
||||
{/if}
|
||||
</EntityHeader>
|
||||
|
||||
{#if settings.debugInfo}
|
||||
<pre>
|
||||
{JSON.stringify(my_user, undefined, 4)}
|
||||
</pre>
|
||||
{/if}
|
||||
@@ -0,0 +1,5 @@
|
||||
import { redirect } from '@sveltejs/kit'
|
||||
|
||||
export function load() {
|
||||
redirect(302, '/profile/user')
|
||||
}
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
{#if data.user && data.sort && data.type && data.page}
|
||||
<UserPage
|
||||
inline
|
||||
data={{
|
||||
items: new ReactiveState(data.user.submissions),
|
||||
filters: new ReactiveState({
|
||||
@@ -14,8 +13,8 @@
|
||||
sort: data.sort,
|
||||
type: data.type,
|
||||
}),
|
||||
person_view: {value: data.user.person_view},
|
||||
moderates: {value: data.user.moderates},
|
||||
person_view: { value: data.user.person_view },
|
||||
moderates: { value: data.user.moderates },
|
||||
}}
|
||||
/>
|
||||
{:else}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
<div class="mt-4 mb-0 sticky z-30 top-6 lg:top-22">
|
||||
<div
|
||||
class="flex gap-2 flex-row items-center w-full text-base h-10 drop-shadow-md"
|
||||
class="flex gap-2 flex-row items-center w-full text-base h-10 drop-shadow-xl"
|
||||
>
|
||||
<TextInput
|
||||
bind:value={query}
|
||||
|
||||
@@ -0,0 +1,126 @@
|
||||
<script lang="ts">
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { defaultSettings, settings } from '$lib/settings.svelte'
|
||||
import { Button, toast, Modal } from 'mono-svelte'
|
||||
import TextArea from 'mono-svelte/forms/TextArea.svelte'
|
||||
import {
|
||||
ArrowDownTray,
|
||||
ArrowPath,
|
||||
ArrowUpTray,
|
||||
Icon,
|
||||
} from 'svelte-hero-icons'
|
||||
|
||||
let { children } = $props()
|
||||
|
||||
let importing = $state(false)
|
||||
let importText = $state('')
|
||||
</script>
|
||||
|
||||
{#if importing}
|
||||
<Modal
|
||||
bind:open={importing}
|
||||
onaction={() => {
|
||||
try {
|
||||
if (importText == '') {
|
||||
throw new Error('Import is empty')
|
||||
}
|
||||
const parsed = JSON.parse(importText)
|
||||
const merged = { ...defaultSettings, ...parsed }
|
||||
|
||||
Object.assign(settings, merged)
|
||||
|
||||
toast({ content: $t('toast.settingsImport'), type: 'success' })
|
||||
importing = false
|
||||
} catch (err) {
|
||||
toast({ content: err as string, type: 'error' })
|
||||
}
|
||||
}}
|
||||
title={$t('routes.theme.import')}
|
||||
action={$t('routes.theme.import')}
|
||||
>
|
||||
<TextArea bind:value={importText} style="font-family: monospace;" />
|
||||
</Modal>
|
||||
{/if}
|
||||
|
||||
<Header pageHeader class="text-3xl font-bold flex justify-between">
|
||||
{$t('settings.title')}
|
||||
{#snippet extended()}
|
||||
<div class="flex items-center tracking-normal gap-2">
|
||||
<Button
|
||||
onclick={() => {
|
||||
importText = ''
|
||||
importing = true
|
||||
}}
|
||||
rounding="pill"
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowDownTray} mini size="18" />
|
||||
{/snippet}
|
||||
{$t('settings.import')}
|
||||
</Button>
|
||||
<Button
|
||||
onclick={() => {
|
||||
const json = JSON.stringify(settings)
|
||||
navigator?.clipboard?.writeText?.(json)
|
||||
toast({ content: $t('toast.copied') })
|
||||
}}
|
||||
rounding="pill"
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowUpTray} mini size="18" />
|
||||
{/snippet}
|
||||
{$t('settings.export')}
|
||||
</Button>
|
||||
<Button
|
||||
onclick={() => {
|
||||
toast({
|
||||
content: $t('toast.resetSettings'),
|
||||
action: () => {
|
||||
Object.assign(settings, defaultSettings)
|
||||
},
|
||||
})
|
||||
}}
|
||||
rounding="pill"
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowPath} mini size="18" />
|
||||
{/snippet}
|
||||
{$t('settings.reset')}
|
||||
</Button>
|
||||
</div>
|
||||
{/snippet}
|
||||
</Header>
|
||||
|
||||
<div class="h-3 sm:h-6"></div>
|
||||
|
||||
<Tabs
|
||||
routes={[
|
||||
{
|
||||
href: '/settings/app',
|
||||
name: $t('settings.app.title'),
|
||||
},
|
||||
{
|
||||
href: '/settings/lemmy',
|
||||
name: $t('settings.lemmy.title'),
|
||||
},
|
||||
{
|
||||
href: '/settings/embeds',
|
||||
name: $t('settings.embeds.title'),
|
||||
},
|
||||
{
|
||||
href: '/settings/moderation',
|
||||
name: $t('settings.moderation.title'),
|
||||
},
|
||||
{
|
||||
href: '/settings/other',
|
||||
name: $t('settings.other.title'),
|
||||
},
|
||||
]}
|
||||
style="subpage"
|
||||
></Tabs>
|
||||
|
||||
<div class="h-3 sm:h-6"></div>
|
||||
|
||||
{@render children?.()}
|
||||
@@ -1,677 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { env } from '$env/dynamic/public'
|
||||
import Link from '$lib/components/input/Link.svelte'
|
||||
import MultiSelect from '$lib/components/input/Switch.svelte'
|
||||
import Sort from '$lib/components/lemmy/dropdowns/Sort.svelte'
|
||||
import ViewSelect from '$lib/components/lemmy/dropdowns/ViewSelect.svelte'
|
||||
import { removalTemplate } from '$lib/components/lemmy/moderation/moderation.js'
|
||||
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||
import Expandable from '$lib/components/ui/Expandable.svelte'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import { locale, locales, t } from '$lib/i18n/translations'
|
||||
import { defaultSettings, settings } from '$lib/settings.svelte'
|
||||
import { DOMAIN_REGEX_FORMS } from '$lib/util.svelte.js'
|
||||
import {
|
||||
Button,
|
||||
Checkbox,
|
||||
Modal,
|
||||
Select,
|
||||
Switch,
|
||||
TextArea,
|
||||
TextInput,
|
||||
toast,
|
||||
} from 'mono-svelte'
|
||||
import Option from 'mono-svelte/forms/select/Option.svelte'
|
||||
import {
|
||||
ArrowDownTray,
|
||||
ArrowPath,
|
||||
ArrowsPointingOut,
|
||||
ArrowsRightLeft,
|
||||
ArrowsUpDown,
|
||||
ArrowTopRightOnSquare,
|
||||
ArrowTrendingDown,
|
||||
ArrowUpTray,
|
||||
Bars2,
|
||||
Bars3,
|
||||
BarsArrowDown,
|
||||
BookOpen,
|
||||
BugAnt,
|
||||
Calendar,
|
||||
ChartBar,
|
||||
ChatBubbleOvalLeftEllipsis,
|
||||
Clock,
|
||||
CubeTransparent,
|
||||
CursorArrowRays,
|
||||
DocumentText,
|
||||
ExclamationTriangle,
|
||||
Eye,
|
||||
EyeSlash,
|
||||
Fire,
|
||||
GlobeAmericas,
|
||||
Heart,
|
||||
Icon,
|
||||
Language,
|
||||
Photo,
|
||||
Plus,
|
||||
ServerStack,
|
||||
Share,
|
||||
Star,
|
||||
TableCells,
|
||||
Tag,
|
||||
Trash,
|
||||
Trophy,
|
||||
User,
|
||||
VideoCamera,
|
||||
ViewColumns,
|
||||
} from 'svelte-hero-icons'
|
||||
import Section from './Section.svelte'
|
||||
import Setting from './Setting.svelte'
|
||||
import ToggleSetting from './ToggleSetting.svelte'
|
||||
let importing = $state(false)
|
||||
let importText = $state('')
|
||||
|
||||
let localeMap: Map<
|
||||
string,
|
||||
{
|
||||
name: string
|
||||
translated: number
|
||||
flag: string
|
||||
}
|
||||
> = new Map([
|
||||
['en', { name: 'English', translated: -1, flag: '🇬🇧' }],
|
||||
['ar', { name: 'العربية', translated: 0.3, flag: '🟩' }],
|
||||
['he', { name: 'עברית', translated: -1, flag: '🇮🇱' }],
|
||||
['bg', { name: 'български', translated: 0.67, flag: '🇧🇬' }],
|
||||
['de', { name: 'Deutsch', translated: 0.7, flag: '🇩🇪' }],
|
||||
['es', { name: 'Español', translated: 0.89, flag: '🇪🇸' }],
|
||||
['et', { name: 'eesti keel', translated: 0.23, flag: '🇪🇪' }],
|
||||
['fi', { name: 'suomi', translated: 0.98, flag: '🇫🇮' }],
|
||||
['fr', { name: 'Français', translated: 0.93, flag: '🇫🇷' }],
|
||||
['hu', { name: 'Magyar', translated: 0.51, flag: '🇭🇺' }],
|
||||
['ja', { name: '日本語', translated: 0.93, flag: '🇯🇵' }],
|
||||
['nl', { name: 'Nederlands', translated: 0.89, flag: '🇳🇱' }],
|
||||
['pl', { name: 'Polski', translated: 0.91, flag: '🇵🇱' }],
|
||||
['pt', { name: 'Português (PT)', translated: 0.86, flag: '🇵🇹' }],
|
||||
['pt-BR', { name: 'Português (BR)', translated: 0.86, flag: '🇧🇷' }],
|
||||
['tr', { name: 'Türkçe', translated: 0.99, flag: '🇹🇷' }],
|
||||
['ru', { name: 'Русский', translated: 0.88, flag: '🇷🇺' }],
|
||||
['zh-Hans', { name: '简体中文', translated: 0.83, flag: '🇨🇳' }],
|
||||
['zh-Hant', { name: '繁體中文', translated: 0.23, flag: '🇹🇼' }],
|
||||
])
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>{$t('settings.title')}</title>
|
||||
</svelte:head>
|
||||
|
||||
{#if importing}
|
||||
<Modal
|
||||
bind:open={importing}
|
||||
onaction={() => {
|
||||
try {
|
||||
if (importText == '') {
|
||||
throw new Error('Import is empty')
|
||||
}
|
||||
const parsed = JSON.parse(importText)
|
||||
const merged = { ...defaultSettings, ...parsed }
|
||||
|
||||
Object.assign(settings, merged)
|
||||
|
||||
toast({ content: $t('toast.settingsImport'), type: 'success' })
|
||||
importing = false
|
||||
} catch (err) {
|
||||
toast({ content: err as string, type: 'error' })
|
||||
}
|
||||
}}
|
||||
title={$t('routes.theme.import')}
|
||||
action={$t('routes.theme.import')}
|
||||
>
|
||||
<TextArea bind:value={importText} style="font-family: monospace;" />
|
||||
</Modal>
|
||||
{/if}
|
||||
|
||||
<Header pageHeader class="text-3xl font-bold flex justify-between">
|
||||
{$t('settings.title')}
|
||||
{#snippet extended()}
|
||||
<div class="flex items-center tracking-normal gap-2">
|
||||
<Button
|
||||
onclick={() => {
|
||||
importText = ''
|
||||
importing = true
|
||||
}}
|
||||
rounding="pill"
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowDownTray} mini size="18" />
|
||||
{/snippet}
|
||||
{$t('settings.import')}
|
||||
</Button>
|
||||
<Button
|
||||
onclick={() => {
|
||||
const json = JSON.stringify(settings)
|
||||
navigator?.clipboard?.writeText?.(json)
|
||||
toast({ content: $t('toast.copied') })
|
||||
}}
|
||||
rounding="pill"
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowUpTray} mini size="18" />
|
||||
{/snippet}
|
||||
{$t('settings.export')}
|
||||
</Button>
|
||||
<Button
|
||||
onclick={() => {
|
||||
toast({
|
||||
content: $t('toast.resetSettings'),
|
||||
action: () => {
|
||||
Object.assign(settings, defaultSettings)
|
||||
},
|
||||
})
|
||||
}}
|
||||
rounding="pill"
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowPath} mini size="18" />
|
||||
{/snippet}
|
||||
{$t('settings.reset')}
|
||||
</Button>
|
||||
</div>
|
||||
{/snippet}
|
||||
</Header>
|
||||
|
||||
<div
|
||||
class="flex flex-col *:py-4 divide-y divide-slate-200 dark:divide-zinc-800"
|
||||
style="scroll-behavior: smooth;"
|
||||
>
|
||||
<Section id="app" title={$t('settings.app.title')}>
|
||||
{#if env.PUBLIC_XYLIGHT_MODE}
|
||||
<Setting icon={Heart}>
|
||||
{#snippet title()}
|
||||
<span class="dark:text-pink-400 text-pink-600">
|
||||
{$t('nav.menu.donate')}
|
||||
</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
{$t('settings.donate.description')}
|
||||
{/snippet}
|
||||
<Button
|
||||
color="none"
|
||||
class="bg-gradient-to-r ml-6 dark:from-pink-400 dark:to-fuchsia-400 from-pink-600 to-red-600 text-white dark:text-black"
|
||||
href="https://buymeacoffee.com/xylight"
|
||||
target="_blank"
|
||||
rounding="xl"
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Heart} size="16" micro />
|
||||
{/snippet}
|
||||
{$t('nav.menu.donate')}
|
||||
</Button>
|
||||
</Setting>
|
||||
{/if}
|
||||
<Setting icon={Language}>
|
||||
{#snippet title()}
|
||||
{$t('settings.app.lang.title')}
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<p>
|
||||
{$t('settings.app.lang.description')}
|
||||
<Link href="/translators" highlight class="text-base font-semibold">
|
||||
{$t('settings.app.lang.credits')}
|
||||
</Link>
|
||||
</p>
|
||||
{/snippet}
|
||||
<!--@ts-ignore-->
|
||||
<Select bind:value={settings.language}>
|
||||
<Option icon={Language} value={null}>
|
||||
{$t('settings.app.lang.auto')}
|
||||
</Option>
|
||||
{#each $locales as locale (locale)}
|
||||
{@const mapped = localeMap.get(locale) ?? {
|
||||
flag: '',
|
||||
translated: 1,
|
||||
name: locale,
|
||||
}}
|
||||
<Option value={locale}>
|
||||
{mapped?.flag}
|
||||
{mapped?.name}
|
||||
</Option>
|
||||
{/each}
|
||||
</Select>
|
||||
</Setting>
|
||||
{#if $locale == 'he' || $locale == 'ar'}
|
||||
<ToggleSetting
|
||||
bind:checked={settings.useRtl}
|
||||
title={$t('settings.app.lang.useRtl.title')}
|
||||
></ToggleSetting>
|
||||
{/if}
|
||||
<Setting icon={ViewColumns}>
|
||||
{#snippet title()}
|
||||
<span>{$t('settings.app.view.title')}</span>
|
||||
{/snippet}
|
||||
<ViewSelect showLabel={false} />
|
||||
{#snippet description()}
|
||||
<p>
|
||||
{#if settings.view == 'cozy'}
|
||||
{$t('settings.app.view.cozy')}
|
||||
{:else if settings.view == 'compact'}
|
||||
{$t('settings.app.view.compact')}
|
||||
{/if}
|
||||
</p>
|
||||
{/snippet}
|
||||
</Setting>
|
||||
<Setting optionClass="flex-2 max-w-full flex-wrap min-w-0 " icon={ChartBar}>
|
||||
{#snippet title()}
|
||||
<span>{$t('settings.app.sort.title')}</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span>{$t('settings.app.sort.description')}</span>
|
||||
{/snippet}
|
||||
<div
|
||||
class="flex flex-row flex-wrap
|
||||
flex-1 gap-2 w-full lg:w-max max-w-full lg:self-end"
|
||||
>
|
||||
<div class="max-w-full">
|
||||
<Select bind:value={settings.defaultSort.feed}>
|
||||
{#snippet customLabel()}
|
||||
<span class="flex items-center gap-1">
|
||||
<Icon src={GlobeAmericas} size="16" mini />
|
||||
{$t('filter.location.label')}
|
||||
</span>
|
||||
{/snippet}
|
||||
<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">
|
||||
<Sort bind:selected={settings.defaultSort.sort} navigate={false} />
|
||||
</div>
|
||||
<div class="max-w-full">
|
||||
<Select bind:value={settings.defaultSort.comments}>
|
||||
{#snippet customLabel()}
|
||||
<span class="flex items-center gap-1">
|
||||
<Icon src={ChatBubbleOvalLeftEllipsis} size="14" mini />
|
||||
{$t('content.comments')}
|
||||
</span>
|
||||
{/snippet}
|
||||
|
||||
<Option icon={Fire} value="Hot">{$t('filter.sort.hot')}</Option>
|
||||
<Option icon={Trophy} value="Top">
|
||||
{$t('filter.sort.top.label')}
|
||||
</Option>
|
||||
<Option icon={Star} value="New">{$t('filter.sort.new')}</Option>
|
||||
<Option icon={Clock} value="Old">{$t('filter.sort.old')}</Option>
|
||||
<Option icon={ArrowTrendingDown} value="Controversial">
|
||||
{$t('filter.sort.controversial')}
|
||||
</Option>
|
||||
</Select>
|
||||
</div>
|
||||
</div>
|
||||
</Setting>
|
||||
<ToggleSetting
|
||||
icon={BarsArrowDown}
|
||||
bind:checked={settings.infiniteScroll}
|
||||
title={$t('settings.app.infiniteScroll.title')}
|
||||
description={$t('settings.app.infiniteScroll.description')}
|
||||
/>
|
||||
<Setting icon={Photo}>
|
||||
{#snippet title()}
|
||||
<span>{$t('settings.app.thumbnailSide.title')}</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span>
|
||||
{$t('settings.app.thumbnailSide.description')}
|
||||
</span>
|
||||
{/snippet}
|
||||
<MultiSelect
|
||||
options={[true, false]}
|
||||
optionNames={[
|
||||
$t('settings.app.thumbnailSide.left'),
|
||||
$t('settings.app.thumbnailSide.right'),
|
||||
]}
|
||||
bind:selected={settings.leftAlign}
|
||||
/>
|
||||
</Setting>
|
||||
<ToggleSetting
|
||||
icon={ArrowsRightLeft}
|
||||
bind:checked={settings.posts.reverseActions}
|
||||
title={$t('settings.app.reverseActions.title')}
|
||||
description={$t('settings.app.reverseActions.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
icon={TableCells}
|
||||
supportedPlatforms={{ desktop: true, tablet: false, mobile: false }}
|
||||
bind:checked={settings.newWidth}
|
||||
title={$t('settings.app.limitLayoutWidth.title')}
|
||||
description={$t('settings.app.limitLayoutWidth.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
icon={Calendar}
|
||||
bind:checked={settings.absoluteDates}
|
||||
title={$t('settings.app.absoluteDates.title')}
|
||||
description={$t('settings.app.absoluteDates.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
icon={ArrowsUpDown}
|
||||
bind:checked={settings.voteRatioBar}
|
||||
title={$t('settings.app.voteRatioBar.title')}
|
||||
description={$t('settings.app.voteRatioBar.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
icon={CubeTransparent}
|
||||
supportedPlatforms={{ desktop: false, tablet: false, mobile: true }}
|
||||
bind:checked={settings.dock.autoHide}
|
||||
title={$t('settings.navigation.autoHide.title')}
|
||||
description={$t('settings.navigation.autoHide.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
icon={ArrowTopRightOnSquare}
|
||||
bind:checked={settings.openLinksInNewTab}
|
||||
title={$t('settings.app.postsInNewTab.title')}
|
||||
description={$t('settings.app.postsInNewTab.description')}
|
||||
/>
|
||||
<Setting icon={DocumentText}>
|
||||
{#snippet title()}
|
||||
<span>{$t('settings.app.font.title')}</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span>{$t('settings.app.font.description')}</span>
|
||||
{/snippet}
|
||||
<Select bind:value={settings.font}>
|
||||
<Option value="inter">Inter</Option>
|
||||
<Option value="system">System UI</Option>
|
||||
<Option value="browser">Browser</Option>
|
||||
</Select>
|
||||
</Setting>
|
||||
<ToggleSetting
|
||||
icon={ArrowPath}
|
||||
bind:checked={settings.randomPlaceholders}
|
||||
title={$t('settings.app.placeholders.title')}
|
||||
description={$t('settings.app.placeholders.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
icon={ArrowsPointingOut}
|
||||
bind:checked={settings.expandImages}
|
||||
title={$t('settings.app.expandImages.title')}
|
||||
description={$t('settings.app.expandImages.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
icon={Bars2}
|
||||
bind:checked={settings.posts.deduplicateEmbed}
|
||||
title={$t('settings.app.duplicateTitles.title')}
|
||||
description={$t('settings.app.duplicateTitles.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
icon={ArrowTopRightOnSquare}
|
||||
bind:checked={settings.posts.titleOpensUrl}
|
||||
title={$t('settings.app.titleOpensUrl.title')}
|
||||
description={$t('settings.app.titleOpensUrl.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
icon={Tag}
|
||||
title={$t('settings.app.titleTags.title')}
|
||||
description={$t('settings.app.titleTags.description')}
|
||||
bind:checked={settings.parseTags}
|
||||
/>
|
||||
</Section>
|
||||
|
||||
<Section id="embeds" title={$t('settings.embeds.title')}>
|
||||
<ToggleSetting
|
||||
icon={CursorArrowRays}
|
||||
title={$t('settings.embeds.clickToView.title')}
|
||||
description={$t('settings.embeds.clickToView.description')}
|
||||
bind:checked={settings.embeds.clickToView}
|
||||
/>
|
||||
<Setting icon={VideoCamera}>
|
||||
{#snippet title()}
|
||||
<span>YouTube</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span>
|
||||
{$t('settings.embeds.youtube.description')}
|
||||
</span>
|
||||
{/snippet}
|
||||
<Select bind:value={settings.embeds.youtube}>
|
||||
<Option value="youtube">YouTube</Option>
|
||||
<Option value="invidious">Invidious</Option>
|
||||
<Option value="piped">Piped</Option>
|
||||
</Select>
|
||||
</Setting>
|
||||
{#if settings.embeds.youtube == 'invidious'}
|
||||
<Setting>
|
||||
{#snippet title()}
|
||||
<span>{$t('settings.embeds.instance.invidious')}</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span>
|
||||
{$t('settings.embeds.instance.description')}
|
||||
</span>
|
||||
{/snippet}
|
||||
<TextInput
|
||||
label={$t('settings.embeds.instance.invidious')}
|
||||
pattern={DOMAIN_REGEX_FORMS}
|
||||
bind:value={settings.embeds.invidious}
|
||||
/>
|
||||
</Setting>
|
||||
{/if}
|
||||
{#if settings.embeds.youtube == 'piped'}
|
||||
<Setting>
|
||||
{#snippet title()}
|
||||
<span>{$t('settings.embeds.instance.piped')}</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span>
|
||||
{$t('settings.embeds.instance.description')}
|
||||
</span>
|
||||
{/snippet}
|
||||
<TextInput
|
||||
label={$t('settings.embeds.instance.piped')}
|
||||
pattern={DOMAIN_REGEX_FORMS}
|
||||
bind:value={settings.embeds.piped}
|
||||
/>
|
||||
</Setting>
|
||||
{/if}
|
||||
</Section>
|
||||
|
||||
<Section id="lemmy" title={$t('settings.lemmy.title')}>
|
||||
<ToggleSetting
|
||||
icon={Eye}
|
||||
bind:checked={settings.posts.showHidden}
|
||||
title={$t('settings.lemmy.showHiddenPosts.title')}
|
||||
description={$t('settings.lemmy.showHiddenPosts.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
icon={Bars3}
|
||||
bind:checked={settings.posts.compactFeatured}
|
||||
title={$t('settings.lemmy.compactFeatured.title')}
|
||||
description={$t('settings.lemmy.compactFeatured.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
icon={BookOpen}
|
||||
bind:checked={settings.markPostsAsRead}
|
||||
title={$t('settings.lemmy.markReadPosts.title')}
|
||||
description={$t('settings.lemmy.markReadPosts.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
icon={CubeTransparent}
|
||||
bind:checked={settings.markReadPosts}
|
||||
title={$t('settings.lemmy.fadeReadPosts.title')}
|
||||
description={$t('settings.lemmy.fadeReadPosts.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
icon={Share}
|
||||
bind:checked={settings.crosspostOriginalLink}
|
||||
title={$t('settings.lemmy.crosspostMarker.title')}
|
||||
description={$t('settings.lemmy.crosspostMarker.description')}
|
||||
/>
|
||||
<Setting icon={EyeSlash}>
|
||||
{#snippet title()}
|
||||
<span>{$t('settings.lemmy.hideSubmissions.title')}</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span>
|
||||
<p>{$t('settings.lemmy.hideSubmissions.description')}</p>
|
||||
</span>
|
||||
{/snippet}
|
||||
<div class="flex flex-col items-start gap-4 flex-wrap">
|
||||
<Switch bind:checked={settings.hidePosts.deleted}>
|
||||
{$t('settings.lemmy.hideSubmissions.deleted')}
|
||||
</Switch>
|
||||
<Switch bind:checked={settings.hidePosts.removed}>
|
||||
{$t('settings.lemmy.hideSubmissions.removed')}
|
||||
</Switch>
|
||||
</div>
|
||||
</Setting>
|
||||
<ToggleSetting
|
||||
icon={ExclamationTriangle}
|
||||
bind:checked={settings.nsfwBlur}
|
||||
title={$t('settings.lemmy.nsfwBlur.title')}
|
||||
description={$t('settings.lemmy.nsfwBlur.description')}
|
||||
/>
|
||||
<Setting icon={ServerStack}>
|
||||
{#snippet title()}
|
||||
<span>{$t('settings.lemmy.instances.title')}</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span>
|
||||
{$t('settings.lemmy.instances.description')}
|
||||
</span>
|
||||
{/snippet}
|
||||
<div class="flex flex-row flex-wrap items-center gap-4">
|
||||
<Checkbox bind:checked={settings.showInstances.user}>
|
||||
{$t('content.users')}
|
||||
</Checkbox>
|
||||
<Checkbox bind:checked={settings.showInstances.comments}>
|
||||
{$t('content.comments')}
|
||||
</Checkbox>
|
||||
<Checkbox bind:checked={settings.showInstances.community}>
|
||||
{$t('content.communities')}
|
||||
</Checkbox>
|
||||
</div>
|
||||
</Setting>
|
||||
<ToggleSetting
|
||||
icon={User}
|
||||
bind:checked={settings.displayNames}
|
||||
title={$t('settings.app.displayName.title')}
|
||||
description={$t('settings.app.displayName.description')}
|
||||
/>
|
||||
</Section>
|
||||
|
||||
<Section id="moderation" title={$t('settings.moderation.title')}>
|
||||
<Setting icon={Trash} adaptive={false}>
|
||||
{#snippet title()}
|
||||
<span>{$t('settings.moderation.replyPresets.title')}</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span>
|
||||
<p>{$t('settings.moderation.replyPresets.description')}</p>
|
||||
<ul class="leading-6">
|
||||
<li>{$t('settings.moderation.replyPresets.syntax')}</li>
|
||||
<li>
|
||||
<code>{'{{reason}}'}</code>
|
||||
</li>
|
||||
<li>
|
||||
<code>{'{{post}}'}</code>
|
||||
</li>
|
||||
<li>
|
||||
<code>{'{{community}}'}</code>
|
||||
</li>
|
||||
<li>
|
||||
<code>{'{{username}}'}</code>
|
||||
</li>
|
||||
</ul>
|
||||
</span>
|
||||
{/snippet}
|
||||
</Setting>
|
||||
{#each settings.moderation.presets as preset, index (preset)}
|
||||
<li>
|
||||
<Expandable>
|
||||
{#snippet title()}
|
||||
{preset.title}
|
||||
{/snippet}
|
||||
<div class="flex flex-col gap-3">
|
||||
<TextInput
|
||||
label="Title"
|
||||
bind:value={preset.title}
|
||||
placeholder="Reason 1"
|
||||
/>
|
||||
<MarkdownEditor
|
||||
bind:value={preset.content}
|
||||
label="Content"
|
||||
images={false}
|
||||
previewButton
|
||||
beforePreview={input =>
|
||||
removalTemplate(input, {
|
||||
postTitle: '<Example post>',
|
||||
communityLink: '[!community@example.com]()',
|
||||
reason: '<Being a meanie>',
|
||||
username: '@Bob',
|
||||
})}
|
||||
/>
|
||||
|
||||
<Button
|
||||
color="danger"
|
||||
rounding="pill"
|
||||
onclick={() => {
|
||||
settings.moderation.presets.splice(index, 1)
|
||||
settings.moderation.presets = settings.moderation.presets
|
||||
}}
|
||||
class="w-max"
|
||||
>
|
||||
<Icon src={Trash} size="16" mini />
|
||||
{$t('common.remove')}
|
||||
</Button>
|
||||
</div>
|
||||
</Expandable>
|
||||
</li>
|
||||
{/each}
|
||||
<li>
|
||||
<Button
|
||||
color="none"
|
||||
class="w-full p-2"
|
||||
onclick={() => {
|
||||
settings.moderation.presets = [
|
||||
...settings.moderation.presets,
|
||||
{
|
||||
title: `Preset ${settings.moderation.presets.length + 1}`,
|
||||
content:
|
||||
'Your submission in *{{post}}* was removed for *{{reason}}*.',
|
||||
},
|
||||
]
|
||||
}}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Plus} micro size="16" />
|
||||
{/snippet}
|
||||
Add Preset
|
||||
</Button>
|
||||
</li>
|
||||
</Section>
|
||||
|
||||
<Section id="other" title={$t('settings.other.title')}>
|
||||
<ToggleSetting
|
||||
icon={BugAnt}
|
||||
bind:checked={settings.debugInfo}
|
||||
title={$t('settings.other.debug.title')}
|
||||
description={$t('settings.other.debug.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
icon={Bars3}
|
||||
bind:checked={settings.posts.noVirtualize}
|
||||
title={$t('settings.other.virtualizeFeeds.title')}
|
||||
description={$t('settings.other.virtualizeFeeds.description')}
|
||||
/>
|
||||
</Section>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
[data-hide-selected]::before {
|
||||
content: attr(data-label);
|
||||
font-size: small;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,5 @@
|
||||
import { redirect } from '@sveltejs/kit'
|
||||
|
||||
export function load() {
|
||||
redirect(302, '/settings/app')
|
||||
}
|
||||
@@ -0,0 +1,306 @@
|
||||
<script lang="ts">
|
||||
import { env } from '$env/dynamic/public'
|
||||
import { locale, locales, t } from '$lib/i18n/translations'
|
||||
import { Button, Option, Select } from 'mono-svelte'
|
||||
import ToggleSetting from '../ToggleSetting.svelte'
|
||||
import {
|
||||
ArrowPath,
|
||||
ArrowsPointingOut,
|
||||
ArrowsRightLeft,
|
||||
ArrowsUpDown,
|
||||
ArrowTopRightOnSquare,
|
||||
ArrowTrendingDown,
|
||||
Bars2,
|
||||
BarsArrowDown,
|
||||
Calendar,
|
||||
ChartBar,
|
||||
ChatBubbleOvalLeftEllipsis,
|
||||
Clock,
|
||||
CubeTransparent,
|
||||
DocumentText,
|
||||
Fire,
|
||||
GlobeAmericas,
|
||||
Heart,
|
||||
Icon,
|
||||
Language,
|
||||
Photo,
|
||||
Star,
|
||||
TableCells,
|
||||
Tag,
|
||||
Trophy,
|
||||
ViewColumns,
|
||||
} from 'svelte-hero-icons'
|
||||
import Setting from '../Setting.svelte'
|
||||
import Link from '$lib/components/input/Link.svelte'
|
||||
import { settings } from '$lib/settings.svelte'
|
||||
import ViewSelect from '$lib/components/lemmy/dropdowns/ViewSelect.svelte'
|
||||
import Sort from '$lib/components/lemmy/dropdowns/Sort.svelte'
|
||||
import Switch from '$lib/components/input/Switch.svelte'
|
||||
import CommonList from '$lib/components/ui/layout/CommonList.svelte'
|
||||
|
||||
let localeMap: Map<
|
||||
string,
|
||||
{
|
||||
name: string
|
||||
translated: number
|
||||
flag: string
|
||||
}
|
||||
> = new Map([
|
||||
['en', { name: 'English', translated: -1, flag: '🇬🇧' }],
|
||||
['ar', { name: 'العربية', translated: 0.3, flag: '🟩' }],
|
||||
['he', { name: 'עברית', translated: -1, flag: '🇮🇱' }],
|
||||
['bg', { name: 'български', translated: 0.67, flag: '🇧🇬' }],
|
||||
['de', { name: 'Deutsch', translated: 0.7, flag: '🇩🇪' }],
|
||||
['es', { name: 'Español', translated: 0.89, flag: '🇪🇸' }],
|
||||
['et', { name: 'eesti keel', translated: 0.23, flag: '🇪🇪' }],
|
||||
['fi', { name: 'suomi', translated: 0.98, flag: '🇫🇮' }],
|
||||
['fr', { name: 'Français', translated: 0.93, flag: '🇫🇷' }],
|
||||
['hu', { name: 'Magyar', translated: 0.51, flag: '🇭🇺' }],
|
||||
['ja', { name: '日本語', translated: 0.93, flag: '🇯🇵' }],
|
||||
['nl', { name: 'Nederlands', translated: 0.89, flag: '🇳🇱' }],
|
||||
['pl', { name: 'Polski', translated: 0.91, flag: '🇵🇱' }],
|
||||
['pt', { name: 'Português (PT)', translated: 0.86, flag: '🇵🇹' }],
|
||||
['pt-BR', { name: 'Português (BR)', translated: 0.86, flag: '🇧🇷' }],
|
||||
['tr', { name: 'Türkçe', translated: 0.99, flag: '🇹🇷' }],
|
||||
['ru', { name: 'Русский', translated: 0.88, flag: '🇷🇺' }],
|
||||
['zh-Hans', { name: '简体中文', translated: 0.83, flag: '🇨🇳' }],
|
||||
['zh-Hant', { name: '繁體中文', translated: 0.23, flag: '🇹🇼' }],
|
||||
])
|
||||
</script>
|
||||
|
||||
<CommonList>
|
||||
{#if env.PUBLIC_XYLIGHT_MODE}
|
||||
<Setting icon={Heart}>
|
||||
{#snippet title()}
|
||||
<span class="dark:text-pink-400 text-pink-600">
|
||||
{$t('nav.menu.donate')}
|
||||
</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
{$t('settings.donate.description')}
|
||||
{/snippet}
|
||||
<Button
|
||||
color="none"
|
||||
class="bg-gradient-to-r ml-6 dark:from-pink-400 dark:to-fuchsia-400 from-pink-600 to-red-600 text-white dark:text-black"
|
||||
href="https://buymeacoffee.com/xylight"
|
||||
target="_blank"
|
||||
rounding="xl"
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Heart} size="16" micro />
|
||||
{/snippet}
|
||||
{$t('nav.menu.donate')}
|
||||
</Button>
|
||||
</Setting>
|
||||
{/if}
|
||||
<Setting icon={Language}>
|
||||
{#snippet title()}
|
||||
{$t('settings.app.lang.title')}
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<p>
|
||||
{$t('settings.app.lang.description')}
|
||||
<Link href="/translators" highlight class="text-base font-semibold">
|
||||
{$t('settings.app.lang.credits')}
|
||||
</Link>
|
||||
</p>
|
||||
{/snippet}
|
||||
<!--@ts-ignore-->
|
||||
<Select bind:value={settings.language}>
|
||||
<Option icon={Language} value={null}>
|
||||
{$t('settings.app.lang.auto')}
|
||||
</Option>
|
||||
{#each $locales as locale (locale)}
|
||||
{@const mapped = localeMap.get(locale) ?? {
|
||||
flag: '',
|
||||
translated: 1,
|
||||
name: locale,
|
||||
}}
|
||||
<Option value={locale}>
|
||||
{mapped?.flag}
|
||||
{mapped?.name}
|
||||
</Option>
|
||||
{/each}
|
||||
</Select>
|
||||
</Setting>
|
||||
{#if $locale == 'he' || $locale == 'ar'}
|
||||
<ToggleSetting
|
||||
bind:checked={settings.useRtl}
|
||||
title={$t('settings.app.lang.useRtl.title')}
|
||||
></ToggleSetting>
|
||||
{/if}
|
||||
<Setting icon={ViewColumns}>
|
||||
{#snippet title()}
|
||||
<span>{$t('settings.app.view.title')}</span>
|
||||
{/snippet}
|
||||
<ViewSelect showLabel={false} />
|
||||
{#snippet description()}
|
||||
<p>
|
||||
{#if settings.view == 'cozy'}
|
||||
{$t('settings.app.view.cozy')}
|
||||
{:else if settings.view == 'compact'}
|
||||
{$t('settings.app.view.compact')}
|
||||
{/if}
|
||||
</p>
|
||||
{/snippet}
|
||||
</Setting>
|
||||
<Setting optionClass="flex-2 max-w-full flex-wrap min-w-0 " icon={ChartBar}>
|
||||
{#snippet title()}
|
||||
<span>{$t('settings.app.sort.title')}</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span>{$t('settings.app.sort.description')}</span>
|
||||
{/snippet}
|
||||
<div
|
||||
class="flex flex-row flex-wrap
|
||||
flex-1 gap-2 w-full lg:w-max max-w-full lg:self-end"
|
||||
>
|
||||
<div class="max-w-full">
|
||||
<Select bind:value={settings.defaultSort.feed}>
|
||||
{#snippet customLabel()}
|
||||
<span class="flex items-center gap-1">
|
||||
<Icon src={GlobeAmericas} size="16" mini />
|
||||
{$t('filter.location.label')}
|
||||
</span>
|
||||
{/snippet}
|
||||
<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">
|
||||
<Sort bind:selected={settings.defaultSort.sort} navigate={false} />
|
||||
</div>
|
||||
<div class="max-w-full">
|
||||
<Select bind:value={settings.defaultSort.comments}>
|
||||
{#snippet customLabel()}
|
||||
<span class="flex items-center gap-1">
|
||||
<Icon src={ChatBubbleOvalLeftEllipsis} size="14" mini />
|
||||
{$t('content.comments')}
|
||||
</span>
|
||||
{/snippet}
|
||||
|
||||
<Option icon={Fire} value="Hot">{$t('filter.sort.hot')}</Option>
|
||||
<Option icon={Trophy} value="Top">
|
||||
{$t('filter.sort.top.label')}
|
||||
</Option>
|
||||
<Option icon={Star} value="New">{$t('filter.sort.new')}</Option>
|
||||
<Option icon={Clock} value="Old">{$t('filter.sort.old')}</Option>
|
||||
<Option icon={ArrowTrendingDown} value="Controversial">
|
||||
{$t('filter.sort.controversial')}
|
||||
</Option>
|
||||
</Select>
|
||||
</div>
|
||||
</div>
|
||||
</Setting>
|
||||
<ToggleSetting
|
||||
icon={BarsArrowDown}
|
||||
bind:checked={settings.infiniteScroll}
|
||||
title={$t('settings.app.infiniteScroll.title')}
|
||||
description={$t('settings.app.infiniteScroll.description')}
|
||||
/>
|
||||
<Setting icon={Photo}>
|
||||
{#snippet title()}
|
||||
<span>{$t('settings.app.thumbnailSide.title')}</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span>
|
||||
{$t('settings.app.thumbnailSide.description')}
|
||||
</span>
|
||||
{/snippet}
|
||||
<Switch
|
||||
options={[true, false]}
|
||||
optionNames={[
|
||||
$t('settings.app.thumbnailSide.left'),
|
||||
$t('settings.app.thumbnailSide.right'),
|
||||
]}
|
||||
bind:selected={settings.leftAlign}
|
||||
/>
|
||||
</Setting>
|
||||
<ToggleSetting
|
||||
icon={ArrowsRightLeft}
|
||||
bind:checked={settings.posts.reverseActions}
|
||||
title={$t('settings.app.reverseActions.title')}
|
||||
description={$t('settings.app.reverseActions.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
icon={TableCells}
|
||||
supportedPlatforms={{ desktop: true, tablet: false, mobile: false }}
|
||||
bind:checked={settings.newWidth}
|
||||
title={$t('settings.app.limitLayoutWidth.title')}
|
||||
description={$t('settings.app.limitLayoutWidth.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
icon={Calendar}
|
||||
bind:checked={settings.absoluteDates}
|
||||
title={$t('settings.app.absoluteDates.title')}
|
||||
description={$t('settings.app.absoluteDates.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
icon={ArrowsUpDown}
|
||||
bind:checked={settings.voteRatioBar}
|
||||
title={$t('settings.app.voteRatioBar.title')}
|
||||
description={$t('settings.app.voteRatioBar.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
icon={CubeTransparent}
|
||||
supportedPlatforms={{ desktop: false, tablet: false, mobile: true }}
|
||||
bind:checked={settings.dock.autoHide}
|
||||
title={$t('settings.navigation.autoHide.title')}
|
||||
description={$t('settings.navigation.autoHide.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
icon={ArrowTopRightOnSquare}
|
||||
bind:checked={settings.openLinksInNewTab}
|
||||
title={$t('settings.app.postsInNewTab.title')}
|
||||
description={$t('settings.app.postsInNewTab.description')}
|
||||
/>
|
||||
<Setting icon={DocumentText}>
|
||||
{#snippet title()}
|
||||
<span>{$t('settings.app.font.title')}</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span>{$t('settings.app.font.description')}</span>
|
||||
{/snippet}
|
||||
<Select bind:value={settings.font}>
|
||||
<Option value="inter">Inter</Option>
|
||||
<Option value="system">System UI</Option>
|
||||
<Option value="browser">Browser</Option>
|
||||
</Select>
|
||||
</Setting>
|
||||
<ToggleSetting
|
||||
icon={ArrowPath}
|
||||
bind:checked={settings.randomPlaceholders}
|
||||
title={$t('settings.app.placeholders.title')}
|
||||
description={$t('settings.app.placeholders.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
icon={ArrowsPointingOut}
|
||||
bind:checked={settings.expandImages}
|
||||
title={$t('settings.app.expandImages.title')}
|
||||
description={$t('settings.app.expandImages.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
icon={Bars2}
|
||||
bind:checked={settings.posts.deduplicateEmbed}
|
||||
title={$t('settings.app.duplicateTitles.title')}
|
||||
description={$t('settings.app.duplicateTitles.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
icon={ArrowTopRightOnSquare}
|
||||
bind:checked={settings.posts.titleOpensUrl}
|
||||
title={$t('settings.app.titleOpensUrl.title')}
|
||||
description={$t('settings.app.titleOpensUrl.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
icon={Tag}
|
||||
title={$t('settings.app.titleTags.title')}
|
||||
description={$t('settings.app.titleTags.description')}
|
||||
bind:checked={settings.parseTags}
|
||||
/>
|
||||
</CommonList>
|
||||
@@ -0,0 +1,69 @@
|
||||
<script lang="ts">
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { settings } from '$lib/settings.svelte'
|
||||
import { DOMAIN_REGEX_FORMS } from '$lib/util.svelte.js'
|
||||
import { Select, TextInput } from 'mono-svelte'
|
||||
import Option from 'mono-svelte/forms/select/Option.svelte'
|
||||
import { CursorArrowRays, VideoCamera } from 'svelte-hero-icons'
|
||||
import Setting from '../Setting.svelte'
|
||||
import ToggleSetting from '../ToggleSetting.svelte'
|
||||
import CommonList from '$lib/components/ui/layout/CommonList.svelte'
|
||||
</script>
|
||||
|
||||
<CommonList>
|
||||
<ToggleSetting
|
||||
icon={CursorArrowRays}
|
||||
title={$t('settings.embeds.clickToView.title')}
|
||||
description={$t('settings.embeds.clickToView.description')}
|
||||
bind:checked={settings.embeds.clickToView}
|
||||
/>
|
||||
<Setting icon={VideoCamera}>
|
||||
{#snippet title()}
|
||||
<span>YouTube</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span>
|
||||
{$t('settings.embeds.youtube.description')}
|
||||
</span>
|
||||
{/snippet}
|
||||
<Select bind:value={settings.embeds.youtube}>
|
||||
<Option value="youtube">YouTube</Option>
|
||||
<Option value="invidious">Invidious</Option>
|
||||
<Option value="piped">Piped</Option>
|
||||
</Select>
|
||||
</Setting>
|
||||
{#if settings.embeds.youtube == 'invidious'}
|
||||
<Setting>
|
||||
{#snippet title()}
|
||||
<span>{$t('settings.embeds.instance.invidious')}</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span>
|
||||
{$t('settings.embeds.instance.description')}
|
||||
</span>
|
||||
{/snippet}
|
||||
<TextInput
|
||||
label={$t('settings.embeds.instance.invidious')}
|
||||
pattern={DOMAIN_REGEX_FORMS}
|
||||
bind:value={settings.embeds.invidious}
|
||||
/>
|
||||
</Setting>
|
||||
{/if}
|
||||
{#if settings.embeds.youtube == 'piped'}
|
||||
<Setting>
|
||||
{#snippet title()}
|
||||
<span>{$t('settings.embeds.instance.piped')}</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span>
|
||||
{$t('settings.embeds.instance.description')}
|
||||
</span>
|
||||
{/snippet}
|
||||
<TextInput
|
||||
label={$t('settings.embeds.instance.piped')}
|
||||
pattern={DOMAIN_REGEX_FORMS}
|
||||
bind:value={settings.embeds.piped}
|
||||
/>
|
||||
</Setting>
|
||||
{/if}
|
||||
</CommonList>
|
||||
@@ -0,0 +1,103 @@
|
||||
<script lang="ts">
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { settings } from '$lib/settings.svelte'
|
||||
import { Checkbox, Switch } from 'mono-svelte'
|
||||
import {
|
||||
Bars3,
|
||||
BookOpen,
|
||||
CubeTransparent,
|
||||
ExclamationTriangle,
|
||||
Eye,
|
||||
EyeSlash,
|
||||
ServerStack,
|
||||
Share,
|
||||
User,
|
||||
} from 'svelte-hero-icons'
|
||||
import Setting from '../Setting.svelte'
|
||||
import ToggleSetting from '../ToggleSetting.svelte'
|
||||
import CommonList from '$lib/components/ui/layout/CommonList.svelte'
|
||||
</script>
|
||||
|
||||
<CommonList>
|
||||
<ToggleSetting
|
||||
icon={Eye}
|
||||
bind:checked={settings.posts.showHidden}
|
||||
title={$t('settings.lemmy.showHiddenPosts.title')}
|
||||
description={$t('settings.lemmy.showHiddenPosts.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
icon={Bars3}
|
||||
bind:checked={settings.posts.compactFeatured}
|
||||
title={$t('settings.lemmy.compactFeatured.title')}
|
||||
description={$t('settings.lemmy.compactFeatured.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
icon={BookOpen}
|
||||
bind:checked={settings.markPostsAsRead}
|
||||
title={$t('settings.lemmy.markReadPosts.title')}
|
||||
description={$t('settings.lemmy.markReadPosts.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
icon={CubeTransparent}
|
||||
bind:checked={settings.markReadPosts}
|
||||
title={$t('settings.lemmy.fadeReadPosts.title')}
|
||||
description={$t('settings.lemmy.fadeReadPosts.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
icon={Share}
|
||||
bind:checked={settings.crosspostOriginalLink}
|
||||
title={$t('settings.lemmy.crosspostMarker.title')}
|
||||
description={$t('settings.lemmy.crosspostMarker.description')}
|
||||
/>
|
||||
<Setting icon={EyeSlash}>
|
||||
{#snippet title()}
|
||||
<span>{$t('settings.lemmy.hideSubmissions.title')}</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span>
|
||||
<p>{$t('settings.lemmy.hideSubmissions.description')}</p>
|
||||
</span>
|
||||
{/snippet}
|
||||
<div class="flex flex-col items-start gap-4 flex-wrap">
|
||||
<Switch bind:checked={settings.hidePosts.deleted}>
|
||||
{$t('settings.lemmy.hideSubmissions.deleted')}
|
||||
</Switch>
|
||||
<Switch bind:checked={settings.hidePosts.removed}>
|
||||
{$t('settings.lemmy.hideSubmissions.removed')}
|
||||
</Switch>
|
||||
</div>
|
||||
</Setting>
|
||||
<ToggleSetting
|
||||
icon={ExclamationTriangle}
|
||||
bind:checked={settings.nsfwBlur}
|
||||
title={$t('settings.lemmy.nsfwBlur.title')}
|
||||
description={$t('settings.lemmy.nsfwBlur.description')}
|
||||
/>
|
||||
<Setting icon={ServerStack}>
|
||||
{#snippet title()}
|
||||
<span>{$t('settings.lemmy.instances.title')}</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span>
|
||||
{$t('settings.lemmy.instances.description')}
|
||||
</span>
|
||||
{/snippet}
|
||||
<div class="flex flex-row flex-wrap items-center gap-4">
|
||||
<Checkbox bind:checked={settings.showInstances.user}>
|
||||
{$t('content.users')}
|
||||
</Checkbox>
|
||||
<Checkbox bind:checked={settings.showInstances.comments}>
|
||||
{$t('content.comments')}
|
||||
</Checkbox>
|
||||
<Checkbox bind:checked={settings.showInstances.community}>
|
||||
{$t('content.communities')}
|
||||
</Checkbox>
|
||||
</div>
|
||||
</Setting>
|
||||
<ToggleSetting
|
||||
icon={User}
|
||||
bind:checked={settings.displayNames}
|
||||
title={$t('settings.app.displayName.title')}
|
||||
description={$t('settings.app.displayName.description')}
|
||||
/>
|
||||
</CommonList>
|
||||
@@ -0,0 +1,102 @@
|
||||
<script lang="ts">
|
||||
import { removalTemplate } from '$lib/components/lemmy/moderation/moderation.js'
|
||||
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||
import Expandable from '$lib/components/ui/Expandable.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { settings } from '$lib/settings.svelte'
|
||||
import { Button, TextInput } from 'mono-svelte'
|
||||
import { Icon, Plus, Trash } from 'svelte-hero-icons'
|
||||
import Setting from '../Setting.svelte'
|
||||
import CommonList from '$lib/components/ui/layout/CommonList.svelte'
|
||||
</script>
|
||||
|
||||
<CommonList>
|
||||
<Setting icon={Trash} adaptive={false}>
|
||||
{#snippet title()}
|
||||
<span>{$t('settings.moderation.replyPresets.title')}</span>
|
||||
{/snippet}
|
||||
{#snippet description()}
|
||||
<span>
|
||||
<p>{$t('settings.moderation.replyPresets.description')}</p>
|
||||
<ul class="leading-6">
|
||||
<li>{$t('settings.moderation.replyPresets.syntax')}</li>
|
||||
<li>
|
||||
<code>{'{{reason}}'}</code>
|
||||
</li>
|
||||
<li>
|
||||
<code>{'{{post}}'}</code>
|
||||
</li>
|
||||
<li>
|
||||
<code>{'{{community}}'}</code>
|
||||
</li>
|
||||
<li>
|
||||
<code>{'{{username}}'}</code>
|
||||
</li>
|
||||
</ul>
|
||||
</span>
|
||||
{/snippet}
|
||||
</Setting>
|
||||
{#each settings.moderation.presets as preset, index (preset)}
|
||||
<li>
|
||||
<Expandable>
|
||||
{#snippet title()}
|
||||
{preset.title}
|
||||
{/snippet}
|
||||
<div class="flex flex-col gap-3">
|
||||
<TextInput
|
||||
label="Title"
|
||||
bind:value={preset.title}
|
||||
placeholder="Reason 1"
|
||||
/>
|
||||
<MarkdownEditor
|
||||
bind:value={preset.content}
|
||||
label="Content"
|
||||
images={false}
|
||||
previewButton
|
||||
beforePreview={input =>
|
||||
removalTemplate(input, {
|
||||
postTitle: '<Example post>',
|
||||
communityLink: '[!community@example.com]()',
|
||||
reason: '<Being a meanie>',
|
||||
username: '@Bob',
|
||||
})}
|
||||
/>
|
||||
|
||||
<Button
|
||||
color="danger"
|
||||
rounding="pill"
|
||||
onclick={() => {
|
||||
settings.moderation.presets.splice(index, 1)
|
||||
settings.moderation.presets = settings.moderation.presets
|
||||
}}
|
||||
class="w-max"
|
||||
>
|
||||
<Icon src={Trash} size="16" mini />
|
||||
{$t('common.remove')}
|
||||
</Button>
|
||||
</div>
|
||||
</Expandable>
|
||||
</li>
|
||||
{/each}
|
||||
<li>
|
||||
<Button
|
||||
color="none"
|
||||
class="w-full p-2"
|
||||
onclick={() => {
|
||||
settings.moderation.presets = [
|
||||
...settings.moderation.presets,
|
||||
{
|
||||
title: `Preset ${settings.moderation.presets.length + 1}`,
|
||||
content:
|
||||
'Your submission in *{{post}}* was removed for *{{reason}}*.',
|
||||
},
|
||||
]
|
||||
}}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Plus} micro size="16" />
|
||||
{/snippet}
|
||||
Add Preset
|
||||
</Button>
|
||||
</li>
|
||||
</CommonList>
|
||||
@@ -1,37 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { Material, Popover } from 'mono-svelte'
|
||||
|
||||
interface Props {
|
||||
href: string
|
||||
size?: keyof typeof sizes
|
||||
title?: string
|
||||
children?: import('svelte').Snippet
|
||||
}
|
||||
|
||||
let { href, size = 'medium', title = '', children }: Props = $props()
|
||||
|
||||
const sizes = {
|
||||
large: 'h-24',
|
||||
medium: 'h-16',
|
||||
small: 'h-8',
|
||||
}
|
||||
</script>
|
||||
|
||||
<Popover openOnHover placement="right">
|
||||
{#snippet target()}
|
||||
<a {href}>
|
||||
{@render children?.()}
|
||||
</a>
|
||||
{/snippet}
|
||||
{#snippet popover()}
|
||||
<Material
|
||||
padding="none"
|
||||
rounding="xl"
|
||||
elevation="medium"
|
||||
class="px-3 py-2 font-medium"
|
||||
>
|
||||
{title}
|
||||
</Material>
|
||||
{/snippet}
|
||||
</Popover>
|
||||
<div class="{sizes[size]} border-l self-center"></div>
|
||||
@@ -0,0 +1,22 @@
|
||||
<script lang="ts">
|
||||
import CommonList from '$lib/components/ui/layout/CommonList.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { settings } from '$lib/settings.svelte'
|
||||
import { Bars3, BugAnt } from 'svelte-hero-icons'
|
||||
import ToggleSetting from '../ToggleSetting.svelte'
|
||||
</script>
|
||||
|
||||
<CommonList>
|
||||
<ToggleSetting
|
||||
icon={BugAnt}
|
||||
bind:checked={settings.debugInfo}
|
||||
title={$t('settings.other.debug.title')}
|
||||
description={$t('settings.other.debug.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
icon={Bars3}
|
||||
bind:checked={settings.posts.noVirtualize}
|
||||
title={$t('settings.other.virtualizeFeeds.title')}
|
||||
description={$t('settings.other.virtualizeFeeds.description')}
|
||||
/>
|
||||
</CommonList>
|
||||
@@ -3,6 +3,7 @@
|
||||
import { page } from '$app/state'
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import CommentItem from '$lib/components/lemmy/comment/CommentItem.svelte'
|
||||
import Sort from '$lib/components/lemmy/dropdowns/Sort.svelte'
|
||||
import ItemList from '$lib/components/lemmy/generic/ItemList.svelte'
|
||||
import { ban, isAdmin } from '$lib/components/lemmy/moderation/moderation.js'
|
||||
import ShieldIcon from '$lib/components/lemmy/moderation/ShieldIcon.svelte'
|
||||
@@ -34,7 +35,6 @@
|
||||
import {
|
||||
AdjustmentsHorizontal,
|
||||
AtSymbol,
|
||||
ChartBar,
|
||||
EllipsisHorizontal,
|
||||
Envelope,
|
||||
Fire,
|
||||
@@ -330,22 +330,10 @@
|
||||
<Option value="posts">{$t('content.posts')}</Option>
|
||||
<Option value="comments">{$t('content.comments')}</Option>
|
||||
</Select>
|
||||
<Select
|
||||
bind:value={data.filters.value.sort}
|
||||
name="sort"
|
||||
<Sort
|
||||
bind:selected={data.filters.value.sort}
|
||||
onchange={() => sortForm?.requestSubmit()}
|
||||
>
|
||||
{#snippet customLabel()}
|
||||
<span class="flex items-center gap-1">
|
||||
<Icon src={ChartBar} size="14" mini />
|
||||
{$t('filter.sort.label')}
|
||||
</span>
|
||||
{/snippet}
|
||||
<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>
|
||||
<Option value="Controversial">{$t('filter.sort.controversial')}</Option>
|
||||
</Select>
|
||||
/>
|
||||
</form>
|
||||
{#if data.items.value.length == 0}
|
||||
<Placeholder
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100" fill="none">
|
||||
<circle cx="50" cy="50" fill="white" r="50" />
|
||||
<path d="M45 20.8868C48.094 19.1004 51.906 19.1004 55 20.8868L72.7128 31.1132C75.8068 32.8996 77.7128 36.2008 77.7128 39.7735V60.2265C77.7128 63.7992 75.8068 67.1004 72.7128 68.8868L55 79.1132C51.906 80.8996 48.094 80.8996 45 79.1132L27.2872 68.8868C24.1932 67.1004 22.2872 63.7992 22.2872 60.2265V39.7735C22.2872 36.2008 24.1932 32.8996 27.2872 31.1132L45 20.8868Z" fill="black"/>
|
||||
</svg>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 535 B After Width: | Height: | Size: 536 B |
@@ -1,3 +1,3 @@
|
||||
<svg fill="white" width="100" height="100" viewBox="15 15 70 70" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg fill="currentColor" width="100" height="100" viewBox="15 15 70 70" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M45 20.8868C48.094 19.1004 51.906 19.1004 55 20.8868L72.7128 31.1132C75.8068 32.8996 77.7128 36.2008 77.7128 39.7735V60.2265C77.7128 63.7992 75.8068 67.1004 72.7128 68.8867L55 79.1133C51.906 80.8996 48.094 80.8996 45 79.1133L27.2872 68.8867C24.1932 67.1004 22.2872 63.7992 22.2872 60.2265V39.7735C22.2872 36.2008 24.1932 32.8996 27.2872 31.1132L45 20.8868Z"/>
|
||||
</svg>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 476 B After Width: | Height: | Size: 484 B |
@@ -20,7 +20,7 @@
|
||||
"display": "standalone",
|
||||
"scope": "/",
|
||||
"theme_color": "#000000",
|
||||
"description": "A client for Lemmy with design as priority.",
|
||||
"description": "A Svelte based web client for Lemmy.",
|
||||
"screenshots": [
|
||||
{
|
||||
"form_factor": "wide",
|
||||
|
||||
Reference in new issue
Block a user