💾 Archived View for iich.space › src › views › admin › AdminBoardsPage.ts captured on 2021-12-03 at 14:04:38.
-=-=-=-=-=-=-
import { Template } from '@/mission-control'; import Header from '../Header'; import { Board, BoardType, PostStats } from '~/db/models'; const ToggleTypeLink = (board: Board) => board.type === BoardType.Text ? `=> /admin/boards/${board.id}/type/1 Change to Image Board` : `=> /admin/boards/${board.id}/type/0 Change to Text Board`; const ToggleLink = (board: Board) => board.deleted ? `=> /admin/boards/${board.id}/enable Enable` : `=> /admin/boards/${board.id}/disable Disable`; const BoardItem = (board: Board & PostStats) => `=> ${board.path} /${ board.name }/ - ${board.description || 'no description'} ${board.threadCount} Threads ${board.replyCount} Replies => /admin/boards/${board.id}/name Change name => /admin/boards/${board.id}/description Change description ${ToggleLink(board)} ${ToggleTypeLink(board)} `; interface Props { boards: Array<Board & PostStats>; } const AdminBoardsPage: Template<Props> = ( { each, include }, { boards }, ): string => ` ${include(Header)} => / Index => /admin Back ${each(boards, (board) => BoardItem(board))} => /admin/boards/create Create a new board `; export default AdminBoardsPage;