diff --git a/common/contract.ts b/common/contract.ts index 343bc750..2b330201 100644 --- a/common/contract.ts +++ b/common/contract.ts @@ -58,6 +58,7 @@ export type Contract = { uniqueBettorCount?: number popularityScore?: number followerCount?: number + featuredOnHomeRank?: number } & T export type BinaryContract = Contract & Binary diff --git a/common/envs/prod.ts b/common/envs/prod.ts index 33cf03c1..5d9ac00e 100644 --- a/common/envs/prod.ts +++ b/common/envs/prod.ts @@ -71,6 +71,7 @@ export const PROD_CONFIG: EnvConfig = { 'taowell@gmail.com', // Stephen 'abc.sinclair@gmail.com', // Sinclair 'manticmarkets@gmail.com', // Manifold + 'iansphilips@gmail.com', // Ian ], visibility: 'PUBLIC', diff --git a/firestore.rules b/firestore.rules index 0e5a759b..4cd718d3 100644 --- a/firestore.rules +++ b/firestore.rules @@ -11,7 +11,8 @@ service cloud.firestore { 'jahooma@gmail.com', 'taowell@gmail.com', 'abc.sinclair@gmail.com', - 'manticmarkets@gmail.com' + 'manticmarkets@gmail.com', + 'iansphilips@gmail.com' ] } diff --git a/web/components/contract/FeaturedContractBadge.tsx b/web/components/contract/FeaturedContractBadge.tsx new file mode 100644 index 00000000..5ef34f4a --- /dev/null +++ b/web/components/contract/FeaturedContractBadge.tsx @@ -0,0 +1,9 @@ +import { SparklesIcon } from '@heroicons/react/solid' + +export function FeaturedContractBadge() { + return ( + + + ) +} diff --git a/web/components/contract/contract-details.tsx b/web/components/contract/contract-details.tsx index 7b6a6277..56407c4d 100644 --- a/web/components/contract/contract-details.tsx +++ b/web/components/contract/contract-details.tsx @@ -33,6 +33,7 @@ import { insertContent } from '../editor/utils' import clsx from 'clsx' import { contractMetrics } from 'common/contract-details' import { User } from 'common/user' +import { FeaturedContractBadge } from 'web/components/contract/FeaturedContractBadge' export type ShowTime = 'resolve-date' | 'close-date' @@ -73,6 +74,8 @@ export function MiscDetails(props: { {'Resolved '} {fromNow(resolutionTime || 0)} + ) : (contract?.featuredOnHomeRank ?? 0) > 0 ? ( + ) : volume > 0 || !isNew ? ( {formatMoney(contract.volume)} bet ) : ( diff --git a/web/components/contract/contract-info-dialog.tsx b/web/components/contract/contract-info-dialog.tsx index 29746c65..7c35a071 100644 --- a/web/components/contract/contract-info-dialog.tsx +++ b/web/components/contract/contract-info-dialog.tsx @@ -7,7 +7,7 @@ import { Bet } from 'common/bet' import { Contract } from 'common/contract' import { formatMoney } from 'common/util/format' -import { contractPool } from 'web/lib/firebase/contracts' +import { contractPool, updateContract } from 'web/lib/firebase/contracts' import { LiquidityPanel } from '../liquidity-panel' import { Col } from '../layout/col' import { Modal } from '../layout/modal' @@ -16,6 +16,7 @@ import { InfoTooltip } from '../info-tooltip' import { useAdmin, useDev } from 'web/hooks/use-admin' import { SiteLink } from '../site-link' import { firestoreConsolePath } from 'common/envs/constants' +import { deleteField } from 'firebase/firestore' export const contractDetailsButtonClassName = 'group flex items-center rounded-md px-3 py-2 text-sm font-medium cursor-pointer hover:bg-gray-100 text-gray-400 hover:text-gray-500' @@ -24,6 +25,9 @@ export function ContractInfoDialog(props: { contract: Contract; bets: Bet[] }) { const { contract, bets } = props const [open, setOpen] = useState(false) + const [featured, setFeatured] = useState( + (contract?.featuredOnHomeRank ?? 0) > 0 + ) const isDev = useDev() const isAdmin = useAdmin() @@ -138,6 +142,48 @@ export function ContractInfoDialog(props: { contract: Contract; bets: Bet[] }) { )} + {isAdmin && ( + + Set featured + + + + + )}