Skip to content

Commit

Permalink
Remove CurrentSeasonCard props
Browse files Browse the repository at this point in the history
Move season due date to constants
  • Loading branch information
kpyszkowski committed May 14, 2024
1 parent 76f4794 commit 115320f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
2 changes: 2 additions & 0 deletions dapp/src/constants/time.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ export const ONE_DAY_IN_SECONDS = ONE_HOUR_IN_SECONDS * 24
export const ONE_WEEK_IN_SECONDS = ONE_DAY_IN_SECONDS * 7
export const ONE_MONTH_IN_SECONDS = ONE_DAY_IN_SECONDS * 30
export const ONE_YEAR_IN_SECONDS = ONE_DAY_IN_SECONDS * 365

export const SEASON_DUE_TIMESTAMP = new Date(2024, 5, 9).getTime() / 1000
29 changes: 15 additions & 14 deletions dapp/src/pages/DashboardPage/CurrentSeasonCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,18 @@ import {
SeasonCountdownSectionBackground,
} from "#/components/shared/SeasonCountdownSection"
import { CurrencyBalance } from "#/components/shared/CurrencyBalance"
import { AmountType } from "#/types"
import { SEASON_DUE_TIMESTAMP } from "#/constants"

type CurrentSeasonCardProps = StackProps & {
heading: React.ReactNode
timestamp: number
totalJoined?: number
tvl?: AmountType
showSeasonStats?: boolean
}

export function CurrentSeasonCard(props: CurrentSeasonCardProps) {
const { heading, timestamp, totalJoined, tvl, ...restProps } = props
const { showSeasonStats = true, ...restProps } = props

const totalJoined = 3045 // TODO: fetch from API
const tvl = 144500000000 // TODO: fetch from API

return (
<VStack
spacing={4}
Expand All @@ -38,21 +39,21 @@ export function CurrentSeasonCard(props: CurrentSeasonCardProps) {
lineHeight={1}
letterSpacing="-0.03rem" // -0.48px
>
{heading}
Season 1 <br />
Pre-launch staking
</Heading>

<CountdownTimer size="sm" timestamp={timestamp} />
<CountdownTimer size="sm" timestamp={SEASON_DUE_TIMESTAMP} />

<Flex align="baseline" justify="space-between" color="white">
{totalJoined && (
{showSeasonStats && (
<Flex align="baseline" justify="space-between" color="white">
<TextMd fontWeight="medium">
Total joined&nbsp;
<TextMd as="span" fontWeight="bold">
{numberToLocaleString(totalJoined)}
</TextMd>
</TextMd>
)}
{!!tvl && (

<TextMd display="flex" fontWeight="medium">
TVL&nbsp;
<CurrencyBalance
Expand All @@ -63,8 +64,8 @@ export function CurrentSeasonCard(props: CurrentSeasonCardProps) {
fontWeight="bold"
/>
</TextMd>
)}
</Flex>
</Flex>
)}

<SeasonCountdownSectionBackground
position="absolute"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ import {
SeasonCountdownSectionBackground,
CountdownTimer,
} from "#/components/shared/SeasonCountdownSection"

const SEASON_DUE_TIMESTAMP = new Date(2024, 5, 9).getTime() / 1000
import { SEASON_DUE_TIMESTAMP } from "#/constants"

export default function SeasonCountdownSection() {
return (
Expand Down

0 comments on commit 115320f

Please sign in to comment.