-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #878 from multiversx/tm-send-usernames-new
Usernames' support
- Loading branch information
Showing
25 changed files
with
13,348 additions
and
13,116 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
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
50 changes: 43 additions & 7 deletions
50
...tionsModals/SignWithDeviceModal/components/components/ConfirmReceiver/ConfirmReceiver.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
54 changes: 54 additions & 0 deletions
54
...al/components/components/ConfirmReceiver/components/ReceiverSubValue/ReceiverSubValue.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,54 @@ | ||
import React from 'react'; | ||
|
||
import { ACCOUNTS_ENDPOINT } from 'apiCalls'; | ||
import { CopyButton } from 'UI/CopyButton'; | ||
import { ExplorerLink } from 'UI/ExplorerLink'; | ||
import { Trim } from 'UI/Trim'; | ||
import { isContract } from 'utils'; | ||
|
||
import styles from './receiverSubValueStyles.scss'; | ||
|
||
export interface ReceiverSubValuePropsType { | ||
hasUsername: boolean; | ||
receiver: string; | ||
} | ||
|
||
export const ReceiverSubValue = ({ | ||
hasUsername, | ||
receiver | ||
}: ReceiverSubValuePropsType) => { | ||
const isSmartContract = isContract(receiver); | ||
|
||
if (hasUsername) { | ||
return ( | ||
<span className={styles.subValue}> | ||
<Trim text={receiver} className={styles.subValueTrim} /> | ||
<CopyButton text={receiver} className={styles.subValueCopy} /> | ||
</span> | ||
); | ||
} | ||
|
||
if (isSmartContract) { | ||
return ( | ||
<span className={styles.subValue}> | ||
<Trim text='Smart Contract Call' className={styles.subValueTrim} /> | ||
|
||
<ExplorerLink | ||
page={`/${ACCOUNTS_ENDPOINT}/${receiver}`} | ||
className={styles.subValueExplorer} | ||
/> | ||
</span> | ||
); | ||
} | ||
|
||
return ( | ||
<span className={styles.subValue}> | ||
<Trim text='View in Explorer' className={styles.subValueTrim} /> | ||
|
||
<ExplorerLink | ||
page={`/${ACCOUNTS_ENDPOINT}/${receiver}`} | ||
className={styles.subValueExplorer} | ||
/> | ||
</span> | ||
); | ||
}; |
1 change: 1 addition & 0 deletions
1
...ithDeviceModal/components/components/ConfirmReceiver/components/ReceiverSubValue/index.ts
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 @@ | ||
export * from './ReceiverSubValue'; |
42 changes: 42 additions & 0 deletions
42
...onents/components/ConfirmReceiver/components/ReceiverSubValue/receiverSubValueStyles.scss
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,42 @@ | ||
.subValue { | ||
display: flex; | ||
align-items: center; | ||
gap: 8px; | ||
height: 16px; | ||
position: absolute; | ||
right: 0; | ||
bottom: 0; | ||
left: 0; | ||
|
||
.subValueTrim { | ||
line-height: 1; | ||
color: var(--dapp-form-placeholder-color); | ||
font-size: 12px; | ||
display: flex; | ||
align-items: flex-end; | ||
max-width: none; | ||
|
||
[class*='left'] *, | ||
[class*='right'] * { | ||
color: var(--dapp-form-placeholder-color); | ||
font-size: 12px !important; | ||
} | ||
} | ||
|
||
.subValueCopy { | ||
font-size: 12px; | ||
} | ||
|
||
.subValueExplorer { | ||
margin-left: 0; | ||
font-size: 12px; | ||
|
||
svg { | ||
color: var(--dapp-form-placeholder-color) !important; | ||
} | ||
|
||
&:hover svg { | ||
color: var(--dapp-form-btn-bg) !important; | ||
} | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
...iceModal/components/components/ConfirmReceiver/components/ReceiverValue/ReceiverValue.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,44 @@ | ||
import React from 'react'; | ||
import classNames from 'classnames'; | ||
|
||
import { ACCOUNTS_ENDPOINT } from 'apiCalls'; | ||
import MultiversXIconSimple from 'assets/icons/mvx-icon-simple.svg'; | ||
import { CopyButton } from 'UI/CopyButton'; | ||
import { ExplorerLink } from 'UI/ExplorerLink'; | ||
import { Trim } from 'UI/Trim'; | ||
|
||
import { trimReceiverDomain } from '../../helpers'; | ||
import styles from './receiverValueStyles.scss'; | ||
|
||
export interface ReceiverValuePropsType { | ||
hasUsername: boolean; | ||
receiverValue: string; | ||
receiverAddress: string; | ||
} | ||
|
||
export const ReceiverValue = ({ | ||
hasUsername, | ||
receiverValue, | ||
receiverAddress | ||
}: ReceiverValuePropsType) => { | ||
if (hasUsername) { | ||
return ( | ||
<span className={classNames(styles.receiverValue, styles.shrunk)}> | ||
<MultiversXIconSimple className={styles.receiverValueIcon} /> | ||
{trimReceiverDomain(receiverValue)} | ||
|
||
<ExplorerLink | ||
page={`/${ACCOUNTS_ENDPOINT}/${receiverAddress}`} | ||
className={styles.receiverValueExplorer} | ||
/> | ||
</span> | ||
); | ||
} | ||
|
||
return ( | ||
<span className={styles.receiverValue}> | ||
<Trim text={receiverAddress} /> | ||
<CopyButton text={receiverAddress} className={styles.receiverValueCopy} /> | ||
</span> | ||
); | ||
}; |
1 change: 1 addition & 0 deletions
1
...gnWithDeviceModal/components/components/ConfirmReceiver/components/ReceiverValue/index.ts
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 @@ | ||
export * from './ReceiverValue'; |
37 changes: 37 additions & 0 deletions
37
...l/components/components/ConfirmReceiver/components/ReceiverValue/receiverValueStyles.scss
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,37 @@ | ||
.receiverValue { | ||
word-break: break-all; | ||
line-height: 1.5; | ||
height: 16px; | ||
gap: 8px; | ||
display: flex; | ||
align-items: center; | ||
|
||
&.shrunk { | ||
line-height: 1; | ||
height: auto; | ||
} | ||
|
||
.receiverValueIcon { | ||
height: 16px; | ||
position: relative; | ||
width: auto; | ||
top: 1px; | ||
} | ||
|
||
.receiverValueCopy { | ||
font-size: 12px; | ||
} | ||
|
||
.receiverValueExplorer { | ||
margin-left: 0; | ||
font-size: 12px; | ||
|
||
svg { | ||
color: var(--dapp-form-placeholder-color) !important; | ||
} | ||
|
||
&:hover svg { | ||
color: var(--dapp-form-btn-bg) !important; | ||
} | ||
} | ||
} |
35 changes: 28 additions & 7 deletions
35
...dals/SignWithDeviceModal/components/components/ConfirmReceiver/confirmReceiverStyles.scss
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 |
---|---|---|
@@ -1,20 +1,41 @@ | ||
.receiver { | ||
text-align: left; | ||
display: flex; | ||
flex-direction: column; | ||
gap: 8px; | ||
position: relative; | ||
padding-bottom: 24px; | ||
width: 100%; | ||
|
||
.value { | ||
font-size: 16px; | ||
word-break: break-all; | ||
line-height: 1.5; | ||
display: block; | ||
color: #e5e5e5; | ||
.valueWrapper { | ||
font-size: 14px; | ||
} | ||
|
||
.label { | ||
margin-bottom: 8px; | ||
color: #a3a3a3; | ||
font-size: 12px; | ||
line-height: 1; | ||
font-weight: 400; | ||
display: block; | ||
} | ||
|
||
.icon { | ||
height: 16px; | ||
position: relative; | ||
width: auto; | ||
top: 1px; | ||
} | ||
|
||
.loadingDots { | ||
font-size: 16px; | ||
line-height: 1; | ||
height: 16px; | ||
|
||
&.absolute { | ||
left: 0; | ||
right: 0; | ||
bottom: 0; | ||
position: absolute; | ||
} | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...sactionsModals/SignWithDeviceModal/components/components/ConfirmReceiver/helpers/index.ts
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 @@ | ||
export * from './trimReceiverDomain'; |
12 changes: 12 additions & 0 deletions
12
...s/SignWithDeviceModal/components/components/ConfirmReceiver/helpers/trimReceiverDomain.ts
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,12 @@ | ||
export const trimReceiverDomain = (receiver?: string) => { | ||
if (!receiver) { | ||
return; | ||
} | ||
|
||
const trimmedPartBeforeLastDot = receiver.substring( | ||
0, | ||
receiver.lastIndexOf('.') | ||
); | ||
|
||
return trimmedPartBeforeLastDot; | ||
}; |
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 |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
display: flex; | ||
flex-direction: column; | ||
margin: auto; | ||
width: 100%; | ||
|
||
.fields { | ||
gap: 32px; | ||
|
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
Oops, something went wrong.