Merge branch 'main' into new-theme-handler

This commit is contained in:
Xylight committed 2024-07-25 10:43:20 -07:00
commit 6fd970320b
14 files changed
+148 -75

No files matched your search

@@ -75,15 +75,25 @@
})
if ($profile.user) {
$profile.user = {
...$profile.user,
moderates: [
...$profile.user.moderates,
{
community: res.community_view.community,
moderator: $profile.user.local_user_view.person,
},
],
const c = $profile.user.moderates
.map((m) => m.community.id)
.indexOf(res.community_view.community.id)
if (c != -1) {
$profile.user.moderates[c] = {
community: res.community_view.community,
moderator: $profile.user.local_user_view.person,
}
} else {
$profile.user = {
...$profile.user,
moderates: [
...$profile.user.moderates,
{
community: res.community_view.community,
moderator: $profile.user.local_user_view.person,
},
],
}
}
addSubscription(res.community_view.community, true)
@@ -106,7 +116,10 @@
}
</script>
<form on:submit|preventDefault={submit} class="flex flex-col gap-4 h-full">
<form
on:submit|preventDefault={submit}
class="flex flex-col gap-4 h-full w-full"
>
<slot name="formtitle">
<Header>{$t('routes.createCommunity')}</Header>
</slot>
@@ -15,9 +15,9 @@
export let navigate: boolean = true
export let changeDefault: boolean = false
let sort: string = selected.startsWith('Top') ? 'TopAll' : selected
let sort: string = selected?.startsWith('Top') ? 'TopAll' : selected
$: if (selected) {
sort = selected.startsWith('Top') ? 'TopAll' : selected
sort = selected?.startsWith('Top') ? 'TopAll' : selected
}
const setSelected = () => (selected = sort)
$: changeDefault
@@ -148,7 +148,7 @@
<Button
size="sm"
href="/post/{getInstance()}/{post.post.id}"
class="text-inherit h-full px-3"
class="!text-inherit h-full px-3"
color="ghost"
rounding="pill"
target={$userSettings.openLinksInNewTab ? '_blank' : ''}
+27 -10
View File
@@ -19,7 +19,10 @@
For embed-type posts. Displays embed card or a compact link.
-->
{#if embed_title && !compact}
<Material color="distinct" class="flex flex-col-reverse sm:flex-row overflow-hidden gap-4">
<Material
color="distinct"
class="flex flex-col-reverse sm:flex-row overflow-hidden gap-4"
>
<div class="flex flex-col gap-2">
{#if richURL}
<Link
@@ -52,14 +55,28 @@
target="_blank"
class="-m-4 mb-auto sm:-mb-4 sm:ml-auto flex-shrink-0 sm:w-1/3 sm:max-w-60"
>
<img
src={optimizeImageURL(thumbnail_url, 256)}
class="w-full h-full object-cover bg-slate-200 dark:bg-zinc-800"
width={600}
height={400}
alt={embed_title}
class:blur-3xl={nsfw}
/>
<picture>
<source
srcset={optimizeImageURL(thumbnail_url, 256)}
media="(max-width: 256px)"
/>
<source
srcset={optimizeImageURL(thumbnail_url, 512)}
media="(max-width: 512px)"
/>
<source
srcset={optimizeImageURL(thumbnail_url, 1024)}
media="(max-width: 1024px)"
/>
<img
src={optimizeImageURL(thumbnail_url, -1)}
class="object-cover w-full sm:max-w-96 h-48 sm:h-72 bg-slate-200 dark:bg-zinc-800"
width={600}
height={400}
alt={embed_title}
class:blur-3xl={nsfw}
/>
</picture>
</a>
{/if}
</Material>
@@ -92,7 +109,7 @@
<a href={url} target="_blank">
<img
src={optimizeImageURL(thumbnail_url, 256)}
class="rounded-md max-w-[300px] w-full h-auto aspect-video object-cover bg-slate-200 dark:bg-zinc-800"
class="rounded-md max-w-72 w-full h-auto aspect-video object-cover bg-slate-200 dark:bg-zinc-800"
width={600}
height={400}
alt={embed_title ?? 'Embed prevented alt text'}
+6 -16
View File
@@ -15,18 +15,7 @@
<script lang="ts">
import FormattedNumber from '$lib/components/util/FormattedNumber.svelte'
import type { Post } from 'lemmy-js-client'
import {
ArrowDown,
ArrowDownCircle,
ArrowUp,
ArrowUpCircle,
ChevronDown,
ChevronUp,
HandThumbDown,
HandThumbUp,
Icon,
Key,
} from 'svelte-hero-icons'
import { ChevronDown, ChevronUp, Icon } from 'svelte-hero-icons'
import { profile } from '$lib/auth.js'
import { vote as voteItem } from '$lib/lemmy/contentview.js'
import { Button, Popover, buttonColor, toast } from 'mono-svelte'
@@ -63,12 +52,13 @@
<div
class="{buttonColor.ghost} rounded-full h-full font-medium flex items-center *:p-2
hover:bg-white hover:dark:bg-zinc-900 overflow-hidden transition-colors flex-shrink-0
{vote != 0 ? '' : '!text-inherit'} !text-inherit
{loading ? 'animate-pulse opacity-75 pointer-events-none' : ''}"
>
<button
on:click={() => castVote(vote == 1 ? 0 : 1)}
class="flex items-center gap-1 {buttonColor.ghost} transition-colors border-0
{vote == 1 ? shouldShowVoteColor(vote, 'upvotes') : ''}"
class="flex items-center gap-0.5 {buttonColor.ghost} transition-colors border-0
{vote == 1 ? shouldShowVoteColor(vote, 'upvotes') : '!text-inherit'}"
>
<Icon src={ChevronUp} size="20" micro />
<span class="grid text-sm">
@@ -89,8 +79,8 @@
></div>
<button
on:click={() => castVote(vote == -1 ? 0 : -1)}
class="flex items-center flex-row-reverse gap-1 {buttonColor.ghost} transition-colors border-0
{vote == -1 ? shouldShowVoteColor(vote, 'downvotes') : ''}"
class="flex items-center flex-row-reverse gap-0.5 {buttonColor.ghost} transition-colors border-0
{vote == -1 ? shouldShowVoteColor(vote, 'downvotes') : '!text-inherit'}"
>
<Icon src={ChevronDown} size="20" micro />
<span class="grid text-sm">