From e4f1fbde3f6cec3c3fa000b220e59739668f3056 Mon Sep 17 00:00:00 2001 From: Austin Chen Date: Sun, 13 Feb 2022 16:09:30 -0800 Subject: [PATCH] Link to each question from Admin page --- web/pages/admin.tsx | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/web/pages/admin.tsx b/web/pages/admin.tsx index 8094ebf6..637e2801 100644 --- a/web/pages/admin.tsx +++ b/web/pages/admin.tsx @@ -1,14 +1,14 @@ import { Page } from '../components/page' -import { Grid } from 'gridjs-react' +import { Grid, _ as r } from 'gridjs-react' import 'gridjs/dist/theme/mermaid.css' import { html } from 'gridjs' import dayjs from 'dayjs' import { usePrivateUsers, useUsers } from '../hooks/use-users' -import { useUser } from '../hooks/use-user' import Custom404 from './404' import { useContracts } from '../hooks/use-contracts' import _ from 'lodash' import { useAdmin } from '../hooks/use-admin' +import { contractPath } from '../lib/firebase/contracts' function avatarHtml(avatarUrl: string) { return ` b.createdTime - a.createdTime) + // Render a clickable question. See https://gridjs.io/docs/examples/react-cells for docs + contracts.map((contract) => { + // @ts-ignore + contract.questionLink = r( +
+ + {contract.question} + +
+ ) + }) return ( @${cell}`), }, { - id: 'question', + id: 'questionLink', name: 'Question', - formatter: (cell) => html(`
${cell}
`), }, { id: 'volume24Hours',