mango-ui-v3/components/AlphaModal.tsx

84 lines
2.8 KiB
TypeScript
Raw Normal View History

2021-10-26 04:05:48 -07:00
import React, { useState } from 'react'
import { CheckCircleIcon } from '@heroicons/react/solid'
2021-04-15 09:34:59 -07:00
import Modal from './Modal'
import Button from './Button'
import useLocalStorageState from '../hooks/useLocalStorageState'
import { useTranslation } from 'next-i18next'
2021-10-26 04:05:48 -07:00
import Checkbox from './Checkbox'
2021-04-15 09:34:59 -07:00
2021-08-31 11:42:33 -07:00
export const ALPHA_MODAL_KEY = 'mangoAlphaAccepted-3.06'
2021-08-30 11:50:37 -07:00
const AlphaModal = ({
2021-04-15 09:34:59 -07:00
isOpen,
onClose,
}: {
isOpen: boolean
onClose?: (x) => void
}) => {
const { t } = useTranslation('common')
2021-10-26 04:05:48 -07:00
const [acceptRisks, setAcceptRisks] = useState(false)
2021-08-30 11:50:37 -07:00
const [, setAlphaAccepted] = useLocalStorageState(ALPHA_MODAL_KEY, false)
2021-08-01 05:48:15 -07:00
const handleAccept = () => {
setAlphaAccepted(true)
}
2021-04-15 09:34:59 -07:00
return (
<Modal isOpen={isOpen} onClose={onClose} hideClose>
2021-04-15 09:34:59 -07:00
<Modal.Header>
<div className="flex flex-col items-center">
2021-10-26 04:05:48 -07:00
<div className="flex space-x-8 items-center justify-center">
2021-06-08 07:59:39 -07:00
<img
2021-08-25 11:47:57 -07:00
className={`h-12 w-auto`}
2021-06-08 07:59:39 -07:00
src="/assets/icons/logo.svg"
alt="next"
/>
</div>
2021-04-15 09:34:59 -07:00
</div>
</Modal.Header>
2021-10-26 04:05:48 -07:00
<h1 className="m-auto mb-4 relative w-max">
{t('v3-welcome')}
2021-10-26 04:05:48 -07:00
<span className="absolute bg-th-primary font-bold px-1.5 py-0.5 -right-8 rounded-full text-black text-xs -top-1 w-max">
V3
</span>
</h1>
<div className="bg-th-bkg-3 p-4 space-y-3 rounded-md">
<div className="flex items-center text-th-fgd-1">
<CheckCircleIcon className="flex-shrink-0 h-5 mr-2 text-th-green w-5" />
Crosscollateralized leverage trading
</div>
<div className="flex items-center text-th-fgd-1">
<CheckCircleIcon className="flex-shrink-0 h-5 mr-2 text-th-green w-5" />
All assets count as collateral to trade or borrow
</div>
<div className="flex items-center text-th-fgd-1">
<CheckCircleIcon className="flex-shrink-0 h-5 mr-2 text-th-green w-5" />
Deposit any asset and earn interest automatically
</div>
<div className="flex items-center text-th-fgd-1">
<CheckCircleIcon className="flex-shrink-0 h-5 mr-2 text-th-green w-5" />
Borrow against your assets for other DeFi activities
</div>
2021-06-08 07:59:39 -07:00
</div>
2021-10-26 04:05:48 -07:00
<div className="px-6 text-th-fgd-3 text-center mt-4">
{t('v3-unaudited')}
2021-08-31 11:03:26 -07:00
</div>
2021-10-26 04:05:48 -07:00
<div className="border border-th-fgd-4 mt-4 p-3 rounded-md">
<Checkbox
checked={acceptRisks}
onChange={(e) => setAcceptRisks(e.target.checked)}
>
I understand and accept the risks
</Checkbox>
2021-06-08 07:59:39 -07:00
</div>
2021-10-26 04:05:48 -07:00
<div className={`mt-6 flex justify-center`}>
<Button disabled={!acceptRisks} onClick={handleAccept}>
Let&apos;s Go
</Button>
2021-04-15 09:34:59 -07:00
</div>
</Modal>
)
}
export default React.memo(AlphaModal)