Skip to content

Commit 98aa545

Browse files
authored
chore: zero copy changes (#1134)
1 parent a84ece0 commit 98aa545

7 files changed

Lines changed: 57 additions & 72 deletions

File tree

.changeset/hot-pens-compare.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'frontend': patch
3+
---
4+
5+
SOV-5296: zero copy changes

apps/frontend/src/app/2_molecules/CTA/CTA.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
import React, { FC } from 'react';
22

3+
import classNames from 'classnames';
4+
35
import { Badge, BadgeStyle, Button, ButtonStyle, Paragraph } from '@sovryn/ui';
46

57
type CTAProps = {
68
index: number;
79
backgroundImage: string;
10+
imageClass?: string;
811
title: string;
912
description: string;
1013
action: string;
@@ -24,6 +27,7 @@ export const CTA: FC<CTAProps> = ({
2427
badges,
2528
disableCTA = false,
2629
href,
30+
imageClass,
2731
}) => (
2832
<div
2933
key={index}
@@ -44,10 +48,13 @@ export const CTA: FC<CTAProps> = ({
4448
<img
4549
src={backgroundImage}
4650
alt={title}
47-
className="absolute top-0 right-0 md:max-w-none max-w-14"
51+
className={classNames(
52+
'absolute top-0 right-0 md:max-w-none max-w-14 z-0',
53+
imageClass,
54+
)}
4855
/>
4956
<Paragraph
50-
className="mb-6 font-medium text-sm xl:max-w-36 xl:pr-0 pr-12"
57+
className="mb-6 font-medium text-sm xl:max-w-36 xl:pr-0 pr-12 relative z-2"
5158
children={title}
5259
/>
5360
<Paragraph

apps/frontend/src/app/5_pages/LandingPage/components/Banner/Banner.tsx

Lines changed: 12 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,13 @@ import React, { FC } from 'react';
33
import { t } from 'i18next';
44
import Carousel from 'react-multi-carousel';
55
import 'react-multi-carousel/lib/styles.css';
6-
import { useNavigate } from 'react-router-dom';
6+
import { Link } from 'react-router-dom';
77

8-
import { Button, ButtonSize, ButtonStyle } from '@sovryn/ui';
9-
10-
import { LAUNCHPAD_LINKS } from '../../../../../constants/links';
118
import { translations } from '../../../../../locales/i18n';
129
import styles from './Banner.module.css';
1310
import { LandingPromoCard } from './components/LandingPromoCard/LandingPromoCard';
1411

1512
export const Banner: FC = () => {
16-
const navigate = useNavigate();
17-
1813
return (
1914
<div className="w-full relative pb-16">
2015
<Carousel
@@ -33,44 +28,27 @@ export const Banner: FC = () => {
3328
swipeable
3429
className="static"
3530
renderDotsOutside
36-
showDots
31+
// showDots
3732
autoPlay={false} // Needs to be true when we have more than 1 promo
3833
dotListClass={styles.dot}
3934
autoPlaySpeed={15000}
40-
infinite
35+
// infinite
4136
>
4237
<LandingPromoCard
43-
heading={t(translations.landingPage.promotions.originsLaunch.title)}
44-
description={t(
45-
translations.landingPage.promotions.originsLaunch.description,
38+
heading={t(
39+
translations.landingPage.promotions.zeroInterestLoans.title,
4640
)}
47-
actions={
48-
<>
49-
<Button
50-
style={ButtonStyle.secondary}
51-
size={ButtonSize.large}
52-
text={t(translations.landingPage.promotions.originsLaunch.cta)}
53-
href={LAUNCHPAD_LINKS.ORIGINS_CLAIM}
54-
hrefExternal
55-
/>
56-
</>
57-
}
58-
className="border-primary"
59-
/>
60-
<LandingPromoCard
61-
heading={t(translations.landingPage.promotions.bosLaunch.title)}
6241
description={t(
63-
translations.landingPage.promotions.bosLaunch.description,
42+
translations.landingPage.promotions.zeroInterestLoans.description,
6443
)}
6544
actions={
6645
<>
67-
<Button
68-
style={ButtonStyle.secondary}
69-
size={ButtonSize.large}
70-
text={t(translations.landingPage.promotions.bosLaunch.cta)}
71-
onClick={() => navigate('/earn/staking')}
72-
hrefExternal
73-
/>
46+
<Link
47+
to="/borrow/line-of-credit"
48+
className="inline-flex box-border items-center justify-center text-center border font-body font-semibold no-underline rounded cursor-pointer px-5 py-2 bg-gray-80 border-gray-50 text-gray-10 text-sm hover:bg-gray-50"
49+
>
50+
{t(translations.landingPage.promotions.zeroInterestLoans.cta)}
51+
</Link>
7452
</>
7553
}
7654
className="border-primary"

apps/frontend/src/app/5_pages/LandingPage/components/QuickLaunch/QuickLaunch.tsx

Lines changed: 10 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,17 @@ import { Chains } from '../../../../../config/chains';
1111
import { CTA } from '../../../../2_molecules/CTA/CTA';
1212
import borrowSovryn from '../../../../../assets/images/QuickLaunch/Borrow with Sovryn.svg';
1313
import comingSoon from '../../../../../assets/images/QuickLaunch/Coming soon.svg';
14-
import depositAMM from '../../../../../assets/images/QuickLaunch/Deposit in AMM.svg';
1514
import lendDLLR from '../../../../../assets/images/QuickLaunch/Lend DLLR.svg';
16-
import originsLaunch from '../../../../../assets/images/QuickLaunch/Origins Launch.svg';
1715
import passiveYield from '../../../../../assets/images/QuickLaunch/Passive yield.svg';
1816
import stakeSOV from '../../../../../assets/images/QuickLaunch/Stake SOV.svg';
1917
import tradeRunes from '../../../../../assets/images/QuickLaunch/Trade Runes.svg';
20-
import { LAUNCHPAD_LINKS } from '../../../../../constants/links';
18+
import zero from '../../../../../assets/images/QuickLaunch/Zero.png';
2119
import { useCurrentChain } from '../../../../../hooks/useChainStore';
2220
import { translations } from '../../../../../locales/i18n';
2321
import { COMMON_SYMBOLS } from '../../../../../utils/asset';
2422
import { isBobChain, isRskChain } from '../../../../../utils/chain';
2523
import { formatValue } from '../../../../../utils/math';
2624
import { useGetNextSupplyInterestRate } from '../../../LendPage/hooks/useGetNextSupplyInterestRate';
27-
import { useGetReturnRates } from '../../../MarketMakingPage/hooks/useGetReturnRates';
2825
import { useGetStakingStatistics } from '../../../StakePage/components/StakingStatistics/hooks/useGetStakingStatistics';
2926
import styles from './QuickLaunch.module.css';
3027

@@ -35,32 +32,18 @@ export const QuickLaunch: FC = () => {
3532
const chainId = useCurrentChain();
3633
const { maxStakingApr } = useGetStakingStatistics();
3734
const { interestRate } = useGetNextSupplyInterestRate(COMMON_SYMBOLS.DLLR);
38-
const { rates } = useGetReturnRates();
39-
40-
const maxRate = useMemo(() => {
41-
let maxRewards = '0';
42-
rates.forEach(rate => {
43-
if (Number(rate.beforeRewards) > Number(maxRewards)) {
44-
maxRewards = rate.beforeRewards;
45-
}
46-
});
47-
48-
return maxRewards;
49-
}, [rates]);
5035

5136
const options = useMemo(
5237
() => [
5338
{
54-
title: t(pageTranslations.quickLaunch.originsLaunchpad.title, {
39+
title: t(pageTranslations.quickLaunch.zero.title, {
5540
amount: formatValue(maxStakingApr, 2),
5641
}),
57-
description: t(
58-
pageTranslations.quickLaunch.originsLaunchpad.description,
59-
),
60-
action: t(pageTranslations.quickLaunch.originsLaunchpad.action),
61-
href: LAUNCHPAD_LINKS.ORIGINS_CLAIM,
62-
url: noop,
63-
backgroundImage: originsLaunch,
42+
description: t(pageTranslations.quickLaunch.zero.description),
43+
action: t(pageTranslations.quickLaunch.zero.action),
44+
url: () => navigate('/borrow/line-of-credit'),
45+
backgroundImage: zero,
46+
imageClass: 'w-16 top-5 right-5',
6447
chains: [Chains.RSK],
6548
},
6649
{
@@ -73,16 +56,6 @@ export const QuickLaunch: FC = () => {
7356
backgroundImage: stakeSOV,
7457
chains: [Chains.RSK],
7558
},
76-
{
77-
title: t(pageTranslations.quickLaunch.earn.title, {
78-
amount: formatValue(maxRate, 2),
79-
}),
80-
description: t(pageTranslations.quickLaunch.earn.description),
81-
action: t(pageTranslations.quickLaunch.earn.action),
82-
url: () => navigate('/earn/market-making'),
83-
backgroundImage: depositAMM,
84-
chains: [Chains.RSK],
85-
},
8659
{
8760
title: t(pageTranslations.quickLaunch.lend.title, {
8861
amount: formatValue(interestRate, 2),
@@ -135,7 +108,7 @@ export const QuickLaunch: FC = () => {
135108
disable: true,
136109
},
137110
],
138-
[interestRate, maxRate, maxStakingApr, navigate],
111+
[interestRate, maxStakingApr, navigate],
139112
);
140113

141114
const filteredOptions = useMemo(() => {
@@ -194,9 +167,10 @@ export const QuickLaunch: FC = () => {
194167
title={option.title}
195168
description={option.description}
196169
action={option.action}
197-
href={option.href}
170+
// href={option.href}
198171
navigateTo={option.url}
199172
disableCTA={option.disable}
173+
imageClass={option.imageClass}
200174
/>
201175
))}
202176
</Carousel>

apps/frontend/src/app/5_pages/ZeroPage/ZeroPage.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ const ZeroPage: FC<ZeroPageProps> = ({ deferred: [price] }) => {
185185
<div className="flex-col-reverse lg:flex-row flex items-stretch md:p-4 md:bg-gray-90 rounded gap-9 md:gap-20">
186186
<div className="md:min-w-[23rem] min-w-auto">
187187
<SystemStats />
188+
<p>hahaha</p>
188189
</div>
189190
<div className="flex-1 flex flex-col">
190191
<Paragraph
@@ -201,6 +202,16 @@ const ZeroPage: FC<ZeroPageProps> = ({ deferred: [price] }) => {
201202
</div>
202203
</div>
203204

205+
<p className="mt-4 px-2">
206+
<a
207+
href="https://wiki.sovryn.com/en/sovryn-dapp/subprotocols/zero-zusd"
208+
target="_blank"
209+
rel="nofollow noreferrer"
210+
>
211+
Learn More
212+
</a>
213+
</p>
214+
204215
<Dialog width={DialogSize.md} isOpen={open} disableFocusTrap>
205216
<DialogHeader
206217
title={
735 KB
Loading

apps/frontend/src/locales/en/translations.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,11 @@
508508
"description": "Earn a share of Sovryn’s revenue & vote on key decisions in Bitocracy.",
509509
"action": "Stake SOV"
510510
},
511+
"zero": {
512+
"title": "0% Interest Loan",
513+
"description": "Just a small origination fee and the rest is free forever. BTC collateral.",
514+
"action": "Sovryn Zero"
515+
},
511516
"earn": {
512517
"title": "Earn up to {{amount}}% APR in AMM",
513518
"description": "Deposit in the AMM pools and earn from trades.",
@@ -585,6 +590,11 @@
585590
"title": "BOS CLAIMS ARE OPEN",
586591
"description": "Claim your BOS tokens on Sovryn Origin - the multichain launchpad!",
587592
"cta": "Claim $BOS"
593+
},
594+
"zeroInterestLoans": {
595+
"title": "0% INTEREST LOANS",
596+
"description": "Take a loan with Sovryn Zero at 0% interest. ",
597+
"cta": "Sovryn Zero"
588598
}
589599
},
590600
"titleSection": {

0 commit comments

Comments
 (0)