import { createSignal, For, Show } from "solid-js"; import { getAtk, useUserinfo } from "../stores/userinfo.tsx"; import PostAttachments from "./PostAttachments.tsx"; import { SolidMarkdown } from "solid-markdown"; export default function PostItem(props: { post: any, noAuthor?: boolean, noControl?: boolean, onRepost?: (post: any) => void, onReply?: (post: any) => void, onEdit?: (post: any) => void, onDelete?: (post: 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); } return (
{props.post.author.name.substring(0, 1)}}> avatar

{props.post.author.nick}

{props.post.author.description}

{props.post.title}

{item => #{item.name} } {item => #{item.name} }

Reposted a post

Replied a post

Login! To access entire platform.
); }