diff --git a/web/components/contract-card.tsx b/web/components/contract-card.tsx index c3d9595d..a452fec1 100644 --- a/web/components/contract-card.tsx +++ b/web/components/contract-card.tsx @@ -26,28 +26,30 @@ export function ContractCard(props: { const { probPercent } = contractMetrics(contract) return ( -
- - - - -

{question}

- +
+ + + + +

{question}

+ +
+ - - +
) } diff --git a/web/components/contract-prob-graph.tsx b/web/components/contract-prob-graph.tsx index 3be73c6b..94f9646a 100644 --- a/web/components/contract-prob-graph.tsx +++ b/web/components/contract-prob-graph.tsx @@ -47,7 +47,10 @@ export function ContractProbGraph(props: { contract: Contract }) { const lessThanAWeek = dayjs(startDate).add(1, 'week').isAfter(latestTime) return ( -
+
= 800 ? 400 : 250 }} + > { - const [size, setSize] = useState( - typeof window === 'undefined' - ? { width: undefined, height: undefined } - : { width: window.innerWidth, height: window.innerHeight } - ) + const [size, setSize] = useState<{ + width: number | undefined + height: number | undefined + }>({ width: undefined, height: undefined }) useEffect(() => { const onResize = () => { setSize({ width: window.innerWidth, height: window.innerHeight }) } + onResize() window.addEventListener('resize', onResize) return () => window.removeEventListener('resize', onResize) }, []) diff --git a/web/pages/admin.tsx b/web/pages/admin.tsx index baea0c8b..d0346ee1 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) + contracts = contracts.filter((contract) => !contract.isResolved) + + 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: 'visibility', + name: 'Visibility', + formatter: (cell) => cell, + }, + { + 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 +148,7 @@ export default function Admin() { return isAdmin ? ( + ) : (