From aee68936d2786ffe90f5bb4588fcc28d024b5948 Mon Sep 17 00:00:00 2001 From: ingawei Date: Wed, 14 Sep 2022 01:06:03 -0700 Subject: [PATCH] should work in theory? --- firestore.rules | 3 ++- web/pages/[username]/[contractSlug].tsx | 10 ++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/firestore.rules b/firestore.rules index d24d4097..1b6c584c 100644 --- a/firestore.rules +++ b/firestore.rules @@ -14,7 +14,8 @@ service cloud.firestore { 'manticmarkets@gmail.com', 'iansphilips@gmail.com', 'd4vidchee@gmail.com', - 'federicoruizcassarino@gmail.com' + 'federicoruizcassarino@gmail.com', + 'ingawei@gmail.com' ] } diff --git a/web/pages/[username]/[contractSlug].tsx b/web/pages/[username]/[contractSlug].tsx index de0c7807..48824849 100644 --- a/web/pages/[username]/[contractSlug].tsx +++ b/web/pages/[username]/[contractSlug].tsx @@ -45,6 +45,7 @@ import { import { ContractsGrid } from 'web/components/contract/contracts-grid' import { Title } from 'web/components/title' import { usePrefetch } from 'web/hooks/use-prefetch' +import { useAdmin } from 'web/hooks/use-admin' export const getStaticProps = fromPropz(getStaticPropz) export async function getStaticPropz(props: { @@ -116,13 +117,16 @@ export function ContractPageSidebar(props: { }) { const { contract, user } = props const { creatorId, isResolved, outcomeType } = contract - const isCreator = user?.id === creatorId const isBinary = outcomeType === 'BINARY' const isPseudoNumeric = outcomeType === 'PSEUDO_NUMERIC' const isNumeric = outcomeType === 'NUMERIC' const allowTrade = tradingAllowed(contract) - const allowResolve = !isResolved && isCreator && !!user + // INGA HERE IT'S HERE THIS IS THE SOLUTION + // const allowResolve = !isResolved && isCreator && !!user + const isAdmin = useAdmin() + const allowResolve = !isResolved && (isCreator || isAdmin) && !!user + const hasSidePanel = (isBinary || isNumeric || isPseudoNumeric) && (allowTrade || allowResolve) @@ -154,10 +158,8 @@ export function ContractPageContent( } ) { const { backToHome, comments, user } = props - const contract = useContractWithPreload(props.contract) ?? props.contract usePrefetch(user?.id) - useTracking( 'view market', {