misc: tweak UI everywhere

This commit is contained in:
James Xylight committed 2025-02-14 14:42:14 -08:00
1 parent fe0c3c005f
commit 393ad4f31f
10 files changed
+51 -47

No files matched your search

@@ -10,7 +10,7 @@
import { Button } from 'mono-svelte'
import { t } from '$lib/translations'
import { errorMessage } from '$lib/lemmy/error'
import { Icon, Language, XMark } from 'svelte-hero-icons'
import { ArrowUp, Icon, Language, XMark } from 'svelte-hero-icons'
interface Props {
postId: number
@@ -104,7 +104,8 @@
<Menu>
{#snippet target()}
<Button
size="square-md"
size="custom"
class="w-9 h-9"
rounding="pill"
color={language != undefined ? 'primary' : 'ghost'}
title={$t('form.profile.languages.title')}
@@ -154,12 +155,15 @@
onclick={submit}
color="primary"
rounding="pill"
size="sm"
class="py-2 px-4"
size="custom"
class="w-9 h-9"
title={$t('form.submit')}
{loading}
disabled={locked || loading || banned}
>
{$t('form.submit')}
{#snippet prefix()}
<Icon src={ArrowUp} size="18" micro />
{/snippet}
</Button>
{/if}
</MarkdownEditor>
@@ -28,7 +28,7 @@
let progress = $state(1)
let previewURLs = $derived(
preview && image ? Array.from(image).map(URL.createObjectURL) : undefined,
preview && image ? Array.from(image).map(URL.createObjectURL) : undefined
)
async function upload() {
@@ -48,8 +48,8 @@
.catch((err) => {
toast({ content: errorMessage(err), type: 'error' })
return 'Failed to upload'
}),
),
})
)
)
).filter((i) => i != undefined)
@@ -108,9 +108,12 @@
{/each}
</div>
{:else}
<div class="flex flex-col justify-center w-full items-center gap-2">
<div
class="flex flex-col justify-center w-full items-center gap-2
text-slate-600 dark:text-zinc-400"
>
<Icon src={DocumentPlus} size="32" />
<span>{$t('form.post.selectFile')}</span>
<span class="font-medium text-sm">{$t('form.post.selectFile')}</span>
</div>
{/if}
<input
@@ -41,8 +41,9 @@
color="distinct"
class="flex flex-col-reverse sm:flex-row
overflow-hidden gap-4 embed-card z-0 relative
dark:border-t-zinc-800 border-opacity-80 max-w-full"
rounding="xl"
dark:border-t-zinc-800 border-opacity-80 max-w-full shadow-sm shadow-black/5
dark:bg-zinc-950"
rounding="2xl"
element="article"
>
{#if thumbnail_url}
@@ -54,14 +55,19 @@
-inset-px"
/>
{/if}
<div class="flex flex-col gap-2 mb-2">
<div class="flex flex-col gap-2">
{#if richURL}
<Link
href={url}
target="_blank"
class="text-slate-600 dark:text-zinc-400 inline-flex items-center gap-1 text-xs"
class="text-slate-600 dark:text-zinc-400 inline-flex items-center gap-1 text-xs font-medium"
>
<Icon src={LinkIcon} size="14" micro />
<Icon
src={LinkIcon}
size="16"
micro
class="text-slate-400 dark:text-zinc-600"
/>
{richURL.hostname}
</Link>
{/if}
@@ -73,7 +79,7 @@
{embed_title}
</a>
{#if embed_description}
<p class="text-sm">
<p class="text-sm max-w-2xl">
{embed_description.slice(0, 300)}{embed_description.length > 300
? '...'
: ''}
@@ -39,6 +39,8 @@
src={optimizeImageURL(href, 1024)}
{title}
alt={text}
width={300}
height={300}
class="object-contain w-auto h-auto max-h-80 inline rounded-lg"
/>
</button>
@@ -1,11 +1,11 @@
<div class="skeleton animate-pulse flex flex-col gap-2 w-full">
<div
class="w-2/3 h-6 bg-slate-300 dark:bg-zinc-800 animate-pulse rounded-md"
class="w-2/3 h-6 bg-slate-200 dark:bg-zinc-800 animate-pulse rounded-md"
></div>
<div
class="w-full h-20 bg-slate-300 dark:bg-zinc-800 animate-pulse rounded-md"
class="w-full h-20 bg-slate-200 dark:bg-zinc-800 animate-pulse rounded-md"
></div>
<div
class="w-32 h-6 bg-slate-300 dark:bg-zinc-800 animate-pulse rounded-md"
class="w-32 h-6 bg-slate-200 dark:bg-zinc-800 animate-pulse rounded-md"
></div>
</div>
+4 -15
View File
@@ -70,9 +70,9 @@
<Menu {...rest}>
{#snippet target()}
<button
class="w-10 h-10 rounded-full border-2 border-slate-200 dark:border-zinc-700
class="w-10 h-10 rounded-full border-slate-200 dark:border-zinc-700
transition-all bg-slate-50 dark:bg-zinc-900 relative
hover:border-primary-900 hover:dark:border-primary-100 active:scale-95 {buttonClass}"
hover:bg-slate-200 hover:dark:bg-zinc-700 {buttonClass}"
title={$t('profile.profile')}
>
{#if profile.data?.user}
@@ -81,7 +81,7 @@
>
<Avatar
url={profile.data.user.local_user_view.person.avatar}
width={36}
width={32}
alt={profile.data.user.local_user_view.person.name}
/>
</div>
@@ -97,18 +97,7 @@
{/if}
</button>
{/snippet}
{#if profile.data?.user}
<UserLink
user={profile.data?.user.local_user_view.person}
showInstance={false}
avatar
avatarSize={24}
displayName={false}
class="font-medium px-2 py-1 pointer-events-none"
/>
{:else}
<MenuDivider>{$t('nav.menu.label')}</MenuDivider>
{/if}
<MenuDivider>{$t('nav.menu.label')}</MenuDivider>
{#if profile.data?.jwt}
<MenuButton link href="/profile">
{#snippet prefix()}
@@ -27,7 +27,7 @@
profile.data,
profileData.profiles,
theme.data,
page.data.contextual?.actions,
page.data.contextual?.actions
)
})
@@ -95,7 +95,7 @@
score: Math.max(
fuzzySearch(action.name, term),
fuzzySearch(group.name, term),
action.detail ? fuzzySearch(action.detail, term) : -1,
action.detail ? fuzzySearch(action.detail, term) : -1
),
}))
.filter((action) => action.score > 0)
@@ -106,7 +106,7 @@
actions: scoredActions,
score: Math.max(
fuzzySearch(group.name, term),
...scoredActions.map((a) => a.score),
...scoredActions.map((a) => a.score)
),
}
})
@@ -140,7 +140,7 @@
function flattenActions(
actions: Action[],
subaction: boolean = true,
subaction: boolean = true
): Action[] {
return actions.flatMap((action) => [
action,
@@ -238,7 +238,7 @@
})
let flattenedActions = $derived(
filteredGroups.flatMap((group) => group.actions),
filteredGroups.flatMap((group) => group.actions)
)
$effect(() => {
@@ -250,7 +250,6 @@
<TextInput
bind:value={search}
autofocus
class="sticky rounded-none border-t-0 border-x-0 focus-within:dark:border-zinc-800"
size="lg"
placeholder={$t('nav.commands.prompt')}
+4 -4
View File
@@ -47,19 +47,19 @@
{manual}
{...rest}
bind:open
popoverClass="backdrop-blur-xl rounded-xl w-full max-w-[280px]"
popoverClass="backdrop-blur-xl rounded-2xl w-full max-w-[280px]"
class={clazz}
{target}
>
{#snippet popover()}
<div
class="w-full max-w-[280px] origin-top-left
max-h-[32rem] overflow-auto list-none shadow-lg rounded-xl"
max-h-[32rem] 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-xl
border border-slate-200 dark:border-zinc-800 border-opacity-50"
rounded-2xl
border border-slate-300 dark:border-zinc-800 border-opacity-50"
>
{@render children?.()}
</div>
+2 -1
View File
@@ -124,7 +124,8 @@
{#if open}
<Portal class="z-[150]">
<div
transition:scale={{ duration: 200, start: 0.96, easing: backOut }}
in:scale={{ duration: 300, start: 0.97, easing: expoOut }}
out:scale={{ duration: 200, start: 0.95, easing: expoOut }}
class="z-[150] {popoverClass}"
use:customFloatingContent
use:focusTrap