Bug #522: Autofill contact address (#567)

Works as intent ended, the address is automatically filled when you add a new address from a Tx.

Checked the Address book functionality in general making sure nothing broke by this fix.
This commit is contained in:
Agustin Pane 2020-02-14 10:09:14 -03:00 committed by GitHub
parent c94bf4edbd
commit 504770d4cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 728 additions and 31 deletions

View File

@ -13,15 +13,16 @@ import Field from '~/components/forms/Field'
import TextField from '~/components/forms/TextField' import TextField from '~/components/forms/TextField'
import Paragraph from '~/components/layout/Paragraph' import Paragraph from '~/components/layout/Paragraph'
import { import {
composeValidators, required, minMaxLength, uniqueAddress, composeValidators,
required,
minMaxLength,
uniqueAddress,
} from '~/components/forms/validator' } from '~/components/forms/validator'
import Modal from '~/components/Modal' import Modal from '~/components/Modal'
import { styles } from './style' import { styles } from './style'
import AddressInput from '~/components/forms/AddressInput' import AddressInput from '~/components/forms/AddressInput'
import type { AddressBookEntry } from '~/logic/addressBook/model/addressBook' import type { AddressBookEntry } from '~/logic/addressBook/model/addressBook'
import { import { getAddressBookListSelector } from '~/logic/addressBook/store/selectors'
getAddressBookListSelector,
} from '~/logic/addressBook/store/selectors'
import { getAddressesListFromAdbk } from '~/logic/addressBook/utils' import { getAddressesListFromAdbk } from '~/logic/addressBook/utils'
export const CREATE_ENTRY_INPUT_NAME_ID = 'create-entry-input-name' export const CREATE_ENTRY_INPUT_NAME_ID = 'create-entry-input-name'
@ -45,8 +46,8 @@ const CreateEditEntryModalComponent = ({
entryToEdit, entryToEdit,
editEntryModalHandler, editEntryModalHandler,
}: Props) => { }: Props) => {
const onFormSubmitted = (values) => { const onFormSubmitted = values => {
if (entryToEdit) { if (entryToEdit && !entryToEdit.entry.isNew) {
editEntryModalHandler(values) editEntryModalHandler(values)
} else { } else {
newEntryModalHandler(values) newEntryModalHandler(values)

View File

@ -85,7 +85,13 @@ const AddressBookTable = ({ classes }: Props) => {
setSelectedEntry({ entry: value, index: key }) setSelectedEntry({ entry: value, index: key })
} else { } else {
// Create new entry // Create new entry
setSelectedEntry(null) setSelectedEntry({
entry: {
name: '',
address: entryAddressToEditOrCreateNew,
isNew: true,
},
})
} }
} }
}, [addressBook]) }, [addressBook])

738
yarn.lock

File diff suppressed because it is too large Load Diff