misc: tweak UI everywhere
This commit is contained in:
10 files changed
+51
-47
No files matched your search
@@ -10,7 +10,7 @@
|
|||||||
import { Button } from 'mono-svelte'
|
import { Button } from 'mono-svelte'
|
||||||
import { t } from '$lib/translations'
|
import { t } from '$lib/translations'
|
||||||
import { errorMessage } from '$lib/lemmy/error'
|
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 {
|
interface Props {
|
||||||
postId: number
|
postId: number
|
||||||
@@ -104,7 +104,8 @@
|
|||||||
<Menu>
|
<Menu>
|
||||||
{#snippet target()}
|
{#snippet target()}
|
||||||
<Button
|
<Button
|
||||||
size="square-md"
|
size="custom"
|
||||||
|
class="w-9 h-9"
|
||||||
rounding="pill"
|
rounding="pill"
|
||||||
color={language != undefined ? 'primary' : 'ghost'}
|
color={language != undefined ? 'primary' : 'ghost'}
|
||||||
title={$t('form.profile.languages.title')}
|
title={$t('form.profile.languages.title')}
|
||||||
@@ -154,12 +155,15 @@
|
|||||||
onclick={submit}
|
onclick={submit}
|
||||||
color="primary"
|
color="primary"
|
||||||
rounding="pill"
|
rounding="pill"
|
||||||
size="sm"
|
size="custom"
|
||||||
class="py-2 px-4"
|
class="w-9 h-9"
|
||||||
|
title={$t('form.submit')}
|
||||||
{loading}
|
{loading}
|
||||||
disabled={locked || loading || banned}
|
disabled={locked || loading || banned}
|
||||||
>
|
>
|
||||||
{$t('form.submit')}
|
{#snippet prefix()}
|
||||||
|
<Icon src={ArrowUp} size="18" micro />
|
||||||
|
{/snippet}
|
||||||
</Button>
|
</Button>
|
||||||
{/if}
|
{/if}
|
||||||
</MarkdownEditor>
|
</MarkdownEditor>
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
let progress = $state(1)
|
let progress = $state(1)
|
||||||
|
|
||||||
let previewURLs = $derived(
|
let previewURLs = $derived(
|
||||||
preview && image ? Array.from(image).map(URL.createObjectURL) : undefined,
|
preview && image ? Array.from(image).map(URL.createObjectURL) : undefined
|
||||||
)
|
)
|
||||||
|
|
||||||
async function upload() {
|
async function upload() {
|
||||||
@@ -48,8 +48,8 @@
|
|||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
toast({ content: errorMessage(err), type: 'error' })
|
toast({ content: errorMessage(err), type: 'error' })
|
||||||
return 'Failed to upload'
|
return 'Failed to upload'
|
||||||
}),
|
})
|
||||||
),
|
)
|
||||||
)
|
)
|
||||||
).filter((i) => i != undefined)
|
).filter((i) => i != undefined)
|
||||||
|
|
||||||
@@ -108,9 +108,12 @@
|
|||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
{:else}
|
{: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" />
|
<Icon src={DocumentPlus} size="32" />
|
||||||
<span>{$t('form.post.selectFile')}</span>
|
<span class="font-medium text-sm">{$t('form.post.selectFile')}</span>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
<input
|
<input
|
||||||
|
|||||||
@@ -41,8 +41,9 @@
|
|||||||
color="distinct"
|
color="distinct"
|
||||||
class="flex flex-col-reverse sm:flex-row
|
class="flex flex-col-reverse sm:flex-row
|
||||||
overflow-hidden gap-4 embed-card z-0 relative
|
overflow-hidden gap-4 embed-card z-0 relative
|
||||||
dark:border-t-zinc-800 border-opacity-80 max-w-full"
|
dark:border-t-zinc-800 border-opacity-80 max-w-full shadow-sm shadow-black/5
|
||||||
rounding="xl"
|
dark:bg-zinc-950"
|
||||||
|
rounding="2xl"
|
||||||
element="article"
|
element="article"
|
||||||
>
|
>
|
||||||
{#if thumbnail_url}
|
{#if thumbnail_url}
|
||||||
@@ -54,14 +55,19 @@
|
|||||||
-inset-px"
|
-inset-px"
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
<div class="flex flex-col gap-2 mb-2">
|
<div class="flex flex-col gap-2">
|
||||||
{#if richURL}
|
{#if richURL}
|
||||||
<Link
|
<Link
|
||||||
href={url}
|
href={url}
|
||||||
target="_blank"
|
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}
|
{richURL.hostname}
|
||||||
</Link>
|
</Link>
|
||||||
{/if}
|
{/if}
|
||||||
@@ -73,7 +79,7 @@
|
|||||||
{embed_title}
|
{embed_title}
|
||||||
</a>
|
</a>
|
||||||
{#if embed_description}
|
{#if embed_description}
|
||||||
<p class="text-sm">
|
<p class="text-sm max-w-2xl">
|
||||||
{embed_description.slice(0, 300)}{embed_description.length > 300
|
{embed_description.slice(0, 300)}{embed_description.length > 300
|
||||||
? '...'
|
? '...'
|
||||||
: ''}
|
: ''}
|
||||||
|
|||||||
@@ -39,6 +39,8 @@
|
|||||||
src={optimizeImageURL(href, 1024)}
|
src={optimizeImageURL(href, 1024)}
|
||||||
{title}
|
{title}
|
||||||
alt={text}
|
alt={text}
|
||||||
|
width={300}
|
||||||
|
height={300}
|
||||||
class="object-contain w-auto h-auto max-h-80 inline rounded-lg"
|
class="object-contain w-auto h-auto max-h-80 inline rounded-lg"
|
||||||
/>
|
/>
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
<div class="skeleton animate-pulse flex flex-col gap-2 w-full">
|
<div class="skeleton animate-pulse flex flex-col gap-2 w-full">
|
||||||
<div
|
<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>
|
||||||
<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>
|
||||||
<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>
|
||||||
</div>
|
</div>
|
||||||
@@ -70,9 +70,9 @@
|
|||||||
<Menu {...rest}>
|
<Menu {...rest}>
|
||||||
{#snippet target()}
|
{#snippet target()}
|
||||||
<button
|
<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
|
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')}
|
title={$t('profile.profile')}
|
||||||
>
|
>
|
||||||
{#if profile.data?.user}
|
{#if profile.data?.user}
|
||||||
@@ -81,7 +81,7 @@
|
|||||||
>
|
>
|
||||||
<Avatar
|
<Avatar
|
||||||
url={profile.data.user.local_user_view.person.avatar}
|
url={profile.data.user.local_user_view.person.avatar}
|
||||||
width={36}
|
width={32}
|
||||||
alt={profile.data.user.local_user_view.person.name}
|
alt={profile.data.user.local_user_view.person.name}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -97,18 +97,7 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</button>
|
</button>
|
||||||
{/snippet}
|
{/snippet}
|
||||||
{#if profile.data?.user}
|
<MenuDivider>{$t('nav.menu.label')}</MenuDivider>
|
||||||
<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}
|
|
||||||
{#if profile.data?.jwt}
|
{#if profile.data?.jwt}
|
||||||
<MenuButton link href="/profile">
|
<MenuButton link href="/profile">
|
||||||
{#snippet prefix()}
|
{#snippet prefix()}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
profile.data,
|
profile.data,
|
||||||
profileData.profiles,
|
profileData.profiles,
|
||||||
theme.data,
|
theme.data,
|
||||||
page.data.contextual?.actions,
|
page.data.contextual?.actions
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -95,7 +95,7 @@
|
|||||||
score: Math.max(
|
score: Math.max(
|
||||||
fuzzySearch(action.name, term),
|
fuzzySearch(action.name, term),
|
||||||
fuzzySearch(group.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)
|
.filter((action) => action.score > 0)
|
||||||
@@ -106,7 +106,7 @@
|
|||||||
actions: scoredActions,
|
actions: scoredActions,
|
||||||
score: Math.max(
|
score: Math.max(
|
||||||
fuzzySearch(group.name, term),
|
fuzzySearch(group.name, term),
|
||||||
...scoredActions.map((a) => a.score),
|
...scoredActions.map((a) => a.score)
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -140,7 +140,7 @@
|
|||||||
|
|
||||||
function flattenActions(
|
function flattenActions(
|
||||||
actions: Action[],
|
actions: Action[],
|
||||||
subaction: boolean = true,
|
subaction: boolean = true
|
||||||
): Action[] {
|
): Action[] {
|
||||||
return actions.flatMap((action) => [
|
return actions.flatMap((action) => [
|
||||||
action,
|
action,
|
||||||
@@ -238,7 +238,7 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
let flattenedActions = $derived(
|
let flattenedActions = $derived(
|
||||||
filteredGroups.flatMap((group) => group.actions),
|
filteredGroups.flatMap((group) => group.actions)
|
||||||
)
|
)
|
||||||
|
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
@@ -250,7 +250,6 @@
|
|||||||
|
|
||||||
<TextInput
|
<TextInput
|
||||||
bind:value={search}
|
bind:value={search}
|
||||||
autofocus
|
|
||||||
class="sticky rounded-none border-t-0 border-x-0 focus-within:dark:border-zinc-800"
|
class="sticky rounded-none border-t-0 border-x-0 focus-within:dark:border-zinc-800"
|
||||||
size="lg"
|
size="lg"
|
||||||
placeholder={$t('nav.commands.prompt')}
|
placeholder={$t('nav.commands.prompt')}
|
||||||
|
|||||||
@@ -47,19 +47,19 @@
|
|||||||
{manual}
|
{manual}
|
||||||
{...rest}
|
{...rest}
|
||||||
bind:open
|
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}
|
class={clazz}
|
||||||
{target}
|
{target}
|
||||||
>
|
>
|
||||||
{#snippet popover()}
|
{#snippet popover()}
|
||||||
<div
|
<div
|
||||||
class="w-full max-w-[280px] origin-top-left
|
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
|
<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 py-2 list-none bg-white/80 dark:bg-zinc-900/90 px-2 gap-px
|
||||||
rounded-xl
|
rounded-2xl
|
||||||
border border-slate-200 dark:border-zinc-800 border-opacity-50"
|
border border-slate-300 dark:border-zinc-800 border-opacity-50"
|
||||||
>
|
>
|
||||||
{@render children?.()}
|
{@render children?.()}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -124,7 +124,8 @@
|
|||||||
{#if open}
|
{#if open}
|
||||||
<Portal class="z-[150]">
|
<Portal class="z-[150]">
|
||||||
<div
|
<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}"
|
class="z-[150] {popoverClass}"
|
||||||
use:customFloatingContent
|
use:customFloatingContent
|
||||||
use:focusTrap
|
use:focusTrap
|
||||||
|
|||||||
@@ -146,7 +146,7 @@
|
|||||||
if (res.post) {
|
if (res.post) {
|
||||||
removeToast(id)
|
removeToast(id)
|
||||||
goto(`/post/${instance.data}/${res.post.post.id}`, {}).then(() =>
|
goto(`/post/${instance.data}/${res.post.post.id}`, {}).then(() =>
|
||||||
removeToast(id),
|
removeToast(id)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -176,7 +176,7 @@
|
|||||||
let commenting = $state(false)
|
let commenting = $state(false)
|
||||||
|
|
||||||
let remoteView = $derived(
|
let remoteView = $derived(
|
||||||
page.params.instance?.toLowerCase() != instance.data.toLowerCase(),
|
page.params.instance?.toLowerCase() != instance.data?.toLowerCase()
|
||||||
)
|
)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user