Skip to content

Commit

Permalink
SOV-2083: add D2 links (#2528)
Browse files Browse the repository at this point in the history
* feat: add links to D2

* fix: links

* fix: dynamic links

---------

Co-authored-by: soulBit <[email protected]>
  • Loading branch information
creed-victor and soulBit authored May 4, 2023
1 parent 6859879 commit f90ffd6
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
import { LanguageToggle } from '../../../../components/LanguageToggle';
import styles from './index.module.scss';
import { ReactComponent as SovLogo } from 'assets/images/sovryn-logo-alpha.svg';
import { bitocracyUrl, myntUrl } from 'utils/classifiers';
import { D2_URL, bitocracyUrl, myntUrl } from 'utils/classifiers';
import { Menu } from 'app/components/Menu';
import { MenuItem } from 'app/components/Menu/components/MenuItem';
import { MenuSeparator } from 'app/components/Menu/components/MenuSeparator';
Expand All @@ -37,12 +37,15 @@ import {
import { Sovryn } from 'utils/sovryn';
import { bignumber } from 'mathjs';

import { ReactComponent as AppsIcon } from 'assets/apps-icon.svg';

type PagesProps = {
to: string;
title: string;
dataActionId: string;
hrefExternal?: boolean;
disabled?: boolean;
bold?: boolean;
};

export const DefaultHeaderComponent: React.FC = () => {
Expand Down Expand Up @@ -188,6 +191,33 @@ export const DefaultHeaderComponent: React.FC = () => {
dataActionId: 'header-mobile-bitocracy-link-forum',
hrefExternal: true,
},
{
to: '',
title: 'Sovryn.app',
dataActionId: '',
hrefExternal: true,
},
{
to: D2_URL,
title: t(translations.mainMenu.borrow),
dataActionId: 'header-mobile-d2-link-borrow',
hrefExternal: true,
bold: true,
},
{
to: `${D2_URL}/earn`,
title: t(translations.mainMenu.earn),
dataActionId: 'header-mobile-d2-link-earn',
hrefExternal: true,
bold: true,
},
{
to: `${D2_URL}/convert`,
title: t(translations.mainMenu.convert),
dataActionId: 'header-mobile-d2-link-convert',
hrefExternal: true,
bold: true,
},
{
to: '',
title: '',
Expand Down Expand Up @@ -231,7 +261,9 @@ export const DefaultHeaderComponent: React.FC = () => {
hrefExternal={link.hrefExternal}
data-action-id={link.dataActionId}
disabled={link.disabled || false}
className="tw-leading-snug"
className={classNames('tw-leading-snug', {
'tw-font-bold': link.bold,
})}
/>
);
});
Expand All @@ -254,6 +286,7 @@ export const DefaultHeaderComponent: React.FC = () => {
};

const SECTION_TYPE = {
PRODUCTS: 'products',
TRADE: 'trade',
EARN: 'earn',
LABS: 'labs',
Expand Down Expand Up @@ -310,6 +343,37 @@ export const DefaultHeaderComponent: React.FC = () => {
</Link>
</div>
<Menu className="tw-hidden xl:tw-flex tw-flex-row tw-flex-nowrap 2xl:tw-space-x-4 tw-items-center">
<NavPopover
content={
<>
<MenuItem
text={t(translations.mainMenu.borrow)}
label={t(translations.mainMenu.labels.d2Borrow)}
href={D2_URL}
hrefExternal
dataActionId="header-trade-d2-link-borrow"
/>
<MenuItem
text={t(translations.mainMenu.earn)}
label={t(translations.mainMenu.labels.d2Earn)}
href={`${D2_URL}/earn`}
hrefExternal
dataActionId="header-trade-d2-link-earn"
/>
<MenuItem
text={t(translations.mainMenu.convert)}
label={t(translations.mainMenu.labels.d2Convert)}
href={`${D2_URL}/convert`}
hrefExternal
dataActionId="header-trade-d2-link-convert"
/>
</>
}
>
<span className={classNames(styles.firstLevelMenu)}>
<AppsIcon />
</span>
</NavPopover>
<NavPopover
content={
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import getStartedBanner from 'assets/images/banner/Zero_banner.svg';
import getStartedBannerMobile from 'assets/images/banner/Zero_banner_mobile.svg';
import { Picture } from 'app/components/Picture';
import { Breakpoint } from 'types';
import { zeroUrl } from 'utils/classifiers';
import { D2_URL } from 'utils/classifiers';

const zeroSrcSet = [
{
Expand All @@ -21,7 +21,7 @@ const zeroSrcSet = [

export const GetStartedBanner: React.FC = () => {
const handleZeroBannerClick = useCallback(
() => window.open(zeroUrl, '_blank'),
() => window.open(D2_URL, '_blank'),
[],
);

Expand Down
1 change: 1 addition & 0 deletions src/assets/apps-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 6 additions & 1 deletion src/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -465,10 +465,12 @@
},
"mainMenu": {
"buySov": "Buy SOV",
"products": "Products",
"trade": "Trade",
"swap": "Swap",
"marginTrade": "Margin",
"earn": "Earn",
"convert": "Convert",
"pool": "Pool",
"voting": "Voting",
"portfolio": "Portfolio",
Expand Down Expand Up @@ -515,7 +517,10 @@
"perpetuals": "Trade perpetual futures contracts",
"zero": "0% interest loans on your bitcoin",
"voting": "Affect Sovryn's governance",
"forum": "Join the community"
"forum": "Join the community",
"d2Borrow": "Open a line of credit with BTC at 0% interest",
"d2Earn": "Earn BTC by providing liquidity for liquidations",
"d2Convert": "Convert between assets"
}
},
"originsLaunchpad": {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/classifiers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const bitocracyUrl =
? 'https://bitocracy.sovryn.app'
: 'https://bitocracy.test.sovryn.app';

export const zeroUrl =
export const D2_URL =
currentNetwork === AppMode.MAINNET
? isStaging
? 'https://staging.sovryn.app'
Expand Down

0 comments on commit f90ffd6

Please sign in to comment.