feat: Add instance changing

This commit is contained in:
Xyphyn committed 2023-07-02 14:27:04 -07:00
1 parent f201123291
commit 3159583654
17 files changed
+142 -35

No files matched your search

+6 -4
View File
@@ -1,9 +1,11 @@
import { lemmy } from '$lib/lemmy.js'
import { getClient } from '$lib/lemmy.js'
export async function load({ params }) {
export async function load({ params, cookies }) {
return {
post: await lemmy.getPost({ id: Number(params.id) }),
comments: await lemmy.getComments({
post: await getClient(cookies.get('instance_url')).getPost({
id: Number(params.id),
}),
comments: await getClient(cookies.get('instance_url')).getComments({
post_id: Number(params.id),
type_: 'All',
limit: 250,
+3 -4
View File
@@ -14,9 +14,6 @@
<li class="py-3">
<details bind:open class="flex flex-col gap-1">
<summary class="flex flex-row cursor-pointer arrow gap-2 items-center">
<!-- <button class="-z-10">
<Icon src={open ? Minus : Plus} width={12} mini />
</button> -->
<Avatar
url={node.comment_view.creator.avatar ??
`https://api.dicebear.com/6.x/initials/svg?seed=${node.comment_view.creator.name}`}
@@ -38,7 +35,9 @@
class="flex flex-col gap-1 whitespace-pre-wrap
max-w-full"
>
<SvelteMarkdown source={node.comment_view.comment.content} />
<div class="max-w-full break-words">
<SvelteMarkdown source={node.comment_view.comment.content} />
</div>
<div class="flex flex-row gap-2">
<button>
<Icon src={ArrowUp} width={16} mini />
+5 -3
View File
@@ -16,6 +16,7 @@
import type { CommentNodeI } from './comments.js'
import RelativeDate from '$lib/components/RelativeDate.svelte'
import CommunityLink from '$lib/components/CommunityLink.svelte'
import { isImage } from '$lib/ui/image.js'
let postRes: PostView
export { postRes as post }
@@ -45,12 +46,13 @@
{postRes.post.url}
</a>
{/if}
{#if postRes.post.thumbnail_url}
{#if isImage(postRes.post.url)}
<a href="/post/{postRes.post.id}" class="inline self-start">
<img
src={postRes.post.thumbnail_url}
src={postRes.post.url}
alt={postRes.post.name}
class="rounded-md max-h-64 max-w-max"
class="rounded-md max-h-64 max-w-full"
loading="lazy"
/>
</a>
{/if}