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

View Raw

More Information

⬅️ Previous capture (2021-12-03)

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

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

import { GEMINI } from '~/constants';
import { Board, PostStats, RecentPost } from '~/db/models';
import { IdentityDisplay } from '~/util/identity';

import BoardItem from './BoardItem';
import Header from './Header';
import RecentPostItem from './RecentPostItem';

interface Props {
  boards: Array<Board>;
  posts: Array<RecentPost>;
  stats: PostStats;
  identity: IdentityDisplay | null;
}

const LandingPage: Template<Props> = (
  { each, include, t, when },
  { boards, identity, posts, stats },
): string => `
${include(Header)}

### ${t('boards')}

${each(boards, (board) => include(BoardItem, { board }))}

### ${t('recent_posts')}

${each(posts, (post) => include(RecentPostItem, { post }), 2)}

### ${t('info')}

=> /info More about ${GEMINI}ch
${when(
  identity !== null,
  () => `
=> /change-name Change name for ${identity!.display}
`,
)}

${t('n_threads', stats.threadCount)}
${t('n_replies', stats.replyCount)}
`;

export default LandingPage;