misc: Split post component into more components
This commit is contained in:
1 parent
58057bbeaa
commit
b0f3e01f5a
9 files changed
+183
-188
No files matched your search
@@ -1,23 +1,11 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import {
|
import { Icon, Minus, Plus } from 'svelte-hero-icons'
|
||||||
ArrowDown,
|
|
||||||
ArrowUp,
|
|
||||||
ChatBubbleOvalLeft,
|
|
||||||
ChevronDown,
|
|
||||||
ChevronUp,
|
|
||||||
Icon,
|
|
||||||
Minus,
|
|
||||||
Plus,
|
|
||||||
} from 'svelte-hero-icons'
|
|
||||||
import type { CommentNodeI } from './comments'
|
import type { CommentNodeI } from './comments'
|
||||||
import RelativeDate from '$lib/components/util/RelativeDate.svelte'
|
import RelativeDate from '$lib/components/util/RelativeDate.svelte'
|
||||||
import { Color } from '$lib/ui/colors.js'
|
|
||||||
import CommentForm from './CommentForm.svelte'
|
import CommentForm from './CommentForm.svelte'
|
||||||
import { page } from '$app/stores'
|
import { page } from '$app/stores'
|
||||||
import UserLink from '$lib/components/user/UserLink.svelte'
|
import UserLink from '$lib/components/user/UserLink.svelte'
|
||||||
import Markdown from '$lib/components/markdown/Markdown.svelte'
|
import Markdown from '$lib/components/markdown/Markdown.svelte'
|
||||||
import CommentVote from '$lib/components/lemmy/comment/CommentVote.svelte'
|
|
||||||
import { userSettings } from '$lib/settings.js'
|
|
||||||
import CommentActions from '$lib/components/lemmy/comment/CommentActions.svelte'
|
import CommentActions from '$lib/components/lemmy/comment/CommentActions.svelte'
|
||||||
|
|
||||||
export let node: CommentNodeI
|
export let node: CommentNodeI
|
||||||
|
|||||||
@@ -7,9 +7,7 @@
|
|||||||
import { ChevronDown, Icon } from 'svelte-hero-icons'
|
import { ChevronDown, Icon } from 'svelte-hero-icons'
|
||||||
import { authData, getClient } from '$lib/lemmy.js'
|
import { authData, getClient } from '$lib/lemmy.js'
|
||||||
import type { Post } from 'lemmy-js-client'
|
import type { Post } from 'lemmy-js-client'
|
||||||
import { Color } from '$lib/ui/colors.js'
|
|
||||||
import { fly } from 'svelte/transition'
|
import { fly } from 'svelte/transition'
|
||||||
import Spinner from '$lib/components/ui/loader/Spinner.svelte'
|
|
||||||
|
|
||||||
export let nodes: CommentNodeI[]
|
export let nodes: CommentNodeI[]
|
||||||
export let isParent: boolean
|
export let isParent: boolean
|
||||||
|
|||||||
@@ -71,3 +71,12 @@ export function buildCommentsTree(
|
|||||||
|
|
||||||
return tree
|
return tree
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function buildCommentsTreeAsync(
|
||||||
|
comments: CommentView[],
|
||||||
|
parentComment: boolean
|
||||||
|
) {
|
||||||
|
const result = buildCommentsTree(comments, parentComment)
|
||||||
|
|
||||||
|
return result
|
||||||
|
}
|
||||||
@@ -1,113 +1,63 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { PostView } from 'lemmy-js-client'
|
import type { PostView } from 'lemmy-js-client'
|
||||||
import RelativeDate from '$lib/components/util/RelativeDate.svelte'
|
|
||||||
import CommunityLink from '$lib/components/community/CommunityLink.svelte'
|
|
||||||
import { isImage } from '$lib/ui/image.js'
|
import { isImage } from '$lib/ui/image.js'
|
||||||
import UserLink from '$lib/components/user/UserLink.svelte'
|
|
||||||
import Card from '$lib/components/ui/Card.svelte'
|
import Card from '$lib/components/ui/Card.svelte'
|
||||||
import { getInstance } from '$lib/lemmy.js'
|
import { getInstance } from '$lib/lemmy.js'
|
||||||
import Avatar from '$lib/components/ui/Avatar.svelte'
|
|
||||||
import PostActions from '$lib/components/lemmy/post/PostActions.svelte'
|
import PostActions from '$lib/components/lemmy/post/PostActions.svelte'
|
||||||
import Badge from '$lib/components/ui/Badge.svelte'
|
|
||||||
import {
|
|
||||||
Bookmark,
|
|
||||||
HandThumbDown,
|
|
||||||
Icon,
|
|
||||||
InformationCircle,
|
|
||||||
Link,
|
|
||||||
Trash,
|
|
||||||
} from 'svelte-hero-icons'
|
|
||||||
import { userSettings } from '$lib/settings.js'
|
import { userSettings } from '$lib/settings.js'
|
||||||
|
import PostLink from '$lib/components/lemmy/post/PostLink.svelte'
|
||||||
|
import PostMeta from '$lib/components/lemmy/post/PostMeta.svelte'
|
||||||
|
|
||||||
let postRes: PostView
|
export let post: PostView
|
||||||
export { postRes as post }
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Card class="bg-white flex flex-col w-full p-5 gap-2.5">
|
<Card class="bg-white flex flex-col w-full p-5 gap-2.5">
|
||||||
<span class="flex flex-row gap-2 text-xs items-center">
|
<PostMeta
|
||||||
<Avatar
|
community={post.community}
|
||||||
url={postRes.community.icon}
|
user={post.creator}
|
||||||
alt={postRes.community.title}
|
published={new Date(post.post.published)}
|
||||||
width={24}
|
upvotes={post.counts.upvotes}
|
||||||
/>
|
downvotes={post.counts.downvotes}
|
||||||
<div class="flex flex-col">
|
deleted={post.post.deleted}
|
||||||
<CommunityLink community={postRes.community} />
|
featured={post.post.featured_local || post.post.featured_community}
|
||||||
<span class="text-slate-600 dark:text-zinc-400 flex flex-row gap-1">
|
nsfw={post.post.nsfw}
|
||||||
<UserLink user={postRes.creator} />
|
saved={post.saved}
|
||||||
<span>•</span>
|
/>
|
||||||
<RelativeDate date={new Date(postRes.post.published)} />
|
|
||||||
<span>•</span>
|
|
||||||
<span>
|
|
||||||
{Math.floor(
|
|
||||||
(postRes.counts.upvotes /
|
|
||||||
(postRes.counts.upvotes + postRes.counts.downvotes || 1)) *
|
|
||||||
100
|
|
||||||
)}%
|
|
||||||
</span>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<!-- Badges -->
|
|
||||||
<div class="flex flex-row ml-auto gap-2">
|
|
||||||
{#if postRes.post.nsfw}
|
|
||||||
<Badge class="bg-red-600 text-white">NSFW</Badge>
|
|
||||||
{/if}
|
|
||||||
{#if postRes.counts.score < 0 && postRes.counts.upvotes > 3 && postRes.counts.downvotes > 3}
|
|
||||||
<Badge class="bg-purple-400 text-white py-1" label="Controversial">
|
|
||||||
<Icon src={HandThumbDown} mini width={16} />
|
|
||||||
</Badge>
|
|
||||||
{/if}
|
|
||||||
{#if postRes.saved}
|
|
||||||
<Badge class="bg-yellow-500 text-white py-1" label="Saved">
|
|
||||||
<Icon src={Bookmark} mini width={16} />
|
|
||||||
</Badge>
|
|
||||||
{/if}
|
|
||||||
{#if postRes.post.deleted || postRes.post.removed}
|
|
||||||
<Badge class="bg-red-600 text-white py-1" label="Deleted">
|
|
||||||
<Icon src={Trash} mini width={16} />
|
|
||||||
</Badge>
|
|
||||||
{/if}
|
|
||||||
{#if postRes.post.featured_community || postRes.post.featured_local}
|
|
||||||
<Badge class="bg-green-500 text-white py-1" label="Pinned">
|
|
||||||
<Icon src={InformationCircle} mini width={16} />
|
|
||||||
</Badge>
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
</span>
|
|
||||||
<a
|
<a
|
||||||
href="/post/{getInstance()}/{postRes.post.id}"
|
href="/post/{getInstance()}/{post.post.id}"
|
||||||
class="font-bold"
|
class="font-bold"
|
||||||
class:opacity-50={postRes.read && $userSettings.markReadPosts}
|
class:opacity-50={post.read && $userSettings.markReadPosts}
|
||||||
>
|
>
|
||||||
{postRes.post.name}
|
{post.post.name}
|
||||||
</a>
|
</a>
|
||||||
{#if postRes.post.url && !postRes.post.thumbnail_url}
|
{#if post.post.url && !post.post.thumbnail_url}
|
||||||
<a
|
<a
|
||||||
href={postRes.post.url}
|
href={post.post.url}
|
||||||
class="max-w-full overflow-hidden overflow-ellipsis whitespace-nowrap text-sky-400 hover:underline text-xs"
|
class="max-w-full overflow-hidden overflow-ellipsis whitespace-nowrap text-sky-400 hover:underline text-xs"
|
||||||
>
|
>
|
||||||
{postRes.post.url}
|
{post.post.url}
|
||||||
</a>
|
</a>
|
||||||
{/if}
|
{/if}
|
||||||
{#if isImage(postRes.post.url)}
|
{#if isImage(post.post.url)}
|
||||||
<div class="self-start" class:blur-3xl={postRes.post.nsfw}>
|
<div class="self-start" class:blur-3xl={post.post.nsfw}>
|
||||||
<picture
|
<picture
|
||||||
class="rounded-md overflow-hidden max-h-[min(50vh,500px)] w-full max-w-full"
|
class="rounded-md overflow-hidden max-h-[min(50vh,500px)] w-full max-w-full"
|
||||||
>
|
>
|
||||||
<source
|
<source
|
||||||
srcset="{postRes.post.url}?thumbnail=256&format=webp"
|
srcset="{post.post.url}?thumbnail=256&format=webp"
|
||||||
media="(max-width: 256px)"
|
media="(max-width: 256px)"
|
||||||
/>
|
/>
|
||||||
<source
|
<source
|
||||||
srcset="{postRes.post.url}?thumbnail=512&format=webp"
|
srcset="{post.post.url}?thumbnail=512&format=webp"
|
||||||
media="(max-width: 512px)"
|
media="(max-width: 512px)"
|
||||||
/>
|
/>
|
||||||
<source
|
<source
|
||||||
srcset="{postRes.post.url}?thumbnail=720&format=webp"
|
srcset="{post.post.url}?thumbnail=720&format=webp"
|
||||||
media="(max-width: 720px)"
|
media="(max-width: 720px)"
|
||||||
/>
|
/>
|
||||||
<!-- svelte-ignore a11y-missing-attribute -->
|
<!-- svelte-ignore a11y-missing-attribute -->
|
||||||
<img
|
<img
|
||||||
src="{postRes.post.url}?thumbnail=1024&format=webp"
|
src="{post.post.url}?thumbnail=1024&format=webp"
|
||||||
loading="lazy"
|
loading="lazy"
|
||||||
class="object-cover bg-slate-100 rounded-md max-h-[50vh] w-full"
|
class="object-cover bg-slate-100 rounded-md max-h-[50vh] w-full"
|
||||||
width={512}
|
width={512}
|
||||||
@@ -115,35 +65,20 @@
|
|||||||
/>
|
/>
|
||||||
</picture>
|
</picture>
|
||||||
</div>
|
</div>
|
||||||
{:else if postRes.post.thumbnail_url && postRes.post.url}
|
{:else if post.post.thumbnail_url && post.post.url}
|
||||||
<a
|
<PostLink
|
||||||
href={postRes.post.url}
|
url={post.post.url}
|
||||||
class="self-start relative group"
|
thumbnail_url={post.post.thumbnail_url}
|
||||||
class:blur-3xl={postRes.post.nsfw}
|
nsfw={post.post.nsfw}
|
||||||
>
|
/>
|
||||||
<img
|
|
||||||
src={postRes.post.thumbnail_url}
|
|
||||||
alt={postRes.post.name}
|
|
||||||
class="rounded-md max-h-[16rem] w-full max-w-full"
|
|
||||||
/>
|
|
||||||
<span
|
|
||||||
class="w-full px-4 py-2 overflow-hidden
|
|
||||||
whitespace-nowrap text-ellipsis text-sm group-hover:underline bg-slate-100 border
|
|
||||||
dark:border-zinc-700
|
|
||||||
dark:bg-zinc-800 absolute bottom-0 rounded-b-md flex flex-row gap-1 items-center"
|
|
||||||
>
|
|
||||||
<Icon src={Link} width={16} mini />
|
|
||||||
{new URL(postRes.post.url).hostname}
|
|
||||||
</span>
|
|
||||||
</a>
|
|
||||||
{/if}
|
{/if}
|
||||||
{#if postRes.post.body && !postRes.post.nsfw}
|
{#if post.post.body && !post.post.nsfw}
|
||||||
<p
|
<p
|
||||||
class="text-sm max-h-[74px] line-clamp-3 bg-slate-100 dark:bg-zinc-800
|
class="text-sm max-h-[74px] line-clamp-3 bg-slate-100 dark:bg-zinc-800
|
||||||
border border-slate-200 dark:border-zinc-700 rounded-md p-2"
|
border border-slate-200 dark:border-zinc-700 rounded-md p-2"
|
||||||
>
|
>
|
||||||
{postRes.post.body}
|
{post.post.body}
|
||||||
</p>
|
</p>
|
||||||
{/if}
|
{/if}
|
||||||
<PostActions post={postRes} />
|
<PostActions {post} />
|
||||||
</Card>
|
</Card>
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import { Icon, Link } from 'svelte-hero-icons'
|
||||||
|
|
||||||
|
export let url: string
|
||||||
|
export let thumbnail_url: string
|
||||||
|
export let nsfw: boolean = false
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<a href={url} class="self-start relative group" class:blur-3xl={nsfw}>
|
||||||
|
<!-- svelte-ignore a11y-missing-attribute -->
|
||||||
|
<img
|
||||||
|
src={thumbnail_url}
|
||||||
|
class="rounded-md max-h-[16rem] w-full aspect-[16/9] object-cover"
|
||||||
|
/>
|
||||||
|
<span
|
||||||
|
class="w-full px-4 py-2 overflow-hidden
|
||||||
|
whitespace-nowrap text-ellipsis text-sm group-hover:underline bg-slate-100 border
|
||||||
|
dark:border-zinc-700
|
||||||
|
dark:bg-zinc-800 absolute bottom-0 rounded-b-md flex flex-row gap-1 items-center h-10"
|
||||||
|
>
|
||||||
|
<Icon src={Link} width={16} mini />
|
||||||
|
{new URL(url).hostname}
|
||||||
|
</span>
|
||||||
|
</a>
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import CommunityLink from '$lib/components/community/CommunityLink.svelte'
|
||||||
|
import Avatar from '$lib/components/ui/Avatar.svelte'
|
||||||
|
import Badge from '$lib/components/ui/Badge.svelte'
|
||||||
|
import UserLink from '$lib/components/user/UserLink.svelte'
|
||||||
|
import RelativeDate from '$lib/components/util/RelativeDate.svelte'
|
||||||
|
import type { Community, Person } from 'lemmy-js-client'
|
||||||
|
import { Bookmark, Icon, InformationCircle, Trash } from 'svelte-hero-icons'
|
||||||
|
|
||||||
|
export let community: Community
|
||||||
|
export let user: Person
|
||||||
|
export let published: Date
|
||||||
|
|
||||||
|
// Score
|
||||||
|
export let upvotes: number
|
||||||
|
export let downvotes: number
|
||||||
|
|
||||||
|
// Badges
|
||||||
|
export let nsfw: boolean
|
||||||
|
export let saved: boolean
|
||||||
|
export let featured: boolean
|
||||||
|
export let deleted: boolean
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<span class="flex flex-row gap-2 text-sm items-center">
|
||||||
|
<Avatar url={community.icon} width={24} alt={community.name} />
|
||||||
|
<div class="flex flex-col text-xs">
|
||||||
|
<CommunityLink {community} />
|
||||||
|
<span class="text-slate-600 dark:text-zinc-400 flex flex-row gap-1">
|
||||||
|
<UserLink {user} />
|
||||||
|
<span>•</span>
|
||||||
|
<RelativeDate date={published} />
|
||||||
|
<span>•</span>
|
||||||
|
<span>
|
||||||
|
{Math.floor((upvotes / (upvotes + downvotes || 1)) * 100)}%
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex flex-row ml-auto gap-2">
|
||||||
|
{#if nsfw}
|
||||||
|
<Badge class="bg-red-600 text-white">NSFW</Badge>
|
||||||
|
{/if}
|
||||||
|
{#if saved}
|
||||||
|
<Badge class="bg-yellow-500 text-white py-1" label="Saved">
|
||||||
|
<Icon src={Bookmark} mini width={16} />
|
||||||
|
</Badge>
|
||||||
|
{/if}
|
||||||
|
{#if deleted}
|
||||||
|
<Badge class="bg-red-600 text-white py-1" label="Deleted">
|
||||||
|
<Icon src={Trash} mini width={16} />
|
||||||
|
</Badge>
|
||||||
|
{/if}
|
||||||
|
{#if featured}
|
||||||
|
<Badge class="bg-green-500 text-white py-1" label="Pinned">
|
||||||
|
<Icon src={InformationCircle} mini width={16} />
|
||||||
|
</Badge>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</span>
|
||||||
@@ -1,14 +1,23 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { fly } from 'svelte/transition'
|
type CardColor = 'default' | 'warning' | 'error'
|
||||||
|
export let cardColor: CardColor = 'default'
|
||||||
|
|
||||||
|
const getColor = (color: CardColor) => {
|
||||||
|
switch (color) {
|
||||||
|
case 'default':
|
||||||
|
return 'border border-slate-200 dark:border-zinc-800 dark:bg-zinc-900'
|
||||||
|
case 'warning':
|
||||||
|
return 'border border-yellow-300 bg-yellow-50'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let clazz = ''
|
let clazz = ''
|
||||||
export { clazz as class }
|
export { clazz as class }
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class="bg-white border border-slate-200
|
class="bg-white break-words
|
||||||
dark:border-zinc-800 dark:bg-zinc-900 break-words
|
p-1 {getColor(cardColor)} rounded-xl {clazz}"
|
||||||
p-1 rounded-xl {clazz}"
|
|
||||||
>
|
>
|
||||||
<slot />
|
<slot />
|
||||||
</div>
|
</div>
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { buildCommentsTree } from '$lib/components/lemmy/comment/comments.js'
|
import {
|
||||||
|
buildCommentsTree,
|
||||||
|
buildCommentsTreeAsync,
|
||||||
|
} from '$lib/components/lemmy/comment/comments.js'
|
||||||
import Comments from '$lib/components/lemmy/comment/Comments.svelte'
|
import Comments from '$lib/components/lemmy/comment/Comments.svelte'
|
||||||
import CommunityLink from '$lib/components/community/CommunityLink.svelte'
|
import CommunityLink from '$lib/components/community/CommunityLink.svelte'
|
||||||
import { isImage } from '$lib/ui/image.js'
|
import { isImage } from '$lib/ui/image.js'
|
||||||
@@ -14,9 +17,17 @@
|
|||||||
import { page } from '$app/stores'
|
import { page } from '$app/stores'
|
||||||
import PostActions from '$lib/components/lemmy/post/PostActions.svelte'
|
import PostActions from '$lib/components/lemmy/post/PostActions.svelte'
|
||||||
import Badge from '$lib/components/ui/Badge.svelte'
|
import Badge from '$lib/components/ui/Badge.svelte'
|
||||||
import { Bookmark, Icon, InformationCircle, Trash } from 'svelte-hero-icons'
|
import {
|
||||||
|
Bookmark,
|
||||||
|
ExclamationTriangle,
|
||||||
|
Icon,
|
||||||
|
InformationCircle,
|
||||||
|
Trash,
|
||||||
|
} from 'svelte-hero-icons'
|
||||||
import Link from '$lib/components/input/Link.svelte'
|
import Link from '$lib/components/input/Link.svelte'
|
||||||
import Spinner from '$lib/components/ui/loader/Spinner.svelte'
|
import Spinner from '$lib/components/ui/loader/Spinner.svelte'
|
||||||
|
import Card from '$lib/components/ui/Card.svelte'
|
||||||
|
import PostLink from '$lib/components/lemmy/post/PostLink.svelte'
|
||||||
|
|
||||||
export let data
|
export let data
|
||||||
|
|
||||||
@@ -51,49 +62,22 @@
|
|||||||
</svelte:head>
|
</svelte:head>
|
||||||
|
|
||||||
<div class="flex flex-col gap-2">
|
<div class="flex flex-col gap-2">
|
||||||
<span class="flex flex-row gap-2 text-sm items-center">
|
{#if $authData && $page.params.instance != $authData.instance}
|
||||||
<Avatar
|
<Card cardColor="warning" class="p-4 flex flex-col gap-1">
|
||||||
url={postData.community.icon}
|
<Icon
|
||||||
width={24}
|
src={ExclamationTriangle}
|
||||||
alt={postData.community.name}
|
width={24}
|
||||||
/>
|
solid
|
||||||
<div class="flex flex-col text-xs">
|
class="text-yellow-500"
|
||||||
<CommunityLink community={postData.community} />
|
/>
|
||||||
<span class="text-slate-600 dark:text-zinc-400 flex flex-row gap-1">
|
<h1 class="font-bold">Warning</h1>
|
||||||
<UserLink user={postData.creator} />
|
<p class="text-sm">
|
||||||
<span>•</span>
|
This URL is for a different instance than you're logged into. You
|
||||||
<RelativeDate date={new Date(postData.post.published)} />
|
probably won't be able to vote or comment.
|
||||||
<span>•</span>
|
</p>
|
||||||
<span>
|
</Card>
|
||||||
{Math.floor(
|
{/if}
|
||||||
(data.post.post_view.counts.upvotes /
|
|
||||||
(data.post.post_view.counts.upvotes +
|
|
||||||
data.post.post_view.counts.downvotes || 1)) *
|
|
||||||
100
|
|
||||||
)}%
|
|
||||||
</span>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{#if data.post.post_view.post.nsfw}
|
|
||||||
<Badge class="bg-red-600 text-white">NSFW</Badge>
|
|
||||||
{/if}
|
|
||||||
{#if data.post.post_view.saved}
|
|
||||||
<Badge class="bg-yellow-500 text-white py-1" label="Saved">
|
|
||||||
<Icon src={Bookmark} mini width={16} />
|
|
||||||
</Badge>
|
|
||||||
{/if}
|
|
||||||
{#if data.post.post_view.post.deleted || data.post.post_view.post.removed}
|
|
||||||
<Badge class="bg-red-600 text-white py-1" label="Deleted">
|
|
||||||
<Icon src={Trash} mini width={16} />
|
|
||||||
</Badge>
|
|
||||||
{/if}
|
|
||||||
{#if data.post.post_view.post.featured_community || data.post.post_view.post.featured_local}
|
|
||||||
<Badge class="bg-green-500 text-white py-1" label="Pinned">
|
|
||||||
<Icon src={InformationCircle} mini width={16} />
|
|
||||||
</Badge>
|
|
||||||
{/if}
|
|
||||||
</span>
|
|
||||||
<h1 class="font-bold text-lg">{post.name}</h1>
|
<h1 class="font-bold text-lg">{post.name}</h1>
|
||||||
{#if isImage(post.url)}
|
{#if isImage(post.url)}
|
||||||
<img
|
<img
|
||||||
@@ -102,25 +86,11 @@
|
|||||||
class="rounded-md max-w-screen max-h-[80vh] mx-auto"
|
class="rounded-md max-w-screen max-h-[80vh] mx-auto"
|
||||||
/>
|
/>
|
||||||
{:else if post.thumbnail_url && post.url}
|
{:else if post.thumbnail_url && post.url}
|
||||||
<a
|
<PostLink
|
||||||
href={post.url}
|
thumbnail_url={post.thumbnail_url}
|
||||||
class="self-start relative group"
|
url={post.url}
|
||||||
class:blur-3xl={post.nsfw}
|
nsfw={post.nsfw}
|
||||||
>
|
/>
|
||||||
<img
|
|
||||||
src={post.thumbnail_url}
|
|
||||||
alt={post.name}
|
|
||||||
class="rounded-md max-h-[16rem] w-full max-w-full"
|
|
||||||
/>
|
|
||||||
<span
|
|
||||||
class="w-full px-4 py-2 overflow-hidden
|
|
||||||
whitespace-nowrap text-ellipsis text-sm group-hover:underline bg-slate-100 dark:bg-zinc-800 border dark:border-transparent
|
|
||||||
absolute bottom-0 rounded-b-md flex flex-row gap-1 items-center h-10"
|
|
||||||
>
|
|
||||||
<Icon src={Link} width={16} mini />
|
|
||||||
{new URL(post.url).hostname}
|
|
||||||
</span>
|
|
||||||
</a>
|
|
||||||
{:else if post.embed_video_url}
|
{:else if post.embed_video_url}
|
||||||
<!-- svelte-ignore a11y-media-has-caption -->
|
<!-- svelte-ignore a11y-media-has-caption -->
|
||||||
<video class="rounded-md max-w-screen max-h-[80vh] mx-auto">
|
<video class="rounded-md max-w-screen max-h-[80vh] mx-auto">
|
||||||
@@ -160,11 +130,13 @@
|
|||||||
])}
|
])}
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
<Comments
|
{#await buildCommentsTreeAsync(comments.comments, false)}
|
||||||
{post}
|
<div class="h-16 mx-auto grid place-items-center">
|
||||||
nodes={buildCommentsTree(comments.comments, false)}
|
<Spinner width={36} />
|
||||||
isParent={true}
|
</div>
|
||||||
/>
|
{:then comments}
|
||||||
|
<Comments {post} nodes={comments} isParent={true} />
|
||||||
|
{/await}
|
||||||
{#if moreComments}
|
{#if moreComments}
|
||||||
<Button
|
<Button
|
||||||
{loading}
|
{loading}
|
||||||
|
|||||||
@@ -49,7 +49,7 @@
|
|||||||
<div class="flex flex-col gap-4 max-w-full w-full">
|
<div class="flex flex-col gap-4 max-w-full w-full">
|
||||||
{#each items as item}
|
{#each items as item}
|
||||||
{#if isComment(item)}<Card
|
{#if isComment(item)}<Card
|
||||||
class="flex flex-col bg-white rounded-md p-4 flex-1"
|
class="flex flex-col bg-white rounded-md p-5 flex-1"
|
||||||
>
|
>
|
||||||
<div class="flex flex-row justify-between items-center">
|
<div class="flex flex-row justify-between items-center">
|
||||||
<div class="flex flex-col gap-1">
|
<div class="flex flex-col gap-1">
|
||||||
|
|||||||
Reference in new issue
Block a user