Merge pull request #640 from Xyphyn/profile-exp-fixes

design: update profiles/user experience
This commit is contained in:
Xylight authored and GitHub committed 2025-08-27 16:49:16 -07:00
commit ee1b8f0b26
91 files changed
+2036 -2189

No files matched your search

+2 -1
View File
@@ -1 +1,2 @@
*.json *.json
app.html
+6
View File
@@ -0,0 +1,6 @@
{
"i18n-ally.localesPaths": [
"src/lib/i18n",
"src/routes/inbox/messages"
]
}
+1
View File
@@ -28,6 +28,7 @@ export default ts.config(
'svelte/require-each-key': 'off', 'svelte/require-each-key': 'off',
'svelte/prefer-writable-derived': 'off', 'svelte/prefer-writable-derived': 'off',
'no-console': 'off', 'no-console': 'off',
'@typescript-eslint/no-explicit-any': 'off',
}, },
}, },
{ {
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "photon-lemmy", "name": "photon-lemmy",
"version": "2.0.1", "version": "2.0.2",
"license": "AGPL-3.0-only", "license": "AGPL-3.0-only",
"devDependencies": { "devDependencies": {
"@dicebear/core": "^8.0.1", "@dicebear/core": "^8.0.1",
+3 -28
View File
@@ -5,40 +5,15 @@
<link rel="icon" href="%sveltekit.assets%/img/logo-background.svg" /> <link rel="icon" href="%sveltekit.assets%/img/logo-background.svg" />
<link rel="manifest" href="/manifest.json" /> <link rel="manifest" href="/manifest.json" />
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="keywords" content="lemmy, client" />
%sveltekit.head% %sveltekit.head%
</head> </head>
<body> <body>
<div <div
style=" style="z-index:-50;position:absolute;inset:0;display:grid;place-items:center; "
z-index: -50;
position: absolute;
inset: 0;
display: grid;
place-items: center;
color: #fafafe;
"
> >
<svg <svg width="50" height="50"><use width="50" height="50" xlink:href='/img/logo-isolated.svg' href="/img/logo-isolated.svg"></use></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>
</div> </div>
<div <div style="display: contents;">
style="
display: contents;
flex-direction: column;
display: flex;
min-height: 100vh;
"
>
%sveltekit.body% %sveltekit.body%
</div> </div>
</body> </body>
+1 -1
View File
@@ -237,7 +237,7 @@ class Profile {
const id = Math.max(...this.meta.profiles.map(p => p.id)) + 1 const id = Math.max(...this.meta.profiles.map(p => p.id)) + 1
this.meta.profile = id this.meta.profile = id
this.meta.profiles.push({ this.meta.profiles.unshift({
id: id, id: id,
instance: instance, instance: instance,
jwt: jwt, jwt: jwt,
@@ -1,17 +1,15 @@
<script lang="ts"> <script lang="ts">
import { profile } from '$lib/auth.svelte.js' import { profile } from '$lib/auth.svelte.js'
import ProgressBar from '$lib/components/ui/ProgressBar.svelte' import ProgressBar from '$lib/components/ui/ProgressBar.svelte'
import { errorMessage } from '$lib/lemmy/error'
import { t } from '$lib/i18n/translations' import { t } from '$lib/i18n/translations'
import { errorMessage } from '$lib/lemmy/error'
import { uploadImage } from '$lib/util.svelte.js' import { uploadImage } from '$lib/util.svelte.js'
import { toast } from 'mono-svelte' import { Button, toast } from 'mono-svelte'
import { Button, Modal } from 'mono-svelte'
import { DocumentPlus, Icon } from 'svelte-hero-icons' import { DocumentPlus, Icon } from 'svelte-hero-icons'
import { expoOut } from 'svelte/easing' import { expoOut } from 'svelte/easing'
import { slide } from 'svelte/transition' import { slide } from 'svelte/transition'
interface Props { interface Props {
open: boolean
image?: FileList | null image?: FileList | null
preview?: boolean preview?: boolean
multiple?: boolean multiple?: boolean
@@ -19,7 +17,6 @@
} }
let { let {
open = $bindable(),
image = $bindable(null), image = $bindable(null),
preview = true, preview = true,
multiple = true, multiple = true,
@@ -57,7 +54,6 @@
onupload?.(uploaded) onupload?.(uploaded)
progress = 1 progress = 1
open = false
} catch (err) { } catch (err) {
toast({ toast({
content: errorMessage(err), content: errorMessage(err),
@@ -69,69 +65,64 @@
} }
</script> </script>
<Modal bind:open> {#if progress != 1}
{#snippet customTitle()} <div transition:slide={{ duration: 500, easing: expoOut }} class="w-full">
<div class="flex items-center gap-2">Upload image</div> <ProgressBar {progress} />
{/snippet} </div>
{#if progress != 1} {/if}
<div transition:slide={{ duration: 500, easing: expoOut }} class="w-full"> <form
<ProgressBar {progress} /> class="flex flex-col gap-4"
</div> onsubmit={e => {
{/if} e.preventDefault()
<form upload()
class="flex flex-col gap-4" }}
onsubmit={e => { >
e.preventDefault() <label
upload() for="image-input"
}} class="p-4 border-2 border-dashed rounded-xl cursor-pointer transition-colors
>
<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" border-slate-300 dark:border-zinc-700 hover:border-primary-900 dark:hover:border-primary-100"
> >
{#if previewURLs} {#if previewURLs}
<div <div
class="grid gap-x-2 gap-y-px max-h-64 overflow-auto 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'}" {multiple ? 'grid-cols-3 grid-rows-2' : 'grid-cols-1 grid-rows-1'}"
> >
{#each previewURLs as file} {#each previewURLs as file}
<img <img
src={file} src={file}
onload={() => URL.revokeObjectURL(file)} onload={() => URL.revokeObjectURL(file)}
alt={file} alt={file}
class="w-full rounded-md h-full object-cover transition-all class="w-full rounded-md h-full object-cover transition-all
border border-slate-200 dark:border-zinc-800 ring-1 border border-slate-200 dark:border-zinc-800 ring-1
ring-slate-50 dark:ring-zinc-950 bg-white dark:bg-zinc-950" ring-slate-50 dark:ring-zinc-950 bg-white dark:bg-zinc-950"
/> />
{/each} {/each}
</div> </div>
{:else} {:else}
<div <div
class="flex flex-col justify-center w-full items-center gap-2 class="flex flex-col justify-center w-full items-center gap-2
text-slate-600 dark:text-zinc-400" text-slate-600 dark:text-zinc-400"
> >
<Icon src={DocumentPlus} size="32" /> <Icon src={DocumentPlus} size="32" />
<span class="font-medium text-sm">{$t('form.post.selectFile')}</span> <span class="font-medium text-sm">{$t('form.post.selectFile')}</span>
</div> </div>
{/if} {/if}
<input <input
{multiple} {multiple}
type="file" type="file"
accept="image/*" accept="image/*"
class="hidden" class="hidden"
id="image-input" id="image-input"
bind:files={image} bind:files={image}
/> />
</label> </label>
<Button <Button
loading={progress != 1} loading={progress != 1}
disabled={progress != 1 || image == null} disabled={progress != 1 || image == null}
submit submit
color="primary" color="primary"
size="lg" size="lg"
> >
Upload Upload
</Button> </Button>
</form> </form>
</Modal>
@@ -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>
+12 -14
View File
@@ -1,11 +1,18 @@
<script lang="ts"> <script lang="ts">
import { t } from '$lib/i18n/translations' 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 { 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 } = let {
$props() imageUrl: passedImageUrl = $bindable(),
label,
}: {
imageUrl?: string
label?: string
} = $props()
let imageUrl = $derived(passedImageUrl)
let open = $state(false) let open = $state(false)
</script> </script>
@@ -43,15 +50,6 @@
{$t('common.attach')} {$t('common.attach')}
</p> </p>
{/if} {/if}
{#if open} <ImageInputModal bind:open bind:imageUrl={passedImageUrl} />
<ImageUploadModal
bind:open
multiple={false}
onupload={uploaded => {
open = false
imageUrl = uploaded[0]
}}
/>
{/if}
</button> </button>
</div> </div>
@@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import { tick } from 'svelte' import { tick } from 'svelte'
import type { HTMLTextareaAttributes } from 'svelte/elements' import type { HTMLAttributes } from 'svelte/elements'
let textarea: HTMLTextAreaElement | undefined = $state() let textarea: HTMLTextAreaElement | undefined = $state()
@@ -11,7 +11,7 @@
textarea.style.height = `${textarea.scrollHeight}px` // Set height to the scrollHeight textarea.style.height = `${textarea.scrollHeight}px` // Set height to the scrollHeight
} }
} }
interface Props extends HTMLTextareaAttributes { interface Props extends HTMLAttributes<HTMLTextAreaElement> {
label?: string | undefined label?: string | undefined
value: string value: string
required?: boolean required?: boolean
+7 -13
View File
@@ -1,4 +1,6 @@
<script lang="ts"> <script lang="ts">
import TabButton from './switch/TabButton.svelte'
type T = $$Generic type T = $$Generic
interface Props { interface Props {
@@ -29,22 +31,14 @@
> >
{#each options as option, index} {#each options as option, index}
{@const slctd = selected == option} {@const slctd = selected == option}
<button <TabButton
class={[ selected={slctd}
'px-2.5 py-1 rounded-xl text-sm font-medium transition-colors duration-75 relative cursor-pointer', onselect={() => (selected = option)}
slctd disabled={disabled[index]}
? '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}
type="button" type="button"
> >
{optionNames[index] || option} {optionNames[index] || option}
</button> </TabButton>
{/each} {/each}
</div> </div>
{@render children?.({ selected })} {@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>
+15 -36
View File
@@ -10,16 +10,16 @@
import Link from '../input/Link.svelte' import Link from '../input/Link.svelte'
import Expandable from '../ui/Expandable.svelte' import Expandable from '../ui/Expandable.svelte'
import LabelStat from '../ui/LabelStat.svelte' import LabelStat from '../ui/LabelStat.svelte'
import CommonList from '../ui/layout/CommonList.svelte' import ItemList from './generic/ItemList.svelte'
import SidebarButton from '../ui/sidebar/SidebarButton.svelte'
import { optimizeImageURL } from './post/helpers' import { optimizeImageURL } from './post/helpers'
import type { ClassValue, HTMLAttributes } from 'svelte/elements'
interface Props { interface Props extends HTMLAttributes<HTMLDivElement> {
site: SiteView site: SiteView
taglines?: Tagline[] | undefined taglines?: Tagline[] | undefined
admins?: PersonView[] | undefined admins?: PersonView[] | undefined
version?: string | undefined version?: string | undefined
class?: string class?: ClassValue
} }
let { let {
@@ -31,7 +31,7 @@
}: Props = $props() }: Props = $props()
</script> </script>
<div <aside
class={[ class={[
'w-full text-slate-600 dark:text-zinc-400 flex flex-col gap-4 text-sm', 'w-full text-slate-600 dark:text-zinc-400 flex flex-col gap-4 text-sm',
clazz, clazz,
@@ -115,36 +115,15 @@
{$t('cards.site.admins')} {$t('cards.site.admins')}
</span> </span>
{/snippet} {/snippet}
<CommonList <ItemList
animate={false} items={admins.map(i => ({
size="xs" id: i.person.id,
items={admins} name: i.person.display_name || i.person.name,
class="px-1 py-0.5" url: userLink(i.person),
> avatar: i.person.avatar,
{#snippet item(admin)} instance: new URL(i.person.actor_id).hostname,
<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>
</Expandable> </Expandable>
{/if} {/if}
@@ -162,4 +141,4 @@
</Link> </Link>
</div> </div>
</div> </div>
</div> </aside>
@@ -1,4 +1,5 @@
<script lang="ts"> <script lang="ts">
import { page } from '$app/state'
import { profile } from '$lib/auth.svelte.js' import { profile } from '$lib/auth.svelte.js'
import CommentActions from '$lib/components/lemmy/comment/CommentActions.svelte' import CommentActions from '$lib/components/lemmy/comment/CommentActions.svelte'
import UserLink from '$lib/components/lemmy/user/UserLink.svelte' import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
@@ -8,6 +9,7 @@
import { t } from '$lib/i18n/translations' import { t } from '$lib/i18n/translations'
import { getClient } from '$lib/lemmy.svelte.js' import { getClient } from '$lib/lemmy.svelte.js'
import { errorMessage } from '$lib/lemmy/error' import { errorMessage } from '$lib/lemmy/error'
import { settings } from '$lib/settings.svelte'
import { Button, Modal, toast } from 'mono-svelte' import { Button, Modal, toast } from 'mono-svelte'
import { import {
Bookmark, Bookmark,
@@ -24,8 +26,6 @@
import ShieldIcon from '../moderation/ShieldIcon.svelte' import ShieldIcon from '../moderation/ShieldIcon.svelte'
import CommentForm from './CommentForm.svelte' import CommentForm from './CommentForm.svelte'
import type { CommentNodeI } from './comments.svelte' import type { CommentNodeI } from './comments.svelte'
import { page } from '$app/state'
import { settings } from '$lib/settings.svelte'
interface Props { interface Props {
node: CommentNodeI node: CommentNodeI
@@ -208,7 +208,7 @@
source={node.comment_view.comment.content} source={node.comment_view.comment.content}
noStyle noStyle
class={[ 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 node.comment_view.comment.distinguished
? 'bg-green-400/10 p-2 rounded-xl max-w-max font-medium' ? 'bg-green-400/10 p-2 rounded-xl max-w-max font-medium'
: page.url.hash.slice(1) == : page.url.hash.slice(1) ==
@@ -57,7 +57,7 @@
size="sm" size="sm"
class="text-slate-500 dark:text-zinc-400" class="text-slate-500 dark:text-zinc-400"
onclick={() => (replying = !replying)} onclick={() => (replying = !replying)}
disabled={comment.post.locked || disabled} disabled={comment.post.locked || disabled || !profile.current.jwt}
> >
<Icon src={ChatBubbleOvalLeft} size="15" micro /> <Icon src={ChatBubbleOvalLeft} size="15" micro />
{$t('comment.reply')} {$t('comment.reply')}
@@ -76,8 +76,6 @@
import Entity from '$lib/components/ui/Entity.svelte' import Entity from '$lib/components/ui/Entity.svelte'
import Expandable from '$lib/components/ui/Expandable.svelte' import Expandable from '$lib/components/ui/Expandable.svelte'
import LabelStat from '$lib/components/ui/LabelStat.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 { t } from '$lib/i18n/translations'
import { client, getClient } from '$lib/lemmy.svelte.js' import { client, getClient } from '$lib/lemmy.svelte.js'
import { errorMessage } from '$lib/lemmy/error' import { errorMessage } from '$lib/lemmy/error'
@@ -107,6 +105,7 @@
NoSymbol, NoSymbol,
Plus, Plus,
} from 'svelte-hero-icons' } from 'svelte-hero-icons'
import ItemList from '../generic/ItemList.svelte'
let loading = $state({ let loading = $state({
blocking: false, blocking: false,
@@ -147,11 +146,15 @@
</script> </script>
{#await community_view} {#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} /> <Spinner width={24} />
</div> </div>
{:then community_view} {:then community_view}
<div <aside
class={[ class={[
'min-w-full pt-0 text-slate-600 dark:text-zinc-400 flex flex-col gap-4 text-sm', 'min-w-full pt-0 text-slate-600 dark:text-zinc-400 flex flex-col gap-4 text-sm',
clazz, clazz,
@@ -214,40 +217,15 @@
{$t('cards.community.moderators')} {$t('cards.community.moderators')}
</span> </span>
{/snippet} {/snippet}
<CommonList <ItemList
animate={false} items={moderators.map(i => ({
size="xs" id: i.moderator.id,
items={moderators} name: i.moderator.display_name || i.moderator.name,
class="px-1 py-0.5" url: userLink(i.moderator),
> avatar: i.moderator.avatar,
{#snippet item(moderator)} instance: new URL(i.moderator.actor_id).hostname,
<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>
</Expandable> </Expandable>
{/if} {/if}
</div> </div>
@@ -363,5 +341,5 @@
{/if} {/if}
</Menu> </Menu>
</div> </div>
</div> </aside>
{/await} {/await}
@@ -1,8 +1,7 @@
<script lang="ts"> <script lang="ts">
import Avatar from '$lib/components/ui/Avatar.svelte' import Avatar from '$lib/components/ui/Avatar.svelte'
import CommonList from '$lib/components/ui/layout/CommonList.svelte'
import { Button } from 'mono-svelte' import { Button } from 'mono-svelte'
import { flip } from 'svelte/animate'
import { expoOut } from 'svelte/easing'
interface Props { interface Props {
items: { items: {
@@ -17,14 +16,11 @@
let { items }: Props = $props() let { items }: Props = $props()
</script> </script>
{#each items.sort((a, b) => a.name.localeCompare(b.name)) as item (item.id)} <CommonList animate={false} class="px-1 py-0.5" size="xs" {items}>
<div {#snippet item(item)}
class="inline-flex w-full"
animate:flip={{ duration: 500, easing: expoOut }}
>
<Button <Button
class="font-normal w-full h-max" class="font-normal w-full h-max block"
color="tertiary" color="none"
alignment="left" alignment="left"
href={item.url} href={item.url}
> >
@@ -45,5 +41,5 @@
{/if} {/if}
</div> </div>
</Button> </Button>
</div> {/snippet}
{/each} </CommonList>
+4 -23
View File
@@ -1,10 +1,9 @@
<script lang="ts"> <script lang="ts">
import { goto } from '$app/navigation'
import { profile } from '$lib/auth.svelte' 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 PostMedia from '$lib/components/lemmy/post/media/PostMedia.svelte'
import PostMediaCompact from '$lib/components/lemmy/post/media/PostMediaCompact.svelte' import PostMediaCompact from '$lib/components/lemmy/post/media/PostMediaCompact.svelte'
import PostActions from '$lib/components/lemmy/post/actions/PostActions.svelte'
import PostMeta, { import PostMeta, {
parseTags, parseTags,
type Tag, type Tag,
@@ -28,15 +27,6 @@
return rule 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 { interface Props {
post: PostView post: PostView
actions?: boolean actions?: boolean
@@ -86,9 +76,7 @@
This is the sole component for displaying posts. 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. 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 --> <article
<!-- svelte-ignore a11y_no_noninteractive_tabindex -->
<div
class={[ class={[
'post relative max-w-full min-w-0 w-full cursor-pointer outline-hidden group/post', 'post relative max-w-full min-w-0 w-full cursor-pointer outline-hidden group/post',
settings.leftAlign && 'left-align', settings.leftAlign && 'left-align',
@@ -97,13 +85,6 @@
clazz, clazz,
]} ]}
id={post.post.id.toString()} id={post.post.id.toString()}
onclick={e => {
onClick(e)
}}
onkeydown={e => {
if (e.key == 'Enter') onClick(e)
}}
tabindex="0"
{style} {style}
> >
<PostMeta <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 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" duration-150"
></div> ></div>
</div> </article>
<style lang="postcss"> <style lang="postcss">
.list-type { .list-type {
@@ -343,7 +343,6 @@
view == 'compact' ? 'text-base' : 'text-lg', view == 'compact' ? 'text-base' : 'text-lg',
]} ]}
style="grid-area: title;" style="grid-area: title;"
data-sveltekit-preload-data="tap"
> >
{#if title} {#if title}
<Markdown <Markdown
@@ -94,7 +94,7 @@
buttonColor.secondary, buttonColor.secondary,
'rounded-full h-full font-medium flex items-center *:p-2 relative', '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', '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', loading && 'animate-pulse opacity-75 pointer-events-none',
voteRatio < 85 && settings.voteRatioBar && 'vote-ratio', voteRatio < 85 && settings.voteRatioBar && 'vote-ratio',
]} ]}
@@ -89,8 +89,6 @@
bind:score={post.counts.score} bind:score={post.counts.score}
bind:upvotes={post.counts.upvotes} bind:upvotes={post.counts.upvotes}
bind:downvotes={post.counts.downvotes} bind:downvotes={post.counts.downvotes}
showCounts={profile.current?.user?.local_user_view?.local_user
?.show_scores ?? true}
/> />
<Button <Button
@@ -75,7 +75,7 @@
<div class="flex flex-row"> <div class="flex flex-row">
<MenuButton <MenuButton
onclick={() => share()} onclick={() => share()}
class={['flex-1', !post.post.local && 'rounded-r-xl']} class={['flex-1', !post.post.local && 'rounded-r-lg']}
> >
{#snippet prefix()} {#snippet prefix()}
<Icon src={Share} size="16" micro /> <Icon src={Share} size="16" micro />
@@ -84,11 +84,11 @@
</MenuButton> </MenuButton>
<!--svelte-ignore a11y_no_static_element_interactions --> <!--svelte-ignore a11y_no_static_element_interactions -->
<!--svelte-ignore a11y_click_events_have_key_events--> <!--svelte-ignore a11y_click_events_have_key_events-->
<div {#if !post.post.local}
class="aspect-square w-max m-1 grid place-items-center" <div
onclick={e => e.stopPropagation()} class="aspect-square w-max m-1 grid place-items-center"
> onclick={e => e.stopPropagation()}
{#if !post.post.local} >
<Menu> <Menu>
{#snippet target()} {#snippet target()}
<Button <Button
@@ -120,8 +120,8 @@
{$t('filter.location.local')} {$t('filter.location.local')}
</MenuButton> </MenuButton>
</Menu> </Menu>
{/if} </div>
</div> {/if}
</div> </div>
{#if profile.current?.jwt} {#if profile.current?.jwt}
<MenuButton <MenuButton
@@ -190,7 +190,7 @@
{:else} {:else}
<VirtualList <VirtualList
id="feed" 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} items={posts}
{initialOffset} {initialOffset}
overscan={3} overscan={3}
@@ -251,14 +251,10 @@
</script> </script>
{#if uploadingImage} {#if uploadingImage}
{#await import('$lib/components/lemmy/modal/ImageUploadModal.svelte') then { default: UploadModal }} {#await import('$lib/components/form/ImageInputModal.svelte') then { default: UploadModal }}
<UploadModal <UploadModal
bind:open={uploadingImage} bind:open={uploadingImage}
multiple={false} bind:imageUrl={() => '', v => (data.url = v)}
onupload={e => {
if (e) data.url = e[0]
uploadingImage = false
}}
/> />
{/await} {/await}
{/if} {/if}
@@ -341,7 +337,6 @@
{/if} {/if}
{/if} {/if}
<FreeTextInput <FreeTextInput
type="text"
required required
bind:value={data.title} bind:value={data.title}
placeholder={placeholders.get('post')} placeholder={placeholders.get('post')}
@@ -29,65 +29,65 @@
For embed-type posts. Displays embed card or a compact link. For embed-type posts. Displays embed card or a compact link.
--> -->
{#if embed_title && view == 'cozy'} {#if embed_title && view == 'cozy'}
<a target="_blank" href={url} class="group/link"> <Material
<Material color="uniform"
color="uniform" class={[
class={[ 'flex flex-col-reverse sm:flex-row overflow-hidden gap-4 z-0 relative',
'flex flex-col-reverse sm:flex-row overflow-hidden gap-4 embed-card z-0 relative', 'dark:bg-zinc-950 hover:bg-slate-50 hover:dark:bg-zinc-900 transition-colors',
'dark:bg-zinc-950 group-hover/link:bg-slate-50 dark:group-hover/link:bg-zinc-900 transition-colors', 'group/link',
'shadow-xs', ]}
]} rounding="2xl"
rounding="2xl" element="a"
element="article" padding="sm"
padding="sm" href={url}
> target="_blank"
{#if thumbnail_url} >
<img {#if thumbnail_url}
src={optimizeImageURL(thumbnail_url, 32)} <img
alt="" src={optimizeImageURL(thumbnail_url, 32)}
class="-z-10 absolute w-full object-cover h-full opacity-5 brightness-150 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" 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} {/if}
<div class="flex flex-col gap-1 p-3 -mt-2 sm:mt-0"> <p class="font-medium text-base">{embed_title}</p>
{#if richURL} </div>
<div {#if thumbnail_url}
class="text-slate-600 dark:text-zinc-400 inline-flex items-center gap-1 text-xs font-medium" <picture class="mb-auto sm:ml-auto shrink-0 sm:w-1/3 sm:max-w-60">
> {#each ['webp'] as format}
{richURL.hostname} <source
</div> srcset="{optimizeImageURL(
{/if} thumbnail_url,
<p class="font-medium text-base">{embed_title}</p> 256,
</div> format as 'avif' | 'webp',
{#if thumbnail_url} )} 256w, {optimizeImageURL(
<picture class="mb-auto sm:ml-auto shrink-0 sm:w-1/3 sm:max-w-60"> thumbnail_url,
{#each ['webp'] as format} 512,
<source format as 'avif' | 'webp',
srcset="{optimizeImageURL( )} 512w"
thumbnail_url, media="(min-width: 0px)"
256, type="image/{format}"
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}
/> />
</picture> {/each}
{/if} <img
</Material> src={optimizeImageURL(thumbnail_url, -1)}
</a> 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} {:else}
<a <a
href={url} href={url}
+1 -1
View File
@@ -151,7 +151,7 @@
<article <article
dir="auto" dir="auto"
class={[!noStyle && 'break-words space-y-2 leading-normal', clazz]} class={[!noStyle && 'break-words space-y-4 leading-normal', clazz]}
{style} {style}
> >
<SvelteMarkdown <SvelteMarkdown
@@ -2,7 +2,7 @@
import MultiSelect from '$lib/components/input/Switch.svelte' import MultiSelect from '$lib/components/input/Switch.svelte'
import Markdown from '$lib/components/markdown/Markdown.svelte' import Markdown from '$lib/components/markdown/Markdown.svelte'
import { t } from '$lib/i18n/translations' 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 type { TextAreaProps } from 'mono-svelte/forms/TextArea.svelte'
import { tick } from 'svelte' import { tick } from 'svelte'
import { import {
@@ -17,8 +17,8 @@
Photo, Photo,
Strikethrough, Strikethrough,
} from 'svelte-hero-icons' } from 'svelte-hero-icons'
import ImageUploadModal from '../lemmy/modal/ImageUploadModal.svelte'
import type { ClassValue } from 'svelte/elements' import type { ClassValue } from 'svelte/elements'
import ImageAttachForm from '../form/ImageAttachForm.svelte'
let textArea: HTMLTextAreaElement | undefined = $state() let textArea: HTMLTextAreaElement | undefined = $state()
@@ -122,15 +122,16 @@
</script> </script>
{#if uploadingImage && images} {#if uploadingImage && images}
<ImageUploadModal <Modal title={$t('form.post.uploadImage')} bind:open={uploadingImage}>
bind:open={uploadingImage} <ImageAttachForm
bind:image bind:image
onupload={e => { onupload={e => {
e.forEach(i => { e.forEach(i => {
wrapSelection(`![](${i})\n\n`, '') wrapSelection(`![](${i})\n\n`, '')
}) })
}} }}
/> />
</Modal>
{/if} {/if}
<div> <div>
@@ -23,7 +23,7 @@
<a <a
href={photonified ?? href} href={photonified ?? href}
{title} {title}
class="hover:underline text-sky-600 dark:text-sky-500" class="hover:underline text-blue-600 dark:text-blue-400"
> >
{@render children?.()} {@render children?.()}
</a> </a>
@@ -9,12 +9,12 @@
let { children } = $props() let { children } = $props()
</script> </script>
<p class="leading-normal break-words {options.inline ? '' : 'max-w'}"> <p class="leading-[1.7] break-words {options.inline ? '' : 'max-w'}">
{@render children?.()} {@render children?.()}
</p> </p>
<style> <style>
.max-w { .max-w {
max-width: 80ch; max-width: 70ch;
} }
</style> </style>
+16 -5
View File
@@ -2,11 +2,19 @@
import type { ClassValue } from 'svelte/elements' import type { ClassValue } from 'svelte/elements'
const sizes = { const sizes = {
xs: 'text-xs',
sm: 'text-sm', sm: 'text-sm',
md: 'text-base', md: 'text-base',
lg: 'text-lg', 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 = { const colors = {
subtle: 'text-slate-600 dark:text-zinc-400', subtle: 'text-slate-600 dark:text-zinc-400',
none: '', none: '',
@@ -16,6 +24,7 @@
class?: ClassValue class?: ClassValue
size?: keyof typeof sizes size?: keyof typeof sizes
color?: keyof typeof colors color?: keyof typeof colors
margin?: keyof typeof margins
border?: boolean border?: boolean
children?: import('svelte').Snippet children?: import('svelte').Snippet
action?: import('svelte').Snippet action?: import('svelte').Snippet
@@ -28,6 +37,7 @@
border = true, border = true,
size = 'sm', size = 'sm',
color = 'subtle', color = 'subtle',
margin = 'none',
}: Props = $props() }: Props = $props()
</script> </script>
@@ -36,17 +46,18 @@
'flex flex-row items-center gap-2 flex-wrap', 'flex flex-row items-center gap-2 flex-wrap',
sizes[size], sizes[size],
colors[color], colors[color],
margins[margin],
clazz, clazz,
]} ]}
> >
<span class="font-medium text-left"> <h3 class="font-medium text-left flex flex-row gap-1 items-center">
{@render children?.()} {@render children?.()}
</span> </h3>
<hr <div
class={[ 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', !border && 'opacity-0',
]} ]}
/> ></div>
{@render action?.()} {@render action?.()}
</div> </div>
+71 -74
View File
@@ -40,90 +40,66 @@
}: Props = $props() }: Props = $props()
</script> </script>
<div {...rest} class={['z-10 relative text-sm contents', clazz]}> <div {...rest} class={['z-10 text-sm contents w-full', clazz]}>
{#if banner} <div class="absolute inset-0 h-96 overflow-x-hidden -z-10">
<img <img
src={banner} src={banner || avatar}
class="w-full object-cover h-48 rounded-t-xl bg-white dark:bg-zinc-900 rounded-xl" class="w-full h-64 object-cover blur-3xl opacity-30 dark:opacity-30"
class:blur-3xl={!banner}
height="192" height="192"
alt="User banner" 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>
<div class="space-y-3 py-4 pt-0"> {#if banner || avatar}
{#if stats.length > 0} <div class="relative overflow-hidden rounded-xl">
<div <img
class="text-sm flex flex-row flex-wrap mx-auto rounded-lg src={banner || avatar}
overflow-hidden gap-4" 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} {#each stats as stat}
<div class=""> <div class="">
<div <div class="text-slate-600 dark:text-zinc-500 text-sm font-medium">
class="text-primary-900 dark:text-primary-100 text-xs font-medium"
>
{stat.name} {stat.name}
</div> </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} {#if stat.format ?? true}
<FormattedNumber <FormattedNumber
number={Number(stat.value)} number={Number(stat.value)}
@@ -137,6 +113,27 @@
{/each} {/each}
</div> </div>
{/if} {/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?.()} {@render children?.()}
</div> </div>
</div> </div>
+2 -3
View File
@@ -10,13 +10,12 @@
{width} {width}
height={width} height={width}
viewBox="0 0 100 100" viewBox="0 0 100 100"
fill="none" fill="currentColor"
xmlns="http://www.w3.org/2000/svg" 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 <path
id="hexagon" 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" 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> </svg>
+7 -9
View File
@@ -44,7 +44,7 @@
<nav <nav
aria-label={$t('aria.pagination.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} {#if children}
<span class="text-sm text-slate-600 dark:text-zinc-400 font-medium"> <span class="text-sm text-slate-600 dark:text-zinc-400 font-medium">
@@ -55,15 +55,14 @@
{#if back} {#if back}
<Button <Button
href={customHref(href?.(cursor?.back ?? page - 1))} href={customHref(href?.(cursor?.back ?? page - 1))}
color="ghost" color="tertiary"
onclick={() => invalidate(pageData.url)} onclick={() => invalidate(pageData.url)}
title={$t('common.back')} title={$t('common.back')}
rounding="none" rounding="pill"
size="custom" 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) || disabled={(cursor?.back == undefined && cursor?.next != undefined) ||
page <= 1} page <= 1}
data-sveltekit-preload-data="off"
> >
{#snippet suffix()} {#snippet suffix()}
<Icon src={ChevronLeft} size="24" mini /> <Icon src={ChevronLeft} size="24" mini />
@@ -88,14 +87,13 @@
<Button <Button
href={customHref(href?.(cursor?.next ?? page + 1))} href={customHref(href?.(cursor?.next ?? page + 1))}
color="ghost" color="tertiary"
onclick={() => invalidate(pageData.url)} onclick={() => invalidate(pageData.url)}
title={$t('common.next')} title={$t('common.next')}
size="custom" size="custom"
rounding="none" rounding="pill"
class="text-inherit dark:text-inherit border-0 border-l p-2" class="text-inherit dark:text-inherit p-1"
disabled={!hasMore} disabled={!hasMore}
data-sveltekit-preload-data="off"
> >
{#snippet suffix()} {#snippet suffix()}
<Icon src={ChevronRight} size="24" mini /> <Icon src={ChevronRight} size="24" mini />
+10 -2
View File
@@ -1,12 +1,14 @@
<script lang="ts"> <script lang="ts">
import { Icon, type IconSource } from 'svelte-hero-icons' import { Icon, type IconSource } from 'svelte-hero-icons'
import type { ClassValue } from 'svelte/elements'
interface Props { interface Props {
icon?: IconSource | undefined icon?: IconSource | undefined
title: string title: string
description?: string | undefined description?: string | undefined
class?: string class?: ClassValue
children?: import('svelte').Snippet children?: import('svelte').Snippet
iconClass?: ClassValue
} }
let { let {
@@ -15,6 +17,7 @@
description = undefined, description = undefined,
class: clazz = '', class: clazz = '',
children, children,
iconClass,
}: Props = $props() }: Props = $props()
</script> </script>
@@ -24,7 +27,12 @@
<div class="flex flex-col gap-2 items-center max-w-sm"> <div class="flex flex-col gap-2 items-center max-w-sm">
{#if icon} {#if icon}
<div <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 /> <Icon src={icon} size="28" solid />
</div> </div>
+35 -31
View File
@@ -35,43 +35,47 @@
<svelte:window {onscroll} /> <svelte:window {onscroll} />
{@render children?.()} {@render children?.()}
<div <div class="min-h-screen flex flex-col">
class={[ <div
'fixed lg:sticky bottom-0 lg:top-0', class={[
!dockVisible && 'max-lg:-bottom-24', 'fixed lg:sticky bottom-0 lg:top-0',
'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', !dockVisible && 'max-lg:-bottom-24',
'w-full z-50 pointer-events-none', '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);" ]}
> style="transition: bottom .4s cubic-bezier(0.075, 0.82, 0.165, 1);"
{@render navbar?.({ aria-hidden="true"
class: [ >
'bg-slate-100/70 dark:bg-zinc-950/90 border-slate-200/50 dark:border-zinc-900', {@render navbar?.({
'pointer-events-auto backdrop-blur-xl border lg:border-t-0 lg:border-x-0', class: [
'rounded-full lg:rounded-none', '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',
style: '', 'rounded-full lg:rounded-none',
})} ],
</div> style: '',
<div class={['content flex-1', settings.newWidth && 'limit-width']}> })}
{@render sidebar?.({ </div>
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`, <div class={['content flex-1', settings.newWidth && 'limit-width']}>
style: 'grid-area: sidebar; width: 100% !important;', {@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`,
{@render main?.({ style: 'grid-area: sidebar; width: 100% !important;',
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 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`,
{@render suffix?.({ style: 'grid-area: main',
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;', {@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> </div>
<style> <style>
.content { .content {
width: 100%; width: 100%;
display: grid; display: grid;
height: 100%;
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
grid-area: content; grid-area: content;
@@ -1,4 +1,6 @@
<script lang="ts"> <script lang="ts">
import { t } from '$lib/i18n/translations'
const sizes = { const sizes = {
sm: 'text-2xl', sm: 'text-2xl',
md: 'text-3xl', md: 'text-3xl',
@@ -25,14 +27,15 @@
}: Props = $props() }: Props = $props()
</script> </script>
<div <header
class={[ class={[
pageHeader && pageHeader &&
`w-[calc(100%+1.5rem)] sm:w-[calc(100%+3rem)] `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 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/50 dark:border-zinc-900 margin`, border-b border-slate-200 dark:border-zinc-900 margin z-0`,
]} ]}
{style} {style}
aria-label={$t('aria.element.pageHeader')}
> >
<h1 <h1
class={[sizes[size], 'flex gap-2 w-full tracking-tight font-medium', clazz]} class={[sizes[size], 'flex gap-2 w-full tracking-tight font-medium', clazz]}
@@ -44,4 +47,4 @@
{@render extended?.()} {@render extended?.()}
</div> </div>
{/if} {/if}
</div> </header>
+25 -13
View File
@@ -1,6 +1,7 @@
<script lang="ts"> <script lang="ts">
import { invalidateAll } from '$app/navigation' import { invalidateAll } from '$app/navigation'
import { page } from '$app/state' import { page } from '$app/state'
import TabButton from '$lib/components/input/switch/TabButton.svelte'
import { SvelteURL } from 'svelte/reactivity' import { SvelteURL } from 'svelte/reactivity'
interface Props { interface Props {
@@ -11,6 +12,7 @@
currentRoute?: SvelteURL | undefined currentRoute?: SvelteURL | undefined
buildUrl?: (currentRoute: SvelteURL | undefined, href: string) => string buildUrl?: (currentRoute: SvelteURL | undefined, href: string) => string
children?: import('svelte').Snippet children?: import('svelte').Snippet
style?: 'header' | 'subpage'
} }
let { let {
@@ -18,6 +20,7 @@
currentRoute = undefined, currentRoute = undefined,
buildUrl = (_, href) => href, buildUrl = (_, href) => href,
children, children,
style = 'header',
}: Props = $props() }: Props = $props()
function isSelected(url: URL, href?: SvelteURL) { function isSelected(url: URL, href?: SvelteURL) {
@@ -27,25 +30,34 @@
</script> </script>
<nav <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)} {#each routes as route (route.href)}
{@const selected = isSelected( {@const selected = isSelected(
page.url, page.url,
new SvelteURL(`${page.url.origin}${route.href}`), new SvelteURL(`${page.url.origin}${route.href}`),
)} )}
<a {#if style == 'header'}
onclick={() => invalidateAll()} <a
href={buildUrl(currentRoute, route.href)} onclick={() => invalidateAll()}
class={[ href={buildUrl(currentRoute, route.href)}
'rounded-full font-medium transition-colors duration-100 relative z-0 shrink-0 hover:text-slate-900 hover:dark:text-zinc-100', class={[
selected 'rounded-full font-medium transition-colors duration-100 relative z-0 shrink-0 hover:text-slate-900 hover:dark:text-zinc-100',
? 'text-primary-900 dark:text-primary-100' selected
: 'text-slate-500 dark:text-zinc-500', ? 'text-primary-900 dark:text-primary-100'
]} : 'text-slate-500 dark:text-zinc-500',
> ]}
{route.name} >
</a> {route.name}
</a>
{:else}
<TabButton href={buildUrl(currentRoute, route.href)} {selected}>
{route.name}
</TabButton>
{/if}
{/each} {/each}
{@render children?.()} {@render children?.()}
</nav> </nav>
@@ -35,12 +35,14 @@
color="none" color="none"
{...rest} {...rest}
class={[ 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 && !rest.color &&
'hover:text-slate-900 dark:hover:text-zinc-50 transition-colors', 'hover:text-slate-900 dark:hover:text-zinc-50 transition-colors',
isSelected !rest.color &&
? 'text-primary-900 dark:text-primary-100 max-lg:bg-slate-100 max-lg:dark:bg-zinc-800' (isSelected
: 'text-slate-500 dark:text-zinc-400', ? '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, clazz,
]} ]}
shadow="none" shadow="none"
@@ -54,7 +56,7 @@
{#snippet prefix()} {#snippet prefix()}
<div class={(icon || customIcon) && adaptive ? 'lg:hidden' : ''}> <div class={(icon || customIcon) && adaptive ? 'lg:hidden' : ''}>
{#if icon} {#if icon}
<Icon src={icon} size="20" mini /> <Icon src={icon} size="18" micro />
{:else} {:else}
{@render customIcon?.({ size: 16, isSelected })} {@render customIcon?.({ size: 16, isSelected })}
{/if} {/if}
+15 -102
View File
@@ -8,16 +8,12 @@
import { t } from '$lib/i18n/translations' import { t } from '$lib/i18n/translations'
import { LINKED_INSTANCE_URL } from '$lib/instance.svelte' import { LINKED_INSTANCE_URL } from '$lib/instance.svelte'
import { site } from '$lib/lemmy.svelte.js' import { site } from '$lib/lemmy.svelte.js'
import { Badge, Menu, MenuButton, MenuDivider, Spinner } from 'mono-svelte' import { Menu, Spinner } from 'mono-svelte'
import { import {
Bars3, Bars3,
Bell,
GlobeAlt, GlobeAlt,
Icon, Icon,
Inbox,
MagnifyingGlass, MagnifyingGlass,
Newspaper,
PencilSquare,
Plus, Plus,
ServerStack, ServerStack,
ShieldCheck, ShieldCheck,
@@ -36,15 +32,6 @@
let { style = '', class: clazz = '' }: Props = $props() let { style = '', class: clazz = '' }: Props = $props()
</script> </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} /> <CommandsWrapper bind:open={promptOpen} />
<nav <nav
class={[ class={[
@@ -61,7 +48,7 @@
}} }}
href="/" href="/"
label={$t('nav.home')} 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} adaptive={false}
> >
{#snippet customIcon()} {#snippet customIcon()}
@@ -109,93 +96,14 @@
icon={GlobeAlt} icon={GlobeAlt}
/> />
<NavButton href="/search" label={$t('nav.search')} icon={MagnifyingGlass} /> <NavButton href="/search" label={$t('nav.search')} icon={MagnifyingGlass} />
{#if profile.current.jwt} <NavButton
{@const linkOnly = class="relative"
!profile.current.user || label={$t('nav.create.label')}
!(isAdmin(profile.current.user) || amModOfAny(profile.current.user))} icon={Plus}
<Menu manual={linkOnly} placement="top"> adaptive={false}
{#snippet target()} color="primary"
<NavButton href="/create"
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>
<Menu placement="bottom"> <Menu placement="bottom">
{#snippet target()} {#snippet target()}
<button <button
@@ -219,6 +127,11 @@
<Icon src={Bars3} micro size="18" /> <Icon src={Bars3} micro size="18" />
</div> </div>
{/if} {/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> </button>
{/snippet} {/snippet}
{#snippet children(open)} {#snippet children(open)}
+50 -14
View File
@@ -1,5 +1,10 @@
<script lang="ts"> <script lang="ts">
import { env } from '$env/dynamic/public'
import { notifications, profile } from '$lib/auth.svelte' 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 SiteCard from '$lib/components/lemmy/SiteCard.svelte'
import { t } from '$lib/i18n/translations' import { t } from '$lib/i18n/translations'
@@ -29,6 +34,7 @@
Inbox, Inbox,
Moon, Moon,
ServerStack, ServerStack,
ShieldCheck,
Sun, Sun,
Swatch, Swatch,
UserCircle, UserCircle,
@@ -53,13 +59,18 @@
</Modal> </Modal>
{/if} {/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} {#if profile.current?.jwt}
<MenuButton href="/profile">
{#snippet prefix()}
<Icon src={UserCircle} micro size="16" />
{/snippet}
{$t('profile.profile')}
</MenuButton>
<MenuButton href="/inbox"> <MenuButton href="/inbox">
{#snippet prefix()} {#snippet prefix()}
<Icon src={Inbox} micro size="16" /> <Icon src={Inbox} micro size="16" />
@@ -71,6 +82,29 @@
</Badge> </Badge>
{/if} {/if}
</MenuButton> </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"> <MenuButton href="/saved">
{#snippet prefix()} {#snippet prefix()}
<Icon src={Bookmark} micro size="16" /> <Icon src={Bookmark} micro size="16" />
@@ -169,13 +203,15 @@
> >
<Icon src={ServerStack} size="16" micro /> <Icon src={ServerStack} size="16" micro />
</Button> </Button>
<Button {#if env.PUBLIC_XYLIGHT_MODE.toLowerCase() == 'true'}
color="tertiary" <Button
href="https://github.com/Xyphyn/Photon" color="tertiary"
title={$t('nav.menu.source')} href="https://github.com/Xyphyn/Photon"
size="square-md" title={$t('nav.menu.source')}
> size="square-md"
<Icon src={CodeBracketSquare} size="16" micro /> >
</Button> <Icon src={CodeBracketSquare} size="16" micro />
</Button>
{/if}
</div> </div>
</li> </li>
@@ -21,6 +21,7 @@
alignment="left" alignment="left"
color="none" color="none"
size="custom" size="custom"
class="block w-full"
data-sveltekit-preload-code="viewport" data-sveltekit-preload-code="viewport"
data-sveltekit-preload-data="tap" data-sveltekit-preload-data="tap"
{...rest} {...rest}
@@ -28,21 +29,27 @@
{#if typeof action.icon === 'string'} {#if typeof action.icon === 'string'}
<Avatar url={action.icon} width={20} /> <Avatar url={action.icon} width={20} />
{:else} {: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} {/if}
{@render children?.()} {@render children?.()}
<span class="mr-auto inline-flex flex-col"> <div class="inline-flex flex-col">
<span>{action.name}</span> <span>{action.name}</span>
{#if action.detail} {#if action.detail}
<span class="font-normal text-xs">{action.detail}</span> <span class="font-normal text-xs">{action.detail}</span>
{/if} {/if}
</span> </div>
<div class="flex-1"></div>
{#if action.shortcut} {#if action.shortcut}
<div class="flex items-center gap-0.5 text-xs font-medium"> <div class="flex items-center gap-0.5 text-xs font-medium">
⌘ {action.shortcut} ⌘ {action.shortcut}
</div> </div>
{/if} {/if}
{#if action.subActions} {#if action.subActions}
<Icon src={ArrowUturnDown} size="16" micro /> <Icon src={ArrowUturnDown} size="16" micro class="" />
{/if} {/if}
</Button> </Button>
@@ -13,6 +13,7 @@
import CommandItem from './CommandItem.svelte' import CommandItem from './CommandItem.svelte'
import { fuzzySearch } from '$lib/util.svelte' import { fuzzySearch } from '$lib/util.svelte'
import CommonList from '../../layout/CommonList.svelte' import CommonList from '../../layout/CommonList.svelte'
import EndPlaceholder from '../../EndPlaceholder.svelte'
interface Props { interface Props {
open?: boolean open?: boolean
@@ -253,7 +254,7 @@
<div class="space-y-1" bind:this={container}> <div class="space-y-1" bind:this={container}>
{#each filteredGroups as group, groupIndex} {#each filteredGroups as group, groupIndex}
<div class="space-y-1"> <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!"> <CommonList size="xs" class="p-0! sm:p-0! lg:p-0!">
{#each group.actions as action, actionIndex} {#each group.actions as action, actionIndex}
{@const globalIndex = {@const globalIndex =
@@ -263,7 +264,8 @@
<li <li
class={[ class={[
'custom-size', 'custom-size',
globalIndex == selectedIndex && 'brightness-125', globalIndex == selectedIndex &&
'brightness-95 dark:brightness-125',
]} ]}
> >
<CommandItem <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>
+141 -177
View File
@@ -1,25 +1,31 @@
<script lang="ts"> <script lang="ts">
import { notifications, profile } from '$lib/auth.svelte.js' 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 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 SidebarButton from '$lib/components/ui/sidebar/SidebarButton.svelte'
import { t } from '$lib/i18n/translations' import { t } from '$lib/i18n/translations'
import { communityLink } from '$lib/lemmy/generic' import { communityLink } from '$lib/lemmy/generic'
import { settings } from '$lib/settings.svelte.js' 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 { import {
ArrowLeftOnRectangle, ArrowLeftOnRectangle,
Bookmark, Bookmark,
Cog6Tooth, Cog6Tooth,
ComputerDesktop,
Identification, Identification,
Inbox, Inbox,
Moon,
Sun,
Swatch,
UserCircle, UserCircle,
UserGroup, UserGroup,
} from 'svelte-hero-icons' } from 'svelte-hero-icons'
import type { ClassValue } from 'svelte/elements' import type { ClassValue } from 'svelte/elements'
import Avatar from '../Avatar.svelte'
import EndPlaceholder from '../EndPlaceholder.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 { interface Props {
style?: string style?: string
@@ -29,202 +35,160 @@
let { style = '', class: clazz = '' }: Props = $props() let { style = '', class: clazz = '' }: Props = $props()
</script> </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} {#if profile.current?.jwt}
<SidebarButton icon={UserCircle} href="/profile"> <SidebarButton
{#snippet label()} icon={UserCircle}
<span> href="/profile"
{$t('profile.profile')} label={$t('profile.profile')}
</span> />
{/snippet} <SidebarButton icon={Inbox} href="/inbox" label={$t('profile.inbox')}>
</SidebarButton> {#if $notifications.inbox}
<SidebarButton icon={Inbox} href="/inbox"> <Badge
{#snippet label()} class="min-w-5 h-5 p-0! px-0.5 grid place-items-center ml-auto"
<span class="flex items-center gap-2"> color="red-subtle"
{$t('profile.inbox')} >
{#if $notifications.inbox} {$notifications.inbox > 99 ? '∞' : $notifications.inbox}
<Badge </Badge>
class="min-w-5 h-5 p-0! px-0.5 grid place-items-center ml-auto" {/if}
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> </SidebarButton>
<SidebarButton icon={Bookmark} href="/saved" label={$t('profile.saved')} />
{:else} {:else}
<SidebarButton <SidebarButton
href="/login" href="/login"
title={$t('account.login')} label={$t('account.login')}
icon={ArrowLeftOnRectangle} icon={ArrowLeftOnRectangle}
> />
{#snippet label()}
<span>{$t('account.login')}</span>
{/snippet}
</SidebarButton>
<SidebarButton <SidebarButton
href="/signup" href="/signup"
title={$t('account.signup')} label={$t('account.signup')}
icon={Identification} icon={Identification}
> />
{#snippet label()}
<span>{$t('account.signup')}</span>
{/snippet}
</SidebarButton>
<SidebarButton <SidebarButton
href="/settings" href="/accounts"
title={$t('nav.menu.settings')} label={$t('account.accounts')}
icon={Cog6Tooth} icon={UserGroup}
> />
{#snippet label()}
<span>{$t('nav.menu.settings')}</span>
{/snippet}
</SidebarButton>
{/if} {/if}
{#if profile.meta.profiles.length >= 1} <EndPlaceholder margin="sm" size="xs">{$t('nav.menu.app')}</EndPlaceholder>
<hr class="border-slate-200 dark:border-zinc-900 my-1" /> <SidebarButton
href="/settings"
<Expandable label={$t('nav.menu.settings')}
class="max-w-full min-w-0 w-full" icon={Cog6Tooth}
bind:open={settings.expand.accounts} />
> <Select bind:value={theme.colorScheme} size="sm">
{#snippet title()} {#snippet target()}
<span class="px-2 py-1 w-full"> <SidebarButton
<EndPlaceholder border={false}> label={$t('nav.menu.colorscheme.label')}
{$t('account.accounts')} icon={theme.colorScheme == 'system'
{#snippet action()} ? ComputerDesktop
<span class="dark:text-white text-black"> : theme.colorScheme == 'light'
{profile.meta.profiles.length} ? Sun
</span> : Moon}
{/snippet} class=" w-full"
</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}
> >
{#snippet item(prof, index)} <Option value="system" class="hidden" icon={ComputerDesktop}>
<ProfileButton {index} {prof} /> {$t('nav.menu.colorscheme.system')}
{/snippet} </Option>
<li class="xs px-1 py-0.5"> <Option value="light" class="hidden" icon={Sun}>
<SidebarButton href="/accounts" icon={UserGroup}> {$t('nav.menu.colorscheme.light')}
{$t('account.accounts')} </Option>
</SidebarButton> <Option value="dark" class="hidden" icon={Moon}>
</li> {$t('nav.menu.colorscheme.dark')}
</CommonList> </Option>
</Expandable> </SidebarButton>
{/if} {/snippet}
<hr class="border-slate-200 dark:border-zinc-900 my-1" /> </Select>
<SidebarButton href="/theme" label={$t('nav.menu.theme')} icon={Swatch} />
{#if profile.current?.user} {#if profile.current?.user}
{#if profile.current?.user.moderates.length > 0} <EndPlaceholder margin="sm" size="xs">
<Expandable {$t('content.communities')}
class="max-w-full min-w-0 w-full" </EndPlaceholder>
bind:open={settings.expand.moderates}
> <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()} {#snippet title()}
<span class="px-2 py-1 w-full"> <span class="px-2 py-1 w-full">
<EndPlaceholder border={false}> <EndPlaceholder border={false}>
{$t('routes.profile.moderates')} {$t('profile.subscribed')}
{#snippet action()} {#snippet action()}
<span class="dark:text-white text-black"> <span class="dark:text-white text-black">
{profile.current.user?.moderates.length} {profile.current.user?.follows.length}
</span> </span>
{/snippet} {/snippet}
</EndPlaceholder> </EndPlaceholder>
</span> </span>
{/snippet} {/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 <ItemList
class="max-w-full min-w-0 w-full" items={profile.current.user.follows.map(i => ({
bind:open={settings.expand.communities} id: i.community.id,
> name: i.community.title,
{#snippet title()} url: communityLink(i.community),
<span class="px-2 py-1 w-full"> avatar: i.community.icon,
<EndPlaceholder border={false}> instance: new URL(i.community.actor_id).hostname,
{$t('profile.subscribed')} }))}
{#snippet action()} />
<span class="dark:text-white text-black"> </Expandable>
{profile.current.user?.follows.length} </div>
</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>
{/if} {/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> </nav>
@@ -8,9 +8,9 @@
href?: string | undefined href?: string | undefined
icon?: IconSource | undefined icon?: IconSource | undefined
class?: string class?: string
label?: string
customIcon?: import('svelte').Snippet<[{ selected: boolean }]> customIcon?: import('svelte').Snippet<[{ selected: boolean }]>
children?: import('svelte').Snippet children?: import('svelte').Snippet
label?: import('svelte').Snippet
} }
let { let {
@@ -27,9 +27,9 @@
</script> </script>
<Button <Button
color="none" color="tertiary"
alignment="left" alignment="left"
rounding="pill" rounding="xl"
{...rest} {...rest}
{href} {href}
class={[ class={[
@@ -46,11 +46,9 @@
{#if customIcon} {#if customIcon}
{@render customIcon({ selected })} {@render customIcon({ selected })}
{:else if icon} {:else if icon}
<Icon src={icon} solid size="20" /> <Icon src={icon} solid size="18" />
{/if} {/if}
{/snippet} {/snippet}
{label}
{@render children?.()} {@render children?.()}
<div class="contents">
{@render label?.()}
</div>
</Button> </Button>
+16 -13
View File
@@ -162,7 +162,8 @@
"2fa": { "2fa": {
"totp": "TOTP", "totp": "TOTP",
"2fa": "2FA", "2fa": "2FA",
"paste": "Paste this in your authenticator app." "paste": "Paste this in your authenticator app.",
"disabled": "2FA is disabled"
}, },
"deleteAccount": { "deleteAccount": {
"label": "Delete account", "label": "Delete account",
@@ -172,6 +173,10 @@
"languages": { "languages": {
"title": "Languages", "title": "Languages",
"description": "If any are set, you will only see content explicitly tagged as that language. Most content, untagged, falls under 'Undetermined'." "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", "email": "Email",
@@ -254,7 +259,8 @@
"warning": "This is permanent. Are you sure you want to do this?" "warning": "This is permanent. Are you sure you want to do this?"
}, },
"overview": "Overview", "overview": "Overview",
"submissions": "Submissions" "submissions": "Submissions",
"edit": "Edit"
}, },
"translators": "Translators", "translators": "Translators",
"accounts": "Accounts", "accounts": "Accounts",
@@ -544,17 +550,6 @@
"delete": "Delete", "delete": "Delete",
"restore": "Restore" "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": { "link": {
"title": "Alternative Links", "title": "Alternative Links",
"actions": "Link Actions" "actions": "Link Actions"
@@ -955,6 +950,14 @@
"upvotes": "{{default}} upvotes", "upvotes": "{{default}} upvotes",
"downvotes": "{{default}} downvotes", "downvotes": "{{default}} downvotes",
"score": "Score: {{default}}" "score": "Score: {{default}}"
},
"sidebar": {
"title": "Sidebar",
"accounts": "Accounts selector"
},
"loading": "Loading",
"element": {
"pageHeader": "Page header"
} }
}, },
"stats": { "stats": {
+2 -2
View File
@@ -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 { getClient } from '$lib/lemmy.svelte.js'
import { trycatch } from '$lib/util.svelte' import { trycatch } from '$lib/util.svelte'
import type { Community, MyUserInfo } from 'lemmy-js-client' 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 profile.favorites?.map(i => i.id).includes(id) ?? false
+7 -7
View File
@@ -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`, hover:bg-slate-100 dark:hover:bg-zinc-800 dark:hover:border-zinc-700 dark:active:bg-zinc-900 active:bg-slate-200`,
tertiary: 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: danger:
'border border-red-500 bg-red-500 hover:text-red-500 hover:bg-transparent text-white', 'border border-red-500 bg-red-500 hover:text-red-500 hover:bg-transparent text-white',
@@ -47,9 +47,9 @@
export const buttonSize = { export const buttonSize = {
xs: 'px-2 py-1 text-xs', xs: 'px-2 py-1 text-xs',
sm: 'px-3 py-1.5 text-[12px]', sm: 'px-3 py-1.5 text-[12px]',
md: 'px-3 py-1.5', md: 'px-3 py-1.5 text-sm',
lg: 'px-4 py-2', lg: 'px-4 py-2 text-sm',
xl: 'px-6 py-3', xl: 'px-6 py-3 text-base',
'square-sm': 'w-6 h-6', 'square-sm': 'w-6 h-6',
'square-md': 'w-8 h-8', 'square-md': 'w-8 h-8',
'square-lg': 'w-10 h-10', 'square-lg': 'w-10 h-10',
@@ -105,7 +105,7 @@
size = 'md', size = 'md',
rounding = size == 'lg' ? 'xl' : 'lg', rounding = size == 'lg' ? 'xl' : 'lg',
alignment = 'center', alignment = 'center',
shadow = color != 'tertiary' ? 'sm' : 'none', shadow = color != 'tertiary' ? 'none' : 'none',
column = false, column = false,
disabled, disabled,
loaderWidth = undefined, loaderWidth = undefined,
@@ -129,7 +129,7 @@
buttonRounding[rounding], buttonRounding[rounding],
buttonShadow[shadow], buttonShadow[shadow],
buttonColor[color], 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', (disabled || loading) && 'pointer-events-none opacity-50 shadow-none',
alignment == 'center' alignment == 'center'
? 'origin-center' ? 'origin-center'
@@ -144,7 +144,7 @@
class={[ class={[
'flex', 'flex',
column ? 'flex-col justify-center' : 'flex-row items-center', 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], buttonAlignment[alignment],
]} ]}
> >
+37 -35
View File
@@ -24,6 +24,7 @@
}, },
] ]
> >
target?: Snippet
oncontextmenu?: HTMLSelectAttributes['oncontextmenu'] oncontextmenu?: HTMLSelectAttributes['oncontextmenu']
onchange?: HTMLSelectAttributes['onchange'] onchange?: HTMLSelectAttributes['onchange']
placement?: Placement placement?: Placement
@@ -33,7 +34,7 @@
</script> </script>
<script lang="ts" generics="T"> <script lang="ts" generics="T">
import { setContext, tick } from 'svelte' import { setContext, tick, type Snippet } from 'svelte'
import { import {
CheckCircle, CheckCircle,
ChevronUpDown, ChevronUpDown,
@@ -76,7 +77,7 @@
placeholder = undefined, placeholder = undefined,
label = undefined, label = undefined,
size = 'md', size = 'md',
shadow = 'sm', shadow = 'none',
id = generateID(), id = generateID(),
class: clazz = '', class: clazz = '',
baseClass = '', baseClass = '',
@@ -87,10 +88,43 @@
oncontextmenu, oncontextmenu,
onchange, onchange,
placement = 'bottom', placement = 'bottom',
target,
...rest ...rest
}: Props<T> = $props() }: Props<T> = $props()
</script> </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]}> <div class={['flex flex-col gap-1', clazz, baseClass]}>
{#if customLabel || label} {#if customLabel || label}
<Label for={id} text={label}> <Label for={id} text={label}>
@@ -99,39 +133,7 @@
{/if} {/if}
<div class="w-full relative"> <div class="w-full relative">
<Menu bind:open {placement}> <Menu bind:open {placement} target={target ?? selectTarget}>
{#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}
{#each context.options as option (option)} {#each context.options as option (option)}
{#if customOption}{@render customOption({ {#if customOption}{@render customOption({
option, option,
+2
View File
@@ -18,6 +18,8 @@
stroke-linejoin="round" stroke-linejoin="round"
class="animate-spin" class="animate-spin"
xmlns="http://www.w3.org/2000/svg" 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="2" x2="12" y2="6"></line>
<line x1="12" y1="18" x2="12" y2="22"></line> <line x1="12" y1="18" x2="12" y2="22"></line>
+2 -1
View File
@@ -45,7 +45,7 @@
none: '', none: '',
} }
interface Props extends HTMLAttributes<HTMLDivElement> { interface Props extends HTMLAttributes<HTMLElement> {
elevation?: Elevation elevation?: Elevation
padding?: Padding padding?: Padding
rounding?: Rounding rounding?: Rounding
@@ -53,6 +53,7 @@
element?: string element?: string
class?: ClassValue class?: ClassValue
children?: import('svelte').Snippet children?: import('svelte').Snippet
[key: string]: any
} }
let { let {
+6 -4
View File
@@ -77,6 +77,8 @@
<Portal> <Portal>
{#if open} {#if open}
<!--svelte-ignore a11y_interactive_supports_focus-->
<!--svelte-ignore a11y_click_events_have_key_events-->
<div <div
role="dialog" role="dialog"
class="overflow-hidden fixed top-0 left-0 w-screen h-screen z-100 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, duration: 300,
}} }}
class="w-full border border-slate-200 border-b-slate-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 dark:border-zinc-900
rounded-2xl max-w-lg box-border mx-auto overscroll-contain shadow-lg overflow-auto 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-925 p-5 flex flex-col gap-2 dark:bg-zinc-950
bg-white relative {clazz}" bg-slate-50 relative {clazz}"
> >
{#if dismissable} {#if dismissable}
<Button <Button
+2 -2
View File
@@ -49,11 +49,11 @@
> >
{#snippet popover()} {#snippet popover()}
<div <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 <div
class="flex flex-col p-1 list-none bg-white/80 dark:bg-zinc-900/90 rounded-xl 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)} {@render children?.(open)}
</div> </div>
+1 -1
View File
@@ -8,7 +8,7 @@
</script> </script>
<div <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> <div class={[!showLabel && 'sr-only']}>{@render children?.()}</div>
<hr <hr
+21 -19
View File
@@ -130,7 +130,7 @@
<ModalContainer /> <ModalContainer />
{#snippet sidebar({ style: s, class: c })} {#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}
{#snippet main({ style: s, class: c })} {#snippet main({ style: s, class: c })}
<main <main
@@ -144,23 +144,25 @@
{#snippet navbar({ style: s, class: c })} {#snippet navbar({ style: s, class: c })}
<Navbar class={c} style={s} /> <Navbar class={c} style={s} />
{/snippet} {/snippet}
{#snippet suffix({ class: c, style: s })} {#snippet suffix({ class: c })}
<div class={[c, 'p-3 sm:p-6']} style={s}> {#if page.data.slots?.sidebar?.component}
{#if page.data.slots?.sidebar?.component} {@const SvelteComponent = page.data.slots.sidebar.component}
{@const SvelteComponent = page.data.slots.sidebar.component} <SvelteComponent
<SvelteComponent {...page.data.slots.sidebar.props} /> {...page.data.slots.sidebar.props}
{:else if site.data} class={[c, 'p-3 sm:p-6']}
<SiteCard />
site={site.data.site_view} {:else if site.data}
taglines={site.data.taglines} <SiteCard
admins={site.data.admins} site={site.data.site_view}
version={site.data.version} taglines={site.data.taglines}
/> admins={site.data.admins}
{:else} version={site.data.version}
<div class="h-64 w-full grid place-items-center"> class={[c, 'p-3 sm:p-6']}
<Spinner width={32} /> />
</div> {:else}
{/if} <div class="h-64 w-full grid place-items-center">
</div> <Spinner width={32} />
</div>
{/if}
{/snippet} {/snippet}
</Shell> </Shell>
+34 -37
View File
@@ -5,6 +5,7 @@
import ViewSelect from '$lib/components/lemmy/dropdowns/ViewSelect.svelte' import ViewSelect from '$lib/components/lemmy/dropdowns/ViewSelect.svelte'
import PostFeed from '$lib/components/lemmy/post/feed/PostFeed.svelte' import PostFeed from '$lib/components/lemmy/post/feed/PostFeed.svelte'
import VirtualFeed from '$lib/components/lemmy/post/feed/VirtualFeed.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 Header from '$lib/components/ui/layout/pages/Header.svelte'
import Pageination from '$lib/components/ui/Pageination.svelte' import Pageination from '$lib/components/ui/Pageination.svelte'
import { t } from '$lib/i18n/translations.js' import { t } from '$lib/i18n/translations.js'
@@ -36,31 +37,25 @@
</svelte:head> </svelte:head>
<div class="flex flex-col gap-2 max-w-full w-full min-w-0"> <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>
<Header pageHeader> {$t('routes.frontpage.title')}
{$t('routes.frontpage.title')}
{#snippet extended()} {#snippet extended()}
<form class="flex items-center gap-2" method="get" action="/"> <form class="flex items-center gap-2" method="get" action="/">
{#if type} {#if type}
<Location name="type" navigate bind:selected={type} /> <Location name="type" navigate bind:selected={type} />
{/if} {/if}
<Sort placement="bottom" name="sort" navigate bind:selected={sort} /> <Sort placement="bottom" name="sort" navigate bind:selected={sort} />
<ViewSelect placement="bottom" /> <ViewSelect placement="bottom" />
<noscript> <noscript>
<Button <Button class="self-end h-[34px] aspect-square" size="custom" submit>
class="self-end h-[34px] aspect-square" <Icon src={ArrowRight} size="16" micro />
size="custom" </Button>
submit </noscript>
> </form>
<Icon src={ArrowRight} size="16" micro /> {/snippet}
</Button> </Header>
</noscript>
</form>
{/snippet}
</Header>
</header>
<FeedComponent <FeedComponent
bind:posts={data.feed.value.posts.posts} bind:posts={data.feed.value.posts.posts}
@@ -71,20 +66,22 @@
this={settings.infiniteScroll && !settings.posts.noVirtualize this={settings.infiniteScroll && !settings.posts.noVirtualize
? 'noscript' ? 'noscript'
: 'div'} : 'div'}
class="mt-auto" class="mt-auto flex flex-col"
> >
<Pageination <EndPlaceholder>
cursor={{ next: data.feed.value.cursor.next }} <Icon src={ChartBar} size="16" mini />
href={page =>
typeof page == 'number' ? `?page=${page}` : `?cursor=${page}`} {$t('routes.frontpage.footer', {
back={false} users: site.data?.site_view?.counts?.users_active_day ?? '??',
> })}
<span class="flex flex-row items-center gap-1"> {#snippet action()}
<Icon src={ChartBar} size="16" mini /> <Pageination
{$t('routes.frontpage.footer', { cursor={{ next: data.feed.value.cursor.next }}
users: site.data?.site_view?.counts?.users_active_day ?? '??', href={page =>
})} typeof page == 'number' ? `?page=${page}` : `?cursor=${page}`}
</span> back={false}
</Pageination> />
{/snippet}
</EndPlaceholder>
</svelte:element> </svelte:element>
</div> </div>
+22 -85
View File
@@ -1,16 +1,16 @@
<script lang="ts"> <script lang="ts">
import { profile } from '$lib/auth.svelte.js' 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 MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
import Header from '$lib/components/ui/layout/pages/Header.svelte' import Header from '$lib/components/ui/layout/pages/Header.svelte'
import SectionTitle from '$lib/components/ui/SectionTitle.svelte' import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
import { t } from '$lib/i18n/translations.js' import { t } from '$lib/i18n/translations.js'
import { getClient, site } from '$lib/lemmy.svelte.js' import { getClient, site } from '$lib/lemmy.svelte.js'
import { errorMessage } from '$lib/lemmy/error.js'
import type { EditSite } from 'lemmy-js-client' import type { EditSite } from 'lemmy-js-client'
import { import {
Badge, Badge,
Button, Button,
Label,
Material, Material,
Menu, Menu,
MenuButton, MenuButton,
@@ -20,9 +20,8 @@
toast, toast,
} from 'mono-svelte' } from 'mono-svelte'
import Option from 'mono-svelte/forms/select/Option.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 type { PageData } from './$types.js'
import { errorMessage } from '$lib/lemmy/error.js'
interface Props { interface Props {
data: PageData data: PageData
@@ -65,11 +64,6 @@
} }
let saving = $state(false) let saving = $state(false)
let uploading = $state({
icon: false,
banner: false,
})
</script> </script>
<svelte:head> <svelte:head>
@@ -108,66 +102,18 @@
} }
label={$t('routes.legal.title')} label={$t('routes.legal.title')}
/> />
<div class="flex flex-col gap-1"> <ImageInputUpload
<Label>{$t('routes.admin.config.icon')}</Label> label={$t('routes.admin.config.icon')}
<button bind:imageUrl={formData.icon}
type="button" />
onclick={() => (uploading.icon = !uploading.icon)} <ImageInputUpload
class="flex flex-col gap-4 bg-white dark:bg-black border border-slate-300 dark:border-zinc-800 p-4 w-full h-32 rounded-xl" label={$t('routes.admin.config.banner')}
> bind:imageUrl={formData.banner}
{#if formData.icon} />
<img src={formData.icon} alt="" class="rounded-md mx-auto h-full" /> <Switch bind:checked={formData.enable_downvotes}>
{: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}>
{$t('routes.admin.config.downvotesEnabled')} {$t('routes.admin.config.downvotesEnabled')}
</Switch> </Switch>
<Switch bind:checked={formData.enable_nsfw} defaultValue={true}> <Switch bind:checked={formData.enable_nsfw}>
{$t('routes.admin.config.nsfwEnabled')} {$t('routes.admin.config.nsfwEnabled')}
</Switch> </Switch>
<Select <Select
@@ -192,25 +138,16 @@
bind:value={formData.application_question} bind:value={formData.application_question}
/> />
{/if} {/if}
<Switch <Switch bind:checked={formData.community_creation_admin_only}>
bind:checked={formData.community_creation_admin_only}
defaultValue={true}
>
{$t('routes.admin.config.adminCommunityOnly')} {$t('routes.admin.config.adminCommunityOnly')}
</Switch> </Switch>
<Switch <Switch bind:checked={formData.require_email_verification}>
bind:checked={formData.require_email_verification}
defaultValue={true}
>
{$t('routes.admin.config.requireVerifyEmail')} {$t('routes.admin.config.requireVerifyEmail')}
</Switch> </Switch>
<Switch <Switch bind:checked={formData.application_email_admins}>
bind:checked={formData.application_email_admins}
defaultValue={true}
>
{$t('routes.admin.config.emailAdminsOnApplication')} {$t('routes.admin.config.emailAdminsOnApplication')}
</Switch> </Switch>
<Switch bind:checked={formData.reports_email_admins} defaultValue={true}> <Switch bind:checked={formData.reports_email_admins}>
{$t('routes.admin.config.emailAdminsOnReport')} {$t('routes.admin.config.emailAdminsOnReport')}
</Switch> </Switch>
<Select <Select
@@ -223,10 +160,10 @@
{$t('routes.admin.config.listingType.local')} {$t('routes.admin.config.listingType.local')}
</Option> </Option>
</Select> </Select>
<Switch bind:checked={formData.private_instance} defaultValue={true}> <Switch bind:checked={formData.private_instance}>
{$t('routes.admin.config.private')} {$t('routes.admin.config.private')}
</Switch> </Switch>
<Switch bind:checked={formData.hide_modlog_mod_names} defaultValue={true}> <Switch bind:checked={formData.hide_modlog_mod_names}>
{$t('routes.admin.config.hideModlogModNames')} {$t('routes.admin.config.hideModlogModNames')}
</Switch> </Switch>
<TextInput <TextInput
@@ -234,13 +171,13 @@
label={$t('routes.admin.config.slurFilter')} label={$t('routes.admin.config.slurFilter')}
placeholder="(word1|word2)" placeholder="(word1|word2)"
/> />
<Switch bind:checked={formData.federation_enabled} defaultValue={true}> <Switch bind:checked={formData.federation_enabled}>
{$t('routes.admin.config.federation')} {$t('routes.admin.config.federation')}
</Switch> </Switch>
<Switch bind:checked={formData.federation_debug} defaultValue={false}> <Switch bind:checked={formData.federation_debug}>
{$t('routes.admin.config.federationDebug')} {$t('routes.admin.config.federationDebug')}
</Switch> </Switch>
<Switch bind:checked={formData.captcha_enabled} defaultValue={false}> <Switch bind:checked={formData.captcha_enabled}>
{$t('routes.admin.config.captcha.enabled')} {$t('routes.admin.config.captcha.enabled')}
</Switch> </Switch>
+6 -7
View File
@@ -17,6 +17,7 @@
import { expoOut } from 'svelte/easing' import { expoOut } from 'svelte/easing'
import { fly } from 'svelte/transition' import { fly } from 'svelte/transition'
import SearchBar from '../search/SearchBar.svelte' import SearchBar from '../search/SearchBar.svelte'
import EndPlaceholder from '$lib/components/ui/EndPlaceholder.svelte'
let { data } = $props() let { data } = $props()
@@ -96,9 +97,7 @@
{/each} {/each}
</div> </div>
{:else} {:else}
<ul <ul class="flex flex-col h-full">
class="flex flex-col divide-y divide-slate-100 dark:divide-zinc-925 my-6 h-full"
>
{#if data.communities.value.length == 0} {#if data.communities.value.length == 0}
<Placeholder <Placeholder
icon={QuestionMarkCircle} icon={QuestionMarkCircle}
@@ -108,9 +107,9 @@
{/if} {/if}
{#if showTop} {#if showTop}
<SectionTitle class="border-0! pb-2"> <EndPlaceholder size="lg" margin="lg">
{$t('routes.search.top')} {$t('routes.search.top')}
</SectionTitle> </EndPlaceholder>
<div <div
class="grid md:grid-cols-2 lg:grid-cols-3 gap-4 items-center mb-6 border-0!" class="grid md:grid-cols-2 lg:grid-cols-3 gap-4 items-center mb-6 border-0!"
> >
@@ -138,9 +137,9 @@
{/if} {/if}
{#if data.communities.value.slice(showTop ? 3 : 0).length > 0} {#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')} {$t('routes.search.other')}
</SectionTitle> </EndPlaceholder>
{/if} {/if}
{#if data.communities.value} {#if data.communities.value}
{@const sliced = data.communities.value.slice(showTop ? 3 : 0)} {@const sliced = data.communities.value.slice(showTop ? 3 : 0)}
+29
View File
@@ -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?.()}
+5
View File
@@ -0,0 +1,5 @@
import { redirect } from '@sveltejs/kit'
export function load() {
redirect(302, '/create/post')
}
+3 -1
View File
@@ -2,4 +2,6 @@
import CommunityForm from '$lib/components/lemmy/community/CommunityForm.svelte' import CommunityForm from '$lib/components/lemmy/community/CommunityForm.svelte'
</script> </script>
<CommunityForm /> <CommunityForm>
{#snippet formtitle()}{/snippet}
</CommunityForm>
+17 -23
View File
@@ -32,26 +32,20 @@
<title>{$t('form.post.create')}</title> <title>{$t('form.post.create')}</title>
</svelte:head> </svelte:head>
<div class="w-full max-w-5xl mx-auto h-full"> <PostForm
<PostForm passedData={data.crosspost == true
passedData={data.crosspost == true ? post
? post : {
: { body: '',
body: '', community: null,
community: null, image: null,
image: null, loading: false,
loading: false, nsfw: false,
nsfw: false, title: '',
title: '', url: undefined,
url: undefined, }}
}} passedCommunity={community}
passedCommunity={community} onsubmit={e => goto(`/post/${e.post.id}`)}
onsubmit={e => goto(`/post/${e.post.id}`)} >
> {#snippet formtitle()}{/snippet}
{#snippet formtitle()} </PostForm>
<Header class="text-3xl font-bold" pageHeader>
{$t('routes.createPost')}
</Header>
{/snippet}
</PostForm>
</div>
+12 -13
View File
@@ -9,19 +9,18 @@
<title>{$t('routes.moderation.title')}</title> <title>{$t('routes.moderation.title')}</title>
</svelte:head> </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"> <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?.()} {@render children?.()}
</div> </div>
@@ -2,7 +2,7 @@
import { page } from '$app/state' import { page } from '$app/state'
import { profile } from '$lib/auth.svelte.js' import { profile } from '$lib/auth.svelte.js'
import PostActions from '$lib/components/lemmy/post/actions/PostActions.svelte' 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 PostMedia from '$lib/components/lemmy/post/media/PostMedia.svelte'
import Post from '$lib/components/lemmy/post/Post.svelte' import Post from '$lib/components/lemmy/post/Post.svelte'
import PostMeta, { import PostMeta, {
@@ -227,11 +227,12 @@
href={data.thread.value.showContext href={data.thread.value.showContext
? `/comment/${ ? `/comment/${
// split first comment path to get 5 before // 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" class="hover:bg-white/50 dark:hover:bg-zinc-800/30"
onclick={data.thread.value.singleThread ? reloadComments : undefined}
> >
{data.thread.value.showContext {data.thread.value.showContext
? $t('routes.post.thread.context') ? $t('routes.post.thread.context')
@@ -19,10 +19,10 @@
import { import {
ArrowPath, ArrowPath,
ArrowTrendingDown, ArrowTrendingDown,
ChatBubbleOvalLeft,
Clock, Clock,
Fire, Fire,
Icon, Icon,
PlusCircle,
Star, Star,
Trophy, Trophy,
} from 'svelte-hero-icons' } from 'svelte-hero-icons'
@@ -77,7 +77,7 @@
)} )}
onclick={() => (commenting = true)} onclick={() => (commenting = true)}
> >
<Icon src={PlusCircle} size="16" micro /> <Icon src={ChatBubbleOvalLeft} size="16" micro />
{$t('routes.post.addComment')} {$t('routes.post.addComment')}
</Button> </Button>
@@ -6,9 +6,9 @@
import Header from '$lib/components/ui/layout/pages/Header.svelte' import Header from '$lib/components/ui/layout/pages/Header.svelte'
import ProfileButton from '$lib/components/ui/sidebar/ProfileButton.svelte' import ProfileButton from '$lib/components/ui/sidebar/ProfileButton.svelte'
import SidebarButton from '$lib/components/ui/sidebar/SidebarButton.svelte' import SidebarButton from '$lib/components/ui/sidebar/SidebarButton.svelte'
import { t } from '$lib/i18n/translations'
import { client } from '$lib/lemmy.svelte' import { client } from '$lib/lemmy.svelte'
import { errorMessage } from '$lib/lemmy/error' import { errorMessage } from '$lib/lemmy/error'
import { t } from '$lib/i18n/translations'
import { toast } from 'mono-svelte' import { toast } from 'mono-svelte'
import Button from 'mono-svelte/button/Button.svelte' import Button from 'mono-svelte/button/Button.svelte'
import Material from 'mono-svelte/materials/Material.svelte' import Material from 'mono-svelte/materials/Material.svelte'
@@ -17,6 +17,8 @@
import Material from 'mono-svelte/materials/Material.svelte' import Material from 'mono-svelte/materials/Material.svelte'
import { Check, Icon, XMark } from 'svelte-hero-icons' import { Check, Icon, XMark } from 'svelte-hero-icons'
import type { PageData } from './$types.js' 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 { interface Props {
// sveltekit doesn't feel like making types work right now // sveltekit doesn't feel like making types work right now
@@ -85,106 +87,109 @@
{$t('routes.profile.blocks.title')} {$t('routes.profile.blocks.title')}
</Header> </Header>
{#if data.community_blocks?.length > 0 || data.person_blocks?.length > 0 || (data.my_user?.instance_blocks?.length ?? 0) > 0} <div>
{#if data.community_blocks?.length > 0} {#if data.community_blocks?.length > 0 || data.person_blocks?.length > 0 || (data.my_user?.instance_blocks?.length ?? 0) > 0}
<div class="space-y-1"> {#if data.community_blocks?.length > 0}
<SectionTitle>{$t('content.communities')}</SectionTitle> <EndPlaceholder size="md" margin="md">
<Material {$t('content.communities')}
color="uniform" </EndPlaceholder>
class="bg-white dark:bg-zinc-950 max-h-96 overflow-auto" <div class="max-h-96 overflow-auto rounded-2xl">
rounding="xl" <CommonList
> size="xs"
<ul class="divide-y divide-slate-200 dark:divide-zinc-900"> class="px-3 py-2"
{#each data.community_blocks as block (block.community.id)} animate={false}
<div class="flex flex-row gap-2 items-center py-1 -mx-4 px-4"> 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 <Button
title="Unblock" title="Unblock"
size="square-md" size="square-md"
rounding="pill" rounding="pill"
color="danger"
onclick={() => unblockCommunity(block)} onclick={() => unblockCommunity(block)}
> >
{#snippet prefix()} {#snippet prefix()}
<Icon src={XMark} micro size="16" /> <Icon src={XMark} micro size="16" />
{/snippet} {/snippet}
</Button> </Button>
<CommunityLink community={block.community} avatar />
</div> </div>
{/each} {/snippet}
</ul> </CommonList>
</Material> </div>
</div> {/if}
{/if} {#if data.person_blocks?.length > 0}
{#if data.person_blocks?.length > 0} <EndPlaceholder size="md" margin="md">
<div class="space-y-1"> {$t('content.users')}
<SectionTitle>{$t('content.users')}</SectionTitle> </EndPlaceholder>
<Material <div class="max-h-96 overflow-auto rounded-2xl">
color="uniform" <CommonList
class="bg-white dark:bg-zinc-950 max-h-96 overflow-auto" size="xs"
rounding="xl" class="px-3 py-2"
> animate={false}
<ul class="divide-y divide-slate-200 dark:divide-zinc-900"> items={data.person_blocks}
{#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 item(block)}
<div class="flex flex-row gap-2 items-center">
<UserLink user={block.target} avatar badges />
<div class="flex-1"></div>
<Button <Button
title="Unblock" title="Unblock"
size="square-md" size="square-md"
rounding="pill" rounding="pill"
color="danger"
onclick={() => unblockUser(block)} onclick={() => unblockUser(block)}
> >
{#snippet prefix()} {#snippet prefix()}
<Icon src={XMark} micro size="16" /> <Icon src={XMark} micro size="16" />
{/snippet} {/snippet}
</Button> </Button>
<UserLink user={block.target} avatar badges />
</div> </div>
{/each} {/snippet}
</ul> </CommonList>
</Material> </div>
</div> {/if}
{/if} {#if data.my_user?.instance_blocks && (data.my_user?.instance_blocks?.length ?? 0) > 0}
{#if data.my_user?.instance_blocks && (data.my_user?.instance_blocks?.length ?? 0) > 0} <EndPlaceholder size="md" margin="md" class="text-lg">
<div class="space-y-1">
<SectionTitle class="text-lg">
{$t('content.instances')} {$t('content.instances')}
</SectionTitle> </EndPlaceholder>
<Material <div class="max-h-96 overflow-auto rounded-2xl">
color="uniform" <CommonList
class="bg-white dark:bg-zinc-950 max-h-96 overflow-auto" size="xs"
rounding="xl" animate={false}
> items={data.my_user.instance_blocks}
<ul class="divide-y divide-slate-200 dark:divide-zinc-900"> class="px-3 py-2"
{#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"> {#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 <Button
title="Unblock" title="Unblock"
size="square-md" size="square-md"
rounding="pill" rounding="pill"
color="danger"
onclick={() => unblockInstances(block)} onclick={() => unblockInstances(block)}
> >
{#snippet prefix()} {#snippet prefix()}
<Icon src={XMark} micro size="16" /> <Icon src={XMark} micro size="16" />
{/snippet} {/snippet}
</Button> </Button>
<Entity
icon={block.site?.icon}
name={block.site?.name ?? block.instance.domain}
label={block.instance.domain}
/>
</div> </div>
{/each} {/snippet}
</ul> </CommonList>
</Material> </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> </div>
{/if} {/if}
{:else} </div>
<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}
@@ -3,7 +3,7 @@
import { page } from '$app/state' import { page } from '$app/state'
import Header from '$lib/components/ui/layout/pages/Header.svelte' 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 * @typedef {Object} Props
* @property {import('svelte').Snippet} [children] * @property {import('svelte').Snippet} [children]
@@ -13,46 +13,36 @@
let { children } = $props() let { children } = $props()
const routes = [ const routes = [
{
name: $t('routes.profile.credentials'),
url: '/profile/password',
},
{ {
name: $t('form.profile.2fa.2fa'), name: $t('form.profile.2fa.2fa'),
url: '/profile/password/2fa', href: '/profile/password/2fa',
}, },
{ {
name: $t('routes.passwordChange.title'), name: $t('routes.passwordChange.title'),
url: '/profile/password/change', href: '/profile/password/change',
}, },
{ {
name: $t('routes.profile.logins'), name: $t('routes.profile.logins'),
url: '/profile/password/logins', href: '/profile/password/logins',
}, },
{ {
name: $t('routes.profile.delete.title'), name: $t('routes.profile.delete.title'),
url: '/profile/password/delete', href: '/profile/password/delete',
}, },
] ]
</script> </script>
<Header pageHeader> <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> </Header>
<div class="flex flex-row gap-12">
<nav class="flex flex-col gap-2 flex-1 max-sm:hidden"> <Tabs style="subpage" {routes}></Tabs>
{#each routes as route (route)} <div
<SidebarButton class={[
size="lg" page.url.pathname == '/profile/password' && ' p-8',
rounding="lg" 'flex flex-col justify-center items-center h-full',
selected={page.url.pathname == route.url} ]}
href={route.url} >
> {@render children?.()}
{route.name}
</SidebarButton>
{/each}
</nav>
<div class="flex-3 max-w-full w-full min-w-0">
{@render children?.()}
</div>
</div> </div>
@@ -1,103 +1,13 @@
<script lang="ts"> <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 { t } from '$lib/i18n/translations.js'
import { Material } from 'mono-svelte' import { Key } from 'svelte-hero-icons'
import {
Icon,
Identification,
Key,
Trash,
UserGroup,
} from 'svelte-hero-icons'
let { data } = $props()
</script> </script>
<div <div class="h-full grid place-items-center">
class="grid grid-cols-1 lg:grid-cols-2 gap-4 <Placeholder
grid-rows-2" icon={Key}
> title={$t('form.profile.credentials.title')}
<EntityHeader description={$t('form.profile.credentials.description')}
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"
/> />
<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> </div>
@@ -4,9 +4,10 @@
import { client } from '$lib/lemmy.svelte.js' import { client } from '$lib/lemmy.svelte.js'
import { t } from '$lib/i18n/translations.js' import { t } from '$lib/i18n/translations.js'
import { qr } from '@svelte-put/qr/svg' import { qr } from '@svelte-put/qr/svg'
import { Button, Material, TextInput, toast } from 'mono-svelte' import { Button, Material, Modal, TextInput, toast } from 'mono-svelte'
import { ClipboardDocument, Icon } from 'svelte-hero-icons' import { ClipboardDocument, Icon, Key } from 'svelte-hero-icons'
import { errorMessage } from '$lib/lemmy/error.js' import { errorMessage } from '$lib/lemmy/error.js'
import Placeholder from '$lib/components/ui/Placeholder.svelte'
let { data } = $props() let { data } = $props()
@@ -17,8 +18,18 @@
let verify_totp = $state('') let verify_totp = $state('')
let openModal = $state(false)
$effect(() => {
if (!openModal) totpLink = undefined
})
async function twofa(enabled: boolean, update: boolean = false) { async function twofa(enabled: boolean, update: boolean = false) {
try { try {
if (!enabled && !update) {
openModal = true
return
}
if (update) { if (update) {
await client().updateTotp({ await client().updateTotp({
enabled: enabled, enabled: enabled,
@@ -34,24 +45,23 @@
} else { } else {
const res = await client().generateTotpSecret() const res = await client().generateTotpSecret()
totpLink = res.totp_secret_url totpLink = res.totp_secret_url
totpEnabled = true openModal = true
} }
} catch (e) { } catch (err) {
toast({ content: errorMessage(e as string), type: 'error' }) toast({ content: errorMessage(err as string), type: 'error' })
} }
} }
</script> </script>
<div class="w-full flex flex-col"> <div class="w-full flex flex-col h-full">
<p class=""> <Modal
<span class="font-medium text-lg"> dismissable={false}
{totpEnabled ? $t('common.enabled') : $t('common.disabled')} bind:open={openModal}
</span> title={$t('form.profile.2fa.2fa')}
</p> >
{#if totpEnabled || totpLink}
{#if totpLink && !totpEnabled} {#if totpLink && !totpEnabled}
<Material color="transparent" class="fill-white!"> <Material rounding="2xl" color="uniform" class="">
<svg use:qr={{ data: totpLink, logo: '/img/logo-isolated.svg' }} /> <svg use:qr={{ data: totpLink, logo: '/img/logo-background.svg' }} />
</Material> </Material>
<TextInput <TextInput
disabled disabled
@@ -76,25 +86,60 @@
</span> </span>
</TextInput> </TextInput>
{/if} {/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 <TextInput
bind:value={verify_totp} bind:value={verify_totp}
placeholder="012345" placeholder="012345"
label={$t('form.2fa')} label={$t('form.2fa')}
pattern={'\\d{6}'}
required
/> />
{#if totpEnabled} {#if totpEnabled}
<Button onclick={() => twofa(false, true)} size="lg" color="primary"> <Button submit size="lg" color="primary">
{$t('common.disable')} {$t('common.disable')}
</Button> </Button>
{:else} {:else}
<Button onclick={() => twofa(true, true)} size="lg" color="primary"> <Button submit size="lg" color="primary">
{$t('common.enable')} {$t('common.enable')}
</Button> </Button>
{/if} {/if}
</form> </form>
{:else} </Modal>
<Button onclick={() => twofa(true)} size="lg" color="primary"> <div class="flex flex-col items-center justify-center h-full gap-4 p-4">
{$t('form.setup')} {#if totpEnabled}
</Button> <Placeholder
{/if} 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> </div>
@@ -1,11 +1,9 @@
<script lang="ts"> <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 { 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(''), let oldPassword = $state(''),
newPassword = $state(''), newPassword = $state(''),
@@ -42,7 +40,13 @@
} }
</script> </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 <TextInput
bind:value={oldPassword} bind:value={oldPassword}
label={$t('form.profile.currentPassword')} label={$t('form.profile.currentPassword')}
@@ -64,14 +68,7 @@
minlength={10} minlength={10}
required required
/> />
<Button <Button size="lg" color="primary" submit {loading} disabled={loading}>
class="sm:ml-auto"
size="lg"
color="primary"
submit
{loading}
disabled={loading}
>
{$t('form.submit')} {$t('form.submit')}
</Button> </Button>
</form> </form>
@@ -1,19 +1,9 @@
<script lang="ts"> <script lang="ts">
import { goto } from '$app/navigation' 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 { 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({ let deletion = $state({
modal: false, modal: false,
@@ -70,9 +60,7 @@
delete_content: deletion.deleteContent, delete_content: deletion.deleteContent,
}) })
profile.meta.profiles.splice( profile.remove(profile.current.id)
profile.meta.profiles.findIndex(p => profile.meta.profile == p.id),
)
profile.meta.profile = -1 profile.meta.profile = -1
toast({ toast({
@@ -90,43 +78,18 @@
} }
</script> </script>
{#if deletion.modal} <form
<Modal onsubmit={e => {
bind:open={deletion.modal} e.preventDefault()
action="Submit" deleteAccount(4)
onaction={() => deleteAccount(4)} }}
> class="w-full flex flex-col gap-4 max-w-xl"
{#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"
> >
<Header class="mx-auto w-max font-bold!"> <TextInput
{$t('routes.profile.delete.title')} label={$t('form.password')}
</Header> type="password"
<p class="text-base"> bind:value={deletion.password}
{$t('routes.profile.delete.warning')} />
</p>
<Switch bind:checked={deletion.deleteContent}> <Switch bind:checked={deletion.deleteContent}>
{$t('form.profile.deleteAccount.deleteContent')} {$t('form.profile.deleteAccount.deleteContent')}
{#snippet description()} {#snippet description()}
@@ -135,7 +98,7 @@
</span> </span>
{/snippet} {/snippet}
</Switch> </Switch>
<Button size="lg" color="danger" onclick={() => deleteAccount(3)}> <Button submit color="danger" size="lg">
{$t('routes.profile.delete.title')} {$t('form.submit')}
</Button> </Button>
</Material> </form>
@@ -1,18 +1,15 @@
<script lang="ts"> <script lang="ts">
import { preventDefault } from 'svelte/legacy'
import { profile } from '$lib/auth.svelte.js' import { profile } from '$lib/auth.svelte.js'
import ImageInputUpload from '$lib/components/form/ImageInputUpload.svelte'
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte' import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
import Header from '$lib/components/ui/layout/pages/Header.svelte' import Header from '$lib/components/ui/layout/pages/Header.svelte'
import SectionTitle from '$lib/components/ui/SectionTitle.svelte' import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
import { t } from '$lib/i18n/translations.js' import { t } from '$lib/i18n/translations.js'
import { getClient, site } from '$lib/lemmy.svelte.js' import { getClient, site } from '$lib/lemmy.svelte.js'
import { uploadImage } from '$lib/util.svelte.js'
import type { SaveUserSettings } from 'lemmy-js-client' import type { SaveUserSettings } from 'lemmy-js-client'
import { import {
Badge, Badge,
Button, Button,
ImageInput,
Material, Material,
Menu, Menu,
MenuButton, MenuButton,
@@ -37,35 +34,14 @@
discussion_languages: data.my_user?.discussion_languages, discussion_languages: data.my_user?.discussion_languages,
}) })
let profileImage: FileList | undefined = $state()
let bannerImage: FileList | undefined = $state()
async function save() { async function save() {
if (!formData || !profile.current?.jwt) return if (!formData || !profile.current?.jwt) return
loading = true loading = true
try { 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({ await getClient().saveUserSettings({
...formData, ...formData,
avatar: pfp,
banner: banner,
}) })
toast({ toast({
@@ -84,9 +60,15 @@
let loading = $state(false) let loading = $state(false)
</script> </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} {#if !inline}
<Header pageHeader>{$t('routes.profile.settings')}</Header> <Header pageHeader>{$t('routes.profile.edit')}</Header>
{/if} {/if}
{@render children?.()} {@render children?.()}
{#if data.my_user?.local_user_view?.local_user && formData} {#if data.my_user?.local_user_view?.local_user && formData}
@@ -103,8 +85,14 @@
previewButton previewButton
/> />
<div class="flex gap-2 items-center *:flex-1"> <div class="flex gap-2 items-center *:flex-1">
<ImageInput label={$t('form.profile.avatar')} bind:files={profileImage} /> <ImageInputUpload
<ImageInput label={$t('form.profile.banner')} bind:files={bannerImage} /> label={$t('form.profile.avatar')}
bind:imageUrl={formData.avatar}
/>
<ImageInputUpload
label={$t('form.profile.banner')}
bind:imageUrl={formData.banner}
/>
</div> </div>
<TextInput <TextInput
label={$t('form.profile.matrix')} label={$t('form.profile.matrix')}
@@ -114,9 +102,6 @@
<Switch bind:checked={formData.show_nsfw}> <Switch bind:checked={formData.show_nsfw}>
{$t('form.profile.showNSFW')} {$t('form.profile.showNSFW')}
</Switch> </Switch>
<Switch bind:checked={formData.show_scores}>
{$t('form.profile.scores')}
</Switch>
<Switch bind:checked={formData.bot_account}> <Switch bind:checked={formData.bot_account}>
{$t('form.profile.bot')} {$t('form.profile.bot')}
</Switch> </Switch>
+7 -19
View File
@@ -1,8 +1,6 @@
<script> <script>
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte' import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
import { t } from '$lib/i18n/translations' 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 { Button, Menu, MenuButton } from 'mono-svelte'
import { import {
ArrowDown, ArrowDown,
@@ -27,12 +25,7 @@
<div class="flex flex-col gap-4 h-full z-0"> <div class="flex flex-col gap-4 h-full z-0">
<div class="flex flex-row justify-between"> <div class="flex flex-row justify-between">
<Tabs <Tabs
class="overflow-auto"
routes={[ routes={[
{
href: '/profile',
name: $t('routes.profile.overview'),
},
{ {
href: '/profile/user', href: '/profile/user',
name: $t('routes.profile.submissions'), name: $t('routes.profile.submissions'),
@@ -40,7 +33,7 @@
{ {
href: '/profile/settings', href: '/profile/settings',
name: $t('routes.profile.settings'), name: $t('routes.profile.edit'),
}, },
{ {
@@ -53,21 +46,16 @@
name: $t('routes.profile.credentials'), name: $t('routes.profile.credentials'),
}, },
]} ]}
/> >
{#if feature('mediaAndVotes', site.data?.version)}
<Menu class="flex-1" placement="bottom-end"> <Menu class="flex-1" placement="bottom-end">
{#snippet target()} {#snippet target()}
<Button <Button
title={$t('post.actions.more.label')} aria-label={$t('post.actions.more.label')}
size="square-lg" size="square-sm"
rounding="pill"
color="none" color="none"
class="bg-white/60 dark:bg-zinc-800/60 class="z-0 text-slate-600 dark:text-zinc-500 hover:bg-slate-100 hover:dark:bg-zinc-800"
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"
> >
<Icon src={EllipsisHorizontal} size="16" mini /> <Icon src={EllipsisHorizontal} size="16" micro />
</Button> </Button>
{/snippet} {/snippet}
<MenuButton href="/profile/media"> <MenuButton href="/profile/media">
@@ -89,7 +77,7 @@
{$t('routes.profile.downvoted')} {$t('routes.profile.downvoted')}
</MenuButton> </MenuButton>
</Menu> </Menu>
{/if} </Tabs>
</div> </div>
{@render children?.()} {@render children?.()}
</div> </div>
-78
View File
@@ -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}
+5
View File
@@ -0,0 +1,5 @@
import { redirect } from '@sveltejs/kit'
export function load() {
redirect(302, '/profile/user')
}
+2 -3
View File
@@ -6,7 +6,6 @@
{#if data.user && data.sort && data.type && data.page} {#if data.user && data.sort && data.type && data.page}
<UserPage <UserPage
inline
data={{ data={{
items: new ReactiveState(data.user.submissions), items: new ReactiveState(data.user.submissions),
filters: new ReactiveState({ filters: new ReactiveState({
@@ -14,8 +13,8 @@
sort: data.sort, sort: data.sort,
type: data.type, type: data.type,
}), }),
person_view: {value: data.user.person_view}, person_view: { value: data.user.person_view },
moderates: {value: data.user.moderates}, moderates: { value: data.user.moderates },
}} }}
/> />
{:else} {:else}
+1 -1
View File
@@ -15,7 +15,7 @@
<div class="mt-4 mb-0 sticky z-30 top-6 lg:top-22"> <div class="mt-4 mb-0 sticky z-30 top-6 lg:top-22">
<div <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 <TextInput
bind:value={query} bind:value={query}
+126
View File
@@ -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?.()}
-677
View File
@@ -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>
+5
View File
@@ -0,0 +1,5 @@
import { redirect } from '@sveltejs/kit'
export function load() {
redirect(302, '/settings/app')
}
+306
View File
@@ -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>
+69
View File
@@ -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>
+103
View File
@@ -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>
+102
View File
@@ -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>
-37
View File
@@ -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>
+22
View File
@@ -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>
+4 -16
View File
@@ -3,6 +3,7 @@
import { page } from '$app/state' import { page } from '$app/state'
import { profile } from '$lib/auth.svelte.js' import { profile } from '$lib/auth.svelte.js'
import CommentItem from '$lib/components/lemmy/comment/CommentItem.svelte' 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 ItemList from '$lib/components/lemmy/generic/ItemList.svelte'
import { ban, isAdmin } from '$lib/components/lemmy/moderation/moderation.js' import { ban, isAdmin } from '$lib/components/lemmy/moderation/moderation.js'
import ShieldIcon from '$lib/components/lemmy/moderation/ShieldIcon.svelte' import ShieldIcon from '$lib/components/lemmy/moderation/ShieldIcon.svelte'
@@ -34,7 +35,6 @@
import { import {
AdjustmentsHorizontal, AdjustmentsHorizontal,
AtSymbol, AtSymbol,
ChartBar,
EllipsisHorizontal, EllipsisHorizontal,
Envelope, Envelope,
Fire, Fire,
@@ -330,22 +330,10 @@
<Option value="posts">{$t('content.posts')}</Option> <Option value="posts">{$t('content.posts')}</Option>
<Option value="comments">{$t('content.comments')}</Option> <Option value="comments">{$t('content.comments')}</Option>
</Select> </Select>
<Select <Sort
bind:value={data.filters.value.sort} bind:selected={data.filters.value.sort}
name="sort"
onchange={() => sortForm?.requestSubmit()} 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> </form>
{#if data.items.value.length == 0} {#if data.items.value.length == 0}
<Placeholder <Placeholder
+1 -1
View File
@@ -1,4 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100" fill="none"> <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" /> <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"/> <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

+2 -2
View File
@@ -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"/> <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

+1 -1
View File
@@ -20,7 +20,7 @@
"display": "standalone", "display": "standalone",
"scope": "/", "scope": "/",
"theme_color": "#000000", "theme_color": "#000000",
"description": "A client for Lemmy with design as priority.", "description": "A Svelte based web client for Lemmy.",
"screenshots": [ "screenshots": [
{ {
"form_factor": "wide", "form_factor": "wide",