import { createSignal, For, Show } from "solid-js"; import { getAtk, useUserinfo } from "../../stores/userinfo.tsx"; import PostAttachments from "./PostAttachments.tsx"; import * as marked from "marked"; import DOMPurify from "dompurify"; export default function PostItem(props: { post: any; noClick?: boolean; noAuthor?: boolean; noControl?: boolean; noRelated?: boolean; noContent?: boolean; onRepost?: (post: any) => void; onReply?: (post: any) => void; onEdit?: (post: any) => void; onDelete?: (post: any) => void; onSearch?: (filter: any) => void; onError: (message: string | null) => void; onReact: () => void; }) { const [reacting, setReacting] = createSignal(false); const userinfo = useUserinfo(); async function reactPost(item: any, type: string) { setReacting(true); const res = await fetch(`/api/posts/${item.id}/react/${type}`, { method: "POST", headers: { Authorization: `Bearer ${getAtk()}` }, }); if (res.status !== 201 && res.status !== 204) { props.onError(await res.text()); } else { props.onReact(); props.onError(null); } setReacting(false); } const content =
; return (
{props.post.author.name.substring(0, 1)}} > avatar

{props.post.author.nick}

{props.post.author.description}

{props.post.title}

{content}
{(item) => ( {item.name} )} {(item) => ( {item.name} )}
0}>

Reposted a post

Replied a post

Login! To access entire platform.
); }