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

View File

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

738
yarn.lock

File diff suppressed because it is too large Load Diff