forked from nervosnetwork/ckb-explorer-frontend
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9119381
commit 8e9e014
Showing
16 changed files
with
893 additions
and
3 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import classnames from 'classnames' | ||
import styles from './index.module.scss' | ||
import SimpleButton from '../SimpleButton' | ||
import { useCountdown, useHalving } from '../../utils/hook' | ||
import i18n from '../../utils/i18n' | ||
import { capitalizeFirstLetter } from '../../utils/string' | ||
|
||
export const HalvingBanner = () => { | ||
const { estimatedDate, nextHalvingCount } = useHalving() | ||
const [days, hours, minutes, seconds] = useCountdown(estimatedDate) | ||
|
||
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 ( | ||
<div className={styles.root}> | ||
<div className={styles.HalvingBannerShadow}> | ||
<div className={classnames(styles.HalvingBanner, 'container')}> | ||
{nextHalvingCount === 1 ? ( | ||
<div className={styles.HalvingBannerText}> | ||
Nervos CKB Layer 1 {i18n.t('halving.halving_countdown')} | ||
<div className={styles.HalvingBannerCount}>{shortCountdown()}</div> | ||
</div> | ||
) : ( | ||
<div className={styles.HalvingBannerText}>{i18n.t('halving.first_congratulation')}</div> | ||
)} | ||
|
||
<a style={{ marginLeft: 'auto' }} href="/halving"> | ||
<SimpleButton className={styles.LearnMoreButton}>{i18n.t('halving.learn_more')}</SimpleButton> | ||
</a> | ||
</div> | ||
</div> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import styles from './index.module.scss' | ||
|
||
export default () => <div className={styles.Root} /> | ||
export default () => <div className={styles.root} /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.