From aa164cd5f5a2a0256f49defa5737a037d8bd1653 Mon Sep 17 00:00:00 2001 From: jahooma Date: Tue, 18 Jan 2022 16:10:40 -0600 Subject: [PATCH] Add contracts table to admin page --- web/pages/admin.tsx | 61 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 60 insertions(+), 1 deletion(-) diff --git a/web/pages/admin.tsx b/web/pages/admin.tsx index baea0c8b..233effcb 100644 --- a/web/pages/admin.tsx +++ b/web/pages/admin.tsx @@ -5,8 +5,8 @@ import { html } from 'gridjs' import dayjs from 'dayjs' import { useUsers } from '../hooks/use-users' import { useUser } from '../hooks/use-user' -import Error from 'next/error' import Custom404 from './404' +import { useContracts } from '../hooks/use-contracts' function avatarHtml(avatarUrl: string) { return ` b.createdTime - a.createdTime) + + return ( + + html(`@${cell}`), + }, + { + id: 'question', + name: 'Question', + formatter: (cell) => cell, + }, + { + id: 'volume24Hours', + name: '24 hour vol', + formatter: (cell) => (cell as number).toFixed(0), + }, + { + id: 'closeTime', + name: 'Close time', + formatter: (cell) => + html( + `${dayjs(cell as number).format( + 'MMM D, h:mma' + )}` + ), + }, + { + id: 'id', + name: 'ID', + formatter: (cell) => + html(`${cell}`), + }, + ]} + search={true} + sort={true} + pagination={{ + enabled: true, + limit: 25, + }} + /> + ) +} + export default function Admin() { const user = useUser() const adminIds = [ @@ -84,6 +142,7 @@ export default function Admin() { return isAdmin ? ( + ) : (