diff --git a/web/components/contract-overview.tsx b/web/components/contract-overview.tsx index 20933e73..14ac0568 100644 --- a/web/components/contract-overview.tsx +++ b/web/components/contract-overview.tsx @@ -51,7 +51,9 @@ export const ContractOverview = (props: { -
{contract.description}
+
+ {contract.description} +
) } diff --git a/web/components/contracts-list.tsx b/web/components/contracts-list.tsx index e2b9f2f2..40d451d6 100644 --- a/web/components/contracts-list.tsx +++ b/web/components/contracts-list.tsx @@ -2,19 +2,23 @@ import dayjs from 'dayjs' import Link from 'next/link' import { useEffect, useState } from 'react' import { useUser } from '../hooks/use-user' -import { Contract, deleteContract, listContracts } from '../lib/firebase/contracts' +import { + Contract, + deleteContract, + listContracts, +} from '../lib/firebase/contracts' function ContractCard(props: { contract: Contract }) { const { contract } = props // only show delete button if there's not bets - const showDelete = contract.pot.YES === contract.seedAmounts.YES - && contract.pot.NO === contract.seedAmounts.NO + const showDelete = + contract.pot.YES === contract.seedAmounts.YES && + contract.pot.NO === contract.seedAmounts.NO const [isDeleted, setIsDeleted] = useState(false) // temporary fix until we stream changes - - if (isDeleted) - return <> + + if (isDeleted) return <> return (
  • @@ -40,10 +44,10 @@ function ContractCard(props: { contract: Contract }) {

    - {showDelete && + {showDelete && ( - } + )} diff --git a/web/components/header.tsx b/web/components/header.tsx index 278e9bd8..8fe9e23c 100644 --- a/web/components/header.tsx +++ b/web/components/header.tsx @@ -34,11 +34,15 @@ function SignInLink(props: { darkBackground?: boolean }) { {user ? ( <> - Create a market + + Create a market + - {user.name} + + {user.name} + ) : showLogin ? ( @@ -70,7 +74,10 @@ export function Header(props: { darkBackground?: boolean }) {
    - +
    {

    - Better forecasting through play-money prediction - markets for you and your community + Better forecasting through play-money prediction markets for + you and your community

    diff --git a/web/components/resolution-panel.tsx b/web/components/resolution-panel.tsx index 526701e8..59b339d6 100644 --- a/web/components/resolution-panel.tsx +++ b/web/components/resolution-panel.tsx @@ -31,10 +31,10 @@ export function ResolutionPanel(props: { outcome === 'YES' ? 'btn-primary' : outcome === 'NO' - ? 'bg-red-400 hover:bg-red-500' - : outcome === 'CANCEL' - ? 'bg-yellow-400 hover:bg-yellow-500' - : 'btn-disabled' + ? 'bg-red-400 hover:bg-red-500' + : outcome === 'CANCEL' + ? 'bg-yellow-400 hover:bg-yellow-500' + : 'btn-disabled' return ( Math.random().toString(16).substr(2, 14) \ No newline at end of file +export const randomString = () => Math.random().toString(16).substr(2, 14) diff --git a/web/lib/util/slugify.ts b/web/lib/util/slugify.ts index f3437959..82172c3a 100644 --- a/web/lib/util/slugify.ts +++ b/web/lib/util/slugify.ts @@ -1,11 +1,10 @@ - export const slugify = (text: any, separator = '-'): string => { - return text - .toString() - .normalize('NFD') // split an accented letter in the base letter and the acent - .replace(/[\u0300-\u036f]/g, '') // remove all previously split accents - .toLowerCase() - .trim() - .replace(/[^a-z0-9 ]/g, '') // remove all chars not letters, numbers and spaces (to be replaced) - .replace(/\s+/g, separator) -} \ No newline at end of file + return text + .toString() + .normalize('NFD') // split an accented letter in the base letter and the acent + .replace(/[\u0300-\u036f]/g, '') // remove all previously split accents + .toLowerCase() + .trim() + .replace(/[^a-z0-9 ]/g, '') // remove all chars not letters, numbers and spaces (to be replaced) + .replace(/\s+/g, separator) +} diff --git a/web/pages/account.tsx b/web/pages/account.tsx index 9e15effc..f946fcec 100644 --- a/web/pages/account.tsx +++ b/web/pages/account.tsx @@ -11,7 +11,12 @@ function UserCard(props: { user: User }) {
    {user?.avatarUrl && ( - + )}
    diff --git a/web/pages/contract/index.tsx b/web/pages/contract/index.tsx index afcab942..fa79a551 100644 --- a/web/pages/contract/index.tsx +++ b/web/pages/contract/index.tsx @@ -8,7 +8,6 @@ import { Title } from '../../components/title' import { useUser } from '../../hooks/use-user' import { createContract } from '../../lib/service/create-contract' - // Allow user to create a new contract export default function NewContract() { const creator = useUser() @@ -24,7 +23,12 @@ export default function NewContract() { setIsSubmitting(true) - const contract = await createContract(question, description, initialProb, creator) + const contract = await createContract( + question, + description, + initialProb, + creator + ) await router.push(`contract/${contract.id}`) } @@ -51,7 +55,7 @@ export default function NewContract() { placeholder="e.g. Will the FDA approve Paxlovid before Jun 2nd, 2022?" className="input" value={question} - onChange={e => setQuestion(e.target.value || '')} + onChange={(e) => setQuestion(e.target.value || '')} />
    @@ -66,7 +70,7 @@ export default function NewContract() { className="textarea h-24 textarea-bordered" placeholder={descriptionPlaceholder} value={description} - onChange={e => setDescription(e.target.value || '')} + onChange={(e) => setDescription(e.target.value || '')} >
    @@ -74,7 +78,9 @@ export default function NewContract() {
    setInitialProb(parseInt(e.target.value))} + onChange={(e) => setInitialProb(parseInt(e.target.value))} />