why the heck is the site card breaking

This commit is contained in:
Xyphyn committed 2023-07-06 18:32:53 -07:00
1 parent 66eca58d01
commit 6181c5138a
10 files changed
+213 -228

No files matched your search

+33 -87
View File
@@ -2,23 +2,10 @@
import { goto } from '$app/navigation'
import { page } from '$app/stores'
import Button from '$lib/components/input/Button.svelte'
import Card from '$lib/components/ui/StickyCard.svelte'
import Link from '$lib/components/input/Link.svelte'
import StickyCard from '$lib/components/ui/StickyCard.svelte'
import MultiSelect from '$lib/components/input/MultiSelect.svelte'
import {
Calendar,
ChatBubbleLeftEllipsis,
ChatBubbleOvalLeftEllipsis,
Icon,
Newspaper,
PencilSquare,
UserGroup,
} from 'svelte-hero-icons'
import Avatar from '$lib/components/ui/Avatar.svelte'
import Post from '$lib/components/lemmy/Post.svelte'
import FormattedNumber from '$lib/components/util/FormattedNumber.svelte'
import Markdown from '$lib/components/markdown/Markdown.svelte'
import RelativeDate from '$lib/components/util/RelativeDate.svelte'
import SiteCard from '$lib/components/lemmy/SiteCard.svelte'
export let data
</script>
@@ -27,9 +14,9 @@
<title>Xylemmy</title>
</svelte:head>
<div class="flex flex-row gap-4 justify-between">
<div class="flex flex-row gap-4 w-full">
<div class="flex flex-col gap-4 max-w-full w-full">
<div class="flex flex-col sm:flex-row gap-4 max-w-full">
<div class="flex flex-col sm:flex-row gap-4 max-w-full w-full">
<MultiSelect
options={['Subscribed', 'Local', 'All']}
selected={$page.url.searchParams.get('type') ?? 'Local'}
@@ -56,13 +43,11 @@
}}
/>
</div>
<div class="flex flex-col gap-4 w-full">
<div class="flex flex-col gap-4">
{#each data.posts.posts as post}
<Post {post} />
{/each}
</div>
<div>
<Button
on:click={() => {
@@ -80,77 +65,38 @@
</Button>
</div>
</div>
<div class="hidden lg:block max-w-sm w-full">
{#await data.streamed.site}
<Card>
<div
class="w-[64px] h-[64px] rounded-full bg-slate-200
{#await data.streamed.site}
<StickyCard>
<div
class="w-[64px] h-[64px] rounded-full bg-slate-200
dark:bg-zinc-700 animate-pulse"
/>
<div
class="w-32 h-3 bg-slate-200 dark:bg-zinc-700 animate-pulse
/>
<div
class="w-32 h-3 bg-slate-200 dark:bg-zinc-700 animate-pulse
rounded-md"
/>
<div
class="w-64 h-3 bg-slate-200 dark:bg-zinc-700 animate-pulse
/>
<div
class="w-64 h-3 bg-slate-200 dark:bg-zinc-700 animate-pulse
rounded-md"
/>
<div
class="w-36 mt-4 h-4 bg-slate-200 dark:bg-zinc-700 animate-pulse
/>
<div
class="w-36 mt-4 h-4 bg-slate-200 dark:bg-zinc-700 animate-pulse
rounded-md"
/>
<div
class="w-full h-4 bg-slate-200 dark:bg-zinc-700 animate-pulse
/>
<div
class="w-full h-4 bg-slate-200 dark:bg-zinc-700 animate-pulse
rounded-md"
/>
<div
class="w-24 h-4 bg-slate-200 dark:bg-zinc-700 animate-pulse
/>
<div
class="w-24 h-4 bg-slate-200 dark:bg-zinc-700 animate-pulse
rounded-md"
/>
</Card>
{:then site}
<Card>
{#if site.site_view.site.icon}
<Avatar
width={64}
url={site.site_view.site.icon}
alt={site.site_view.site.name}
/>
{/if}
<span class="flex flex-row items-center gap-1 text-sm capitalize">
<Icon src={Calendar} width={16} height={16} mini />
<RelativeDate date={new Date(site.site_view.site.published)} />
</span>
<div class="text-sm flex flex-row flex-wrap gap-3">
<span class="flex flex-row items-center gap-1">
<Icon src={UserGroup} width={16} height={16} mini />
<FormattedNumber number={site.site_view.counts.users} />
</span>
<span class="flex flex-row items-center gap-1">
<Icon src={PencilSquare} width={16} height={16} mini />
<FormattedNumber number={site.site_view.counts.posts} />
</span>
<span class="flex flex-row items-center gap-1">
<Icon
src={ChatBubbleOvalLeftEllipsis}
width={16}
height={16}
mini
/>
<FormattedNumber number={site.site_view.counts.comments} />
</span>
<span class="flex flex-row items-center gap-1">
<Icon src={Newspaper} width={16} height={16} mini />
<FormattedNumber number={site.site_view.counts.communities} />
</span>
</div>
<h1 class="font-bold text-lg">{site.site_view.site.name}</h1>
<Markdown source={site.site_view.site.description ?? ''} />
</Card>
{:catch}
<Card>
<h1 class="font-bold text-lg">Failed to load</h1>
</Card>
{/await}
</div>
/>
</StickyCard>
{:then site}
<SiteCard site={site.site_view} />
{:catch}
<StickyCard>
<h1 class="font-bold text-lg">Failed to load</h1>
</StickyCard>
{/await}
</div>