misc: Improve error handling
This commit is contained in:
1 parent
98b5e4b5c1
commit
a5460a03b4
23 files changed
+285
-202
No files matched your search
@@ -9,7 +9,7 @@
|
||||
import type { CommentNodeI } from './comments.js'
|
||||
import Comments from './Comments.svelte'
|
||||
import SvelteMarkdown from 'svelte-markdown'
|
||||
import CommunityLink from '$lib/components/CommunityLink.svelte'
|
||||
import CommunityLink from '$lib/components/community/CommunityLink.svelte'
|
||||
import { isImage } from '$lib/ui/image.js'
|
||||
|
||||
export let data: { post: GetPostResponse; comments: GetCommentsResponse }
|
||||
@@ -88,8 +88,8 @@
|
||||
|
||||
<title>{data.post.post_view.post.name}</title>
|
||||
<div class="flex flex-col gap-2">
|
||||
<span class="flex flex-row gap-2 text-sm opacity-70">
|
||||
<CommunityLink community={postData.community} />
|
||||
<span class="flex flex-row gap-2 text-sm opacity-80 items-center">
|
||||
<CommunityLink avatar community={postData.community} />
|
||||
<span class="opacity-50">{postData.creator.name}</span>
|
||||
</span>
|
||||
<h1 class="font-bold text-lg">{post.name}</h1>
|
||||
@@ -112,7 +112,7 @@
|
||||
{#if post.body}
|
||||
<p
|
||||
class="bg-slate-100 border border-slate-200 dark:border-zinc-800
|
||||
dark:bg-zinc-900 p-2 text-sm rounded-md"
|
||||
dark:bg-zinc-900 p-2 text-sm rounded-md leading-5"
|
||||
>
|
||||
<SvelteMarkdown source={post.body} />
|
||||
</p>
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
|
||||
export async function load({ params, cookies }) {
|
||||
export async function load({ params }) {
|
||||
return {
|
||||
post: await getClient(cookies.get('instance_url')).getPost({
|
||||
post: await getClient().getPost({
|
||||
id: Number(params.id),
|
||||
}),
|
||||
comments: await getClient(cookies.get('instance_url')).getComments({
|
||||
comments: await getClient().getComments({
|
||||
post_id: Number(params.id),
|
||||
type_: 'All',
|
||||
limit: 250,
|
||||
@@ -11,7 +11,7 @@
|
||||
<ul
|
||||
class={isParent
|
||||
? ''
|
||||
: 'ml-2 mt-2 mx-2.5 px-2.5 border-l-2 border-black/10 dark:border-white/10'}
|
||||
: 'ml-2.5 mt-2 px-2.5 border-l-2 border-black/10 dark:border-white/10'}
|
||||
>
|
||||
{#each nodes.slice(0, maxComments) as node}
|
||||
<Comment {node} open={true}>
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
} from 'svelte-hero-icons'
|
||||
import type { CommentNodeI } from './comments.js'
|
||||
import RelativeDate from '$lib/components/RelativeDate.svelte'
|
||||
import CommunityLink from '$lib/components/CommunityLink.svelte'
|
||||
import CommunityLink from '$lib/components/community/CommunityLink.svelte'
|
||||
import { isImage } from '$lib/ui/image.js'
|
||||
|
||||
let postRes: PostView
|
||||
@@ -29,8 +29,9 @@
|
||||
rounded-md flex flex-col overflow-hidden max-w-xl w-full"
|
||||
>
|
||||
<div class="flex flex-col gap-2 bg-white dark:bg-zinc-900 p-4 rounded-md">
|
||||
<span class="flex flex-row gap-2 text-sm opacity-70">
|
||||
<CommunityLink community={postRes.community} />
|
||||
<span class="flex flex-row gap-2 text-sm opacity-80 items-center">
|
||||
<CommunityLink avatar community={postRes.community} />
|
||||
<div class="ml-auto" />
|
||||
<span class="opacity-50">{postRes.creator.name}</span>
|
||||
<span class="opacity-50">
|
||||
<RelativeDate date={new Date(postRes.post.published)} />
|
||||
|
||||
Reference in new issue
Block a user