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