Skip to content

Commit

Permalink
feat: Add description for clear cache feature
Browse files Browse the repository at this point in the history
  • Loading branch information
ashchan committed Nov 17, 2019
1 parent 83ff29d commit 38aa4c4
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 14 deletions.
33 changes: 19 additions & 14 deletions packages/neuron-ui/src/components/GeneralSetting/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useCallback, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { Stack, PrimaryButton, Spinner } from 'office-ui-fabric-react'
import { Stack, PrimaryButton, Spinner, Text } from 'office-ui-fabric-react'
import { StateWithDispatch } from 'states/stateProvider/reducer'
import { addPopup } from 'states/stateProvider/actionCreators'
import { clearCellCache } from 'services/remote'
Expand All @@ -20,19 +20,24 @@ const GeneralSetting = ({ dispatch }: React.PropsWithoutRef<StateWithDispatch>)
}, [dispatch])

return (
<Stack tokens={{ childrenGap: 15 }} horizontal horizontalAlign="start">
<PrimaryButton
onClick={clearCache}
disabled={clearing}
ariaDescription="Create new network configuration"
styles={{
root: {
minWidth: 150,
},
}}
>
{clearing ? <Spinner /> : t('settings.general.clear-cache')}
</PrimaryButton>
<Stack tokens={{ childrenGap: 15 }}>
<Stack horizontal horizontalAlign="start">
<PrimaryButton
onClick={clearCache}
disabled={clearing}
ariaDescription="Create new network configuration"
styles={{
root: {
minWidth: 150,
},
}}
>
{clearing ? <Spinner /> : t('settings.general.clear-cache')}
</PrimaryButton>
</Stack>
<Text as="p" variant="medium">
{t('settings.general.clear-cache-description')}
</Text>
</Stack>
)
}
Expand Down
1 change: 1 addition & 0 deletions packages/neuron-ui/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@
},
"general": {
"clear-cache": "Clear cache",
"clear-cache-description": "Clear cache if you encounter data sync or balance display problems. Neuron will rescan block data.",
"show": "Show",
"hide": "Hide"
},
Expand Down
1 change: 1 addition & 0 deletions packages/neuron-ui/src/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@
},
"general": {
"clear-cache": "清空缓存",
"clear-cache-description": "当数据同步或显示出现问题时,可以清空缓存,Neuron 会重新同步所有块数据。",
"show": "显示",
"hide": "隐藏"
},
Expand Down

0 comments on commit 38aa4c4

Please sign in to comment.