import { Template } from '@/mission-control'; import { ThreadWithReplies } from '~/db/models'; import PostItem from './PostItem'; interface Props { thread: ThreadWithReplies; repliesPerThread: number; showLinks?: boolean; } const ThreadItem: Template = ( { each, include, t, when }, { repliesPerThread, showLinks, thread }, ): string => ` => ${thread.path} ${include(PostItem, { post: thread, showLinks })} ${when( thread.replies.length > 0, () => ` ${when( thread.replyCount > repliesPerThread, () => ` ... `, )} ${each( thread.replies, (reply) => include(PostItem, { post: reply, showLinks }), 2, )} `, )} => ${thread.path} ${t('reply')} `; export default ThreadItem;