Skip to content

Commit fcf9a5c

Browse files
committed
feat: add legal intro for all risk disclaimer subtabs
1 parent 10258ae commit fcf9a5c

File tree

10 files changed

+92
-27
lines changed

10 files changed

+92
-27
lines changed

packages/curve-ui-kit/src/widgets/Legal/LegalPage.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,10 @@ export const LegalPage = ({ currentApp }: LegalPageProps) => {
118118
/>
119119
</Stack>
120120
<TabPanel>
121-
{disclaimerTab === 'dex' && <Dex />}
121+
{disclaimerTab === 'dex' && <Dex currentApp={currentApp} network={network} />}
122122
{disclaimerTab === 'lend' && <LlamaLend currentApp={currentApp} network={network} />}
123-
{disclaimerTab === 'crvusd' && <CrvUsd />}
124-
{disclaimerTab === 'scrvusd' && <SCrvUsd />}
123+
{disclaimerTab === 'crvusd' && <CrvUsd currentApp={currentApp} network={network} />}
124+
{disclaimerTab === 'scrvusd' && <SCrvUsd currentApp={currentApp} network={network} />}
125125
<Footer />
126126
</TabPanel>
127127
</>

packages/curve-ui-kit/src/widgets/Legal/components/disclaimer-tabs/CrvUsd.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,18 @@ import Stack from '@mui/material/Stack'
55
import Typography from '@mui/material/Typography'
66
import { t } from '@ui-kit/lib/i18n'
77
import { SizesAndSpaces } from '@ui-kit/themes/design/1_sizes_spaces'
8+
import type { TabProps } from '../../types/tabs'
89
import { List } from '../general/List'
910
import { Section, Header, Title, Paragraph } from '../general/Section'
11+
import { LegalIntro } from './LegalIntro'
1012

1113
const { Spacing } = SizesAndSpaces
1214

13-
export const CrvUsd = () => (
15+
export const CrvUsd = ({ currentApp, network }: TabProps) => (
1416
<>
1517
<Section>
18+
<LegalIntro currentApp={currentApp} network={network} />
19+
1620
<Paragraph>{t`Curve stablecoin infrastructure enables users to mint crvUSD using a selection of crypto-tokenized collaterals (adding new ones is subject to DAO approval). Interacting with crvUSD doesn't come without risks. Before minting or taking exposure of crvUSD, it is best to research and understand the risks involved.`}</Paragraph>
1721
</Section>
1822

packages/curve-ui-kit/src/widgets/Legal/components/disclaimer-tabs/Dex.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,17 @@ import Link from '@mui/material/Link'
44
import Stack from '@mui/material/Stack'
55
import { t } from '@ui-kit/lib/i18n'
66
import { SizesAndSpaces } from '@ui-kit/themes/design/1_sizes_spaces'
7+
import type { TabProps } from '../../types/tabs'
78
import { Section, Header, Title, Paragraph } from '../general/Section'
9+
import { LegalIntro } from './LegalIntro'
810

911
const { Spacing } = SizesAndSpaces
1012

11-
export const Dex = () => (
13+
export const Dex = ({ currentApp, network }: TabProps) => (
1214
<>
1315
<Section>
16+
<LegalIntro currentApp={currentApp} network={network} />
17+
1418
<Paragraph>{t`Providing liquidity on Curve doesn't come without risks. Before making a deposit, it is best to research and understand the risks involved.`}</Paragraph>
1519
</Section>
1620

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import Typography from '@mui/material/Typography'
2+
import { t } from '@ui-kit/lib/i18n'
3+
import { getInternalUrl, PAGE_LEGAL } from '@ui-kit/shared/routes'
4+
import { RouterLink } from '@ui-kit/shared/ui/RouterLink'
5+
import { pushSearchParams } from '@ui-kit/utils/urls'
6+
import type { TabProps } from '../../types/tabs'
7+
import { List } from '../general/List'
8+
import { Paragraph } from '../general/Section'
9+
10+
export const LegalIntro = ({ currentApp, network }: TabProps) => (
11+
<>
12+
<Paragraph>
13+
{t`Use of this site and the Curve functionalities is subject to the`}{' '}
14+
<RouterLink
15+
color="textSecondary"
16+
href={getInternalUrl(currentApp, network, PAGE_LEGAL)}
17+
onClick={(e) => pushSearchParams(e, { tab: 'terms' })}
18+
>
19+
{t`Terms and Conditions`}
20+
</RouterLink>
21+
{t`. The term “Curve Functionalities” has the meaning given in the Terms and Conditions.`}
22+
</Paragraph>
23+
24+
<Paragraph>
25+
<List type="disc">
26+
<Typography component="li" variant="bodyMRegular">
27+
{t`New technology risk: smart contracts and related software can fail.`}
28+
</Typography>
29+
30+
<Typography component="li" variant="bodyMRegular">
31+
{t`Wallet security: you are solely responsible for your keys and wallet security.`}
32+
</Typography>
33+
34+
<Typography component="li" variant="bodyMRegular">
35+
{t`Tax risk: you are responsible for any tax obligations.`}
36+
</Typography>
37+
38+
<Typography component="li" variant="bodyMRegular">
39+
{t`No counterparty guarantee: no party guarantees performance of any market participant.`}
40+
</Typography>
41+
42+
<Typography component="li" variant="bodyMRegular">
43+
{t`Regulatory risk: laws can change and impact access or use.`}
44+
</Typography>
45+
46+
<Typography component="li" variant="bodyMRegular">
47+
{t`Limitation of liability: see the Terms and Conditions for limits on liability.`}
48+
</Typography>
49+
</List>
50+
</Paragraph>
51+
</>
52+
)

packages/curve-ui-kit/src/widgets/Legal/components/disclaimer-tabs/LlamaLend.tsx

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,19 @@
1-
import type { INetworkName as CurveNetworkId } from '@curvefi/api/lib/interfaces'
2-
import type { INetworkName as LlamaNetworkId } from '@curvefi/llamalend-api/lib/interfaces'
31
import Link from '@mui/material/Link'
42
import Typography from '@mui/material/Typography'
53
import { t } from '@ui-kit/lib/i18n'
6-
import { type AppName, getInternalUrl, PAGE_LEGAL } from '@ui-kit/shared/routes'
4+
import { getInternalUrl, PAGE_LEGAL } from '@ui-kit/shared/routes'
75
import { RouterLink } from '@ui-kit/shared/ui/RouterLink'
86
import { pushSearchParams } from '@ui-kit/utils/urls'
7+
import type { TabProps } from '../../types/tabs'
98
import { List } from '../general/List'
109
import { Header, Paragraph, Section, Title } from '../general/Section'
10+
import { LegalIntro } from './LegalIntro'
1111

12-
export const LlamaLend = ({
13-
currentApp,
14-
network,
15-
}: {
16-
currentApp: AppName
17-
network: CurveNetworkId | LlamaNetworkId
18-
}) => (
12+
export const LlamaLend = ({ currentApp, network }: TabProps) => (
1913
<>
2014
<Section>
15+
<LegalIntro currentApp={currentApp} network={network} />
16+
2117
<Paragraph>{t`Curve Lending enables users to permissionlessly create and interact with isolated lending pairs composed of crvUSD, a decentralized stablecoin native to the Curve ecosystem, and various paired tokens. The notifications provided herein address risks associated with Curve Lending activities. The following list is not exhaustive.`}</Paragraph>
2218

2319
<Paragraph>

packages/curve-ui-kit/src/widgets/Legal/components/disclaimer-tabs/SCrvUsd.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,18 @@ import { CRVUSD_ROUTES, getInternalUrl } from '@ui-kit/shared/routes'
99
import { RouterLink } from '@ui-kit/shared/ui/RouterLink'
1010
import { SizesAndSpaces } from '@ui-kit/themes/design/1_sizes_spaces'
1111
import { pushSearchParams } from '@ui-kit/utils/urls'
12+
import type { TabProps } from '../../types/tabs'
1213
import { List } from '../general/List'
1314
import { Header, Paragraph, Section } from '../general/Section'
15+
import { LegalIntro } from './LegalIntro'
1416

1517
const { Spacing } = SizesAndSpaces
1618

17-
export const SCrvUsd = () => (
19+
export const SCrvUsd = ({ currentApp, network }: TabProps) => (
1820
<>
1921
<Section>
22+
<LegalIntro currentApp={currentApp} network={network} />
23+
2024
<Paragraph>{t`scrvUSD is an ERC4626 compliant vault that allows crvUSD holders to earn yield from protocol revenue. Deposits are not rehypothecated, can be readily redeemed for the underlying crvUSD at any time, and are non-transferrable except for the purpose of user-initiated redemption.`}</Paragraph>
2125
<Paragraph>{t`There are, nonetheless, design mechanisms that introduce risks and trust assumptions. Users should familiarize themselves with these before interacting with scrvUSD.`}</Paragraph>
2226
</Section>

packages/curve-ui-kit/src/widgets/Legal/components/general/Section.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ReactNode, Children } from 'react'
1+
import { ReactNode, Children, isValidElement } from 'react'
22
import Stack from '@mui/material/Stack'
33
import Typography from '@mui/material/Typography'
44
import { SizesAndSpaces } from '@ui-kit/themes/design/1_sizes_spaces'
@@ -44,10 +44,8 @@ export const Bold = ({ children }: { children: ReactNode }) => (
4444

4545
export const Section = ({ children }: { children?: ReactNode }) => {
4646
const childArray = Children.toArray(children)
47-
const title = childArray.find((child) => typeof child === 'object' && 'type' in child && child.type === Title)
48-
const content = childArray.filter(
49-
(child) => typeof child === 'object' && 'type' in child && (child.type === Paragraph || child.type === SubTitle),
50-
)
47+
const title = childArray.find((child) => isValidElement(child) && child.type === Title)
48+
const content = childArray.filter((child) => isValidElement(child) && child.type !== Title)
5149

5250
return (
5351
<Stack

packages/curve-ui-kit/src/widgets/Legal/components/tabs/Privacy.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import Link from '@mui/material/Link'
22
import Typography from '@mui/material/Typography'
3-
import { CurveNetworkId, LlamaNetworkId } from '@ui-kit/features/connect-wallet/lib/types'
43
import { t } from '@ui-kit/lib/i18n'
5-
import { AppName } from '@ui-kit/shared/routes'
4+
import type { TabProps } from '../../types/tabs'
65
import { List } from '../general/List'
76
import { Section, Header, Title, Paragraph, Bold } from '../general/Section'
87

9-
export const Privacy = ({ currentApp, network }: { currentApp: AppName; network: CurveNetworkId | LlamaNetworkId }) => (
8+
export const Privacy = ({ currentApp, network }: TabProps) => (
109
<>
1110
<Header>{t`Privacy Notice`}</Header>
1211
<Section>

packages/curve-ui-kit/src/widgets/Legal/components/tabs/Terms.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import Link from '@mui/material/Link'
22
import Typography from '@mui/material/Typography'
3-
import { CurveNetworkId, LlamaNetworkId } from '@ui-kit/features/connect-wallet/lib/types'
43
import { t } from '@ui-kit/lib/i18n'
5-
import { AppName, getInternalUrl, PAGE_LEGAL } from '@ui-kit/shared/routes'
4+
import { getInternalUrl, PAGE_LEGAL } from '@ui-kit/shared/routes'
65
import { RouterLink } from '@ui-kit/shared/ui/RouterLink'
76
import { pushSearchParams } from '@ui-kit/utils/urls'
7+
import type { TabProps } from '../../types/tabs'
88
import { List } from '../general/List'
99
import { Section, Header, Title, Paragraph, Bold, SubTitle } from '../general/Section'
1010

11-
export const Terms = ({ currentApp, network }: { currentApp: AppName; network: CurveNetworkId | LlamaNetworkId }) => (
11+
export const Terms = ({ currentApp, network }: TabProps) => (
1212
<>
1313
<Header>{t`Preamble`}</Header>
1414
<Section>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,10 @@
1+
import type { CurveNetworkId, LlamaNetworkId } from '@ui-kit/features/connect-wallet/lib/types'
2+
import type { AppName } from '@ui-kit/shared/routes'
3+
14
export type Tab = 'terms' | 'privacy' | 'disclaimers'
25
export type DisclaimerTab = 'dex' | 'lend' | 'crvusd' | 'scrvusd'
6+
7+
export type TabProps = {
8+
currentApp: AppName
9+
network: CurveNetworkId | LlamaNetworkId
10+
}

0 commit comments

Comments
 (0)