Merge branch 'main' into stripe

This commit is contained in:
jahooma 2021-12-19 16:48:13 -06:00
commit 5e9e97c20a
11 changed files with 6436 additions and 15322 deletions

View File

@ -2,9 +2,9 @@
"name": "functions", "name": "functions",
"scripts": { "scripts": {
"build": "tsc", "build": "tsc",
"serve": "npm run build && firebase emulators:start --only functions", "serve": "yarn build && firebase emulators:start --only functions",
"shell": "npm run build && firebase functions:shell", "shell": "yarn build && firebase functions:shell",
"start": "npm run shell", "start": "yarn shell",
"deploy": "firebase deploy --only functions", "deploy": "firebase deploy --only functions",
"logs": "firebase functions:log" "logs": "firebase functions:log"
}, },

1594
functions/yarn.lock Normal file

File diff suppressed because it is too large Load Diff

6
package-lock.json generated
View File

@ -1,6 +0,0 @@
{
"name": "mantic",
"lockfileVersion": 2,
"requires": true,
"packages": {}
}

1
web/.gitignore vendored
View File

@ -2,3 +2,4 @@
.next .next
node_modules node_modules
out out
tsconfig.tsbuildinfo

View File

@ -197,7 +197,7 @@ export function MyBetsSummary(props: {
{resolution ? ( {resolution ? (
<> <>
<Col> <Col>
<div className="text-sm text-gray-500">Winnings</div> <div className="text-sm text-gray-500">Payout</div>
<div className="whitespace-nowrap">{formatMoney(betsPayout)}</div> <div className="whitespace-nowrap">{formatMoney(betsPayout)}</div>
</Col> </Col>
</> </>

View File

@ -173,7 +173,7 @@ export function SearchableGrid(props: {
export function ContractsList(props: { creator: User }) { export function ContractsList(props: { creator: User }) {
const { creator } = props const { creator } = props
const [contracts, setContracts] = useState<Contract[]>([]) const [contracts, setContracts] = useState<Contract[] | 'loading'>('loading')
useEffect(() => { useEffect(() => {
if (creator?.id) { if (creator?.id) {
@ -182,5 +182,7 @@ export function ContractsList(props: { creator: User }) {
} }
}, [creator]) }, [creator])
if (contracts === 'loading') return <></>
return <SearchableGrid contracts={contracts} defaultSort="all" /> return <SearchableGrid contracts={contracts} defaultSort="all" />
} }

View File

@ -11,24 +11,32 @@ import { MenuButton } from './menu'
const hoverClasses = const hoverClasses =
'hover:underline hover:decoration-indigo-400 hover:decoration-2' 'hover:underline hover:decoration-indigo-400 hover:decoration-2'
const mobileNavigation = [ function getNavigationOptions(user: User, options: { mobile: boolean }) {
const { mobile } = options
return [
{ {
name: 'Home', name: 'Home',
href: '/', href: '/',
}, },
{ ...(mobile
name: 'Account', ? [
href: '/account', { name: 'FAQ', href: '/about' },
},
{
name: 'Your bets',
href: '/bets',
},
{ {
name: 'Create a market', name: 'Create a market',
href: '/create', href: '/create',
}, },
] ]
: []),
{
name: 'Your bets',
href: '/bets',
},
{
name: 'Your markets',
href: `/${user.username}`,
},
]
}
function ProfileSummary(props: { user: User }) { function ProfileSummary(props: { user: User }) {
const { user } = props const { user } = props
@ -50,6 +58,17 @@ function SignedInHeaders(props: { user: User; themeClasses?: string }) {
return ( return (
<> <>
<Link href="/about">
<a
className={clsx(
'text-base hidden md:block whitespace-nowrap',
themeClasses
)}
>
FAQ
</a>
</Link>
<Link href="/create"> <Link href="/create">
<a <a
className={clsx( className={clsx(
@ -61,30 +80,15 @@ function SignedInHeaders(props: { user: User; themeClasses?: string }) {
</a> </a>
</Link> </Link>
<Link href="/bets"> <MenuButton
<a className="hidden md:block"
className={clsx( menuItems={getNavigationOptions(user, { mobile: false })}
'text-base hidden md:block whitespace-nowrap', buttonContent={<ProfileSummary user={user} />}
themeClasses />
)}
>
Your bets
</a>
</Link>
<Link href="/account">
<a
className={clsx(
'text-base hidden md:block hover:underline hover:decoration-2 hover:decoration-indigo-700'
)}
>
<ProfileSummary user={user} />
</a>
</Link>
<MenuButton <MenuButton
className="md:hidden" className="md:hidden"
menuItems={mobileNavigation} menuItems={getNavigationOptions(user, { mobile: true })}
buttonContent={<ProfileSummary user={user} />} buttonContent={<ProfileSummary user={user} />}
/> />
</> </>
@ -138,7 +142,7 @@ export function Header(props: {
/> />
<div <div
className={clsx( className={clsx(
'font-major-mono lowercase mt-1 sm:text-2xl', 'font-major-mono lowercase mt-1 sm:text-2xl md:whitespace-nowrap',
darkBackground && 'text-white' darkBackground && 'text-white'
)} )}
> >

15259
web/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,8 @@
"name": "mantic", "name": "mantic",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "next dev", "dev": "concurrently -n NEXT,TS -c magenta,cyan \"next dev -p 3000\" \"yarn ts --watch\"",
"ts": "tsc --noEmit --incremental --preserveWatchOutput --pretty",
"build": "next build", "build": "next build",
"start": "next start", "start": "next start",
"lint": "next lint", "lint": "next lint",
@ -10,8 +11,8 @@
"prepare": "cd .. && husky install web/.husky" "prepare": "cd .. && husky install web/.husky"
}, },
"dependencies": { "dependencies": {
"@headlessui/react": "^1.4.2", "@headlessui/react": "1.4.2",
"@heroicons/react": "^1.0.5", "@heroicons/react": "1.0.5",
"@nivo/core": "0.74.0", "@nivo/core": "0.74.0",
"@nivo/line": "0.74.0", "@nivo/line": "0.74.0",
"clsx": "1.1.1", "clsx": "1.1.1",
@ -25,19 +26,20 @@
}, },
"devDependencies": { "devDependencies": {
"@tailwindcss/forms": "0.4.0", "@tailwindcss/forms": "0.4.0",
"@types/lodash": "^4.14.178", "@types/lodash": "4.14.178",
"@types/node": "16.11.11", "@types/node": "16.11.11",
"@types/react": "17.0.37", "@types/react": "17.0.37",
"autoprefixer": "10.2.6", "autoprefixer": "10.2.6",
"concurrently": "6.5.1",
"eslint": "7.32.0", "eslint": "7.32.0",
"eslint-config-next": "12.0.4", "eslint-config-next": "12.0.4",
"husky": "^7.0.4", "husky": "7.0.4",
"lint-staged": "^12.1.3", "lint-staged": "12.1.3",
"postcss": "8.3.5", "postcss": "8.3.5",
"prettier": "2.5.0", "prettier": "2.5.0",
"pretty-quick": "^3.1.2", "pretty-quick": "3.1.2",
"tailwindcss": "3.0.1", "tailwindcss": "3.0.1",
"tsc-files": "^1.1.3", "tsc-files": "1.1.3",
"typescript": "4.5.2" "typescript": "4.5.2"
}, },
"lint-staged": { "lint-staged": {

View File

@ -21,9 +21,11 @@ export default function Markets(props: { contracts: Contract[] }) {
return ( return (
<div className="max-w-4xl px-4 pb-8 mx-auto"> <div className="max-w-4xl px-4 pb-8 mx-auto">
<Header /> <Header />
{(props.contracts || contracts !== 'loading') && (
<SearchableGrid <SearchableGrid
contracts={contracts === 'loading' ? props.contracts || [] : contracts} contracts={contracts === 'loading' ? props.contracts : contracts}
/> />
)}
</div> </div>
) )
} }

4774
web/yarn.lock Normal file

File diff suppressed because it is too large Load Diff