fix: improve small screen support

This commit is contained in:
Xylight committed 2024-06-28 11:44:24 -07:00
1 parent ed33e9d59b
commit ae1a3bffc0
9 files changed
+76 -58

No files matched your search

BIN
View File
Binary file not shown.
+1
View File
@@ -21,6 +21,7 @@
"@sveltejs/adapter-vercel": "^5.1.0", "@sveltejs/adapter-vercel": "^5.1.0",
"@sveltejs/kit": "latest", "@sveltejs/kit": "latest",
"@sveltejs/vite-plugin-svelte": "^3.0.0", "@sveltejs/vite-plugin-svelte": "^3.0.0",
"@tailwindcss/container-queries": "^0.1.1",
"@types/markdown-it": "^12.2.3", "@types/markdown-it": "^12.2.3",
"@types/markdown-it-container": "^2.0.6", "@types/markdown-it-container": "^2.0.6",
"@types/nprogress": "^0.2.0", "@types/nprogress": "^0.2.0",
@@ -13,7 +13,7 @@
<a <a
{...$$restProps} {...$$restProps}
class="items-center flex flex-row gap-2 hover:underline flex-shrink-0 {$$props.class || class="items-center flex flex-row gap-2 hover:underline max-w-full min-w-0 {$$props.class ||
''}" ''}"
href="/c/{community.name}@{new URL(community.actor_id).hostname}" href="/c/{community.name}@{new URL(community.actor_id).hostname}"
> >
@@ -27,18 +27,25 @@
{/if} {/if}
{#if name} {#if name}
<span class="flex gap-0 items-center"> <span class="flex gap-0 items-center max-w-full min-w-0 flex-shrink">
<span class="font-medium">{community.title}</span>
{#if showInstance} {#if showInstance}
<span class="font-medium">{community.title}</span>
<span <span
class="text-slate-500 dark:text-zinc-500 font-normal {$$props.instanceClass || class="text-slate-500 dark:text-zinc-500 font-normal
''}" instance-text flex-shrink {$$props.instanceClass || ''}"
> >
@{new URL(community.actor_id).hostname} @{new URL(community.actor_id).hostname}
</span> </span>
{:else}
{community.title}
{/if} {/if}
</span> </span>
{/if} {/if}
</a> </a>
<style>
.instance-text {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
max-width: 100%;
}
</style>
+22 -22
View File
@@ -124,30 +124,30 @@
combinedPosts = combinedPosts.toSpliced(index, 1) combinedPosts = combinedPosts.toSpliced(index, 1)
}} }}
> >
<button <svelte:fragment slot="badges">
slot="badges"
class:hidden={!post.withCrossposts}
on:click={() => {
if (viewPost == post.post.id) viewPost = -1
else viewPost = post.post.id
}}
>
{#if post.withCrossposts} {#if post.withCrossposts}
<Badge <button
class="z-10 backdrop-blur-xl hover:brightness-110 cursor-pointer transition-all" on:click={() => {
color="gray-subtle" if (viewPost == post.post.id) viewPost = -1
else viewPost = post.post.id
}}
> >
{#if viewPost == post.post.id} <Badge
<Icon mini src={Minus} size="14" /> class="z-10 backdrop-blur-xl hover:brightness-110 cursor-pointer transition-all"
{:else} color="gray-subtle"
<Icon mini src={Plus} size="14" /> >
{/if} {#if viewPost == post.post.id}
{post.crossposts.length} crosspost{post.crossposts.length == 1 <Icon mini src={Minus} size="14" />
? '' {:else}
: 's'} <Icon mini src={Plus} size="14" />
</Badge> {/if}
{/if} {post.crossposts.length} crosspost{post.crossposts.length ==
</button> 1
? ''
: 's'}
</Badge>
</button>{/if}
</svelte:fragment>
</Post> </Post>
{#if post.withCrossposts && viewPost == post.post.id} {#if post.withCrossposts && viewPost == post.post.id}
<div <div
+14 -6
View File
@@ -60,13 +60,14 @@
subscribed = subscribed =
subscribed == 'NotSubscribed' ? 'Subscribed' : 'NotSubscribed' subscribed == 'NotSubscribed' ? 'Subscribed' : 'NotSubscribed'
}} }}
class="relative cursor-pointer pr-2 row-span-2" class="relative cursor-pointer pr-2 row-span-2 flex-shrink-0"
> >
<Avatar <Avatar
url={community.icon} url={community.icon}
width={28} width={28}
alt={community.name} alt={community.name}
style="grid-area: avatar; height: 100%;" style="grid-area: avatar; height: 100%;"
class="flex-shrink-0"
/> />
{#if subscribed != undefined && $profile?.jwt} {#if subscribed != undefined && $profile?.jwt}
<div <div
@@ -87,10 +88,14 @@
</Subscribe> </Subscribe>
{/if} {/if}
{#if community} {#if community}
<CommunityLink {community} style="grid-area: community;" /> <CommunityLink
{community}
style="grid-area: community;"
class="flex-shrink"
/>
{/if} {/if}
<span <span
class="text-slate-600 dark:text-zinc-400 flex flex-row gap-2 flex-wrap items-center" class="text-slate-600 dark:text-zinc-400 flex flex-row gap-2 items-center"
style="grid-area: stats;" style="grid-area: stats;"
> >
{#if user} {#if user}
@@ -106,12 +111,11 @@
</UserLink> </UserLink>
{/if} {/if}
{#if published} {#if published}
<RelativeDate date={published} /> <RelativeDate date={published} class="flex-shrink-0" />
{/if} {/if}
</span> </span>
<div <div
class="flex flex-row items-center self-center flex-wrap gap-2 [&>*]:flex-shrink-0 class="flex flex-row items-center self-center flex-wrap gap-2 [&>*]:flex-shrink-0 badges"
{Object.values(badges).some(Boolean) ? 'pt-2' : ''}"
style="grid-area: badges;" style="grid-area: badges;"
> >
{#if badges.nsfw} {#if badges.nsfw}
@@ -192,4 +196,8 @@
grid-template-rows: auto auto auto; grid-template-rows: auto auto auto;
grid-template-columns: auto 1fr; grid-template-columns: auto 1fr;
} }
.badges:not(:empty) {
padding-top: 0.5rem;
}
</style> </style>
+21 -4
View File
@@ -16,20 +16,28 @@
</script> </script>
<a <a
class="items-center inline-flex flex-row gap-1 hover:underline {$$props.class ?? class="items-center flex flex-row gap-1 hover:underline max-w-full min-w-0 {$$props.class ??
''}" ''}"
href="/u/{user.name}@{new URL(user.actor_id).hostname}" href="/u/{user.name}@{new URL(user.actor_id).hostname}"
> >
{#if avatar} {#if avatar}
<Avatar url={user.avatar} alt={user.name} width={avatarSize} /> <Avatar
url={user.avatar}
alt={user.name}
width={avatarSize}
class="flex-shrink-0"
/>
{/if} {/if}
<span class="flex flex-wrap gap-0 items-center" class:ml-0.5={avatar}> <span
class="flex gap-0 items-center flex-shrink max-w-full min-w-0"
class:ml-0.5={avatar}
>
<span class:font-medium={showInstance}> <span class:font-medium={showInstance}>
{$userSettings.displayNames ? user.display_name || user.name : user.name} {$userSettings.displayNames ? user.display_name || user.name : user.name}
</span> </span>
{#if showInstance} {#if showInstance}
<span <span
class="text-slate-500 dark:text-zinc-500 font-normal {$$props.instanceClass ?? class="text-slate-500 dark:text-zinc-500 font-normal instance-text flex-shrink {$$props.instanceClass ??
''}" ''}"
> >
@{new URL(user.actor_id).hostname} @{new URL(user.actor_id).hostname}
@@ -48,3 +56,12 @@
<slot name="badges" /> <slot name="badges" />
{/if} {/if}
</a> </a>
<style>
.instance-text {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
max-width: 100%;
}
</style>
+3 -1
View File
@@ -100,7 +100,9 @@
</SearchBar> </SearchBar>
</div> </div>
{/if} {/if}
<div class="flex flex-row gap-2 py-2 px-2 items-center w-full"> <div
class="flex flex-row gap-2 py-2 px-2 items-center w-full rounded-full overflow-auto"
>
<div class="ml-auto" /> <div class="ml-auto" />
{#if $profile?.user && isAdmin($profile.user)} {#if $profile?.user && isAdmin($profile.user)}
<NavButton <NavButton
-17
View File
@@ -54,20 +54,3 @@
</Pageination> </Pageination>
</div> </div>
</div> </div>
<style>
.background-gradient {
background-image: radial-gradient(
circle at left,
rgba(162, 1, 114, 0.05) 0%,
rgba(255, 0, 43, 0) 100%
),
radial-gradient(
circle at 60% 80%,
rgba(162, 33, 1, 0.1) 0%,
rgba(255, 0, 174, 0) 100%
);
background-repeat: no-repeat;
mask-image: linear-gradient(to bottom, rgba(0 0 0 / 100%), transparent);
}
</style>
+1 -1
View File
@@ -66,5 +66,5 @@ export default {
}, },
}, },
}, },
plugins: [], plugins: [require('@tailwindcss/container-queries')],
} }