Unverified Commit 8a7e71ff authored by Andrei Eres's avatar Andrei Eres Committed by GitHub
Browse files

Improve UI feedback on importing (#81)

parent 6d88a72a
Pipeline #163092 passed with stages
in 1 minute and 13 seconds
......@@ -11,11 +11,16 @@ export const importHeaderAction: Action = {
onAction: goToImport,
}
export const goHomeHeaderAction: Action = {
export const cancelAndGoHomeHeaderAction: Action = {
label: 'Cancel',
onAction: goHome,
}
export const doneAndGoHomeHeaderAction: Action = {
label: 'Done',
onAction: goHome,
}
export const headerActions = createStore<Action[]>(() => {
headerActions.set([])
})
......
......@@ -4,7 +4,8 @@ import styled from 'styled-components'
import Address from '../components/Address'
import {
addHeaderAction,
goHomeHeaderAction,
cancelAndGoHomeHeaderAction,
doneAndGoHomeHeaderAction,
resetHeaderActions,
} from '../../stores/headerActions'
import { BaseProps } from '../types'
......@@ -37,9 +38,11 @@ const ImportQr: React.FC<BaseProps> = ({ className }) => {
}
useEffect(() => {
addHeaderAction(goHomeHeaderAction)
scanned.length === 0
? addHeaderAction(cancelAndGoHomeHeaderAction)
: addHeaderAction(doneAndGoHomeHeaderAction)
return () => resetHeaderActions()
}, [])
}, [scanned.length])
return (
<div className={className}>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment