diff --git a/src/assets/block-rewards-cn.png b/src/assets/block-rewards-cn.png new file mode 100644 index 000000000..87d0ded7f Binary files /dev/null and b/src/assets/block-rewards-cn.png differ diff --git a/src/assets/block-rewards.png b/src/assets/block-rewards.png new file mode 100644 index 000000000..aee406a38 Binary files /dev/null and b/src/assets/block-rewards.png differ diff --git a/src/assets/calendar.svg b/src/assets/calendar.svg new file mode 100644 index 000000000..1332af123 --- /dev/null +++ b/src/assets/calendar.svg @@ -0,0 +1,4 @@ + + \ No newline at end of file diff --git a/src/assets/ckb_base_issuance_trend.png b/src/assets/ckb_base_issuance_trend.png new file mode 100644 index 000000000..45362c374 Binary files /dev/null and b/src/assets/ckb_base_issuance_trend.png differ diff --git a/src/assets/fonts/digital-7.ttf b/src/assets/fonts/digital-7.ttf new file mode 100644 index 000000000..5dbe6f908 Binary files /dev/null and b/src/assets/fonts/digital-7.ttf differ diff --git a/src/assets/fonts/fonts.css b/src/assets/fonts/fonts.css index 64582cb8f..c64fff8be 100644 --- a/src/assets/fonts/fonts.css +++ b/src/assets/fonts/fonts.css @@ -4,3 +4,8 @@ font-weight: 300; font-style: normal; } + +@font-face { + font-family:'digital-clock-font'; + src: url('./digital-7.ttf'); +} diff --git a/src/assets/halving_banner.png b/src/assets/halving_banner.png new file mode 100644 index 000000000..dabba5f9e Binary files /dev/null and b/src/assets/halving_banner.png differ diff --git a/src/assets/halving_banner_success.png b/src/assets/halving_banner_success.png new file mode 100644 index 000000000..91ccb0edc Binary files /dev/null and b/src/assets/halving_banner_success.png differ diff --git a/src/assets/halving_bg.png b/src/assets/halving_bg.png new file mode 100644 index 000000000..4736a30a8 Binary files /dev/null and b/src/assets/halving_bg.png differ diff --git a/src/assets/halving_success_bg.png b/src/assets/halving_success_bg.png new file mode 100644 index 000000000..258afb464 Binary files /dev/null and b/src/assets/halving_success_bg.png differ diff --git a/src/assets/twitter.svg b/src/assets/twitter.svg new file mode 100644 index 000000000..5bf712052 --- /dev/null +++ b/src/assets/twitter.svg @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/src/assets/warning_circle.svg b/src/assets/warning_circle.svg new file mode 100644 index 000000000..23281be15 --- /dev/null +++ b/src/assets/warning_circle.svg @@ -0,0 +1,4 @@ + + \ No newline at end of file diff --git a/src/components/BannerFallback/HalvingBanner.tsx b/src/components/BannerFallback/HalvingBanner.tsx new file mode 100644 index 000000000..b0eec3d7e --- /dev/null +++ b/src/components/BannerFallback/HalvingBanner.tsx @@ -0,0 +1,86 @@ +import classnames from 'classnames' +import styles from './index.module.scss' +import halvingBanner from '../../assets/halving_banner.png' +import halvingBannerSuccess from '../../assets/halving_banner_success.png' +import SimpleButton from '../SimpleButton' +import { useCountdown, useHalving } from '../../utils/hook' +import i18n from '../../utils/i18n' +import { capitalizeFirstLetter } from '../../utils/string' +import { fetchCachedData } from '../../utils/cache' + +function numberToOrdinal(number: number) { + switch (number) { + case 1: + return 'first' + case 2: + return 'second' + default: + break + } + + switch (number % 10) { + case 1: + return `${number}st` + case 2: + return `${number}nd` + case 3: + return `${number}rd` + default: + return `${number}th` + } +} + +export const HalvingBanner = () => { + const { estimatedDate, nextHalvingCount } = useHalving() + const [days, hours, minutes, seconds] = useCountdown(estimatedDate) + const lastedHavingKey = `lasted-having-${nextHalvingCount - 1}` + const unreadLastedHaving = nextHalvingCount > 1 && fetchCachedData(lastedHavingKey) === null + + const shortCountdown = () => { + if (days > 0) { + return `${days}${i18n.t('symbol.char_space')}${capitalizeFirstLetter(i18n.t('unit.days'))}` + } + if (hours > 0) { + return `${hours}${i18n.t('symbol.char_space')}${capitalizeFirstLetter(i18n.t('unit.hours'))}` + } + if (minutes > 0) { + return `${minutes}${i18n.t('symbol.char_space')}${capitalizeFirstLetter(i18n.t('unit.minutes'))}` + } + if (seconds > 0) { + return `${seconds}${i18n.t('symbol.char_space')}${capitalizeFirstLetter(i18n.t('unit.seconds'))}` + } + return `${capitalizeFirstLetter(i18n.t('halving.halving'))}!` + } + + return ( +
{i18n.t('halving.table_event')} | +{i18n.t('halving.table_date')} | +{i18n.t('halving.table_epoch_number')} | +{i18n.t('halving.table_epoch_reward')} | +{i18n.t('halving.table_block_reward')} | +{i18n.t('halving.table_daily_reward')} | +{i18n.t('halving.table_total')} | + + +
---|---|---|---|---|---|---|
{i18n.t('halving.table_launches')} | +16 Nov 2019 | +0 ({i18n.t('halving.genesis_epoch')}) | +1,917,808 CKB | +1,065 CKB | +11,506,849 CKB | +16,800,000,000 CKB | +
+ + {capitalizeFirstLetter(i18n.t('ordinal.first'))} + {i18n.t('symbol.char_space')} + {i18n.t('halving.halving')} + + | ++ {i18n.t('halving.expected')} 19 Nov 2023 + | ++ 8,760 + | ++ 958,904 CKB + | ++ 533 CKB + | ++ 5,753,424 CKB + | ++ 8,400,000,000 CKB + | +
+ {capitalizeFirstLetter(i18n.t('ordinal.second'))} + {i18n.t('symbol.char_space')} + {i18n.t('halving.halving')} + | +{i18n.t('halving.expected')} November 2027 | +17,520 | +479,452 CKB | +266 CKB | +2,876,712 CKB | +4,200,000,000 CKB | +
+ {capitalizeFirstLetter(i18n.t('ordinal.3rd'))} + {i18n.t('symbol.char_space')} + {i18n.t('halving.halving')} + | +{i18n.t('halving.expected')} November 2031 | +26,280 | +239,726 CKB | +133 CKB | +1,438,356 CKB | +2,100,000,000 CKB | +
+ {capitalizeFirstLetter(i18n.t('ordinal.4th'))} + {i18n.t('symbol.char_space')} + {i18n.t('halving.halving')} + | +{i18n.t('halving.expected')} November 2035 | +35,040 | +119,863 CKB | +67 CKB | +719,178 CKB | +1,050,000,000 CKB | +
+ {capitalizeFirstLetter(i18n.t('ordinal.5th'))} + {i18n.t('symbol.char_space')} + {i18n.t('halving.halving')} + | +{i18n.t('halving.expected')} November 2039 | +43,800 | +59,932 CKB | +33.5 CKB | +359,589 CKB | +525,000,000 CKB | +
+ {capitalizeFirstLetter(i18n.t('ordinal.6th'))} + {i18n.t('symbol.char_space')} + {i18n.t('halving.halving')} + | +{i18n.t('halving.expected')} November 2043 | +52,560 | +29,966 CKB | +16.75 CKB | +179,794.5 CKB | +262,500,000 CKB | +
+ {capitalizeFirstLetter(i18n.t('ordinal.7th'))} + {i18n.t('symbol.char_space')} + {i18n.t('halving.halving')} + | +{i18n.t('halving.expected')} November 2047 | +61,320 | +14,983 CKB | +8.375 CKB | +89,897.25 CKB | +131,250,000 CKB | +
+ {capitalizeFirstLetter(i18n.t('ordinal.8th'))} + {i18n.t('symbol.char_space')} + {i18n.t('halving.halving')} + | +{i18n.t('halving.expected')} November 2051 | +70,080 | +7,491 CKB | +4.1875 CKB | +44,948.625 CKB | +65,625,000 CKB | +
+ {capitalizeFirstLetter(i18n.t('ordinal.9th'))} + {i18n.t('symbol.char_space')} + {i18n.t('halving.halving')} + | +{i18n.t('halving.expected')} November 2055 | +78,840 | +3,746 CKB | +2.09375 CKB | +22,474.3125 CKB | +32,812,500 CKB | +
+ {capitalizeFirstLetter(i18n.t('ordinal.10th'))} + {i18n.t('symbol.char_space')} + {i18n.t('halving.halving')} + | +{i18n.t('halving.expected')} November 2059 | +87,600 | +1,873 CKB | +1.046875 CKB | +11,237.15625 CKB | +16,406,250 CKB | +
{i18n.t('halving.countdown_tooltip_section1')}
++ {i18n.t('halving.countdown_tooltip_section2')} +
+{i18n.t('halving.countdown_tooltip_section3')}
+ > + } + > +