Add challenge enabled flag

This commit is contained in:
Ian Philips 2022-08-04 15:05:50 -06:00
parent 313c10c33a
commit 839f19520a
4 changed files with 56 additions and 24 deletions

View File

@ -59,3 +59,5 @@ export type Acceptance = {
createdTime: number createdTime: number
} }
export const CHALLENGES_ENABLED = true

View File

@ -25,6 +25,7 @@ import React from 'react'
import { copyToClipboard } from 'web/lib/util/copy' import { copyToClipboard } from 'web/lib/util/copy'
import toast from 'react-hot-toast' import toast from 'react-hot-toast'
import { LinkIcon } from '@heroicons/react/outline' import { LinkIcon } from '@heroicons/react/outline'
import { CHALLENGES_ENABLED } from 'common/challenge'
export const ContractOverview = (props: { export const ContractOverview = (props: {
contract: Contract contract: Contract
@ -39,7 +40,7 @@ export const ContractOverview = (props: {
const isBinary = outcomeType === 'BINARY' const isBinary = outcomeType === 'BINARY'
const isPseudoNumeric = outcomeType === 'PSEUDO_NUMERIC' const isPseudoNumeric = outcomeType === 'PSEUDO_NUMERIC'
const showChallenge = user && isBinary && !resolution const showChallenge = user && isBinary && !resolution && CHALLENGES_ENABLED
return ( return (
<Col className={clsx('mb-6', className)}> <Col className={clsx('mb-6', className)}>

View File

@ -29,6 +29,7 @@ import { Spacer } from '../layout/spacer'
import { useUnseenPreferredNotifications } from 'web/hooks/use-notifications' import { useUnseenPreferredNotifications } from 'web/hooks/use-notifications'
import { PrivateUser } from 'common/user' import { PrivateUser } from 'common/user'
import { useWindowSize } from 'web/hooks/use-window-size' import { useWindowSize } from 'web/hooks/use-window-size'
import { CHALLENGES_ENABLED } from 'common/challenge'
const logout = async () => { const logout = async () => {
// log out, and then reload the page, in case SSR wants to boot them out // log out, and then reload the page, in case SSR wants to boot them out
@ -60,28 +61,50 @@ function getMoreNavigation(user?: User | null) {
} }
if (!user) { if (!user) {
return [ if (CHALLENGES_ENABLED)
{ name: 'Challenges', href: '/challenges' }, return [
{ name: 'Charity', href: '/charity' }, { name: 'Challenges', href: '/challenges' },
{ name: 'Blog', href: 'https://news.manifold.markets' }, { name: 'Charity', href: '/charity' },
{ name: 'Discord', href: 'https://discord.gg/eHQBNBqXuh' }, { name: 'Blog', href: 'https://news.manifold.markets' },
{ name: 'Twitter', href: 'https://twitter.com/ManifoldMarkets' }, { name: 'Discord', href: 'https://discord.gg/eHQBNBqXuh' },
] { name: 'Twitter', href: 'https://twitter.com/ManifoldMarkets' },
]
else
return [
{ name: 'Charity', href: '/charity' },
{ name: 'Blog', href: 'https://news.manifold.markets' },
{ name: 'Discord', href: 'https://discord.gg/eHQBNBqXuh' },
{ name: 'Twitter', href: 'https://twitter.com/ManifoldMarkets' },
]
} }
return [ if (CHALLENGES_ENABLED)
{ name: 'Challenges', href: '/challenges' }, return [
{ name: 'Referrals', href: '/referrals' }, { name: 'Challenges', href: '/challenges' },
{ name: 'Charity', href: '/charity' }, { name: 'Referrals', href: '/referrals' },
{ name: 'Send M$', href: '/links' }, { name: 'Charity', href: '/charity' },
{ name: 'Discord', href: 'https://discord.gg/eHQBNBqXuh' }, { name: 'Send M$', href: '/links' },
{ name: 'About', href: 'https://docs.manifold.markets/$how-to' }, { name: 'Discord', href: 'https://discord.gg/eHQBNBqXuh' },
{ { name: 'About', href: 'https://docs.manifold.markets/$how-to' },
name: 'Sign out', {
href: '#', name: 'Sign out',
onClick: logout, href: '#',
}, onClick: logout,
] },
]
else
return [
{ name: 'Referrals', href: '/referrals' },
{ name: 'Charity', href: '/charity' },
{ name: 'Send M$', href: '/links' },
{ name: 'Discord', href: 'https://discord.gg/eHQBNBqXuh' },
{ name: 'About', href: 'https://docs.manifold.markets/$how-to' },
{
name: 'Sign out',
href: '#',
onClick: logout,
},
]
} }
const signedOutNavigation = [ const signedOutNavigation = [
@ -121,13 +144,19 @@ function getMoreMobileNav() {
return [ return [
...(IS_PRIVATE_MANIFOLD ...(IS_PRIVATE_MANIFOLD
? [] ? []
: [ : CHALLENGES_ENABLED
{ name: 'Send M$', href: '/links' }, ? [
{ name: 'Challenges', href: '/challenges' }, { name: 'Challenges', href: '/challenges' },
{ name: 'Referrals', href: '/referrals' }, { name: 'Referrals', href: '/referrals' },
{ name: 'Charity', href: '/charity' }, { name: 'Charity', href: '/charity' },
{ name: 'Send M$', href: '/links' }, { name: 'Send M$', href: '/links' },
{ name: 'Discord', href: 'https://discord.gg/eHQBNBqXuh' }, { name: 'Discord', href: 'https://discord.gg/eHQBNBqXuh' },
]
: [
{ name: 'Referrals', href: '/referrals' },
{ name: 'Charity', href: '/charity' },
{ name: 'Send M$', href: '/links' },
{ name: 'Discord', href: 'https://discord.gg/eHQBNBqXuh' },
]), ]),
{ {
name: 'Sign out', name: 'Sign out',

View File

@ -32,7 +32,7 @@ dayjs.extend(customParseFormat)
const columnClass = 'sm:px-5 px-2 py-3.5 max-w-[100px] truncate' const columnClass = 'sm:px-5 px-2 py-3.5 max-w-[100px] truncate'
const amountClass = columnClass + ' max-w-[75px] font-bold' const amountClass = columnClass + ' max-w-[75px] font-bold'
export default function LinkPage() { export default function ChallengesListPage() {
const user = useUser() const user = useUser()
const userChallenges = useUserChallenges(user?.id ?? '') const userChallenges = useUserChallenges(user?.id ?? '')
const challenges = useAcceptedChallenges() const challenges = useAcceptedChallenges()