Merge branch 'main' into infinite-scroll

This commit is contained in:
Xylight committed 2024-07-07 18:20:19 -07:00
commit 0da8d729f6
30 files changed
+431 -224

No files matched your search

@@ -55,6 +55,11 @@
}
</script>
<!--
@component
This is the sole component for displaying posts.
It adapts to all kinds of form factors for different contexts, such as feeds, full post view, and crosspost list.
-->
<!-- svelte-ignore a11y-no-static-element-interactions -->
<!-- svelte-ignore a11y-click-events-have-key-events -->
<Material
@@ -14,6 +14,10 @@
$: richURL = parseURL(url)
</script>
<!--
@component
For embed-type posts. Displays embed card or a compact link.
-->
{#if embed_title && !compact}
<Material color="distinct" class="flex flex-row gap-4">
<div class="flex flex-col gap-2">
@@ -45,6 +45,10 @@
}
</script>
<!--
@component
This component will build two different things: a post's meta block and the title.
-->
<div
class="grid w-full meta {community
? 'grid-rows-2'
@@ -184,6 +188,8 @@
>
<Markdown source={title} inline noStyle class="leading-[1.3]"></Markdown>
</a>
{:else}
<div style="grid-area: title; margin: 0;"></div>
{/if}
<style>
+3 -3
View File
@@ -18,8 +18,8 @@ export const bestImageURL = (
}
if (compact && post.thumbnail_url)
return `${post.thumbnail_url}?thumbnail=256&format=webp`
else if (compact && post.url) return `${post.url}?thumbnail=256&format=webp`
return `${post.thumbnail_url}?thumbnail=512&format=webp`
else if (compact && post.url) return `${post.url}?thumbnail=512&format=webp`
if (post.url) return `${post.url}?thumbnail=${width}&format=webp`
else if (post.thumbnail_url)
@@ -37,7 +37,7 @@ export const optimizeImageURL = (
url.searchParams.append('format', 'webp')
url.searchParams.append(
'thumbnail',
findClosestNumber([128, 256, 512, 1024], width).toString()
findClosestNumber([128, 256, 512, 728, 1024, 1536], width).toString()
)
return url.toString()
} catch (e) {
@@ -92,6 +92,10 @@
$: embedUrl = urlToEmbed(url)
</script>
<!--
@component
Displays a video file or embedded video iframe.
-->
{#if opened}
{#if type == 'video'}
<!-- svelte-ignore a11y-media-has-caption -->
@@ -23,6 +23,12 @@
let showAltText = false
</script>
<!--
@component
This component will show either
- A media item (pictures, videos) (large form factor posts only)
- Embed link/card.
-->
{#if type == 'image'}
{#if view == 'card' || view == 'cozy'}
<!--disabled preloads here since most people will hover over every image while scrolling-->
@@ -39,9 +45,9 @@
>
<!-- svelte-ignore a11y-missing-attribute -->
<img
src={bestImageURL(post, false, 256)}
src={bestImageURL(post, false, 64)}
loading="lazy"
class="-z-10 absolute top-0 left-0 w-full h-full object-cover blur-xl opacity-50"
class="-z-10 absolute top-0 left-0 w-full h-full object-cover blur-xl opacity-40"
/>
<picture class="max-h-[inherit]">
<source
@@ -17,6 +17,10 @@
export let type: MediaType = 'none'
</script>
<!--
@component
Thumbnails for compact and list view posts.
-->
{#if view == 'compact' || (view == 'list' && type != 'none')}
<div
class="w-24 sm:w-32 h-24 relative group/media {$$props.class ?? ''}"
+1 -1
View File
@@ -3,7 +3,7 @@
import { createAvatar } from '@dicebear/core'
import * as initials from '@dicebear/initials'
const sizes = [48, 64, 128, 256, 512]
const sizes = [16, 32, 48, 64, 128, 256, 512]
export let url: string | undefined
export let alt: string = ''
+5 -1
View File
@@ -68,7 +68,11 @@
<svelte:window bind:innerWidth={screenWidth} />
<div class="shell {$$props.class}" style={colorsToVars($colors)}>
<div
{...$$restProps}
class="shell {$$props.class}"
style={colorsToVars($colors)}
>
<slot />
<div
class="
+3 -3
View File
@@ -1,5 +1,5 @@
<script lang="ts">
import { profile, profileData } from '$lib/auth.js'
import { notifications, profile, profileData } from '$lib/auth.js'
import Link from '$lib/components/input/Link.svelte'
import ShieldIcon from '$lib/components/lemmy/moderation/ShieldIcon.svelte'
import {
@@ -112,7 +112,7 @@
class="relative"
isSelectedFilter={(path) => path.startsWith('/admin')}
>
{#if ($profile?.user?.notifications.applications ?? 0) > 0}
{#if ($notifications.applications ?? 0) > 0}
<div
class="rounded-full w-2 h-2 bg-red-500 absolute -top-1 -left-1"
/>
@@ -125,7 +125,7 @@
label={$t('nav.moderation')}
class="relative"
>
{#if ($profile?.user?.notifications.reports ?? 0) > 0}
{#if ($notifications.reports ?? 0) > 0}
<div
class="rounded-full w-2 h-2 bg-red-500 absolute -top-1 -left-1"
/>
+4 -4
View File
@@ -1,5 +1,5 @@
<script lang="ts">
import { profile } from '$lib/auth'
import { notifications, profile } from '$lib/auth'
import {
Badge,
@@ -73,7 +73,7 @@
alt={$profile.user.local_user_view.person.name}
/>
</div>
{#if $profile.user.notifications.inbox > 0}
{#if $notifications.inbox > 0}
<div
class="rounded-full w-2 h-2 bg-red-500 absolute top-0 left-0 z-10"
/>
@@ -104,9 +104,9 @@
<MenuButton link href="/inbox">
<Icon src={Inbox} mini width={16} slot="prefix" />
{$t('profile.inbox')}
{#if $profile.user.notifications.inbox > 0}
{#if $notifications.inbox > 0}
<Badge color="red-subtle" class="text-xs ml-auto font-bold !py-0.5">
{$profile.user.notifications.inbox}
{$notifications.inbox}
</Badge>
{/if}
</MenuButton>
+3 -3
View File
@@ -14,7 +14,7 @@
UserCircle,
UserGroup,
} from 'svelte-hero-icons'
import { profile, profileData } from '$lib/auth.js'
import { notifications, profile, profileData } from '$lib/auth.js'
import { userSettings } from '$lib/settings.js'
import SidebarButton from '$lib/components/ui/sidebar/SidebarButton.svelte'
import CommunityList from '$lib/components/ui/sidebar/CommunityList.svelte'
@@ -70,12 +70,12 @@
<SidebarButton icon={Inbox} href="/inbox">
<span slot="label" class="flex items-center gap-2">
{$t('profile.inbox')}
{#if $profile?.user?.notifications.inbox}
{#if $notifications.inbox}
<Badge
class="w-5 h-5 !p-0 grid place-items-center ml-auto"
color="red-subtle"
>
{$profile?.user?.notifications.inbox}
{$notifications.inbox}
</Badge>
{/if}
</span>