Merge pull request #598 from Xyphyn/generic-issue-fix

fix: Lots of generic issues fixes
This commit is contained in:
Xylight authored and GitHub committed 2025-06-26 01:02:47 +00:00
commit 6191fc7880
22 files changed
+206 -181

No files matched your search

+6 -58
View File
@@ -1,29 +1,11 @@
<!doctype html>
<html lang="en">
<html class="dark" lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/img/logo-background.svg" />
<link rel="manifest" href="/manifest.json" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="keywords" content="lemmy, client" />
<script defer type="">
const dark = () =>
localStorage.theme == 'dark' ||
((!localStorage.theme || localStorage.theme == 'system') &&
window.matchMedia('(prefers-color-scheme: dark)').matches)
if (dark()) document.documentElement.classList.add('dark')
else document.documentElement.classList.remove('dark')
window
.matchMedia('(prefers-color-scheme: dark)')
.addEventListener('change', (event) => {
if (dark()) document.documentElement.classList.add('dark')
else document.documentElement.classList.remove('dark')
})
// document.getElementById("loader")?.classList.remove('hidden')
</script>
%sveltekit.head%
</head>
<body data-sveltekit-preload-data="hover">
@@ -33,13 +15,11 @@
height: 100vh;
z-index: -50;
position: absolute;
top: 0;
left: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 1rem;
inset: 0;
display: grid;
place-items: center;
background-color: #111115;
color: #fafafe;
"
>
<svg
@@ -53,39 +33,7 @@
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
stroke="currentColor"
fill="none"
stroke-width="2"
viewBox="0 0 24 24"
stroke-linecap="round"
stroke-linejoin="round"
height="20"
width="20"
class="animate-spin"
xmlns="http://www.w3.org/2000/svg"
>
<line x1="12" y1="2" x2="12" y2="6"></line>
<line x1="12" y1="18" x2="12" y2="22"></line>
<line x1="4.93" y1="4.93" x2="7.76" y2="7.76"></line>
<line x1="16.24" y1="16.24" x2="19.07" y2="19.07"></line>
<line x1="2" y1="12" x2="6" y2="12"></line>
<line x1="18" y1="12" x2="22" y2="12"></line>
<line x1="4.93" y1="19.07" x2="7.76" y2="16.24"></line>
<line x1="16.24" y1="7.76" x2="19.07" y2="4.93"></line>
</svg>
</div>
<div style="display: contents">%sveltekit.body%</div>
</body>
<style>
@keyframes spin {
to {
transform: rotate(360deg);
}
}
.animate-spin {
animation: spin 0.9s linear infinite;
}
</style>
</html>
+19 -2
View File
@@ -7,7 +7,7 @@
import { client } from '$lib/lemmy.svelte'
import { instanceToURL } from '$lib/util.svelte'
import type { LocalImage, Person } from 'lemmy-js-client'
import { Button, toast } from 'mono-svelte'
import { action, Button, modal, toast } from 'mono-svelte'
import { ArrowDownTray, Icon, Trash } from 'svelte-hero-icons'
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
@@ -67,7 +67,24 @@
</Button>
<Button
title={$t('post.actions.more.delete')}
onclick={() => deleteImage(image)}
onclick={() => {
modal({
title: $t('routes.theme.preset.delete.confirm'),
body: '',
actions: [
action({
close: true,
content: $t('common.cancel'),
}),
action({
type: 'danger',
action: () => deleteImage(image),
close: true,
content: $t('post.actions.more.delete'),
}),
],
})
}}
size="square-md"
{loading}
disabled={loading}
@@ -88,7 +88,7 @@
}}
>
<Icon src={Square2Stack} mini size="16" />
<div>{$t('comment.actions.link')}</div>
<div>{$t('post.actions.more.share')}</div>
</MenuButton>
{#if profile.data?.jwt}
{#if comment.creator.id == profile.data.user?.local_user_view.person.id}
@@ -20,6 +20,7 @@
Trash,
} from 'svelte-hero-icons'
import Subscribe from '../../../../routes/communities/Subscribe.svelte'
import { settings } from '$lib/settings.svelte'
let showInfo = $state(false)
interface Props {
@@ -65,11 +66,16 @@
? 'flex-col gap-2'
: 'flex-row'} gap-2 items-center"
>
{#if icon}{@render icon()}{:else}
{#if icon}{@render icon()}{:else if community.community.nsfw && settings.nsfwBlur}
<div class="w-8 h-8 rounded-full bg-red-400"></div>
{:else}
<Avatar
url={community.community.icon}
width={32}
alt={community.community.name}
class={[
community.community.nsfw && settings.nsfwBlur && 'blur-3xl',
]}
/>
{/if}
<div
@@ -133,6 +133,7 @@
style="grid-area: meta;"
edited={post.post.updated}
tags={tags?.tags}
postUrl={post.post.url}
{view}
{extraBadges}
/>
+25 -8
View File
@@ -98,6 +98,7 @@
style?: string
titleClass?: string
extraBadges?: import('svelte').Snippet
postUrl?: string
}
let {
@@ -122,6 +123,7 @@
admin: false,
},
tags = [],
postUrl,
style = '',
titleClass = '',
extraBadges,
@@ -150,13 +152,23 @@
'bg-slate-200 dark:bg-zinc-800 rounded-lg cursor-pointer',
]}
>
<Avatar
url={community?.icon}
width={view == 'compact' ? 24 : 32}
alt={community?.name}
circle={false}
class="group-hover/btn:scale-90 group-active/btn:scale-[.85] transition-transform"
/>
{#if community.nsfw && settings.nsfwBlur}
<div
style="width: {view == 'compact' ? 24 : 32}; height: {view ==
'compact'
? 24
: 32}"
class="bg-red-400 rounded-xl"
></div>
{:else}
<Avatar
url={community?.icon}
width={view == 'compact' ? 24 : 32}
alt={community?.name}
circle={false}
class="group-hover/btn:scale-90 group-active/btn:scale-[.85] transition-transform"
/>
{/if}
</button>
{/snippet}
{#snippet popover()}
@@ -322,7 +334,12 @@
</header>
{#if title && id}
<a
href="/post/{encodeURIComponent(instance.data)}/{id}"
href={settings.posts.titleOpensUrl && postUrl
? postUrl
: `/post/${encodeURIComponent(instance.data)}/${id}`}
target={settings.posts.titleOpensUrl || settings.openLinksInNewTab
? '_blank'
: undefined}
class={[
'inline max-[480px]:mt-0!',
'hover:underline hover:text-primary-900 dark:hover:text-primary-100 transition-colors',
@@ -46,11 +46,21 @@
const videoID = youtubeVideoID(inputUrl)
if (autoplay) url.searchParams.set('autoplay', '1')
if (videoID) {
const embedUrl = new URL(
`https://${youtubeDomain(settings.embeds.youtube)}/embed/${videoID}`,
)
return `https://${youtubeDomain(
settings.embeds.youtube,
)}/embed/${videoID}?${url.searchParams.toString()}`
embedUrl.searchParams.set('start', url.searchParams.get('t') ?? '')
url.searchParams.forEach((value, key) => {
embedUrl.searchParams.set(key, value)
})
if (autoplay) embedUrl.searchParams.set('autoplay', '1')
return embedUrl.toString()
}
}
return ''
+16 -22
View File
@@ -1,6 +1,4 @@
<script lang="ts">
import { stopPropagation } from 'svelte/legacy'
import { notifications, profile } from '$lib/auth.svelte'
import SiteCard from '$lib/components/lemmy/SiteCard.svelte'
@@ -133,7 +131,7 @@
{/snippet}
{$t('nav.menu.settings')}
</MenuButton>
<MenuButton class="py-0!">
<MenuButton class="py-0!" onclick={e => e.stopPropagation()}>
{#snippet prefix()}
<Icon
src={theme.colorScheme == 'system'
@@ -148,25 +146,21 @@
/>
{/snippet}
<span>{$t('nav.menu.colorscheme.label')}</span>
<!-- svelte-ignore a11y_click_events_have_key_events -->
<!-- svelte-ignore a11y_no_static_element_interactions -->
<div class="contents" onclick={stopPropagation(() => {})}>
<Select
bind:value={theme.colorScheme}
class="ml-auto my-auto w-24"
size="sm"
>
<Option value="system" icon={ComputerDesktop}>
{$t('nav.menu.colorscheme.system')}
</Option>
<Option value="light" icon={Sun}>
{$t('nav.menu.colorscheme.light')}
</Option>
<Option value="dark" icon={Moon}>
{$t('nav.menu.colorscheme.dark')}
</Option>
</Select>
</div>
<Select
bind:value={theme.colorScheme}
class="ml-auto my-auto w-24"
size="sm"
>
<Option value="system" icon={ComputerDesktop}>
{$t('nav.menu.colorscheme.system')}
</Option>
<Option value="light" icon={Sun}>
{$t('nav.menu.colorscheme.light')}
</Option>
<Option value="dark" icon={Moon}>
{$t('nav.menu.colorscheme.dark')}
</Option>
</Select>
</MenuButton>
<MenuButton href="/theme">
{#snippet prefix()}
+8 -1
View File
@@ -313,7 +313,10 @@
"messages": {
"conversation": "This is the beginning of your conversation with {{user}}",
"indicator": "Messaging {{user}}",
"start": "Start chat"
"start": "Start chat",
"empty": {
"title": "No messages"
}
}
},
"moderation": {
@@ -828,6 +831,10 @@
"absoluteDates": {
"title": "Absolute timestamps",
"description": "Replaces relative timestamps (3 hours ago) with absolute ones (15/6/25)"
},
"titleOpensUrl": {
"title": "Title opens URL",
"description": "Makes clicking the title open the post's attached URL, rather than the comments."
}
},
"embeds": {
+2
View File
@@ -92,6 +92,7 @@ interface Settings {
showHidden: boolean
noVirtualize: boolean
reverseActions: boolean
titleOpensUrl: boolean
}
infiniteScroll: boolean
language: string | null
@@ -172,6 +173,7 @@ export const defaultSettings: Settings = {
showHidden: false,
noVirtualize: false,
reverseActions: toBool(env.PUBLIC_REVERSE_ACTIONS) ?? false,
titleOpensUrl: toBool(env.PUBLIC_TITLE_OPENS_URL) ?? false,
},
infiniteScroll: true,
language: env.PUBLIC_LANGUAGE ?? null,
+44 -41
View File
@@ -1,59 +1,62 @@
import { env } from '$env/dynamic/public'
import type { Theme, ThemeColors } from './colors.svelte'
const PHOTON_DEFAULT = {
slate: {
25: '252 253 254',
50: '248 250 252',
100: '241 245 249',
200: '226 232 240',
300: '203 213 225',
400: '148 163 184',
500: '100 116 139',
600: '71 85 105',
700: '51 65 85',
800: '30 41 59',
900: '15 23 42',
950: '2 6 23',
},
zinc: {
'50': '252 252 254',
'100': '248 248 251',
'200': '235 235 240',
'300': '222 222 228',
'400': '175 175 185',
'500': '128 128 138',
'600': '98 98 108',
'700': '68 68 76',
'800': '47 47 54',
'900': '34 34 39',
'925': '28 28 32',
'950': '25 25 29',
},
primary: {
100: '241 245 249',
900: '15 23 42',
},
other: {
black: '0 0 0',
white: '255 255 255',
},
}
export function getDefaultColors(): ThemeColors {
return env.PUBLIC_THEME
? JSON.parse(env.PUBLIC_THEME)
: {
slate: {
25: '252 253 254',
50: '248 250 252',
100: '241 245 249',
200: '226 232 240',
300: '203 213 225',
400: '148 163 184',
500: '100 116 139',
600: '71 85 105',
700: '51 65 85',
800: '30 41 59',
900: '15 23 42',
950: '2 6 23',
},
zinc: {
'50': '252 252 254',
'100': '248 248 251',
'200': '235 235 240',
'300': '222 222 228',
'400': '175 175 185',
'500': '128 128 138',
'600': '98 98 108',
'700': '68 68 76',
'800': '47 47 54',
'900': '34 34 39',
'925': '28 28 32',
'950': '25 25 29',
},
primary: {
100: '241 245 249',
900: '15 23 42',
},
other: {
black: '0 0 0',
white: '255 255 255',
},
}
return env.PUBLIC_THEME ? JSON.parse(env.PUBLIC_THEME) : PHOTON_DEFAULT
}
export function getDefaultTheme(): Theme {
return {
id: 0,
colors: getDefaultColors(),
name: 'Default',
name: env.PUBLIC_THEME ? 'Instance Default' : 'Mono',
}
}
export const presets: Theme[] = [
getDefaultTheme(),
...(env.PUBLIC_THEME
? [{ colors: PHOTON_DEFAULT, id: -10, name: 'Mono' }]
: []),
{
colors: {
slate: {
+1 -4
View File
@@ -61,9 +61,7 @@
? 'font-inter'
: settings.font == 'system'
? 'font-system'
: settings.font == 'satoshi/nunito'
? 'font-nunito'
: 'font-sans',
: 'font-sans',
)
}
})
@@ -81,7 +79,6 @@
<svelte:head>
{#if site.data?.site_view}
<title>{site.data?.site_view.site.name}</title>
<meta
name="theme-color"
content={rgbToHex(
+4
View File
@@ -30,6 +30,10 @@
)
</script>
<svelte:head>
<title>{site.data?.site_view.site.name}</title>
</svelte:head>
<div class="flex flex-col gap-2 max-w-full w-full min-w-0">
<header class="flex flex-col gap-4 relative">
<Header pageHeader>
+4 -4
View File
@@ -12,14 +12,14 @@
<Header pageHeader>{$t('routes.profile.media.title')}</Header>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3">
{#each data.images as image (image.local_image.pictrs_delete_token)}
{#each data.images.value as image (image.local_image.pictrs_delete_token)}
<div animate:flip={{ duration: 500, easing: expoInOut }}>
<PictrsImage
image={image.local_image}
user={image.person}
ondelete={() => {
data.images = data.images.toSpliced(
data.images.findIndex(
data.images.value = data.images.value.toSpliced(
data.images.value.findIndex(
i =>
i.local_image.pictrs_delete_token ==
image.local_image.pictrs_delete_token,
@@ -31,7 +31,7 @@
</div>
{/each}
</div>
{#if data.images.length == 20}
{#if data.images.value.length == 20}
<Pageination
page={Number(page.url.searchParams.get('page')) || 1}
href={page => `?page=${page}`}
+2 -1
View File
@@ -1,5 +1,6 @@
import { profile } from '$lib/auth.svelte'
import { client } from '$lib/lemmy.svelte.js'
import { ReactiveState } from '$lib/promise.svelte.js'
export async function load({ fetch, url }) {
const { jwt } = profile.data
@@ -11,5 +12,5 @@ export async function load({ fetch, url }) {
page: page,
})
return { images: res.images }
return { images: new ReactiveState(res.images) }
}
+1 -1
View File
@@ -154,7 +154,7 @@ items-center px-2 w-max top-6 lg:top-22"
class="self-center justify-self-center my-auto"
/>
{:else}
{#each data.inbox.value as item, index (item.id)}
{#each data.inbox.value as item, index}
{#if item.creator.id != profile.data.user?.local_user_view.person.id}
<div
class="-mx-4 sm:-mx-6 px-4 sm:px-6
+24 -13
View File
@@ -7,12 +7,13 @@
import Skeleton from '$lib/components/ui/generic/Skeleton.svelte'
import Header from '$lib/components/ui/layout/pages/Header.svelte'
import Pageination from '$lib/components/ui/Pageination.svelte'
import Placeholder from '$lib/components/ui/Placeholder.svelte'
import { publishedToDate } from '$lib/components/util/date.js'
import RelativeDate from '$lib/components/util/RelativeDate.svelte'
import { t } from '$lib/i18n/translations.js'
import type { Person, PrivateMessageView } from 'lemmy-js-client'
import { Button, Modal } from 'mono-svelte'
import { ChatBubbleOvalLeftEllipsis, Icon } from 'svelte-hero-icons'
import { ChatBubbleOvalLeftEllipsis, Icon, Inbox } from 'svelte-hero-icons'
import { expoOut } from 'svelte/easing'
import { fly } from 'svelte/transition'
@@ -85,18 +86,19 @@
/>
</Modal>
<Header pageHeader>
{#snippet startChat()}
<Button
color="primary"
size="lg"
onclick={() => (searchModal.open = !searchModal.open)}
>
<Icon src={ChatBubbleOvalLeftEllipsis} size="18" mini />
{$t('routes.inbox.messages.start')}
</Button>
{/snippet}
<Header pageHeader extended={startChat}>
{$t('filter.inbox.messages')}
{#snippet extended()}
<Button
color="primary"
size="lg"
onclick={() => (searchModal.open = !searchModal.open)}
>
<Icon src={ChatBubbleOvalLeftEllipsis} size="18" mini />
{$t('routes.inbox.messages.start')}
</Button>
{/snippet}
</Header>
{#await data.messages}
<div class="w-full h-full flex flex-col gap-2">
@@ -119,8 +121,17 @@
{@const previews = conversationPreviews(conversations)}
<ul
class="flex flex-col divide-y divide-slate-200 dark:divide-zinc-800 w-full mt-6"
class="flex flex-col divide-y divide-slate-200 dark:divide-zinc-800 w-full mt-6 h-full"
>
{#if previews.length == 0}
<Placeholder
title={$t('routes.inbox.messages.empty.title')}
icon={Inbox}
class="my-auto"
>
{@render startChat?.()}
</Placeholder>
{/if}
{#each previews as preview, index (preview)}
<a
href="/inbox/messages/{preview.user.id}"
+4 -4
View File
@@ -12,13 +12,13 @@
<Header pageHeader>{$t('routes.admin.media.title')}</Header>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3">
{#each data.images as image (image.local_image.pictrs_delete_token)}
{#each data.images.value as image (image.local_image.pictrs_delete_token)}
<div animate:flip={{ duration: 500, easing: expoInOut }}>
<PictrsImage
image={image.local_image}
ondelete={() => {
data.images = data.images.toSpliced(
data.images.findIndex(
data.images.value = data.images.value.toSpliced(
data.images.value.findIndex(
i =>
i.local_image.pictrs_delete_token ==
image.local_image.pictrs_delete_token,
@@ -30,7 +30,7 @@
</div>
{/each}
</div>
{#if data.images.length == 20}
{#if data.images.value.length == 20}
<Pageination
page={Number(page.url.searchParams.get('page')) || 1}
href={page => `?page=${page}`}
+2 -1
View File
@@ -1,5 +1,6 @@
import { profile } from '$lib/auth.svelte'
import { client } from '$lib/lemmy.svelte.js'
import { ReactiveState } from '$lib/promise.svelte.js'
export async function load({ fetch, url }) {
const { jwt } = profile.data
@@ -11,5 +12,5 @@ export async function load({ fetch, url }) {
page: page,
})
return { images: res.images }
return { images: new ReactiveState(res.images) }
}
+4 -3
View File
@@ -36,8 +36,6 @@
let searchElement: HTMLInputElement | undefined = $state()
let form = $state<HTMLFormElement>()
let pageNum = $state(data.filters.value.page)
let moreOptions = $state(false)
</script>
@@ -200,6 +198,9 @@
</div>
<div class="mt-4"></div>
{#if data.results.value.length > 0}
<Pageination bind:page={pageNum} href={page => `?page=${page}`} />
<Pageination
bind:page={data.filters.value.page}
href={page => `?page=${page}`}
/>
{/if}
{/if}
+5
View File
@@ -439,6 +439,11 @@
title={$t('settings.app.duplicateTitles.title')}
description={$t('settings.app.duplicateTitles.description')}
/>
<ToggleSetting
bind:checked={settings.posts.titleOpensUrl}
title={$t('settings.app.titleOpensUrl.title')}
description={$t('settings.app.titleOpensUrl.description')}
/>
<ToggleSetting
title={$t('settings.app.titleTags.title')}
description={$t('settings.app.titleTags.description')}
+12 -12
View File
@@ -29,18 +29,18 @@
--color-slate-900: rgb(var(--c-s-900, 15 23 42));
--color-slate-950: rgb(var(--c-s-950, 2 6 23));
--color-zinc-50: rgb(var(--c-z-50, 251 253 255));
--color-zinc-100: rgb(var(--c-z-100, 246 247 249));
--color-zinc-200: rgb(var(--c-z-200, 229 231 235));
--color-zinc-300: rgb(var(--c-z-300, 217 221 226));
--color-zinc-400: rgb(var(--c-z-400, 171 177 188));
--color-zinc-500: rgb(var(--c-z-500, 127 133 146));
--color-zinc-600: rgb(var(--c-z-600, 95 104 117));
--color-zinc-700: rgb(var(--c-z-700, 75 84 99));
--color-zinc-800: rgb(var(--c-z-800, 42 50 63));
--color-zinc-900: rgb(var(--c-z-900, 32 37 50));
--color-zinc-925: rgb(var(--c-z-925, 28 32 43));
--color-zinc-950: rgb(var(--c-z-950, 23 27 36));
--color-zinc-50: rgb(var(--c-z-50, 252 252 254));
--color-zinc-100: rgb(var(--c-z-100, 248 248 251));
--color-zinc-200: rgb(var(--c-z-200, 235 235 240));
--color-zinc-300: rgb(var(--c-z-300, 222 222 228));
--color-zinc-400: rgb(var(--c-z-400, 175 175 185));
--color-zinc-500: rgb(var(--c-z-500, 128 128 138));
--color-zinc-600: rgb(var(--c-z-600, 98 98 108));
--color-zinc-700: rgb(var(--c-z-700, 68 68 76));
--color-zinc-800: rgb(var(--c-z-800, 47 47 54));
--color-zinc-900: rgb(var(--c-z-900, 34 34 39));
--color-zinc-925: rgb(var(--c-z-925, 28 28 32));
--color-zinc-950: rgb(var(--c-z-950, 25 25 29));
--color-primary-100: rgb(var(--c-p-100, 241 245 249));
--color-primary-900: rgb(var(--c-p-900, 15 23 42));