Skip to content

Commit

Permalink
Revert "Merge master to aggron"
Browse files Browse the repository at this point in the history
  • Loading branch information
duanyytop authored Jul 1, 2020
1 parent d4ff916 commit 2a6b893
Show file tree
Hide file tree
Showing 63 changed files with 398 additions and 207 deletions.
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"trailingComma": "all",
"semi": false,
"singleQuote": true,
"printWidth": 130,
"printWidth": 120,
"arrowParens": "avoid"
}
2 changes: 1 addition & 1 deletion src/__tests__/components/__snapshots__/Table.spec.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ exports[`Table Component shallow renders 2`] = `
exports[`Table Component shallow renders 3`] = `
.c0 {
width: 10px;
margin: auto 0;
line-height: 20px;
text-align: center;
margin: auto 0;
}
Expand Down
6 changes: 3 additions & 3 deletions src/__tests__/pages/__snapshots__/Home.spec.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ exports[`Active Page shallow renders 1`] = `
Miner
</span>
<div
className="sc-fznzOf eVxyCl"
className="sc-fznzOf bKNQLi"
fontSize="14px"
width="10%"
>
Expand Down Expand Up @@ -444,7 +444,7 @@ exports[`Active Page shallow renders 1`] = `
Miner
</span>
<div
className="sc-fznzOf eVxyCl"
className="sc-fznzOf bKNQLi"
fontSize="14px"
width="10%"
>
Expand Down Expand Up @@ -546,7 +546,7 @@ exports[`Active Page shallow renders 1`] = `
Miner
</span>
<div
className="sc-fznzOf eVxyCl"
className="sc-fznzOf bKNQLi"
fontSize="14px"
width="10%"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ exports[`Active Page shallow renders with empty data 1`] = `
className="sc-fzqNJr dLfJWR"
>
<div
className="sc-fzoiQi cJWpwo container"
className="sc-fzoiQi ioDjAy container"
>
<div
className="sc-fzqARJ dBcmJI"
Expand Down
Binary file added src/assets/blue_mobile_maintain.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/blue_pc_maintain.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/detail.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/flag_blue_mobile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/flag_blue_pc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/flag_green_mobile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/flag_green_pc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/flag_red_mobile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/flag_red_pc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/menu_chart.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/menu_close_mobile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/menu_dao.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/menu_mobile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/mobile_maintain.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/pc_maintain.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/search.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/search_blue.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/search_green.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/tag_android.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/tag_html.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/tag_ios.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/tag_linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/tag_mac.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/tag_windows.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/transactions.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/wallet_abc.png
Binary file added src/assets/wallet_bitpie.png
Binary file added src/assets/wallet_cobo.png
Binary file added src/assets/wallet_hoo.png
Binary file added src/assets/wallet_imtoken.png
Binary file added src/assets/wallet_neuron.png
Binary file added src/assets/wallet_renrenbit.png
24 changes: 12 additions & 12 deletions src/components/Card/HashCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,6 @@ import SmallLoading from '../../Loading/SmallLoading'
import { useDispatch } from '../../../contexts/providers'
import { HashCardPanel, LoadingPanel } from './styled'
import SimpleButton from '../../SimpleButton'
import { AppDispatch } from '../../../contexts/reducer'

const copyAction = (dispatch: AppDispatch) => {
copyElementValue(document.getElementById('hash__value'))
dispatch({
type: AppActions.ShowToastMessage,
payload: {
message: i18n.t('common.copied'),
},
})
}

