Merge pull request #638 from Xyphyn/design-fixes

design: fix a bunch of annoying things
This commit is contained in:
Xylight authored and GitHub committed 2025-08-21 19:01:29 -07:00
commit 2fde48cbfb
39 files changed
+398 -447

No files matched your search

@@ -11,7 +11,7 @@
import { deleteItem, save } from '$lib/lemmy/contentview.js' import { deleteItem, save } from '$lib/lemmy/contentview.js'
import { settings } from '$lib/settings.svelte' import { settings } from '$lib/settings.svelte'
import type { CommentView } from 'lemmy-js-client' import type { CommentView } from 'lemmy-js-client'
import { Button, Menu, MenuButton, MenuDivider } from 'mono-svelte' import { Button, Menu, MenuButton } from 'mono-svelte'
import { import {
Bookmark, Bookmark,
BookmarkSlash, BookmarkSlash,
@@ -69,15 +69,14 @@
title={$t('comment.actions.label')} title={$t('comment.actions.label')}
color="tertiary" color="tertiary"
rounding="pill" rounding="pill"
size="square-sm" size="square-md"
class="text-slate-600 dark:text-zinc-400" class="text-slate-600 dark:text-zinc-400"
> >
{#snippet prefix()} {#snippet prefix()}
<Icon src={EllipsisHorizontal} width={16} height={16} mini /> <Icon src={EllipsisHorizontal} size="16" micro />
{/snippet} {/snippet}
</Button> </Button>
{/snippet} {/snippet}
<MenuDivider>{$t('comment.actions.label')}</MenuDivider>
<MenuButton <MenuButton
onclick={() => { onclick={() => {
if (navigator.share) if (navigator.share)
@@ -41,19 +41,14 @@
<div bind:this={offsetEl}> <div bind:this={offsetEl}>
{#if offsetEl} {#if offsetEl}
<VirtualList <VirtualList
class="divide-y divide-slate-100 dark:divide-zinc-900 -mx-3 sm:-mx-6" class="divide-y-2 divide-slate-100 dark:divide-zinc-900 -mx-3 sm:-mx-6"
overscan={5} overscan={5}
estimatedHeight={500} estimatedHeight={500}
items={nodes} items={nodes}
{initialOffset} {initialOffset}
> >
{#snippet item(index)} {#snippet item(index)}
<div <div class={['px-3 sm:px-6', index % 2 == 1 && '']}>
class={[
'px-3 sm:px-6',
index % 2 == 1 && 'bg-slate-25 dark:bg-zinc-950',
]}
>
<Comments <Comments
bind:nodes={() => [nodes[index]], v => (nodes[index] = v[0])} bind:nodes={() => [nodes[index]], v => (nodes[index] = v[0])}
{post} {post}
@@ -76,6 +76,8 @@
import Entity from '$lib/components/ui/Entity.svelte' import Entity from '$lib/components/ui/Entity.svelte'
import Expandable from '$lib/components/ui/Expandable.svelte' import Expandable from '$lib/components/ui/Expandable.svelte'
import LabelStat from '$lib/components/ui/LabelStat.svelte' import LabelStat from '$lib/components/ui/LabelStat.svelte'
import CommonList from '$lib/components/ui/layout/CommonList.svelte'
import SidebarButton from '$lib/components/ui/sidebar/SidebarButton.svelte'
import { t } from '$lib/i18n/translations' import { t } from '$lib/i18n/translations'
import { client, getClient } from '$lib/lemmy.svelte.js' import { client, getClient } from '$lib/lemmy.svelte.js'
import { errorMessage } from '$lib/lemmy/error' import { errorMessage } from '$lib/lemmy/error'
@@ -105,9 +107,6 @@
NoSymbol, NoSymbol,
Plus, Plus,
} from 'svelte-hero-icons' } from 'svelte-hero-icons'
import ItemList from '../generic/ItemList.svelte'
import CommonList from '$lib/components/ui/layout/CommonList.svelte'
import SidebarButton from '$lib/components/ui/sidebar/SidebarButton.svelte'
let loading = $state({ let loading = $state({
blocking: false, blocking: false,
@@ -1,13 +1,13 @@
<script lang="ts"> <script lang="ts">
import { preventDefault } from 'svelte/legacy'
import { goto } from '$app/navigation' import { goto } from '$app/navigation'
import { profile } from '$lib/auth.svelte.js' import { profile } from '$lib/auth.svelte.js'
import ImageInputUpload from '$lib/components/form/ImageInputUpload.svelte'
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte' import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
import Header from '$lib/components/ui/layout/pages/Header.svelte' import Header from '$lib/components/ui/layout/pages/Header.svelte'
import SectionTitle from '$lib/components/ui/SectionTitle.svelte' import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
import { t } from '$lib/i18n/translations' import { t } from '$lib/i18n/translations'
import { getClient, site } from '$lib/lemmy.svelte.js' import { getClient, site } from '$lib/lemmy.svelte.js'
import { errorMessage } from '$lib/lemmy/error'
import { addSubscription } from '$lib/lemmy/user.js' import { addSubscription } from '$lib/lemmy/user.js'
import { import {
Badge, Badge,
@@ -17,15 +17,11 @@
TextInput, TextInput,
toast, toast,
} from 'mono-svelte' } from 'mono-svelte'
import Label from 'mono-svelte/forms/Label.svelte'
import Option from 'mono-svelte/forms/select/Option.svelte' import Option from 'mono-svelte/forms/select/Option.svelte'
import Select from 'mono-svelte/forms/select/Select.svelte' import Select from 'mono-svelte/forms/select/Select.svelte'
import Material from 'mono-svelte/materials/Material.svelte' import Material from 'mono-svelte/materials/Material.svelte'
import Menu from 'mono-svelte/popover/Menu.svelte' import Menu from 'mono-svelte/popover/Menu.svelte'
import { DocumentPlus, GlobeAlt, Icon, MapPin, Plus } from 'svelte-hero-icons' import { GlobeAlt, Icon, MapPin, Plus } from 'svelte-hero-icons'
import ImageUploadModal from '../modal/ImageUploadModal.svelte'
import { errorMessage } from '$lib/lemmy/error'
import ImageInputUpload from '$lib/components/form/ImageInputUpload.svelte'
interface Props { interface Props {
/** /**
@@ -140,15 +136,13 @@
formData.submitting = false formData.submitting = false
} }
let uploading = $state({
banner: false,
icon: false,
})
</script> </script>
<form <form
onsubmit={preventDefault(submit)} onsubmit={e => {
e.preventDefault()
submit()
}}
class="flex flex-col gap-4 h-full w-full" class="flex flex-col gap-4 h-full w-full"
> >
{#if formtitle}{@render formtitle()}{:else} {#if formtitle}{@render formtitle()}{:else}
+3 -4
View File
@@ -81,7 +81,7 @@
}) })
</script> </script>
<!-- <!--
@component @component
This is the sole component for displaying posts. 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. It adapts to all kinds of form factors for different contexts, such as feeds, full post view, and crosspost list.
@@ -90,7 +90,7 @@
<!-- svelte-ignore a11y_no_noninteractive_tabindex --> <!-- svelte-ignore a11y_no_noninteractive_tabindex -->
<div <div
class={[ class={[
'post relative max-w-full min-w-0 w-full cursor-pointer outline-hidden group', 'post relative max-w-full min-w-0 w-full cursor-pointer outline-hidden 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',
@@ -164,8 +164,7 @@
class="absolute overflow-hidden inset-0 class="absolute overflow-hidden inset-0
sm:rounded-xl bg-slate-50 dark:bg-zinc-900 sm:rounded-xl bg-slate-50 dark:bg-zinc-900
opacity-0 transition-all -z-50 no-list-margin opacity-0 transition-all -z-50 no-list-margin
group-hover:inset-y-0.5 group-hover:-inset-x-3 sm:group-hover:-inset-x-5 group-hover:opacity-100 group-hover/post:inset-y-0.5 group-hover/post:-inset-x-3 sm:group-hover/post:-inset-x-5 group-hover/post:opacity-100
group-focus:inset-y-0.5 group-focus:-inset-x-3 sm:group-focus:-inset-x-5 group-focus:opacity-100
duration-150" duration-150"
></div> ></div>
</div> </div>
@@ -1,28 +1,25 @@
<script lang="ts"> <script lang="ts">
import { goto } from '$app/navigation' import { goto } from '$app/navigation'
import { profile } from '$lib/auth.svelte' import { profile } from '$lib/auth.svelte'
import TextProps from '$lib/components/ui/text/TextProps.svelte'
import { t } from '$lib/i18n/translations' import { t } from '$lib/i18n/translations'
import { deleteItem, markAsRead } from '$lib/lemmy/contentview' import { deleteItem, markAsRead } from '$lib/lemmy/contentview'
import { communityLink, userLink } from '$lib/lemmy/generic'
import { setSessionStorage } from '$lib/session' import { setSessionStorage } from '$lib/session'
import { settings } from '$lib/settings.svelte' import { settings } from '$lib/settings.svelte'
import { instanceToURL } from '$lib/util.svelte' import { instanceToURL } from '$lib/util.svelte'
import type { PostView } from 'lemmy-js-client' import type { PostView } from 'lemmy-js-client'
import { Button, MenuButton, MenuDivider, toast } from 'mono-svelte' import { Button, Menu, MenuButton, toast } from 'mono-svelte'
import { import {
ArrowTopRightOnSquare, ArrowTopRightOnSquare,
EllipsisHorizontal,
Eye, Eye,
EyeSlash, EyeSlash,
Flag, Flag,
GlobeAmericas, GlobeAlt,
Icon, Icon,
MapPin, MapPin,
Newspaper,
PencilSquare, PencilSquare,
Share, Share,
Trash, Trash,
UserCircle,
XMark, XMark,
} from 'svelte-hero-icons' } from 'svelte-hero-icons'
import { report } from '../../moderation/moderation' import { report } from '../../moderation/moderation'
@@ -34,14 +31,24 @@
editing: boolean editing: boolean
} }
let localShare = $state(false)
let { post, onhide, editing = $bindable() }: Props = $props() let { post, onhide, editing = $bindable() }: Props = $props()
function share(global: boolean = true) {
const link = global
? post.post.ap_id
: `${instanceToURL(profile.current.instance)}/post/${post.post.id}`
if (navigator.share)
navigator.share?.({
url: link,
})
else {
navigator.clipboard.writeText(link)
toast({ content: $t('toast.copied') })
}
}
</script> </script>
<MenuDivider>
{$t('post.actions.more.actions')}
</MenuDivider>
{#if profile.current?.user && profile.current?.jwt && profile.current.user.local_user_view.person.id == post.creator.id} {#if profile.current?.user && profile.current?.jwt && profile.current.user.local_user_view.person.id == post.creator.id}
<MenuButton onclick={() => (editing = true)}> <MenuButton onclick={() => (editing = true)}>
{#snippet prefix()} {#snippet prefix()}
@@ -65,52 +72,57 @@
: $t('post.actions.more.markRead')} : $t('post.actions.more.markRead')}
</MenuButton> </MenuButton>
{/if} {/if}
<MenuButton <div class="flex flex-row">
onclick={() => { <MenuButton
if (navigator.share) onclick={() => share()}
navigator.share?.({ class={['flex-1', !post.post.local && 'rounded-r-xl']}
url: localShare >
? `${instanceToURL(profile.current.instance)}/post/${post.post.id}` {#snippet prefix()}
: post.post.ap_id, <Icon src={Share} size="16" micro />
}) {/snippet}
else {$t('post.actions.more.share')}
navigator.clipboard.writeText( </MenuButton>
localShare <!--svelte-ignore a11y_no_static_element_interactions -->
? `${instanceToURL(profile.current.instance)}/post/${post.post.id}` <!--svelte-ignore a11y_click_events_have_key_events-->
: post.post.ap_id, <div
) class="aspect-square w-max m-1 grid place-items-center"
toast({ content: $t('toast.copied') }) onclick={e => e.stopPropagation()}
}} >
class="flex-1 py-0!" {#if !post.post.local}
> <Menu>
{#snippet prefix()} {#snippet target()}
<Icon src={Share} size="16" micro /> <Button
{/snippet} aria-label={$t('post.actions.more.label')}
{$t('post.actions.more.share')} color="tertiary"
<div class="flex-1"></div> size="custom"
{#if !post.post.local} class="w-full h-full"
<div class="flex gap-1"> >
<Button {#snippet prefix()}
color={!localShare ? 'primary' : 'secondary'} <Icon
size="square-sm" src={EllipsisHorizontal}
rounding="pill" size="16"
onclick={() => (localShare = false)} micro
title={$t('filter.location.global')} class="text-slate-600 dark:text-zinc-400"
> />
<Icon src={GlobeAmericas} size="16" micro /> {/snippet}
</Button> </Button>
<Button {/snippet}
color={localShare ? 'primary' : 'secondary'} <MenuButton onclick={() => share(true)}>
size="square-sm" {#snippet prefix()}
rounding="pill" <Icon src={GlobeAlt} size="16" micro />
onclick={() => (localShare = true)} {/snippet}
title={$t('filter.location.local')} {$t('filter.location.global')}
> </MenuButton>
<Icon src={MapPin} size="16" micro /> <MenuButton onclick={() => share(false)}>
</Button> {#snippet prefix()}
</div> <Icon src={MapPin} size="16" micro />
{/if} {/snippet}
</MenuButton> {$t('filter.location.local')}
</MenuButton>
</Menu>
{/if}
</div>
</div>
{#if profile.current?.jwt} {#if profile.current?.jwt}
<MenuButton <MenuButton
onclick={() => { onclick={() => {
@@ -1,8 +1,9 @@
<script lang="ts"> <script lang="ts">
import { parseURL } from '$lib/components/input/Link.svelte' import { parseURL } from '$lib/components/input/Link.svelte'
import type { View } from '$lib/settings.svelte' import type { View } from '$lib/settings.svelte'
import { Button, Material } from 'mono-svelte' import { Material } from 'mono-svelte'
import { optimizeImageURL } from '../helpers' import { optimizeImageURL } from '../helpers'
import { Icon, Link } from 'svelte-hero-icons'
interface Props { interface Props {
url: string url: string
@@ -23,7 +24,7 @@
let richURL = $derived(parseURL(url)) let richURL = $derived(parseURL(url))
</script> </script>
<!-- <!--
@component @component
For embed-type posts. Displays embed card or a compact link. For embed-type posts. Displays embed card or a compact link.
--> -->
@@ -38,16 +39,17 @@
]} ]}
rounding="2xl" rounding="2xl"
element="article" element="article"
padding="sm"
> >
{#if thumbnail_url} {#if thumbnail_url}
<img <img
src={optimizeImageURL(thumbnail_url, 64)} src={optimizeImageURL(thumbnail_url, 32)}
alt="" alt=""
class="-z-10 absolute w-full object-cover h-full opacity-5 brightness-150 class="-z-10 absolute w-full object-cover h-full opacity-5 brightness-150
dark:brightness-70 dark:opacity-20 blur-2xl -inset-px" dark:brightness-70 dark:opacity-10 blur-2xl -inset-px"
/> />
{/if} {/if}
<div class="flex flex-col gap-2"> <div class="flex flex-col gap-1 p-3 -mt-2 sm:mt-0">
{#if richURL} {#if richURL}
<div <div
class="text-slate-600 dark:text-zinc-400 inline-flex items-center gap-1 text-xs font-medium" class="text-slate-600 dark:text-zinc-400 inline-flex items-center gap-1 text-xs font-medium"
@@ -58,9 +60,7 @@
<p class="font-medium text-base">{embed_title}</p> <p class="font-medium text-base">{embed_title}</p>
</div> </div>
{#if thumbnail_url} {#if thumbnail_url}
<picture <picture class="mb-auto sm:ml-auto shrink-0 sm:w-1/3 sm:max-w-60">
class="-m-4 mb-auto sm:-mb-4 sm:ml-auto shrink-0 sm:w-1/3 sm:max-w-60"
>
{#each ['webp'] as format} {#each ['webp'] as format}
<source <source
srcset="{optimizeImageURL( srcset="{optimizeImageURL(
@@ -78,7 +78,7 @@
{/each} {/each}
<img <img
src={optimizeImageURL(thumbnail_url, -1)} src={optimizeImageURL(thumbnail_url, -1)}
class="object-cover w-full sm:max-w-96 h-32 sm:min-h-16 bg-slate-200 dark:bg-zinc-800" class="object-cover w-full sm:max-w-96 h-32 sm:min-h-16 bg-slate-200 dark:bg-zinc-800 rounded-xl"
width={600} width={600}
height={400} height={400}
alt="" alt=""
@@ -89,23 +89,20 @@
</Material> </Material>
</a> </a>
{:else} {:else}
<Button <a
href={url} href={url}
target="_blank" target="_blank"
class="text-slate-900 dark:text-zinc-300 items-center class="flex flex-row text-slate-900 dark:text-zinc-400 items-center overflow-hidden group/link hover:underline space-x-1 my-1"
text-xs overflow-hidden max-w-full block shrink self-start w-max"
size="xs"
color="ghost"
rounding="pill"
> >
<Icon src={Link} size="16" micro class="shrink-0" />
{#if richURL} {#if richURL}
<div <div
class="flex max-w-full overflow-hidden font-medium self-start justify-self-start w-max" class="flex max-w-full overflow-hidden font-medium self-start justify-self-start w-max text-sm"
> >
{richURL.hostname} {richURL.hostname}
{#if richURL.pathname != '/'} {#if richURL.pathname != '/'}
<span <span
class="text-slate-500 dark:text-zinc-500 whitespace-nowrap font-normal" class="text-slate-500 dark:text-zinc-500 whitespace-nowrap font-normal group-hover/link:opacity-100 opacity-0 transition-opacity duration-100"
> >
{richURL.pathname} {richURL.pathname}
</span> </span>
@@ -114,5 +111,5 @@
{:else} {:else}
{url} {url}
{/if} {/if}
</Button> </a>
{/if} {/if}
@@ -26,8 +26,8 @@
href={postLink(post)} href={postLink(post)}
class={[ class={[
'container/a z-10 rounded-2xl cursor-pointer relative overflow-hidden', 'container/a z-10 rounded-2xl cursor-pointer relative overflow-hidden',
'bg-slate-100 dark:bg-zinc-900 transition-colors p-2', 'bg-slate-100 dark:bg-zinc-900 transition-colors',
'border border-slate-200 dark:border-zinc-800 hover:border-slate-300 hover:dark:border-zinc-700', 'border border-slate-200 dark:border-zinc-800 group',
]} ]}
data-sveltekit-preload-data="off" data-sveltekit-preload-data="off"
aria-label={post.name} aria-label={post.name}
@@ -36,7 +36,7 @@
tabindex="0" tabindex="0"
> >
<!-- svelte-ignore a11y_missing_attribute --> <!-- svelte-ignore a11y_missing_attribute -->
<div class="inset-2 absolute -z-10 rounded-xl overflow-hidden"> <div class="inset-0 absolute -z-10 rounded-xl overflow-hidden">
<img <img
loading="lazy" loading="lazy"
fetchpriority="auto" fetchpriority="auto"
@@ -71,7 +71,8 @@
src={bestImageURL(post, false, -1, null)} src={bestImageURL(post, false, -1, null)}
loading="lazy" loading="lazy"
class={[ class={[
'max-w-full rounded-xl z-30 transition-opacity max-h-[60vh] duration-500 object-contain mx-auto', 'max-w-full rounded-xl z-30 transition-all max-h-[60vh] duration-500 object-contain mx-auto group-hover:scale-98 group-active:scale-95',
'duration-200 ease-cubic',
imageLoaded === false ? 'opacity-0' : 'opacity-100', imageLoaded === false ? 'opacity-0' : 'opacity-100',
blur && 'blur-3xl', blur && 'blur-3xl',
]} ]}
+37 -5
View File
@@ -1,20 +1,52 @@
<script lang="ts"> <script lang="ts">
import type { ClassValue } from 'svelte/elements'
const sizes = {
sm: 'text-sm',
md: 'text-base',
lg: 'text-lg',
}
const colors = {
subtle: 'text-slate-600 dark:text-zinc-400',
none: '',
}
interface Props { interface Props {
class?: string class?: ClassValue
size?: keyof typeof sizes
color?: keyof typeof colors
border?: boolean
children?: import('svelte').Snippet children?: import('svelte').Snippet
action?: import('svelte').Snippet action?: import('svelte').Snippet
} }
let { class: clazz = '', children, action }: Props = $props() let {
class: clazz = '',
children,
action,
border = true,
size = 'sm',
color = 'subtle',
}: Props = $props()
</script> </script>
<div <div
class="flex flex-row items-center class={[
text-sm text-slate-600 dark:text-zinc-400 gap-2 flex-wrap {clazz}" 'flex flex-row items-center gap-2 flex-wrap',
sizes[size],
colors[color],
clazz,
]}
> >
<span class="font-medium text-left"> <span class="font-medium text-left">
{@render children?.()} {@render children?.()}
</span> </span>
<div class="flex-1"></div> <hr
class={[
'flex-1 border-slate-200 dark:border-zinc-800',
!border && 'opacity-0',
]}
/>
{@render action?.()} {@render action?.()}
</div> </div>
+11 -14
View File
@@ -10,7 +10,6 @@
}[] }[]
currentRoute?: SvelteURL | undefined currentRoute?: SvelteURL | undefined
buildUrl?: (currentRoute: SvelteURL | undefined, href: string) => string buildUrl?: (currentRoute: SvelteURL | undefined, href: string) => string
class?: string
children?: import('svelte').Snippet children?: import('svelte').Snippet
} }
@@ -18,7 +17,6 @@
routes, routes,
currentRoute = undefined, currentRoute = undefined,
buildUrl = (_, href) => href, buildUrl = (_, href) => href,
class: clazz = '',
children, children,
}: Props = $props() }: Props = $props()
@@ -29,25 +27,24 @@
</script> </script>
<nav <nav
class="flex flex-row items-center gap-1 p-1 rounded-full bg-white/60 dark:bg-zinc-900/60 class="flex flex-row items-center gap-x-8 gap-y-4 p-1 justify-center sm:justify-start my-2 sm:mt-0 flex-wrap"
backdrop-blur-lg border border-slate-200 dark:border-zinc-800 shadow-sm {clazz ??
''}
"
> >
{#each routes as route (route.href)} {#each routes as route (route.href)}
{@const selected = isSelected(
page.url,
new SvelteURL(`${page.url.origin}${route.href}`),
)}
<a <a
onclick={() => invalidateAll()} onclick={() => invalidateAll()}
href={buildUrl(currentRoute, route.href)} href={buildUrl(currentRoute, route.href)}
class="font-medium rounded-full px-4 py-1 hover:bg-slate-200/40 dark:hover:bg-zinc-700/40 class={[
transition-colors duration-100 relative z-0 shrink-0" 'rounded-full font-medium transition-colors duration-100 relative z-0 shrink-0 hover:text-slate-900 hover:dark:text-zinc-100',
selected
? 'text-primary-900 dark:text-primary-100'
: 'text-slate-500 dark:text-zinc-500',
]}
> >
{route.name} {route.name}
{#if isSelected(page.url, new SvelteURL(`${page.url.origin}${route.href}`))}
<div
class="rounded-full bg-slate-200/60 dark:bg-zinc-700/60
absolute inset-0 w-full h-full -z-10"
></div>
{/if}
</a> </a>
{/each} {/each}
{@render children?.()} {@render children?.()}
+6 -7
View File
@@ -1,10 +1,10 @@
<script lang="ts"> <script lang="ts">
import { notifications, profile } from '$lib/auth.svelte.js' import { notifications, profile } from '$lib/auth.svelte.js'
import Expandable from '$lib/components/ui/Expandable.svelte' import Expandable from '$lib/components/ui/Expandable.svelte'
import CommunityList from '$lib/components/ui/sidebar/CommunityList.svelte'
import ProfileButton from '$lib/components/ui/sidebar/ProfileButton.svelte' import ProfileButton from '$lib/components/ui/sidebar/ProfileButton.svelte'
import SidebarButton from '$lib/components/ui/sidebar/SidebarButton.svelte' import SidebarButton from '$lib/components/ui/sidebar/SidebarButton.svelte'
import { t } from '$lib/i18n/translations' import { t } from '$lib/i18n/translations'
import { communityLink } from '$lib/lemmy/generic'
import { settings } from '$lib/settings.svelte.js' import { settings } from '$lib/settings.svelte.js'
import { Badge } from 'mono-svelte' import { Badge } from 'mono-svelte'
import { import {
@@ -16,11 +16,10 @@
UserCircle, UserCircle,
UserGroup, UserGroup,
} from 'svelte-hero-icons' } from 'svelte-hero-icons'
import EndPlaceholder from '../EndPlaceholder.svelte'
import type { ClassValue } from 'svelte/elements' import type { ClassValue } from 'svelte/elements'
import CommonList from '../layout/CommonList.svelte'
import { communityLink } from '$lib/lemmy/generic'
import Avatar from '../Avatar.svelte' import Avatar from '../Avatar.svelte'
import EndPlaceholder from '../EndPlaceholder.svelte'
import CommonList from '../layout/CommonList.svelte'
interface Props { interface Props {
style?: string style?: string
@@ -97,7 +96,7 @@
> >
{#snippet title()} {#snippet title()}
<span class="px-2 py-1 w-full"> <span class="px-2 py-1 w-full">
<EndPlaceholder> <EndPlaceholder border={false}>
{$t('account.accounts')} {$t('account.accounts')}
{#snippet action()} {#snippet action()}
<span class="dark:text-white text-black"> <span class="dark:text-white text-black">
@@ -134,7 +133,7 @@
> >
{#snippet title()} {#snippet title()}
<span class="px-2 py-1 w-full"> <span class="px-2 py-1 w-full">
<EndPlaceholder> <EndPlaceholder border={false}>
{$t('routes.profile.moderates')} {$t('routes.profile.moderates')}
{#snippet action()} {#snippet action()}
<span class="dark:text-white text-black"> <span class="dark:text-white text-black">
@@ -185,7 +184,7 @@
> >
{#snippet title()} {#snippet title()}
<span class="px-2 py-1 w-full"> <span class="px-2 py-1 w-full">
<EndPlaceholder> <EndPlaceholder border={false}>
{$t('profile.subscribed')} {$t('profile.subscribed')}
{#snippet action()} {#snippet action()}
<span class="dark:text-white text-black"> <span class="dark:text-white text-black">
+2 -2
View File
@@ -281,8 +281,8 @@
"createPost": "Create Post", "createPost": "Create Post",
"createCommunity": "Create Community", "createCommunity": "Create Community",
"post": { "post": {
"crosspostCount": "crossposts", "crosspostCount": "Crossposts",
"commentCount": "comments", "commentCount": "Comments",
"addComment": "Add a comment", "addComment": "Add a comment",
"scrollToTop": "Scroll to top", "scrollToTop": "Scroll to top",
"instanceWarning": "This post was requested from a different server than your account's. Many actions won't work.", "instanceWarning": "This post was requested from a different server than your account's. Many actions won't work.",
+1 -1
View File
@@ -39,7 +39,7 @@
import Label from '../forms/Label.svelte' import Label from '../forms/Label.svelte'
import { generateID } from '../forms/helper.js' import { generateID } from '../forms/helper.js'
const borderClass = `border border-slate-200 border-b-slate-300 dark:border-zinc-800` const borderClass = `border border-slate-200 border-b-slate-300 dark:border-t-zinc-800 dark:border-zinc-900`
let { let {
label = undefined, label = undefined,
+2 -2
View File
@@ -88,7 +88,7 @@
}: Props<T> = $props() }: Props<T> = $props()
</script> </script>
<div class="flex flex-col gap-1 {clazz} {baseClass}"> <div class={['flex flex-col gap-1', clazz, baseClass]}>
{#if customLabel || label} {#if customLabel || label}
<Label for={id} text={label}> <Label for={id} text={label}>
{@render customLabel?.()} {@render customLabel?.()}
@@ -144,7 +144,7 @@
disabled={option.disabled} disabled={option.disabled}
color="none" color="none"
class={[ class={[
'min-h-0! py-[5px]! hover:bg-slate-100 dark:hover:bg-zinc-800', 'min-h-0! py-1 hover:bg-slate-100 dark:hover:bg-zinc-800',
option.value == value && option.value == value &&
'bg-slate-100 dark:bg-zinc-800 text-primary-900 dark:text-primary-100 font-medium', 'bg-slate-100 dark:bg-zinc-800 text-primary-900 dark:text-primary-100 font-medium',
option.disabled && option.disabled &&
+2 -2
View File
@@ -58,8 +58,8 @@
let { let {
elevation = 'flat', elevation = 'flat',
padding = 'md', padding = 'md',
rounding = 'lg', rounding = 'xl',
color = 'default', color = 'uniform',
element = 'div', element = 'div',
class: clazz = '', class: clazz = '',
children, children,
+3 -5
View File
@@ -49,13 +49,11 @@
> >
{#snippet popover()} {#snippet popover()}
<div <div
class="w-full max-w-[280px] origin-top-left class="w-full max-w-sm origin-top-left max-h-128 overflow-auto list-none shadow-lg rounded-2xl"
max-h-128 overflow-auto list-none shadow-lg rounded-2xl"
> >
<div <div
class="flex flex-col py-2 list-none bg-white/80 dark:bg-zinc-900/90 px-2 gap-px class="flex flex-col px-0 list-none bg-white/80 dark:bg-zinc-900/90 rounded-2xl
rounded-2xl border border-slate-300 dark:border-zinc-800 border-opacity-50 py-1"
border border-slate-300 dark:border-zinc-800 border-opacity-50"
> >
{@render children?.(open)} {@render children?.(open)}
</div> </div>
+2 -1
View File
@@ -37,9 +37,10 @@
<Button <Button
{...rest} {...rest}
{color} {color}
size="custom"
rounding="none" rounding="none"
class={[ class={[
'w-full px-2 rounded-lg min-h-8 font-normal duration-100', 'w-full px-4.5 py-1.5 min-h-7 duration-100 font-normal',
disabled && 'opacity-70 pointer-events-none cursor-not-allowed', disabled && 'opacity-70 pointer-events-none cursor-not-allowed',
color == 'tertiary' && 'dark:hover:bg-zinc-800/70', color == 'tertiary' && 'dark:hover:bg-zinc-800/70',
clazz, clazz,
+1 -1
View File
@@ -9,7 +9,7 @@
</script> </script>
<div <div
class="text-slate-800 dark:text-zinc-200 text-xs font-medium py-2 px-2 flex items-center gap-1" class="text-slate-800 dark:text-zinc-200 text-xs font-medium m-4 mb-1 flex items-center gap-1"
> >
<div>{@render children?.()}</div> <div>{@render children?.()}</div>
<hr <hr
+6 -1
View File
@@ -134,7 +134,12 @@
{#if open} {#if open}
<Portal class="z-150"> <Portal class="z-150">
<div <div
transition:scale={{ duration: 300, start: 0.97, easing: expoOut }} transition:scale={{
duration: 175,
start: 0.95,
opacity: 0,
easing: expoOut,
}}
class="z-150 {popoverClass}" class="z-150 {popoverClass}"
use:customFloatingContent use:customFloatingContent
use:focusTrap use:focusTrap
+5 -6
View File
@@ -29,8 +29,6 @@
account: undefined as ProfileInfo | undefined, account: undefined as ProfileInfo | undefined,
}) })
let switching = $state(-1)
let radioSelected = $state(profile.current.id) let radioSelected = $state(profile.current.id)
$effect(() => { $effect(() => {
switching = radioSelected switching = radioSelected
@@ -134,7 +132,11 @@
{/snippet} {/snippet}
</Header> </Header>
<form class="accounts-grid mt-4 sm:mt-6 gap-4"> <form class="accounts-grid mt-4 sm:mt-6 gap-4">
<CommonList items={profile.meta.profiles}> <CommonList
selected={p => p.id == profile.meta.profile}
items={profile.meta.profiles}
animate={false}
>
{#snippet item(p, index)} {#snippet item(p, index)}
<label class="relative"> <label class="relative">
<input <input
@@ -149,9 +151,6 @@
class={[ class={[
'flex flex-row items-center gap-2 transition-all duration-75', 'flex flex-row items-center gap-2 transition-all duration-75',
'cursor-pointer relative ring-transparent', 'cursor-pointer relative ring-transparent',
switching == p.id
? 'ring-slate-500 dark:ring-zinc-500'
: 'peer-checked:ring-primary-900 peer-checked:dark:ring-primary-100',
]} ]}
> >
<div <div
+29 -34
View File
@@ -22,39 +22,34 @@
{/if} {/if}
<div class="flex flex-col gap-4 h-full"> <div class="flex flex-col gap-4 h-full">
<div <Tabs
class="sticky mx-auto z-50 max-w-full min-w-0 flex items-center gap-2 routes={[
top-6 lg:top-22" {
> href: '/admin/config',
<Tabs name: $t('routes.admin.config.title'),
routes={[ },
{ {
href: '/admin/config', href: '/admin/applications',
name: $t('routes.admin.config.title'), name: $t('routes.admin.applications.title'),
}, },
{ {
href: '/admin/applications', href: '/admin/taglines',
name: $t('routes.admin.applications.title'), name: $t('routes.admin.taglines.title'),
}, },
{ {
href: '/admin/taglines', href: '/admin/team',
name: $t('routes.admin.taglines.title'), name: $t('routes.admin.team.title'),
}, },
{ {
href: '/admin/team', href: '/admin/federation',
name: $t('routes.admin.team.title'), name: $t('routes.admin.federation.title'),
}, },
{ {
href: '/admin/federation', href: '/admin/media',
name: $t('routes.admin.federation.title'), name: $t('routes.admin.media.title'),
}, },
{ ]}
href: '/admin/media', class="overflow-auto"
name: $t('routes.admin.media.title'), />
},
]}
class="overflow-auto"
/>
</div>
{@render children?.()} {@render children?.()}
</div> </div>
+12 -16
View File
@@ -20,21 +20,17 @@
</script> </script>
<div class="flex flex-col gap-4 h-full"> <div class="flex flex-col gap-4 h-full">
<div <Tabs
class="sticky mx-auto z-50 max-w-full min-w-0 flex items-center gap-2 top-6 lg:top-22" routes={[
> {
<Tabs href: `${communityUrl}/settings`,
routes={[ name: $t('routes.community.settings.settings'),
{ },
href: `${communityUrl}/settings`, {
name: $t('routes.community.settings.settings'), href: `${communityUrl}/settings/team`,
}, name: $t('routes.community.settings.team'),
{ },
href: `${communityUrl}/settings/team`, ]}
name: $t('routes.community.settings.team'), ></Tabs>
},
]}
></Tabs>
</div>
{@render children?.()} {@render children?.()}
</div> </div>
+2 -8
View File
@@ -7,19 +7,13 @@
import Skeleton from '$lib/components/ui/generic/Skeleton.svelte' import Skeleton from '$lib/components/ui/generic/Skeleton.svelte'
import CommonList from '$lib/components/ui/layout/CommonList.svelte' import CommonList from '$lib/components/ui/layout/CommonList.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 Pageination from '$lib/components/ui/Pageination.svelte' import Pageination from '$lib/components/ui/Pageination.svelte'
import Placeholder from '$lib/components/ui/Placeholder.svelte' import Placeholder from '$lib/components/ui/Placeholder.svelte'
import SectionTitle from '$lib/components/ui/SectionTitle.svelte' import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
import { t } from '$lib/i18n/translations.js' import { t } from '$lib/i18n/translations.js'
import { LINKED_INSTANCE_URL } from '$lib/instance.svelte' import { LINKED_INSTANCE_URL } from '$lib/instance.svelte'
import { Button, Material, Option, TextInput } from 'mono-svelte' import { Material, Option } from 'mono-svelte'
import { import { QuestionMarkCircle, ServerStack } from 'svelte-hero-icons'
Icon,
MagnifyingGlass,
QuestionMarkCircle,
ServerStack,
} from 'svelte-hero-icons'
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'
+21 -39
View File
@@ -1,47 +1,29 @@
<script lang="ts"> <script lang="ts">
import { page } from '$app/state'
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'
import { SvelteURLSearchParams } from 'svelte/reactivity'
let { children } = $props() let { children } = $props()
function addSearchParam(
currentSearchParams: URLSearchParams,
newParamString: string,
) {
const updatedParams = new SvelteURLSearchParams(currentSearchParams)
const newParam = new SvelteURLSearchParams(newParamString)
const [key, value]: [string, string] = newParam.entries().next().value!
updatedParams.set(key, value)
return updatedParams
}
</script> </script>
<div <Tabs
class="mt-4 mb-2 z-30 mx-auto max-w-full flex gap-2 md:flex-row flex-col routes={[
items-center px-2 w-max top-6 lg:top-22" {
> href: '/inbox',
<Tabs name: $t('filter.location.all'),
routes={[ },
{ {
href: '/inbox', href: '/inbox?type=replies',
name: $t('filter.location.all'), name: $t('filter.inbox.replies'),
}, },
{ {
href: '/inbox?type=replies', href: '/inbox?type=mentions',
name: $t('filter.inbox.replies'), name: $t('filter.inbox.mentions'),
}, },
{ {
href: '/inbox?type=mentions', href: '/inbox/messages',
name: $t('filter.inbox.mentions'), name: $t('filter.inbox.messages'),
}, },
{ ]}
href: '/inbox/messages', class="overflow-auto"
name: $t('filter.inbox.messages'), />
},
]}
class="overflow-auto"
/>
</div>
{@render children?.()} {@render children?.()}
+1 -2
View File
@@ -4,15 +4,14 @@
import { notifications, profile } from '$lib/auth.svelte.js' import { notifications, profile } from '$lib/auth.svelte.js'
import CommonList from '$lib/components/ui/layout/CommonList.svelte' import CommonList from '$lib/components/ui/layout/CommonList.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 Pageination from '$lib/components/ui/Pageination.svelte' import Pageination from '$lib/components/ui/Pageination.svelte'
import Placeholder from '$lib/components/ui/Placeholder.svelte' import Placeholder from '$lib/components/ui/Placeholder.svelte'
import { t } from '$lib/i18n/translations' import { t } from '$lib/i18n/translations'
import { getClient } from '$lib/lemmy.svelte.js' import { getClient } from '$lib/lemmy.svelte.js'
import { searchParam } from '$lib/util.svelte'
import { Button, Option, Select } from 'mono-svelte' import { Button, Option, Select } from 'mono-svelte'
import { ArrowPath, Check, Funnel, Icon, Inbox } from 'svelte-hero-icons' import { ArrowPath, Check, Funnel, Icon, Inbox } from 'svelte-hero-icons'
import InboxItem from './InboxItem.svelte' import InboxItem from './InboxItem.svelte'
import { searchParam } from '$lib/util.svelte'
let { data } = $props() let { data } = $props()
+1 -1
View File
@@ -160,7 +160,7 @@
</CommonList> </CommonList>
{#if res.private_messages.length == 50 || data.page != 1} {#if res.private_messages.length == 50 || data.page != 1}
<div class="mt-auto pb-4"> <div class="mt-auto pb-4 mx-auto">
<Pageination <Pageination
page={data.page} page={data.page}
hasMore={res.private_messages.length == 50} hasMore={res.private_messages.length == 50}
+19
View File
@@ -0,0 +1,19 @@
<script lang="ts">
import Header from '$lib/components/ui/layout/pages/Header.svelte'
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
let { children } = $props()
</script>
<Header pageHeader>Instances</Header>
<Tabs
routes={[
{
href: '/instances/linked',
name: 'Linked',
},
{ href: '/instances/blocked', name: 'Blocked' },
]}
></Tabs>
<div class="h-3 sm:h-6"></div>
{@render children?.()}
+6
View File
@@ -0,0 +1,6 @@
import { getClient } from '$lib/lemmy.svelte.js'
export async function load({ fetch }) {
return (await getClient(undefined, fetch).getFederatedInstances())
.federated_instances
}
-99
View File
@@ -1,99 +0,0 @@
<script lang="ts">
import Placeholder from '$lib/components/ui/Placeholder.svelte'
import Header from '$lib/components/ui/layout/pages/Header.svelte'
import RelativeDate from '$lib/components/util/RelativeDate.svelte'
import { publishedToDate } from '$lib/components/util/date.js'
import { Material, Popover } from 'mono-svelte'
import { Check, Icon, InformationCircle } from 'svelte-hero-icons'
let { data } = $props()
</script>
<Header pageHeader>Linked Instances</Header>
{#if data}
<div class="flex flex-col md:flex-row gap-4">
<div class="flex-1 w-full max-h-168 h-full flex flex-col gap-2">
<h2 class="font-bold text-xl flex flex-row items-center gap-1">
Linked
<Popover openOnHover>
{#snippet target()}
<Icon src={InformationCircle} mini size="20" />
{/snippet}
<p class="font-normal">
These are the instances your instance can see and interact with
content from.
</p>
</Popover>
</h2>
<Material
class="h-full overflow-auto divide-y *:py-3 divide-slate-200 dark:divide-zinc-800"
color="distinct"
>
{#if data.linked && data.linked.length > 0}
{#each data.linked?.sort((b, a) => b.id - a.id) as instance (instance.id)}
<div class="flex justify-between items-center first:pt-0 last:pb-0">
<div class="flex flex-col">
<span class="font-medium">{instance.domain}</span>
<span
class="text-xs text-slate-600 dark:text-zinc-400 capitalize"
>
{instance.software ?? 'Unknown'} • <RelativeDate
date={publishedToDate(instance.published)}
/>
</span>
</div>
</div>
{/each}
{:else}
<Placeholder
icon={Check}
title="No linked instances"
description="This instance likely has federation disabled."
/>
{/if}
</Material>
</div>
<div class="flex-1 w-full max-h-168 h-full flex flex-col gap-2">
<h2 class="font-bold text-xl flex flex-row items-center gap-1">
Blocked
<Popover openOnHover placement="bottom">
{#snippet target()}
<Icon src={InformationCircle} mini size="20" />
{/snippet}
<p class="font-normal">
These are the instances your instance is explicitly blocking content
from.
</p>
</Popover>
</h2>
<Material
class="h-full overflow-auto divide-y *:py-3 divide-slate-200 dark:divide-zinc-800"
color="distinct"
>
{#if data.blocked && data.blocked.length > 0}
{#each data.blocked?.sort((b, a) => b.id - a.id) as instance (instance.id)}
<div class="flex justify-between items-center first:pt-0 last:pb-0">
<div class="flex flex-col">
<span class="font-medium">{instance.domain}</span>
<span
class="text-xs text-slate-600 dark:text-zinc-400 capitalize"
>
{instance.software ?? 'Unknown'} • <RelativeDate
date={publishedToDate(instance.published)}
/>
</span>
</div>
</div>
{/each}
{:else}
<Placeholder
icon={Check}
title="No blocked instances"
description="Blocking an instance will hide submissions from that instance."
/>
{/if}
</Material>
</div>
</div>
{/if}
+3 -4
View File
@@ -1,6 +1,5 @@
import { getClient } from '$lib/lemmy.svelte.js' import { redirect } from '@sveltejs/kit'
export async function load({ fetch }) { export function load() {
return (await getClient(undefined, fetch).getFederatedInstances()) redirect(302, '/instances/linked')
.federated_instances
} }
+50
View File
@@ -0,0 +1,50 @@
<script lang="ts">
import VirtualList from '$lib/components/render/VirtualList.svelte'
import Placeholder from '$lib/components/ui/Placeholder.svelte'
import RelativeDate from '$lib/components/util/RelativeDate.svelte'
import { publishedToDate } from '$lib/components/util/date.js'
import { Material } from 'mono-svelte'
import { Check } from 'svelte-hero-icons'
let { data } = $props()
</script>
{#if data}
<div class="flex flex-col md:flex-row gap-4">
<Material
class="h-full overflow-auto divide-y *:py-3 divide-slate-200 dark:divide-zinc-800 max-h-[48rem] w-full"
>
{#if data.linked && data.linked.length > 0}
<VirtualList
useWindow={false}
items={data.linked}
height={473}
estimatedHeight={100}
>
{#snippet item(index)}
<div
class="flex justify-between items-center first:pt-0 last:pb-0 my-3"
>
<div class="flex flex-col">
<span class="font-medium">{data.linked[index].domain}</span>
<span
class="text-xs text-slate-600 dark:text-zinc-400 capitalize"
>
{data.linked[index].software ?? 'Unknown'} • <RelativeDate
date={publishedToDate(data.linked[index].published)}
/>
</span>
</div>
</div>
{/snippet}
</VirtualList>
{:else}
<Placeholder
icon={Check}
title="No linked instances"
description="This instance likely has federation disabled."
/>
{/if}
</Material>
</div>
{/if}
+13 -17
View File
@@ -10,22 +10,18 @@
</svelte:head> </svelte:head>
<div class="w-full space-y-4 pb-8"> <div class="w-full space-y-4 pb-8">
<div <Tabs
class="sticky w-max mx-auto z-50 max-w-full min-w-0 flex items-center gap-2 top-6 lg:top-22" class="overflow-auto"
> routes={[
<Tabs {
class="overflow-auto" href: '/moderation',
routes={[ name: $t('routes.moderation.feed'),
{ },
href: '/moderation', {
name: $t('routes.moderation.feed'), href: '/moderation/communities',
}, name: $t('routes.communities.title'),
{ },
href: '/moderation/communities', ]}
name: $t('routes.communities.title'), />
},
]}
/>
</div>
{@render children?.()} {@render children?.()}
</div> </div>
@@ -1,10 +1,10 @@
<script lang="ts"> <script lang="ts">
import { page } from '$app/state' import { page } from '$app/state'
import { profile } from '$lib/auth.svelte.js' import { profile } from '$lib/auth.svelte.js'
import PostActions from '$lib/components/lemmy/post/actions/PostActions.svelte'
import { mediaType } from '$lib/components/lemmy/post/helpers.js' import { mediaType } from '$lib/components/lemmy/post/helpers.js'
import PostMedia from '$lib/components/lemmy/post/media/PostMedia.svelte' import PostMedia from '$lib/components/lemmy/post/media/PostMedia.svelte'
import Post from '$lib/components/lemmy/post/Post.svelte' import Post from '$lib/components/lemmy/post/Post.svelte'
import PostActions from '$lib/components/lemmy/post/actions/PostActions.svelte'
import PostMeta, { import PostMeta, {
parseTags, parseTags,
} from '$lib/components/lemmy/post/PostMeta.svelte' } from '$lib/components/lemmy/post/PostMeta.svelte'
@@ -17,12 +17,13 @@
import { t } from '$lib/i18n/translations.js' import { t } from '$lib/i18n/translations.js'
import { client } from '$lib/lemmy.svelte.js' import { client } from '$lib/lemmy.svelte.js'
import { resumables } from '$lib/lemmy/item.js' import { resumables } from '$lib/lemmy/item.js'
import { postFeeds } from '$lib/lemmy/postfeed.svelte'
import { ReactiveState } from '$lib/promise.svelte'
import { settings } from '$lib/settings.svelte.js' import { settings } from '$lib/settings.svelte.js'
import { isImage } from '$lib/ui/image.js' import { isImage } from '$lib/ui/image.js'
import { Button, toast } from 'mono-svelte' import { Button, toast } from 'mono-svelte'
import { onMount } from 'svelte' import { onMount } from 'svelte'
import { import {
ArrowLeft,
ArrowRight, ArrowRight,
ChatBubbleLeftRight, ChatBubbleLeftRight,
ChevronDoubleUp, ChevronDoubleUp,
@@ -31,8 +32,6 @@
import { expoOut } from 'svelte/easing' import { expoOut } from 'svelte/easing'
import { fly } from 'svelte/transition' import { fly } from 'svelte/transition'
import CommentProvider from './CommentProvider.svelte' import CommentProvider from './CommentProvider.svelte'
import { ReactiveState } from '$lib/promise.svelte'
import { postFeeds } from '$lib/lemmy/postfeed.svelte'
let { data } = $props() let { data } = $props()
@@ -191,17 +190,14 @@
{#if crossposts?.length > 0} {#if crossposts?.length > 0}
<Expandable class="text-base mt-2 w-full cursor-pointer"> <Expandable class="text-base mt-2 w-full cursor-pointer">
{#snippet title()} {#snippet title()}
<div <EndPlaceholder size="md" color="none" class="w-full">
class={[
'flex items-center gap-1 w-full text-left text-base font-normal',
]}
>
<span class="font-bold">{crossposts.length}</span>
{$t('routes.post.crosspostCount')} {$t('routes.post.crosspostCount')}
<hr {#snippet action()}
class="flex-1 inline-block w-full border-slate-200 dark:border-zinc-800 mx-3" <span class="font-bold">
/> <FormattedNumber number={crossposts.length} />
</div> </span>
{/snippet}
</EndPlaceholder>
{/snippet} {/snippet}
<div <div
class="divide-y! divide-slate-200 dark:divide-zinc-800 flex flex-col" class="divide-y! divide-slate-200 dark:divide-zinc-800 flex flex-col"
@@ -216,7 +212,6 @@
{/if} {/if}
{/await} {/await}
</article> </article>
<hr class="-mx-3 sm:-mx-6 my-6 border-slate-200 dark:border-zinc-800" />
{#await data.comments.value then comments} {#await data.comments.value then comments}
{#if data.thread.value.showContext || data.thread.value.singleThread} {#if data.thread.value.showContext || data.thread.value.singleThread}
<div <div
@@ -249,13 +244,15 @@
{/if} {/if}
{/await} {/await}
<section class="flex flex-col gap-2 w-full" id="comments"> <section class="flex flex-col gap-2 w-full" id="comments">
<header> <header class="mt-4">
<div class="text-base"> <EndPlaceholder size="md" color="none">
<span class="font-bold">
<FormattedNumber number={data.post.value.post_view.counts.comments} />
</span>
{$t('routes.post.commentCount')} {$t('routes.post.commentCount')}
</div> {#snippet action()}
<span class="font-bold">
<FormattedNumber number={data.post.value.post_view.counts.comments} />
</span>
{/snippet}
</EndPlaceholder>
</header> </header>
{#if !page.url.searchParams.get('noVirtualize')} {#if !page.url.searchParams.get('noVirtualize')}
<noscript> <noscript>
@@ -64,7 +64,7 @@
{#if profile.current?.jwt} {#if profile.current?.jwt}
{#if !commenting} {#if !commenting}
<EndPlaceholder> <EndPlaceholder border={false}>
<Button <Button
color="primary" color="primary"
rounding="xl" rounding="xl"
+1 -3
View File
@@ -25,9 +25,7 @@
</svelte:head> </svelte:head>
<div class="flex flex-col gap-4 h-full z-0"> <div class="flex flex-col gap-4 h-full z-0">
<div <div class="flex flex-row justify-between">
class="sticky mx-auto z-50 max-w-full min-w-0 flex items-center gap-2 top-6 lg:top-22"
>
<Tabs <Tabs
class="overflow-auto" class="overflow-auto"
routes={[ routes={[
+5 -2
View File
@@ -4,7 +4,6 @@
import PostItem from '$lib/components/lemmy/post/PostItem.svelte' import PostItem from '$lib/components/lemmy/post/PostItem.svelte'
import CommonList from '$lib/components/ui/layout/CommonList.svelte' import CommonList from '$lib/components/ui/layout/CommonList.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 Pageination from '$lib/components/ui/Pageination.svelte' import Pageination from '$lib/components/ui/Pageination.svelte'
import Placeholder from '$lib/components/ui/Placeholder.svelte' import Placeholder from '$lib/components/ui/Placeholder.svelte'
import { t } from '$lib/i18n/translations.js' import { t } from '$lib/i18n/translations.js'
@@ -82,5 +81,9 @@
</CommonList> </CommonList>
{/if} {/if}
<div class="sticky z-30 mx-auto max-w-full bottom-22 lg:bottom-6"> <div class="sticky z-30 mx-auto max-w-full bottom-22 lg:bottom-6">
<Pageination href={page => `?page=${page}`} page={data.page} /> <Pageination
hasMore={data.data.length == 40}
href={page => `?page=${page}`}
page={data.page}
/>
</div> </div>
+2 -3
View File
@@ -1,6 +1,5 @@
<script lang="ts"> <script lang="ts">
import { navigating } from '$app/state' import { navigating } from '$app/state'
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
import { t } from '$lib/i18n/translations' import { t } from '$lib/i18n/translations'
import { Button, TextInput } from 'mono-svelte' import { Button, TextInput } from 'mono-svelte'
import { Icon, MagnifyingGlass } from 'svelte-hero-icons' import { Icon, MagnifyingGlass } from 'svelte-hero-icons'
@@ -14,13 +13,13 @@
let searchElement = $state<HTMLInputElement>() let searchElement = $state<HTMLInputElement>()
</script> </script>
<div class="mt-4 mb-0 sticky z-30 top-6 lg:top-22 drop-shadow-xl"> <div class="mt-4 mb-0 sticky z-30 top-6 lg:top-22 drop-shadow-md">
<div class="flex gap-2 flex-row items-center w-full text-base h-10"> <div class="flex gap-2 flex-row items-center w-full text-base h-10">
<TextInput <TextInput
bind:value={query} bind:value={query}
bind:element={searchElement} bind:element={searchElement}
name="q" name="q"
aria-label={$t('routes.search.query')} placeholder={$t('routes.search.query')}
size="lg" size="lg"
class="flex-1 rounded-full! h-full text-base!" class="flex-1 rounded-full! h-full text-base!"
/> />
+1 -5
View File
@@ -1,12 +1,12 @@
<script lang="ts"> <script lang="ts">
import { env } from '$env/dynamic/public' import { env } from '$env/dynamic/public'
import { profile } from '$lib/auth.svelte'
import Link from '$lib/components/input/Link.svelte' import Link from '$lib/components/input/Link.svelte'
import MultiSelect from '$lib/components/input/Switch.svelte' import MultiSelect from '$lib/components/input/Switch.svelte'
import Sort from '$lib/components/lemmy/dropdowns/Sort.svelte' import Sort from '$lib/components/lemmy/dropdowns/Sort.svelte'
import ViewSelect from '$lib/components/lemmy/dropdowns/ViewSelect.svelte' import ViewSelect from '$lib/components/lemmy/dropdowns/ViewSelect.svelte'
import { removalTemplate } from '$lib/components/lemmy/moderation/moderation.js' import { removalTemplate } from '$lib/components/lemmy/moderation/moderation.js'
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte' import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
import Expandable from '$lib/components/ui/Expandable.svelte'
import Header from '$lib/components/ui/layout/pages/Header.svelte' import Header from '$lib/components/ui/layout/pages/Header.svelte'
import { locale, locales, t } from '$lib/i18n/translations' import { locale, locales, t } from '$lib/i18n/translations'
import { defaultSettings, settings } from '$lib/settings.svelte' import { defaultSettings, settings } from '$lib/settings.svelte'
@@ -14,7 +14,6 @@
import { import {
Button, Button,
Checkbox, Checkbox,
Material,
Modal, Modal,
Select, Select,
Switch, Switch,
@@ -26,7 +25,6 @@
import { import {
ArrowDownTray, ArrowDownTray,
ArrowPath, ArrowPath,
ArrowRight,
ArrowsPointingOut, ArrowsPointingOut,
ArrowsRightLeft, ArrowsRightLeft,
ArrowsUpDown, ArrowsUpDown,
@@ -41,7 +39,6 @@
Calendar, Calendar,
ChartBar, ChartBar,
ChatBubbleOvalLeftEllipsis, ChatBubbleOvalLeftEllipsis,
ChevronDown,
Clock, Clock,
CubeTransparent, CubeTransparent,
CursorArrowRays, CursorArrowRays,
@@ -70,7 +67,6 @@
import Section from './Section.svelte' import Section from './Section.svelte'
import Setting from './Setting.svelte' import Setting from './Setting.svelte'
import ToggleSetting from './ToggleSetting.svelte' import ToggleSetting from './ToggleSetting.svelte'
import Expandable from '$lib/components/ui/Expandable.svelte'
let importing = $state(false) let importing = $state(false)
let importText = $state('') let importText = $state('')
+29 -35
View File
@@ -1,5 +1,4 @@
<script lang="ts"> <script lang="ts">
import { page } from '$app/state'
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte' import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
interface Props { interface Props {
children?: import('svelte').Snippet children?: import('svelte').Snippet
@@ -9,39 +8,34 @@
</script> </script>
<div class="flex flex-col gap-2"> <div class="flex flex-col gap-2">
<div <Tabs
class="sticky mx-auto z-50 max-w-full min-w-0 flex items-center gap-2 top-6 lg:top-22" routes={[
> {
<Tabs href: '/util',
routes={[ name: 'Home',
{ },
href: '/util', {
name: 'Home', href: '/util/instance',
}, name: 'Photon instance',
{ },
href: '/util/instance', {
name: 'Photon instance', href: '/util/photonify',
}, name: 'Photonify Links',
{ },
href: '/util/photonify', {
name: 'Photonify Links', href: '/util/placeholder',
}, name: 'Placeholders',
{ },
href: '/util/placeholder', {
name: 'Placeholders', href: '/util/constants',
}, name: 'Constants',
{ },
href: '/util/constants', {
name: 'Constants', href: '/functions',
}, name: 'Functions',
{ },
href: '/functions', ]}
name: 'Functions', class="overflow-auto"
}, />
]}
class="overflow-auto"
currentRoute={page.url.toString()}
/>
</div>
{@render children?.()} {@render children?.()}
</div> </div>