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.
feat: transaction page support node-connect mode (#350)
* feat: transaction page support node-connect mode * chore: optimize english text for readable * feat: support cellbase display * feat: optimize ver name * feat: support node-connect mode state hold * feat: home page support get lastest tx & block by node * chore: fix typo
- Loading branch information
1 parent
dc903db
commit 97fdaa9
Showing
60 changed files
with
2,099 additions
and
336 deletions.
There are no files selected for viewing
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
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,44 @@ | ||
import { useRef } from 'react' | ||
import { useTranslation } from 'react-i18next' | ||
import { useCKBNode } from '../../../hooks/useCKBNode' | ||
import CommonModal from '../../CommonModal' | ||
import { HelpTip } from '../../HelpTip' | ||
import { Switch } from '../../ui/Switch' | ||
import CloseIcon from '../../../assets/modal_close.png' | ||
import styles from './style.module.scss' | ||
|
||
export const CKBNodeModal = ({ onClose }: { onClose: () => void }) => { | ||
const { t } = useTranslation() | ||
const ref = useRef<HTMLDivElement>(null) | ||
const { isActivated, setIsActivated } = useCKBNode() | ||
|
||
return ( | ||
<CommonModal isOpen onClose={onClose}> | ||
<div ref={ref} className={styles.modalWrapper}> | ||
<div className={styles.contentWrapper}> | ||
<div className={styles.modalTitle}> | ||
<p>{t('navbar.node')}</p> | ||
<button type="button" onClick={onClose} className={styles.closeBtn}> | ||
<img src={CloseIcon} alt="close icon" /> | ||
</button> | ||
</div> | ||
|
||
<div className={styles.switcher}> | ||
<label htmlFor="node-connect-mode">{t('node.node_connect_mode')}</label> | ||
<HelpTip title={t('node.node_connect_tooltip')} /> | ||
<Switch | ||
id="node-connect-mode" | ||
style={{ marginLeft: 'auto' }} | ||
checked={isActivated} | ||
onCheckedChange={checked => setIsActivated(checked)} | ||
/> | ||
</div> | ||
|
||
<button type="button" className={styles.doneBtn} onClick={onClose}> | ||
{t('node.done')} | ||
</button> | ||
</div> | ||
</div> | ||
</CommonModal> | ||
) | ||
} |
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,25 @@ | ||
import { useState } from 'react' | ||
import { Trans } from 'react-i18next' | ||
import { CKBNodeModal } from './CKBNodeModal' | ||
|
||
import styles from './style.module.scss' | ||
|
||
const NodeAlert = () => { | ||
const [nodeModalVisible, setNodeModalVisible] = useState(false) | ||
return ( | ||
<> | ||
<div className={styles.alert}> | ||
<Trans | ||
i18nKey="node.alert" | ||
components={{ | ||
// eslint-disable-next-line jsx-a11y/click-events-have-key-events | ||
switcher: <span className={styles.clickable} onClick={() => setNodeModalVisible(true)} />, | ||
}} | ||
/> | ||
</div> | ||
{nodeModalVisible ? <CKBNodeModal onClose={() => setNodeModalVisible(false)} /> : null} | ||
</> | ||
) | ||
} | ||
|
||
export default NodeAlert |
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,101 @@ | ||
@import '../../../styles/variables.module'; | ||
|
||
.contentWrapper { | ||
background-color: white; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
border-radius: 4px; | ||
width: 80vw; | ||
max-width: 280px; | ||
padding: 24px; | ||
|
||
@media screen and (width <= 750px) { | ||
padding: 16px; | ||
width: calc(100vw - 32px); | ||
} | ||
|
||
p { | ||
margin: 0; | ||
} | ||
} | ||
|
||
.modalTitle { | ||
display: flex; | ||
width: 100%; | ||
align-items: center; | ||
justify-content: space-between; | ||
color: #333; | ||
font-weight: 600; | ||
font-size: 16px; | ||
line-height: 20px; | ||
} | ||
|
||
.modalContent { | ||
width: 100%; | ||
margin-top: 32px; | ||
} | ||
|
||
.languageSelect { | ||
color: #333; | ||
} | ||
|
||
.closeBtn { | ||
border: none; | ||
background: transparent; | ||
cursor: pointer; | ||
|
||
img { | ||
width: 13px; | ||
height: 13px; | ||
} | ||
} | ||
|
||
.doneBtn { | ||
width: 100%; | ||
margin-top: 32px; | ||
height: 47px; | ||
background: var(--primary-color); | ||
border: none; | ||
border-radius: 4px; | ||
color: #fff; | ||
font-size: 16px; | ||
cursor: pointer; | ||
} | ||
|
||
.loading { | ||
text-align: center; | ||
} | ||
|
||
.switcher { | ||
margin-top: 32px; | ||
width: 100%; | ||
display: flex; | ||
align-items: center; | ||
|
||
label { | ||
color: black; | ||
} | ||
} | ||
|
||
.alert { | ||
position: sticky; | ||
color: #fff; | ||
font-size: 14px; | ||
font-weight: 450; | ||
line-height: 1.2; | ||
text-align: center; | ||
padding: 1rem; | ||
background-color: #fa8f00; | ||
|
||
@media (width <= $mobileBreakPoint) { | ||
text-align: left; | ||
} | ||
} | ||
|
||
.clickable { | ||
color: var(--primary-color); | ||
cursor: pointer; | ||
text-decoration: underline; | ||
} |
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
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.