export default ({
title,
Expand Down Expand Up @@ -73,7 +62,18 @@ export default ({
<span className="monospace">{isMobile() ? mobileHash() : adaptPCEllipsis(hash, 13, 25)}</span>
</div>
)}
<SimpleButton className="hash__copy_icon" onClick={() => copyAction(dispatch)}>
<SimpleButton
className="hash__copy_icon"
onClick={() => {
copyElementValue(document.getElementById('hash__value'))
dispatch({
type: AppActions.ShowToastMessage,
payload: {
message: i18n.t('common.copied'),
},
})
}}
>
{!loading && <img src={CopyIcon} alt="copy" />}
</SimpleButton>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Content/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const ContentPanel = styled.div`
margin-top: 64px;
background: #ededed;
`
export default ({ children, style }: { children?: ReactNode; style?: any }) => {
export default ({ children, style }: { children: ReactNode; style?: any }) => {
const {
components: { mobileMenuVisible },
} = useAppState()
Expand Down
7 changes: 6 additions & 1 deletion src/components/Header/BlockchainComp/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,12 @@ const BlockchainMenu = () => {

return (
<MobileSubMenuPanel showSubMenu={false}>
<SimpleButton className="mobile__menus__main__item" onClick={() => setShowSubMenu(!showSubMenu)}>
<SimpleButton
className="mobile__menus__main__item"
onClick={() => {
setShowSubMenu(!showSubMenu)
}}
>
<div className="mobile__menus__main__item__content__highlight">
{isMainnet() ? i18n.t('navbar.mainnet') : CONFIG.TESTNET_NAME.toUpperCase()}
</div>
Expand Down
21 changes: 18 additions & 3 deletions src/components/Header/LanguageComp/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,12 @@ const LanguageMenu = () => {

return (
<MobileSubMenuPanel showSubMenu={false}>
<SimpleButton className="mobile__menus__main__item" onClick={() => setShowSubMenu(!showSubMenu)}>
<SimpleButton
className="mobile__menus__main__item"
onClick={() => {
setShowSubMenu(!showSubMenu)
}}
>
<div className="mobile__menus__main__item__content">
{currentLanguage() === 'en' ? i18n.t('navbar.language_en') : i18n.t('navbar.language_zh')}
</div>
Expand All @@ -108,10 +113,20 @@ const LanguageMenu = () => {
</SimpleButton>
{showSubMenu && (
<>
<SimpleButton className="mobile__menus__sub__item" onClick={() => hideMobileMenu(dispatch)}>
<SimpleButton
className="mobile__menus__sub__item"
onClick={() => {
hideMobileMenu(dispatch)
}}
>
{currentLanguage() === 'en' ? i18n.t('navbar.language_en') : i18n.t('navbar.language_zh')}
</SimpleButton>
<SimpleButton className="mobile__menus__sub__item" onClick={() => languageAction(dispatch)}>
<SimpleButton
className="mobile__menus__sub__item"
onClick={() => {
languageAction(dispatch)
}}
>
{currentLanguage() === 'en' ? i18n.t('navbar.language_zh') : i18n.t('navbar.language_en')}
</SimpleButton>
</>
Expand Down
24 changes: 13 additions & 11 deletions src/components/Header/SearchComp/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,6 @@ import { isScreen750to1440 } from '../../../utils/screen'
import { HeaderSearchBarPanel } from './styled'
import { useDispatch, useAppState } from '../../../contexts/providers'
import { ComponentActions } from '../../../contexts/actions'
import { AppDispatch } from '../../../contexts/reducer'

const headerSearchAction = (dispatch: AppDispatch) => {
dispatch({
type: ComponentActions.UpdateHeaderSearchEditable,
payload: {
searchBarEditable: true,
},
})
}

export const SearchComp = () => {
const dispatch = useDispatch()
Expand All @@ -25,7 +15,19 @@ export const SearchComp = () => {

if (isScreen750to1440() && !searchBarEditable) {
return (
<HeaderSearchBarPanel onClick={() => headerSearchAction(dispatch)}>
<HeaderSearchBarPanel
role="button"
tabIndex={-1}
onKeyDown={() => {}}
onClick={() => {
dispatch({
type: ComponentActions.UpdateHeaderSearchEditable,
payload: {
searchBarEditable: true,
},
})
}}
>
<img alt="header search bar" src={SearchLogo} />
</HeaderSearchBarPanel>
)
Expand Down
3 changes: 1 addition & 2 deletions src/components/Header/SearchComp/styled.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import styled from 'styled-components'
import SimpleButton from '../../SimpleButton'

export const HeaderSearchPanel = styled.div`
display: flex;
Expand All @@ -23,7 +22,7 @@ export const HeaderSearchPanel = styled.div`
}
`

export const HeaderSearchBarPanel = styled(SimpleButton)`
export const HeaderSearchBarPanel = styled.div`
display: flex;
align-items: center;
margin-right: 30px;
Expand Down
23 changes: 11 additions & 12 deletions src/components/Header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { SearchComp } from './SearchComp'
import LanguageComp from './LanguageComp'
import BlockchainComp from './BlockchainComp'
import { useLocation } from 'react-router'
import { AppDispatch } from '../../contexts/reducer'

const LogoComp = () => {
return (
Expand All @@ -19,22 +18,22 @@ const LogoComp = () => {
)
}

const headerMenuAction = (dispatch: AppDispatch, mobileMenuVisible: boolean) => {
dispatch({
type: ComponentActions.UpdateHeaderMobileMenuVisible,
payload: {
mobileMenuVisible: !mobileMenuVisible,
},
})
}

const MobileMenuComp = () => {
const dispatch = useDispatch()
const {
components: { mobileMenuVisible },
} = useAppState()
return (
<HeaderMobileMenuPanel onClick={() => headerMenuAction(dispatch, mobileMenuVisible)}>
<HeaderMobileMenuPanel
onClick={() => {
dispatch({
type: ComponentActions.UpdateHeaderMobileMenuVisible,
payload: {
mobileMenuVisible: !mobileMenuVisible,
},
})
}}
>
<div className={mobileMenuVisible ? 'close' : ''}>
<div className="menu__icon__first" />
<div className="menu__icon__second" />
Expand All @@ -55,7 +54,7 @@ export default () => {
dispatch({
type: ComponentActions.UpdateHeaderSearchBarVisible,
payload: {
headerSearchBarVisible: pathname !== '/' && pathname !== '/search/fail',
headerSearchBarVisible: pathname !== '/' && pathname !== '/search/fail' && pathname !== '/maintain',
},
})
}, [dispatch, pathname])
Expand Down
46 changes: 26 additions & 20 deletions src/components/Search/Filter/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,34 +48,40 @@ const Filter = ({
const [showClear, setShowClear] = useState(false)
const inputElement = useRef<HTMLInputElement>(null)

const filterAction = (isClear?: boolean) => {
if (isClear) {
setShowClear(false)
clearFilterInput(inputElement)
}
}

const resetFilterAction = () => {
setShowReset(false)
setShowClear(false)
clearFilterInput(inputElement)
if (filterType === FilterType.DAO) {
getNervosDaoTransactions(dispatch, 1, PageParams.PageSize)
} else if (typeHash) {
getSimpleUDTTransactions(typeHash, 1, PageParams.PageSize, dispatch)
}
}

const FilterIcon = ({ isClear }: { isClear?: boolean }) => {
return (
<FilterImage isClear={isClear} onClick={() => filterAction(isClear)}>
<FilterImage
isClear={isClear}
onClick={() => {
if (isClear) {
setShowClear(false)
clearFilterInput(inputElement)
}
}}
>
<img src={isClear ? ClearLogo : SearchFilter} alt="search logo" />
</FilterImage>
)
}

const ResetFilter = () => {
return <ResetButtonPanel onClick={() => resetFilterAction()}>{i18n.t('nervos_dao.dao_search_reset')}</ResetButtonPanel>
const dispatch = useDispatch()
return (
<ResetButtonPanel
onClick={() => {
setShowReset(false)
setShowClear(false)
clearFilterInput(inputElement)
if (filterType === FilterType.DAO) {
getNervosDaoTransactions(dispatch, 1, PageParams.PageSize)
} else if (typeHash) {
getSimpleUDTTransactions(typeHash, 1, PageParams.PageSize, dispatch)
}
}}
>
{i18n.t('nervos_dao.dao_search_reset')}
</ResetButtonPanel>
)
}

const handleSearchResult = () => {
Expand Down
Loading

0 comments on commit 2a6b893

Please sign in to comment.