Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add ExpiringCFGRewardsBanner component to Header #41

Merged
merged 2 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions tinlake-ui/components/ExpiringCFGRewardsBanner.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { Anchor, Box, Card, Paragraph } from 'grommet'

export const ExpiringCFGRewardsBanner = () => {
const expirationDate = new Date('2024-01-29T15:01')
const currentDateCET = new Date().toLocaleString('en-US', { timeZone: 'CET' })
const currentDateCETMillis = new Date(currentDateCET).getTime()

const isExpired = currentDateCETMillis > expirationDate.getTime()

const formattedExpirationDate = `${expirationDate.toLocaleString('en-US', {
month: 'short',
day: 'numeric',
year: 'numeric',
})} at ${expirationDate.toLocaleString('en-US', { hour: 'numeric', minute: 'numeric', hour12: true }).toLowerCase()}`

return (
<Card
margin={{ top: 'medium' }}
pad={{ top: 'xsmall', bottom: 'xsmall', left: 'medium', right: 'medium' }}
style={{
backgroundColor: '#fff5da',
}}
>
<Box>
<Paragraph>
{isExpired ? (
`CFG rewards expired on ${formattedExpirationDate} CET.`
) : (
<>
Claim your rewards until {formattedExpirationDate} CET. After this day, users will not be able to claim
their CFG rewards. Check <Anchor href="/rewards" label="here" /> if there are still unclaimed rewards.
</>
)}{' '}
Read more <Anchor href="https://gov.centrifuge.io/t/cp81-unclaimed-tinlake-rewards/5885/4" label="here" />.
</Paragraph>
</Box>
</Card>
)
}
6 changes: 6 additions & 0 deletions tinlake-ui/components/Header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import { usePool } from '../../utils/usePool'
import { usePortfolio } from '../../utils/usePortfolio'
import { ClientOnlyRender } from '../ClientOnlyRender'
import { ExpiringCFGRewardsBanner } from '../ExpiringCFGRewardsBanner'
import { ExploreCentrifugeBanner } from '../ExploreCentrifugeBanner'
import { RewardsBanner } from '../RewardsBanner'
import { useTinlake } from '../TinlakeProvider'
Expand Down Expand Up @@ -160,7 +161,7 @@
>
<LogoWrapper>
<Link href="/" shallow>
<a title="Tinlake" style={{ display: 'block' }}>

Check warning on line 164 in tinlake-ui/components/Header/index.tsx

View workflow job for this annotation

GitHub Actions / build-and-deploy-to-mainnet

The href attribute is required for an anchor to be keyboard accessible. Provide a valid, navigable address as the href value. If you cannot provide an href, but still need the element to resemble a link, use a button and change it with appropriate styles. Learn more: https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/HEAD/docs/rules/anchor-is-valid.md

Check warning on line 164 in tinlake-ui/components/Header/index.tsx

View workflow job for this annotation

GitHub Actions / build-and-deploy-to-goerli

The href attribute is required for an anchor to be keyboard accessible. Provide a valid, navigable address as the href value. If you cannot provide an href, but still need the element to resemble a link, use a button and change it with appropriate styles. Learn more: https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/HEAD/docs/rules/anchor-is-valid.md
<DesktopLogo hasPoolSelector={!!poolTitle} src={logoUrl} />
<MobileLogo hasPoolSelector={!!poolTitle} src="/static/tinlake-logo-icon-only.svg" />
</a>
Expand Down Expand Up @@ -258,6 +259,11 @@
</MobileNav>
</HeaderBar>
{!props.hideRewardsBanner && <RewardsBanner />}
<Box justify="center" direction="row">
<Box width="xlarge">
<ExpiringCFGRewardsBanner />
</Box>
</Box>
<Box justify="center" direction="row">
<Box width="xlarge">
<ExploreCentrifugeBanner />
Expand Down
Loading