-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(send-form): remove custom dropdown type
- Loading branch information
1 parent
a1fdbd2
commit 5b6bbfc
Showing
16 changed files
with
153 additions
and
242 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 0 additions & 62 deletions
62
...pages/send/send-crypto-asset-form/components/recipient-fields/generic-recipient-field.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
src/app/pages/send/send-crypto-asset-form/components/recipient-fields/recipient-field.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { TextInputFieldError } from '@app/components/field-error'; | ||
|
||
import { SelectAccountButton } from '../recipient-accounts-drawer/select-account-button'; | ||
import { RecipientAddressTypeField } from '../recipient-address-type-field'; | ||
import { RecipientIdentifierTypeDropdown } from '../recipient-type-dropdown/recipient-type-dropdown'; | ||
import { useRecipientSelectFields } from './hooks/use-recipient-select-fields'; | ||
import { RecipientBnsNameTypeField } from './recipient-bns-name-type-field'; | ||
|
||
interface RecipientFieldProps { | ||
bnsLookupFn(client: any, name: string, isTestnet?: boolean): Promise<string | null>; | ||
} | ||
export function RecipientField({ bnsLookupFn }: RecipientFieldProps) { | ||
const { | ||
showRecipientAccountsModal, | ||
onSelectRecipientFieldType, | ||
selectedRecipientFieldName, | ||
selectedRecipientField, | ||
} = useRecipientSelectFields(); | ||
|
||
const recipientDropdown = ( | ||
<RecipientIdentifierTypeDropdown | ||
activeRecipientIdentifierType={selectedRecipientFieldName} | ||
onSelectRecipientIdentifierType={recipientType => onSelectRecipientFieldType(recipientType)} | ||
/> | ||
); | ||
|
||
const selectAccountButton = <SelectAccountButton onClick={showRecipientAccountsModal} />; | ||
|
||
switch (selectedRecipientField) { | ||
case 'bnsName': | ||
return ( | ||
<> | ||
<RecipientBnsNameTypeField | ||
fetchFn={bnsLookupFn} | ||
rightLabel={selectAccountButton} | ||
topInputOverlay={recipientDropdown} | ||
/> | ||
<TextInputFieldError name="recipientBnsName" /> | ||
</> | ||
); | ||
case 'address': | ||
default: | ||
return ( | ||
<> | ||
<RecipientAddressTypeField | ||
name="recipient" | ||
rightLabel={selectAccountButton} | ||
placeholder="Enter recipient address" | ||
topInputOverlay={recipientDropdown} | ||
/> | ||
<TextInputFieldError name="recipient" /> | ||
</> | ||
); | ||
} | ||
} |
43 changes: 0 additions & 43 deletions
43
...ypto-asset-form/components/recipient-type-dropdown/components/recipient-dropdown-item.tsx
This file was deleted.
Oops, something went wrong.
23 changes: 0 additions & 23 deletions
23
...o-asset-form/components/recipient-type-dropdown/components/recipient-dropdown-overlay.tsx
This file was deleted.
Oops, something went wrong.
49 changes: 0 additions & 49 deletions
49
...to-asset-form/components/recipient-type-dropdown/components/recipient-dropdown.layout.tsx
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.