2022-01-07 22:56:14 +00:00
|
|
|
import { useState } from 'react'
|
2022-05-09 13:04:36 +00:00
|
|
|
import { Col } from 'web/components/layout/col'
|
|
|
|
import { SEO } from 'web/components/SEO'
|
|
|
|
import { Title } from 'web/components/title'
|
|
|
|
import { FundsSelector } from 'web/components/yes-no-selector'
|
|
|
|
import { useUser } from 'web/hooks/use-user'
|
|
|
|
import { checkoutURL } from 'web/lib/service/stripe'
|
|
|
|
import { Page } from 'web/components/page'
|
2022-06-15 21:34:34 +00:00
|
|
|
import { useTracking } from 'web/hooks/use-tracking'
|
|
|
|
import { trackCallback } from 'web/lib/service/analytics'
|
2022-07-19 07:50:11 +00:00
|
|
|
import { redirectIfLoggedOut } from 'web/lib/firebase/server-auth'
|
|
|
|
|
|
|
|
export const getServerSideProps = redirectIfLoggedOut('/')
|
2022-01-07 22:56:14 +00:00
|
|
|
|
|
|
|
export default function AddFundsPage() {
|
|
|
|
const user = useUser()
|
|
|
|
|
2022-04-09 23:56:05 +00:00
|
|
|
const [amountSelected, setAmountSelected] = useState<1000 | 2500 | 10000>(
|
|
|
|
2500
|
|
|
|
)
|
2022-01-07 22:56:14 +00:00
|
|
|
|
2022-06-15 21:34:34 +00:00
|
|
|
useTracking('view add funds')
|
|
|
|
|
2022-01-07 22:56:14 +00:00
|
|
|
return (
|
|
|
|
<Page>
|
2022-06-13 04:49:02 +00:00
|
|
|
<SEO
|
2022-09-22 00:49:32 +00:00
|
|
|
title="Get Mana"
|
|
|
|
description="Buy mana to trade in your favorite markets on Manifold"
|
2022-06-13 04:49:02 +00:00
|
|
|
url="/add-funds"
|
|
|
|
/>
|
2022-01-07 22:56:14 +00:00
|
|
|
|
|
|
|
<Col className="items-center">
|
2022-03-03 09:09:32 +00:00
|
|
|
<Col className="h-full rounded bg-white p-4 py-8 sm:p-8 sm:shadow-md">
|
2022-09-22 00:49:32 +00:00
|
|
|
<Title className="!mt-0" text="Get Mana" />
|
2022-01-27 22:50:55 +00:00
|
|
|
<img
|
2022-03-03 09:09:32 +00:00
|
|
|
className="mb-6 block -scale-x-100 self-center"
|
2022-03-01 01:32:43 +00:00
|
|
|
src="/stylized-crane-black.png"
|
2022-01-07 22:56:14 +00:00
|
|
|
width={200}
|
|
|
|
height={200}
|
|
|
|
/>
|
|
|
|
|
2022-02-11 18:40:22 +00:00
|
|
|
<div className="mb-6 text-gray-500">
|
2022-09-22 00:49:32 +00:00
|
|
|
Buy mana (M$) to trade in your favorite markets. <br /> (Not
|
|
|
|
redeemable for cash.)
|
2022-01-07 22:56:14 +00:00
|
|
|
</div>
|
|
|
|
|
2022-02-11 18:40:22 +00:00
|
|
|
<div className="mb-2 text-sm text-gray-500">Amount</div>
|
2022-01-07 22:56:14 +00:00
|
|
|
<FundsSelector
|
|
|
|
className="max-w-md"
|
|
|
|
selected={amountSelected}
|
|
|
|
onSelect={setAmountSelected}
|
|
|
|
/>
|
|
|
|
|
|
|
|
<div className="mt-6">
|
2022-02-11 18:40:22 +00:00
|
|
|
<div className="mb-1 text-sm text-gray-500">Price USD</div>
|
2022-01-07 22:56:14 +00:00
|
|
|
<div className="text-xl">
|
|
|
|
${Math.round(amountSelected / 100)}.00
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<form
|
|
|
|
action={checkoutURL(user?.id || '', amountSelected)}
|
|
|
|
method="POST"
|
2022-03-01 01:32:43 +00:00
|
|
|
className="mt-8"
|
2022-01-07 22:56:14 +00:00
|
|
|
>
|
|
|
|
<button
|
|
|
|
type="submit"
|
2022-06-13 04:25:57 +00:00
|
|
|
className="btn btn-primary w-full bg-gradient-to-r from-indigo-500 to-blue-500 font-medium hover:from-indigo-600 hover:to-blue-600"
|
2022-06-15 21:34:34 +00:00
|
|
|
onClick={trackCallback('checkout', { amount: amountSelected })}
|
2022-01-07 22:56:14 +00:00
|
|
|
>
|
|
|
|
Checkout
|
|
|
|
</button>
|
|
|
|
</form>
|
|
|
|
</Col>
|
|
|
|
</Col>
|
|
|
|
</Page>
|
|
|
|
)
|
|
|
|
}
|