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
+108 -54

No files matched your search

+5
View File
@@ -72,8 +72,12 @@ export function client({
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
// but not here, so that if jwt == '', it doesnt put a bearer
const headers = jwt ? { authorization: `Bearer ${jwt}` } : {}
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(
instanceURL?: string,
func?: (
@@ -54,7 +54,7 @@
<div class={clazz}>
<div
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',
]}
>
@@ -63,7 +63,7 @@
community.community.name,
community.community.actor_id,
)}"
class="flex-1 w-full overflow-hidden"
class="flex-1 w-full overflow-hidden group"
data-sveltekit-preload-data="tap"
>
<div class="flex flex-row gap-2 items-center">
@@ -88,7 +88,9 @@
<div
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}
<Icon
src={Trash}
@@ -126,10 +128,7 @@
/>
{/if}
</div>
<div
class="text-sm text-slate-500 dark:text-zinc-500 flex gap-0.5"
class:justify-center={view == 'cozy'}
>
<div class="text-sm text-slate-500 dark:text-zinc-500 flex gap-0.5">
<span class="overflow-hidden text-ellipsis">
{new URL(community.community.actor_id).hostname}
</span>
+1 -1
View File
@@ -78,7 +78,7 @@
-->
<article
class={[
'relative cursor-pointer group/post',
'relative group/post',
settings.leftAlign && 'left-align',
view == 'compact' && 'py-3 list-type compact',
view == 'cozy' && 'py-5 flex flex-col gap-2',
@@ -342,7 +342,7 @@
<h3
class={[
'max-sm:m-0!',
'font-medium text-balance max-w-xl',
'font-medium',
titleClass,
settings.markReadPosts && read && 'text-slate-600 dark:text-zinc-400',
view == 'compact' ? 'text-base' : 'text-lg',
@@ -314,10 +314,11 @@
<div class="flex flex-col gap-1">
<span class="font-medium text-sm">{$t('form.post.community')}</span>
<Button
class="w-full bg-white! dark:bg-black! h-[38px]"
class="w-full"
onclick={() => (data.community = null)}
alignment="left"
size="sm"
rounding="xl"
>
{#snippet prefix()}
<Avatar
@@ -327,7 +328,7 @@
/>
{/snippet}
<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">
{new URL(data.community.actor_id).hostname}
</span>
+10 -4
View File
@@ -42,10 +42,15 @@
}
</script>
<nav
{#if hasMore || page != 1}
<nav
aria-label={$t('aria.pagination.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"
>
class={[
'flex flex-row gap-2 items-center justify-center bg-white dark:bg-zinc-900',
'border border-slate-200 dark:border-zinc-800 rounded-full overflow-hidden w-max mx-auto p-0.5',
'shadow-md',
]}
>
{#if children}
<span class="text-sm text-slate-600 dark:text-zinc-400 font-medium">
{@render children?.()}
@@ -99,4 +104,5 @@
<Icon src={ChevronRight} size="24" mini />
{/snippet}
</Button>
</nav>
</nav>
{/if}
+1 -1
View File
@@ -3,7 +3,7 @@
const placements = {
top: 'top-6 lg:top-22',
bottom: 'bottom-22 lg:bottom-6',
bottom: 'bottom-22 lg:bottom-6 mt-6',
}
interface Props {
@@ -13,6 +13,7 @@
buildUrl?: (currentRoute: SvelteURL | undefined, href: string) => string
children?: import('svelte').Snippet
style?: 'header' | 'subpage'
margin?: boolean
}
let {
@@ -21,6 +22,7 @@
buildUrl = (_, href) => href,
children,
style = 'header',
margin = true,
}: Props = $props()
let matchType = $derived<('search' | 'pathname')[]>(
@@ -53,10 +55,12 @@
<nav
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'
? 'p-1 gap-x-8 gap-y-4 justify-center sm:justify-start'
: 'gap-2',
margin && 'my-2',
margin && style == 'subpage' && 'mb-3',
]}
>
{#each routes as route, index (route.href)}
@@ -86,7 +90,3 @@
{/each}
{@render children?.()}
</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 { buttonColor, buttonSize, buttonShadow } from './button/Button.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 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
class={[
toastColors[toast.type],
'relative rounded-xl overflow-hidden flex flex-row items-center gap-2 px-3 py-3',
'bg-white dark:bg-zinc-900 shadow-lg',
'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-925 shadow-lg',
toast.long ? 'w-full max-w-lg' : 'w-80',
]}
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 threadPath =
split.length > 4
? comment.comment_view.comment.id
: split.slice(-5).join('.')
const threadPath = split.slice(-5).join('.')
redirect(
302,
+3 -2
View File
@@ -17,6 +17,7 @@
import { expoOut } from 'svelte/easing'
import { fly } from 'svelte/transition'
import SearchBar from '../search/SearchBar.svelte'
import Fixate from '$lib/components/ui/generic/Fixate.svelte'
let { data } = $props()
@@ -157,10 +158,10 @@
</ul>
{/if}
{#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
page={Number(page.url.searchParams.get('page')) || 1}
href={c => `?page=${c}`}
/>
</div>
</Fixate>
{/if}
+5 -2
View File
@@ -1,4 +1,5 @@
<script lang="ts">
import { site } from '$lib/lemmy.svelte'
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'
@@ -10,7 +11,8 @@
{$t('nav.create.label')}
</Header>
<Tabs
{#if !site || !site.data?.site_view.local_site.community_creation_admin_only}
<Tabs
style="subpage"
routes={[
{
@@ -22,6 +24,7 @@
name: $t('nav.create.community'),
},
]}
/>
/>
{/if}
{@render children?.()}
+1 -8
View File
@@ -1,19 +1,12 @@
<script lang="ts">
import { goto } from '$app/navigation'
import { profile } from '$lib/auth.svelte.js'
import PostForm from '$lib/components/lemmy/post/form/PostForm.svelte'
import { t } from '$lib/i18n/translations.js'
import { getSessionStorage, setSessionStorage } from '$lib/session.js'
import { onDestroy, onMount } from 'svelte'
import { onDestroy } from 'svelte'
let { data } = $props()
onMount(() => {
if (!profile.current?.jwt) {
goto('/login')
}
})
let community = getSessionStorage('lastSeenCommunity') as
| { id: number; name: string }
| undefined
+5
View File
@@ -1,3 +1,8 @@
import { profile } from '$lib/auth.svelte.js'
import { redirect } from '@sveltejs/kit'
export const load = ({ url }) => {
if (!profile.current.jwt) redirect(302, '/login')
return { crosspost: Boolean(url.searchParams.get('crosspost')) }
}
@@ -26,7 +26,7 @@ interface PartialPost {
function buildContext(thread?: string) {
let parentId: number | undefined
let showContext: boolean = false
const max_depth = 3
let max_depth = 3
if (thread) {
const split = thread.split('.')
@@ -35,6 +35,7 @@ function buildContext(thread?: string) {
else {
parentId = Number(thread.split('.')[0])
showContext = true
max_depth = 5
}
}
@@ -35,9 +35,11 @@
<Header pageHeader>
{routes.find(r => page.url.pathname == r.href)?.name ??
$t('routes.profile.credentials')}
{#snippet extended()}
<Tabs style="subpage" margin={false} {routes}></Tabs>
{/snippet}
</Header>
<Tabs style="subpage" {routes}></Tabs>
<div
class={[
page.url.pathname == '/profile/password' && ' p-8',
+1
View File
@@ -67,6 +67,7 @@
icon={Bookmark}
title="No saved items"
description="Save posts or comments, and they'll be here to refer to them later."
class="my-auto"
/>
{:else}
<CommonList items={data.data} size="lg">
+3 -4
View File
@@ -21,7 +21,7 @@
isUser,
} from '$lib/lemmy/item.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 {
AdjustmentsHorizontal,
@@ -151,8 +151,7 @@
class="flex gap-2 items-center my-4"
out:slide={{ axis: 'y', easing: expoOut }}
>
<Spinner width={24} />
<span>{$t('routes.search.federating')}</span>
<TextLoader>{$t('routes.search.federating')}</TextLoader>
</div>
{:then object}
{#if object}
@@ -175,7 +174,7 @@
</div>
{/if}
{/await}
<CommonList items={data.results.value} animate size="lg">
<CommonList items={data.results.value}>
{#snippet item(result)}
{#if isPostView(result)}
<PostItem post={result} />
+1 -3
View File
@@ -13,9 +13,7 @@
let searchElement = $state<HTMLInputElement>()
</script>
<div
class="flex gap-2 flex-row items-center w-full text-base h-10 drop-shadow-xl"
>
<div class="flex gap-2 flex-row items-center w-full text-base h-10">
<TextInput
bind:value={query}
bind:element={searchElement}
+1 -1
View File
@@ -67,7 +67,7 @@
</svelte:head>
<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 />
{$t('common.back')}
</Button>
+2 -2
View File
@@ -157,8 +157,7 @@
class="flex flex-col gap-4 h-full w-full flex-2/3"
onsubmit={preventDefault(submit)}
>
<ErrorContainer scope={page.url.pathname} />
<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 />
{$t('common.back')}
</Button>
@@ -177,6 +176,7 @@
</span>
{/snippet}
</Header>
<ErrorContainer scope={page.url.pathname} />
{#if data.site_view.local_site.registration_mode != 'Closed'}
<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 { ReactiveState } from '$lib/promise.svelte.js'
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'
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,
page: page,
username: params.name,
+1 -1
View File
@@ -11,7 +11,7 @@
--font-display: Inter, system-ui, sans-serif;
--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);
--spacing-22: 88px;