Merge remote-tracking branch 'origin/main' into piefed-3

This commit is contained in:
James Xylight committed 2025-09-05 22:28:22 -07:00
commit aa270be722
25 files changed
+164 -110

No files matched your search

+5
View File
@@ -72,8 +72,12 @@ export function client({
clientType = profile.current.client ?? DEFAULT_CLIENT_TYPE clientType = profile.current.client ?? DEFAULT_CLIENT_TYPE
} }
// we use nullish coealsiaihsa something so that
// we can set auth = '' to remove it
const jwt = auth ?? profile.current?.jwt const jwt = auth ?? profile.current?.jwt
// but not here, so that if jwt == '', it doesnt put a bearer
const headers = jwt ? { authorization: `Bearer ${jwt}` } : {} const headers = jwt ? { authorization: `Bearer ${jwt}` } : {}
return new (clientType.name == 'piefed' ? PiefedClient : LemmyClient)( return new (clientType.name == 'piefed' ? PiefedClient : LemmyClient)(
@@ -85,6 +89,7 @@ export function client({
) )
} }
// here for parts where i forgor to switch
export function getClient( export function getClient(
instanceURL?: string, instanceURL?: string,
func?: ( func?: (
@@ -54,7 +54,7 @@
<div class={clazz}> <div class={clazz}>
<div <div
class={[ class={[
view == 'cozy' ? 'flex-col gap-2 items-center' : 'flex-row', view == 'cozy' ? 'flex-col gap-2' : 'flex-row',
'flex max-w-full w-full', 'flex max-w-full w-full',
]} ]}
> >
@@ -63,7 +63,7 @@
community.community.name, community.community.name,
community.community.actor_id, community.community.actor_id,
)}" )}"
class="flex-1 w-full overflow-hidden" class="flex-1 w-full overflow-hidden group"
data-sveltekit-preload-data="tap" data-sveltekit-preload-data="tap"
> >
<div class="flex flex-row gap-2 items-center"> <div class="flex flex-row gap-2 items-center">
@@ -88,7 +88,9 @@
<div <div
class="font-medium text-base overflow-hidden text-ellipsis leading-5" class="font-medium text-base overflow-hidden text-ellipsis leading-5"
> >
<span>{community.community.title}</span> <h3 class="group-hover:underline text-left">
{community.community.title}
</h3>
{#if community.community.deleted} {#if community.community.deleted}
<Icon <Icon
src={Trash} src={Trash}
@@ -126,10 +128,7 @@
/> />
{/if} {/if}
</div> </div>
<div <div class="text-sm text-slate-500 dark:text-zinc-500 flex gap-0.5">
class="text-sm text-slate-500 dark:text-zinc-500 flex gap-0.5"
class:justify-center={view == 'cozy'}
>
<span class="overflow-hidden text-ellipsis"> <span class="overflow-hidden text-ellipsis">
{new URL(community.community.actor_id).hostname} {new URL(community.community.actor_id).hostname}
</span> </span>
+1 -1
View File
@@ -78,7 +78,7 @@
--> -->
<article <article
class={[ class={[
'relative cursor-pointer group/post', 'relative group/post',
settings.leftAlign && 'left-align', settings.leftAlign && 'left-align',
view == 'compact' && 'py-3 list-type compact', view == 'compact' && 'py-3 list-type compact',
view == 'cozy' && 'py-5 flex flex-col gap-2', view == 'cozy' && 'py-5 flex flex-col gap-2',
@@ -342,7 +342,7 @@
<h3 <h3
class={[ class={[
'max-sm:m-0!', 'max-sm:m-0!',
'font-medium text-balance max-w-xl', 'font-medium',
titleClass, titleClass,
settings.markReadPosts && read && 'text-slate-600 dark:text-zinc-400', settings.markReadPosts && read && 'text-slate-600 dark:text-zinc-400',
view == 'compact' ? 'text-base' : 'text-lg', view == 'compact' ? 'text-base' : 'text-lg',
@@ -314,10 +314,11 @@
<div class="flex flex-col gap-1"> <div class="flex flex-col gap-1">
<span class="font-medium text-sm">{$t('form.post.community')}</span> <span class="font-medium text-sm">{$t('form.post.community')}</span>
<Button <Button
class="w-full bg-white! dark:bg-black! h-[38px]" class="w-full"
onclick={() => (data.community = null)} onclick={() => (data.community = null)}
alignment="left" alignment="left"
size="sm" size="sm"
rounding="xl"
> >
{#snippet prefix()} {#snippet prefix()}
<Avatar <Avatar
@@ -327,7 +328,7 @@
/> />
{/snippet} {/snippet}
<div class="flex flex-col gap-0"> <div class="flex flex-col gap-0">
<span class="text-xs">{data.community.name}</span> <span class="text-sm">{data.community.name}</span>
<span class="text-[10px] leading-3"> <span class="text-[10px] leading-3">
{new URL(data.community.actor_id).hostname} {new URL(data.community.actor_id).hostname}
</span> </span>
+55 -49
View File
@@ -42,61 +42,67 @@
} }
</script> </script>
<nav {#if hasMore || page != 1}
aria-label={$t('aria.pagination.nav')} <nav
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" aria-label={$t('aria.pagination.nav')}
> class={[
{#if children} 'flex flex-row gap-2 items-center justify-center bg-white dark:bg-zinc-900',
<span class="text-sm text-slate-600 dark:text-zinc-400 font-medium"> 'border border-slate-200 dark:border-zinc-800 rounded-full overflow-hidden w-max mx-auto p-0.5',
{@render children?.()} 'shadow-md',
</span> ]}
<hr class="border-slate-200 dark:border-zinc-800 flex-1" /> >
{/if} {#if children}
{#if back} <span class="text-sm text-slate-600 dark:text-zinc-400 font-medium">
{@render children?.()}
</span>
<hr class="border-slate-200 dark:border-zinc-800 flex-1" />
{/if}
{#if back}
<Button
href={customHref(href?.(cursor?.back ?? page - 1))}
color="tertiary"
onclick={() => invalidate(pageData.url)}
title={$t('common.back')}
rounding="pill"
size="custom"
class="text-inherit dark:text-inherit p-1"
disabled={(cursor?.back == undefined && cursor?.next != undefined) ||
page <= 1}
>
{#snippet suffix()}
<Icon src={ChevronLeft} size="24" mini />
{/snippet}
</Button>
{/if}
{#if page}
<div style="display: grid;">
{#key page}
<div
in:fly={{ y: 8, easing: backOut, duration: 400, delay: 100 }}
out:fly={{ y: 8, easing: backOut, duration: 400 }}
class="text-lg font-medium"
style="grid-column: 1; grid-row: 1;"
>
{page}
</div>
{/key}
</div>
{/if}
<Button <Button
href={customHref(href?.(cursor?.back ?? page - 1))} href={customHref(href?.(cursor?.next ?? page + 1))}
color="tertiary" color="tertiary"
onclick={() => invalidate(pageData.url)} onclick={() => invalidate(pageData.url)}
title={$t('common.back')} title={$t('common.next')}
rounding="pill"
size="custom" size="custom"
rounding="pill"
class="text-inherit dark:text-inherit p-1" class="text-inherit dark:text-inherit p-1"
disabled={(cursor?.back == undefined && cursor?.next != undefined) || disabled={!hasMore}
page <= 1}
> >
{#snippet suffix()} {#snippet suffix()}
<Icon src={ChevronLeft} size="24" mini /> <Icon src={ChevronRight} size="24" mini />
{/snippet} {/snippet}
</Button> </Button>
{/if} </nav>
{/if}
{#if page}
<div style="display: grid;">
{#key page}
<div
in:fly={{ y: 8, easing: backOut, duration: 400, delay: 100 }}
out:fly={{ y: 8, easing: backOut, duration: 400 }}
class="text-lg font-medium"
style="grid-column: 1; grid-row: 1;"
>
{page}
</div>
{/key}
</div>
{/if}
<Button
href={customHref(href?.(cursor?.next ?? page + 1))}
color="tertiary"
onclick={() => invalidate(pageData.url)}
title={$t('common.next')}
size="custom"
rounding="pill"
class="text-inherit dark:text-inherit p-1"
disabled={!hasMore}
>
{#snippet suffix()}
<Icon src={ChevronRight} size="24" mini />
{/snippet}
</Button>
</nav>
+1 -1
View File
@@ -3,7 +3,7 @@
const placements = { const placements = {
top: 'top-6 lg:top-22', top: 'top-6 lg:top-22',
bottom: 'bottom-22 lg:bottom-6', bottom: 'bottom-22 lg:bottom-6 mt-6',
} }
interface Props { interface Props {
@@ -13,6 +13,7 @@
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' style?: 'header' | 'subpage'
margin?: boolean
} }
let { let {
@@ -21,6 +22,7 @@
buildUrl = (_, href) => href, buildUrl = (_, href) => href,
children, children,
style = 'header', style = 'header',
margin = true,
}: Props = $props() }: Props = $props()
let matchType = $derived<('search' | 'pathname')[]>( let matchType = $derived<('search' | 'pathname')[]>(
@@ -53,10 +55,12 @@
<nav <nav
class={[ class={[
'flex flex-row items-center my-2 sm:mt-0 flex-wrap z-20', 'flex flex-row items-center sm:mt-0 flex-wrap z-20',
style == 'header' style == 'header'
? 'p-1 gap-x-8 gap-y-4 justify-center sm:justify-start' ? 'p-1 gap-x-8 gap-y-4 justify-center sm:justify-start'
: 'gap-2', : 'gap-2',
margin && 'my-2',
margin && style == 'subpage' && 'mb-3',
]} ]}
> >
{#each routes as route, index (route.href)} {#each routes as route, index (route.href)}
@@ -86,7 +90,3 @@
{/each} {/each}
{@render children?.()} {@render children?.()}
</nav> </nav>
{#if style == 'subpage'}
<div class="h-3"></div>
{/if}
+1
View File
@@ -3,6 +3,7 @@
export { default as Button } from './button/Button.svelte' export { default as Button } from './button/Button.svelte'
export { buttonColor, buttonSize, buttonShadow } from './button/Button.svelte' export { buttonColor, buttonSize, buttonShadow } from './button/Button.svelte'
export { default as Spinner } from './loader/Spinner.svelte' export { default as Spinner } from './loader/Spinner.svelte'
export { default as TextLoader } from './loader/TextLoader.svelte'
export { default as Material } from './materials/Material.svelte' export { default as Material } from './materials/Material.svelte'
export { default as Label } from './forms/Label.svelte' export { default as Label } from './forms/Label.svelte'
+42
View File
@@ -0,0 +1,42 @@
<script lang="ts">
import type { Snippet } from 'svelte'
interface Props {
children: Snippet
}
let { children }: Props = $props()
</script>
<div class="text-loader">
{@render children?.()}
</div>
<style>
.text-loader {
color: transparent;
background: linear-gradient(
to right,
var(--color-zinc-500),
var(--color-zinc-50),
var(--color-zinc-500)
);
background-size: 200%;
background-clip: text;
display: inline;
width: max-content;
animation: pulse 1s infinite linear;
}
@keyframes pulse {
0% {
background-position: 100%;
}
50% {
background-position: 0%;
}
100% {
background-position: -100%;
}
}
</style>
+2 -2
View File
@@ -24,8 +24,8 @@
<div <div
class={[ class={[
toastColors[toast.type], toastColors[toast.type],
'relative rounded-xl overflow-hidden flex flex-row items-center gap-2 px-3 py-3', 'relative rounded-xl overflow-hidden flex flex-row items-center gap-2 px-3 py-3 border border-slate-200 dark:border-zinc-800',
'bg-white dark:bg-zinc-900 shadow-lg', 'bg-white dark:bg-zinc-925 shadow-lg',
toast.long ? 'w-full max-w-lg' : 'w-80', toast.long ? 'w-full max-w-lg' : 'w-80',
]} ]}
transition:fly={{ transition:fly={{
+1 -4
View File
@@ -16,10 +16,7 @@ export async function load({ params, fetch }) {
const split = comment.comment_view.comment.path.split('.') const split = comment.comment_view.comment.path.split('.')
const threadPath = const threadPath = split.slice(-5).join('.')
split.length > 4
? comment.comment_view.comment.id
: split.slice(-5).join('.')
redirect( redirect(
302, 302,
+3 -2
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 Fixate from '$lib/components/ui/generic/Fixate.svelte'
let { data } = $props() let { data } = $props()
@@ -157,10 +158,10 @@
</ul> </ul>
{/if} {/if}
{#if data.communities.value.length > 0} {#if data.communities.value.length > 0}
<div class="sticky z-30 mx-auto max-w-full bottom-22 lg:bottom-6"> <Fixate placement="bottom">
<Pageination <Pageination
page={Number(page.url.searchParams.get('page')) || 1} page={Number(page.url.searchParams.get('page')) || 1}
href={c => `?page=${c}`} href={c => `?page=${c}`}
/> />
</div> </Fixate>
{/if} {/if}
+16 -13
View File
@@ -1,4 +1,5 @@
<script lang="ts"> <script lang="ts">
import { site } from '$lib/lemmy.svelte'
import Header from '$lib/components/ui/layout/pages/Header.svelte' import Header from '$lib/components/ui/layout/pages/Header.svelte'
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'
@@ -10,18 +11,20 @@
{$t('nav.create.label')} {$t('nav.create.label')}
</Header> </Header>
<Tabs {#if !site || !site.data?.site_view.local_site.community_creation_admin_only}
style="subpage" <Tabs
routes={[ style="subpage"
{ routes={[
href: '/create/post', {
name: $t('nav.create.post'), href: '/create/post',
}, name: $t('nav.create.post'),
{ },
href: '/create/community', {
name: $t('nav.create.community'), href: '/create/community',
}, name: $t('nav.create.community'),
]} },
/> ]}
/>
{/if}
{@render children?.()} {@render children?.()}
+1 -8
View File
@@ -1,19 +1,12 @@
<script lang="ts"> <script lang="ts">
import { goto } from '$app/navigation' import { goto } from '$app/navigation'
import { profile } from '$lib/auth.svelte.js'
import PostForm from '$lib/components/lemmy/post/form/PostForm.svelte' import PostForm from '$lib/components/lemmy/post/form/PostForm.svelte'
import { t } from '$lib/i18n/translations.js' import { t } from '$lib/i18n/translations.js'
import { getSessionStorage, setSessionStorage } from '$lib/session.js' import { getSessionStorage, setSessionStorage } from '$lib/session.js'
import { onDestroy, onMount } from 'svelte' import { onDestroy } from 'svelte'
let { data } = $props() let { data } = $props()
onMount(() => {
if (!profile.current?.jwt) {
goto('/login')
}
})
let community = getSessionStorage('lastSeenCommunity') as let community = getSessionStorage('lastSeenCommunity') as
| { id: number; name: string } | { id: number; name: string }
| undefined | undefined
+5
View File
@@ -1,3 +1,8 @@
import { profile } from '$lib/auth.svelte.js'
import { redirect } from '@sveltejs/kit'
export const load = ({ url }) => { export const load = ({ url }) => {
if (!profile.current.jwt) redirect(302, '/login')
return { crosspost: Boolean(url.searchParams.get('crosspost')) } return { crosspost: Boolean(url.searchParams.get('crosspost')) }
} }
@@ -26,7 +26,7 @@ interface PartialPost {
function buildContext(thread?: string) { function buildContext(thread?: string) {
let parentId: number | undefined let parentId: number | undefined
let showContext: boolean = false let showContext: boolean = false
const max_depth = 3 let max_depth = 3
if (thread) { if (thread) {
const split = thread.split('.') const split = thread.split('.')
@@ -35,6 +35,7 @@ function buildContext(thread?: string) {
else { else {
parentId = Number(thread.split('.')[0]) parentId = Number(thread.split('.')[0])
showContext = true showContext = true
max_depth = 5
} }
} }
@@ -35,9 +35,11 @@
<Header pageHeader> <Header pageHeader>
{routes.find(r => page.url.pathname == r.href)?.name ?? {routes.find(r => page.url.pathname == r.href)?.name ??
$t('routes.profile.credentials')} $t('routes.profile.credentials')}
{#snippet extended()}
<Tabs style="subpage" margin={false} {routes}></Tabs>
{/snippet}
</Header> </Header>
<Tabs style="subpage" {routes}></Tabs>
<div <div
class={[ class={[
page.url.pathname == '/profile/password' && ' p-8', page.url.pathname == '/profile/password' && ' p-8',
+1
View File
@@ -67,6 +67,7 @@
icon={Bookmark} icon={Bookmark}
title="No saved items" title="No saved items"
description="Save posts or comments, and they'll be here to refer to them later." description="Save posts or comments, and they'll be here to refer to them later."
class="my-auto"
/> />
{:else} {:else}
<CommonList items={data.data} size="lg"> <CommonList items={data.data} size="lg">
+3 -4
View File
@@ -21,7 +21,7 @@
isUser, isUser,
} from '$lib/lemmy/item.js' } from '$lib/lemmy/item.js'
import { searchParam } from '$lib/util.svelte.js' import { searchParam } from '$lib/util.svelte.js'
import { Button, Select, Spinner } from 'mono-svelte' import { Button, Select, Spinner, TextLoader } from 'mono-svelte'
import Option from 'mono-svelte/forms/select/Option.svelte' import Option from 'mono-svelte/forms/select/Option.svelte'
import { import {
AdjustmentsHorizontal, AdjustmentsHorizontal,
@@ -151,8 +151,7 @@
class="flex gap-2 items-center my-4" class="flex gap-2 items-center my-4"
out:slide={{ axis: 'y', easing: expoOut }} out:slide={{ axis: 'y', easing: expoOut }}
> >
<Spinner width={24} /> <TextLoader>{$t('routes.search.federating')}</TextLoader>
<span>{$t('routes.search.federating')}</span>
</div> </div>
{:then object} {:then object}
{#if object} {#if object}
@@ -175,7 +174,7 @@
</div> </div>
{/if} {/if}
{/await} {/await}
<CommonList items={data.results.value} animate size="lg"> <CommonList items={data.results.value}>
{#snippet item(result)} {#snippet item(result)}
{#if isPostView(result)} {#if isPostView(result)}
<PostItem post={result} /> <PostItem post={result} />
+1 -3
View File
@@ -13,9 +13,7 @@
let searchElement = $state<HTMLInputElement>() let searchElement = $state<HTMLInputElement>()
</script> </script>
<div <div class="flex gap-2 flex-row items-center w-full text-base h-10">
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}
bind:element={searchElement} bind:element={searchElement}
+1 -1
View File
@@ -67,7 +67,7 @@
</svelte:head> </svelte:head>
<div class="mx-auto max-w-xl flex flex-col gap-4 my-auto h-max w-full"> <div class="mx-auto max-w-xl flex flex-col gap-4 my-auto h-max w-full">
<Button href="/accounts" class="inline-block mb-4 w-max" rounding="pill"> <Button href="/accounts" class="mb-4 w-max" rounding="pill">
<Icon src={ArrowLeft} size="16" micro /> <Icon src={ArrowLeft} size="16" micro />
{$t('common.back')} {$t('common.back')}
</Button> </Button>
+2 -2
View File
@@ -157,8 +157,7 @@
class="flex flex-col gap-4 h-full w-full flex-2/3" class="flex flex-col gap-4 h-full w-full flex-2/3"
onsubmit={preventDefault(submit)} onsubmit={preventDefault(submit)}
> >
<ErrorContainer scope={page.url.pathname} /> <Button href="/accounts" class=" mb-4 w-max" rounding="pill">
<Button href="/accounts" class="inline-block mb-4 w-max" rounding="pill">
<Icon src={ArrowLeft} size="16" micro /> <Icon src={ArrowLeft} size="16" micro />
{$t('common.back')} {$t('common.back')}
</Button> </Button>
@@ -177,6 +176,7 @@
</span> </span>
{/snippet} {/snippet}
</Header> </Header>
<ErrorContainer scope={page.url.pathname} />
{#if data.site_view.local_site.registration_mode != 'Closed'} {#if data.site_view.local_site.registration_mode != 'Closed'}
<div class="flex flex-col md:flex-row gap-2 *:flex-1"> <div class="flex flex-col md:flex-row gap-2 *:flex-1">
+2 -2
View File
@@ -1,4 +1,4 @@
import { getClient } from '$lib/client/lemmy.svelte' import { client } from '$lib/client/lemmy.svelte'
import { getItemPublished } from '$lib/lemmy/item.js' import { getItemPublished } from '$lib/lemmy/item.js'
import { ReactiveState } from '$lib/promise.svelte.js' import { ReactiveState } from '$lib/promise.svelte.js'
import type { SortType } from '$lib/client/types' import type { SortType } from '$lib/client/types'
@@ -9,7 +9,7 @@ export async function load({ params, url, fetch }) {
(url.searchParams.get('type') as 'comments' | 'posts' | 'all') || 'all' (url.searchParams.get('type') as 'comments' | 'posts' | 'all') || 'all'
const sort: SortType = (url.searchParams.get('sort') as SortType) || 'New' const sort: SortType = (url.searchParams.get('sort') as SortType) || 'New'
const user = await getClient(undefined, fetch).getPersonDetails({ const user = await client({ func: fetch }).getPersonDetails({
limit: 20, limit: 20,
page: page, page: page,
username: params.name, username: params.name,
+1 -1
View File
@@ -11,7 +11,7 @@
--font-display: Inter, system-ui, sans-serif; --font-display: Inter, system-ui, sans-serif;
--font-mono: monospace; --font-mono: monospace;
--animate-pop-in: pop-in 0.8s cubic-bezier(0.075, 0.82, 0.165, 1); --animate-pop-in: pop-in 0.8s cubic-bezier(0.075, 0.82, 0.165, 1) forwards;
--ease-cubic: cubic-bezier(0.075, 0.82, 0.165, 1); --ease-cubic: cubic-bezier(0.075, 0.82, 0.165, 1);
--spacing-22: 88px; --spacing-22: 88px;