💾 Archived View for iich.space › src › views › RecentPostItem.ts captured on 2022-03-01 at 16:00:35.

View Raw

More Information

⬅️ Previous capture (2021-12-03)

-=-=-=-=-=-=-

import { Template } from '@/mission-control';

import { RecentPost } from '~/db/models';
import { truncate } from '~/util/truncate';

import PostItem from './PostItem';

interface Props {
  post: RecentPost;
}

const RecentPostItem: Template<Props> = ({ include }, { post }): string => {
  if (post.comment === '[Image]') {
    const replyTo = truncate(post.threadComment.split('\n')[0], 30);
    post.comment = `[Image reply in: ${replyTo}]`;
  }

  return `
=> ${post.path} ${include(PostItem, { post })}
`;
};

export default RecentPostItem;