misc: basic functionality

This commit is contained in:
Xyphyn committed 2023-06-24 14:27:20 -07:00
1 parent c9fc488ef2
commit 83608fdaa6
12 files changed
+147 -36

No files matched your search

-1
View File
@@ -1,5 +1,4 @@
import { lemmy } from '$lib/lemmy.js';
import { error } from '@sveltejs/kit';
export function load({ params }) {
return lemmy.getCommunity({ name: params.name })
+15 -17
View File
@@ -1,23 +1,21 @@
<script lang="ts">
import type { GetCommunityResponse } from 'lemmy-js-client'
export let data: Promise<GetCommunityResponse>
export let data: GetCommunityResponse
</script>
{#await data then data}
<div class="flex flex-col gap-4">
<div class="flex flex-row gap-4 items-center">
<img
src={data.community_view.community.icon}
alt="test"
class="rounded-full bg-white border-slate-200 border p-2"
width={64}
height={64}
/>
<h1 class="font-bold text-xl">
{data.community_view.community.name}
</h1>
</div>
<slot />
<div class="flex flex-col gap-4">
<div class="flex flex-row gap-4 items-center">
<img
src={data.community_view.community.icon}
alt="test"
class="rounded-full bg-white border-slate-200 border p-2"
width={64}
height={64}
/>
<h1 class="font-bold text-xl">
{data.community_view.community.name}
</h1>
</div>
{/await}
<slot />
</div>
View File
Whitespace-only changes.
+5
View File
@@ -0,0 +1,5 @@
import { redirect } from '@sveltejs/kit';
export function load({ params }) {
throw redirect(300, `/c/${params.name}/posts`)
}
+5 -9
View File
@@ -1,18 +1,14 @@
<script lang="ts">
import MultiSelect from '$lib/components/MultiSelect.svelte'
import type { PostResponse } from 'lemmy-js-client'
import Post from './Post.svelte'
import Post from '../../../post/[id]/Post.svelte'
export let data: any
export let data
</script>
<MultiSelect options={['Community', 'idk']} selected="Community" />
<div class="flex flex-col gap-4">
{#await data then data}
<pre>{JSON.stringify(data, undefined, 2)}</pre>
{#each data?.posts as post}
<Post {post} />
{/each}
{/await}
{#each data.posts as post}
<Post {post} />
{/each}
</div>
-5
View File
@@ -1,5 +0,0 @@
<script lang="ts">
export let post: Post
</script>
<p>{post.post.name}</p>