1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00

Remove risks warning (#1420)

* Removing risks warning from add liquidity tab

* Removing risks warning from add trade tab

* Removing isWarningAccepted state variable
This commit is contained in:
Jamie Hewitt 2022-05-11 15:29:07 +03:00 committed by GitHub
parent e30786c97b
commit 8819a66e67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 55 deletions

View File

@ -54,8 +54,7 @@
"titleIn": "You will receive", "titleIn": "You will receive",
"titleOut": "Pool conversion" "titleOut": "Pool conversion"
}, },
"action": "Supply", "action": "Supply"
"warning": "Use at your own risk. Please familiarize yourself [with the risks](https://blog.oceanprotocol.com/on-staking-on-data-in-ocean-market-3d8e09eb0a13) and the [Terms of Use](/terms)."
}, },
"remove": { "remove": {
"title": "Remove Liquidity", "title": "Remove Liquidity",
@ -68,7 +67,6 @@
} }
}, },
"trade": { "trade": {
"action": "Swap", "action": "Swap"
"warning": "Use at your own risk. Please familiarize yourself [with the risks](https://blog.oceanprotocol.com/on-staking-on-data-in-ocean-market-3d8e09eb0a13) and the [Terms of Use](/terms)."
} }
} }

View File

@ -40,7 +40,6 @@ export default function Add({
const [amountMax, setAmountMax] = useState<string>() const [amountMax, setAmountMax] = useState<string>()
const [newPoolTokens, setNewPoolTokens] = useState('0') const [newPoolTokens, setNewPoolTokens] = useState('0')
const [newPoolShare, setNewPoolShare] = useState('0') const [newPoolShare, setNewPoolShare] = useState('0')
const [isWarningAccepted, setIsWarningAccepted] = useState(false)
// Live validation rules // Live validation rules
// https://github.com/jquense/yup#number // https://github.com/jquense/yup#number
@ -143,37 +142,17 @@ export default function Add({
{({ isSubmitting, setSubmitting, submitForm, values, isValid }) => ( {({ isSubmitting, setSubmitting, submitForm, values, isValid }) => (
<> <>
<div className={styles.addInput}> <div className={styles.addInput}>
{isWarningAccepted ? (
<FormAdd <FormAdd
amountMax={amountMax} amountMax={amountMax}
setNewPoolTokens={setNewPoolTokens} setNewPoolTokens={setNewPoolTokens}
setNewPoolShare={setNewPoolShare} setNewPoolShare={setNewPoolShare}
/> />
) : (
content.pool.add.warning && (
<Alert
className={styles.warning}
text={content.pool.add.warning.toString()}
state="info"
action={{
name: 'I understand',
style: 'text',
handleAction: () => setIsWarningAccepted(true)
}}
/>
)
)}
</div> </div>
<Output newPoolTokens={newPoolTokens} newPoolShare={newPoolShare} /> <Output newPoolTokens={newPoolTokens} newPoolShare={newPoolShare} />
<Actions <Actions
isDisabled={ isDisabled={!isValid || !values.amount || values.amount === 0}
!isValid ||
!isWarningAccepted ||
!values.amount ||
values.amount === 0
}
isLoading={isSubmitting} isLoading={isSubmitting}
loaderMessage="Adding Liquidity..." loaderMessage="Adding Liquidity..."
successMessage="Successfully added liquidity." successMessage="Successfully added liquidity."

View File

@ -41,7 +41,6 @@ export default function FormTrade({
const [coinFrom, setCoinFrom] = useState<string>('OCEAN') const [coinFrom, setCoinFrom] = useState<string>('OCEAN')
const [maximumBaseToken, setMaximumBaseToken] = useState('0') const [maximumBaseToken, setMaximumBaseToken] = useState('0')
const [maximumDt, setMaximumDt] = useState('0') const [maximumDt, setMaximumDt] = useState('0')
const [isWarningAccepted, setIsWarningAccepted] = useState(false)
const validationSchema: Yup.SchemaOf<FormTradeData> = Yup.object() const validationSchema: Yup.SchemaOf<FormTradeData> = Yup.object()
.shape({ .shape({
@ -185,7 +184,6 @@ export default function FormTrade({
> >
{({ isSubmitting, setSubmitting, submitForm, values, isValid }) => ( {({ isSubmitting, setSubmitting, submitForm, values, isValid }) => (
<> <>
{isWarningAccepted ? (
<Swap <Swap
asset={asset} asset={asset}
balance={balance} balance={balance}
@ -194,23 +192,9 @@ export default function FormTrade({
setMaximumDt={setMaximumDt} setMaximumDt={setMaximumDt}
isLoading={isSubmitting} isLoading={isSubmitting}
/> />
) : (
<div className={styles.alertWrap}>
<Alert
text={content.trade.warning}
state="info"
action={{
name: 'I understand',
style: 'text',
handleAction: () => setIsWarningAccepted(true)
}}
/>
</div>
)}
<Actions <Actions
isDisabled={ isDisabled={
!isValid || !isValid ||
!isWarningAccepted ||
!isAssetNetwork || !isAssetNetwork ||
values.datatoken === undefined || values.datatoken === undefined ||
values.baseToken === undefined values.baseToken === undefined