Skip to content

Commit

Permalink
✨staking: add staking news banner
Browse files Browse the repository at this point in the history
  • Loading branch information
franm91 committed Sep 6, 2024
1 parent 7d39811 commit d8ff42b
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 6 deletions.
41 changes: 35 additions & 6 deletions components/NewsModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import Link from 'next/link';
import useRouter from 'hooks/useRouter';
import { useTranslation } from 'react-i18next';
import { track } from 'utils/mixpanel';
import { useWeb3 } from 'hooks/useWeb3';
import { mainnet } from 'wagmi';

const NEWS_READ_KEY = 'news_read';

Expand All @@ -20,9 +22,24 @@ const isNewsRead = (id: string) => {
};

const NewsModal = () => {
const { chain } = useWeb3();
const isEthereum = chain.id === mainnet.id;
const { t } = useTranslation();
const news = useMemo(
() => [
{
id: 'Staking',
title: t('Staking EXA program'),
description: [
t('Step 1: Stake your EXA'),
t('Step 2: Start receiving rewards from the protocol’s treasury fees.'),
],
image: 'img/news/5.png',
buttonTitle: t('Start staking now'),
pathname: `${isEthereum ? 'https://app.exact.ly/staking' : '/staking'}`,
isExternal: isEthereum,
until: '2024-11-30T23:59:59.000Z',
},
{
id: 'esEXA Vesting',
title: t('esEXA Vesting'),
Expand All @@ -33,6 +50,7 @@ const NewsModal = () => {
image: 'img/news/4.png',
buttonTitle: t('Start vesting now'),
pathname: '/vesting',
isExternal: false,
until: '2023-11-30T23:59:59.000Z',
},
{
Expand All @@ -45,6 +63,7 @@ const NewsModal = () => {
image: 'img/news/1.png',
buttonTitle: t('Check it now'),
pathname: '/security',
isExternal: false,
until: '2023-10-31T23:59:59.000Z',
},
{
Expand All @@ -57,6 +76,7 @@ const NewsModal = () => {
image: 'img/news/2.png',
buttonTitle: t('Check transactions'),
pathname: '/activity',
isExternal: false,
until: '2023-10-31T23:59:59.000Z',
},
{
Expand All @@ -69,10 +89,11 @@ const NewsModal = () => {
image: 'img/news/3.png',
buttonTitle: 'Manage allowances',
pathname: '/revoke',
isExternal: false,
until: '2023-10-31T23:59:59.000Z',
},
],
[t],
[isEthereum, t],
);

const { pathname: currentPathname, query } = useRouter();
Expand Down Expand Up @@ -156,11 +177,19 @@ const NewsModal = () => {
))}
</Box>
</Box>
<Link href={{ pathname: selectedNews.pathname, query }} legacyBehavior>
<Button variant="contained" sx={{ width: 'fit-content' }}>
{selectedNews.buttonTitle}
</Button>
</Link>
{selectedNews.isExternal ? (
<a href={selectedNews.pathname} target="_blank" rel="noopener noreferrer">
<Button variant="contained" sx={{ width: 'fit-content' }}>
{selectedNews.buttonTitle}
</Button>
</a>
) : (
<Link href={{ pathname: selectedNews.pathname, query }} legacyBehavior>
<Button variant="contained" sx={{ width: 'fit-content' }}>
{selectedNews.buttonTitle}
</Button>
</Link>
)}
</Grid>
{!isMobile && (
<Grid item xs={12} md={6}>
Expand Down
Binary file added public/img/news/5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit d8ff42b

Please sign in to comment.