Skip to content

Commit 565b6b5

Browse files
committed
refactor: move components to root level and remove specific components
1 parent 091ff35 commit 565b6b5

File tree

5 files changed

+45
-52
lines changed

5 files changed

+45
-52
lines changed

frontend/src/lib/components/pages/home/recent_quibs.svelte

Lines changed: 0 additions & 42 deletions
This file was deleted.

frontend/src/routes/(app)/+page.svelte

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
<script lang="ts">
2-
import Quib from '$lib/components/pages/home/quib.svelte';
3-
import QuibsHeader from '$lib/components/pages/home/quibs_header.svelte';
4-
import RecentQuibs from '$lib/components/pages/home/recent_quibs.svelte';
2+
import Quib from '$lib/components/quib.svelte';
3+
import QuibsHeader from '$lib/components/quibs_header.svelte';
4+
import recent_posts from '$lib/data/mock/recent_posts.json';
5+
import readable from 'readable-numbers';
6+
import Avatar from '$lib/components/ui/avatar.svelte';
57
import type { PageData } from './$types';
68
79
const { data }: { data: PageData } = $props();
@@ -25,6 +27,42 @@
2527
<div
2628
class="fixed top-[3.75rem] flex h-[calc(100dvh-3.75rem)] w-72 flex-col gap-4 overflow-y-scroll p-4 scrollbar-none"
2729
>
28-
<RecentQuibs />
30+
<h2 class="font-medium">Recent Quibs</h2>
31+
<div class="flex flex-col gap-4">
32+
{#each recent_posts as post}
33+
<div class="flex flex-col gap-2">
34+
<div class="flex justify-between gap-2">
35+
<div class="flex flex-col gap-1">
36+
<a
37+
href="/q/{post.community.name}"
38+
class="flex items-center gap-2 hover:text-accent hover:underline"
39+
>
40+
<Avatar src={post.community.avatar} />
41+
<h3 class="text-xs font-semibold">q/{post.community.name}</h3>
42+
</a>
43+
<a
44+
href="/q/{post.community.name}/posts/{post.slug}"
45+
class="font-semibold text-info hover:underline"
46+
>
47+
{post.title}
48+
</a>
49+
</div>
50+
{#if post.cover}
51+
<img
52+
class="aspect-square size-20 flex-shrink-0 rounded-xl object-cover"
53+
src={post.cover}
54+
alt=""
55+
/>
56+
{/if}
57+
</div>
58+
<div class="flex items-center gap-2">
59+
<p class="text-xs font-medium">{readable(post.likes)} upvotes</p>
60+
<coreicons-shape-circle variant="filled" class="size-0.5"
61+
></coreicons-shape-circle>
62+
<p class="text-xs font-medium">{readable(post.comments)} comments</p>
63+
</div>
64+
</div>
65+
{/each}
66+
</div>
2967
</div>
3068
</div>

frontend/src/routes/(app)/q/[name]/+page.svelte

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script lang="ts">
2-
import Quib from '$lib/components/pages/home/quib.svelte';
3-
import QuibsHeader from '$lib/components/pages/home/quibs_header.svelte';
2+
import Quib from '$lib/components/quib.svelte';
3+
import QuibsHeader from '$lib/components/quibs_header.svelte';
44
import Avatar from '$lib/components/ui/avatar.svelte';
55
import { cn } from '$lib/functions/classnames';
66
import type { PageData } from './$types';
@@ -34,10 +34,7 @@
3434
></div>
3535
<div class="absolute inset-x-0 -bottom-12 flex items-end justify-between px-4">
3636
<div class="flex items-end gap-2">
37-
<Avatar
38-
class="!size-20 outline outline-8 outline-base-300"
39-
src={'https://google.com'}
40-
/>
37+
<Avatar class="!size-20 outline outline-8 outline-base-300" src={quiblet?.avatar} />
4138
<h3 class="text-2xl font-bold text-info">q/{quiblet?.name}</h3>
4239
</div>
4340
<div class="flex items-center gap-2">

0 commit comments

Comments
 (0)