on master help sign in
feat: make addresses across the app copiable with a click
commitc8d5d0b76180246a53e52db45779ac6899a8840f authorMatt Condon (shrugs) <mattgcondon@gmail.com> dateMon 19 Aug 2019, 20:08 (7 years ago) parent75177b3
8 files changed+44−21
src/components/InlineEthereumTransaction.js+5−3 src/views/Activate/PassportTransfer.js+3−2 src/views/Admin/Reticket/ReticketExecute.js+3−2 src/views/CreateGalaxy.js+2−1 src/views/Invite/InviteEmail.js+8−3 src/views/IssueChild.js+3−2 src/views/Party/PartySetPoolSize.js+12−6 src/views/Points.js+8−2
src/components/InlineEthereumTransaction.js+5−3
@@ -22,6 +22,7 @@ import { GenerateButton, ForwardButton, RestartButton } from './Buttons';
2222import WarningBox from './WarningBox';
2323import CopyButton from './CopyButton';
2424import ProgressButton from './ProgressButton';
25+import CopiableAddress from './CopiableAddress';
2526
2627export default function InlineEthereumTransaction({
2728 // from useEthereumTransaction.bind
@@ -144,15 +145,16 @@ export default function InlineEthereumTransaction({
144145 {renderPrimarySection()}
145146
146147 {error && (
147− <Grid.Item full as={ErrorText} className="mt1">
148+ <Grid.Item full as={ErrorText} className="mv1">
148149 {error.message}
149150 </Grid.Item>
150151 )}
151152
152153 {needFunds && (
153154 <Grid.Item full as={WarningBox} className="mt3">
154− The address {needFunds.address} needs at least{' '}
155− {fromWei(needFunds.minBalance)} ETH and currently has{' '}
155+ The address{' '}
156+ <CopiableAddress>{needFunds.address}</CopiableAddress> needs at
157+ least {fromWei(needFunds.minBalance)} ETH and currently has{' '}
156158 {fromWei(needFunds.balance)} ETH. Waiting until the account has
157159 enough funds.
158160 </Grid.Item>
src/views/Activate/PassportTransfer.js+3−2
@@ -22,6 +22,7 @@ import { RestartButton } from 'components/Buttons';
2222
2323import { useActivateFlow } from './ActivateFlow';
2424import PassportView from './PassportView';
25+import CopiableAddress from 'components/CopiableAddress';
2526
2627const labelForProgress = progress => {
2728 if (progress <= 0) {
@@ -163,8 +164,8 @@ export default function PassportTransfer({ className, resetActivateRouter }) {
163164 return (
164165 <Grid.Item full className="mt8">
165166 <Highlighted warning>
166− The address {needFunds.address} needs at least{' '}
167− {fromWei(needFunds.minBalance)} ETH and currently has{' '}
167+ The address <CopiableAddress>{needFunds.address}</CopiableAddress>{' '}
168+ needs at least {fromWei(needFunds.minBalance)} ETH and currently has{' '}
168169 {fromWei(needFunds.balance)} ETH. Waiting until the account has
169170 enough funds.
170171 </Highlighted>
src/views/Admin/Reticket/ReticketExecute.js+3−2
@@ -21,6 +21,7 @@ import WarningBox from 'components/WarningBox';
2121import LoadingBar from 'components/LoadingBar';
2222import Highlighted from 'components/Highlighted';
2323import { WALLET_TYPES } from 'lib/wallet';
24+import CopiableAddress from 'components/CopiableAddress';
2425
2526const labelForProgress = progress => {
2627 if (progress <= 0) {
@@ -129,8 +130,8 @@ export default function ReticketExecute({ newWallet, setNewWallet }) {
129130 return (
130131 <Grid.Item full className="mt4">
131132 <Highlighted warning>
132− The address {needFunds.address} needs at least{' '}
133− {fromWei(needFunds.minBalance)} ETH and currently has{' '}
133+ The address <CopiableAddress>{needFunds.address}</CopiableAddress>{' '}
134+ needs at least {fromWei(needFunds.minBalance)} ETH and currently has{' '}
134135 {fromWei(needFunds.balance)} ETH. Waiting until the account has
135136 enough funds.
136137 </Highlighted>
src/views/CreateGalaxy.js+2−1
@@ -25,6 +25,7 @@ import {
2525 hasErrors,
2626} from 'form/validators';
2727import FormError from 'form/FormError';
28+import CopiableAddress from 'components/CopiableAddress';
2829
2930function useCreateGalaxy() {
3031 const { contracts } = useNetwork();
@@ -127,7 +128,7 @@ export default function CreateGalaxy() {
127128 green3: completed,
128129 })}>
129130 {values.galaxyName} has been created and can be claimed by{' '}
130− {values.owner}.
131+ <CopiableAddress>{values.owner}</CopiableAddress>.
131132 </Grid.Item>
132133 )}
133134
src/views/Invite/InviteEmail.js+8−3
@@ -58,7 +58,9 @@ import FormError from 'form/FormError';
5858import { WARNING, onlyHasWarning } from 'form/helpers';
5959import useGasPrice from 'lib/useGasPrice';
6060import timeout from 'lib/timeout';
61+
6162import { ForwardButton } from 'components/Buttons';
63+import CopiableAddress from 'components/CopiableAddress';
6264
6365const INITIAL_VALUES = { emails: [''] };
6466
@@ -584,9 +586,12 @@ export default function InviteEmail() {
584586 {needFunds && (
585587 <Grid.Item full>
586588 <Highlighted warning>
587− Your ownership address {needFunds.address} needs at
588− least {fromWei(needFunds.minBalance)} ETH and
589− currently has {fromWei(needFunds.balance)} ETH.
589+ Your ownership address{' '}
590+ <CopiableAddress>
591+ {needFunds.address}
592+ </CopiableAddress>{' '}
593+ needs at least {fromWei(needFunds.minBalance)} ETH
594+ and currently has {fromWei(needFunds.balance)} ETH.
590595 Waiting until the account has enough funds.
591596 </Highlighted>
592597 </Grid.Item>
src/views/IssueChild.js+3−2
@@ -28,6 +28,7 @@ import {
2828} from 'form/validators';
2929import BridgeForm from 'form/BridgeForm';
3030import FormError from 'form/FormError';
31+import CopiableAddress from 'components/CopiableAddress';
3132
3233function useIssueChild() {
3334 const { contracts } = useNetwork();
@@ -84,7 +85,7 @@ export default function IssueChild() {
8485
8586 const validateFormAsync = useCallback(
8687 async values => {
87− const point = patp2dec(values.name);
88+ const point = patp2dec(values.point);
8889 const hasPoint = (await availablePointsPromise).has(point);
8990
9091 if (!hasPoint) {
@@ -153,7 +154,7 @@ export default function IssueChild() {
153154 green3: completed,
154155 })}>
155156 {values.point} has been spawned and can be claimed by{' '}
156− {values.owner}.
157+ <CopiableAddress>{values.owner}</CopiableAddress>.
157158 </Grid.Item>
158159 )}
159160
src/views/Party/PartySetPoolSize.js+12−6
@@ -27,6 +27,7 @@ import {
2727 buildPointValidator,
2828} from 'form/validators';
2929import FormError from 'form/FormError';
30+import CopiableAddress from 'components/CopiableAddress';
3031
3132function useSetPoolSize() {
3233 const { contracts } = useNetwork();
@@ -98,11 +99,11 @@ export default function PartySetPoolSize() {
9899 </Grid.Item>
99100
100101 {!spawnIsDelegatedSending && (
101− <Grid.Item full as={WarningBox} className="mb4">
102+ <Grid.Item full as={WarningBox} className="mb4 f6">
102103 The spawn proxy must be set to{' '}
103− <code className="mono f6">
104+ <CopiableAddress>
104105 {_contracts.delegatedSending.address}
105− </code>{' '}
106+ </CopiableAddress>{' '}
106107 for invitations to be available.
107108 </Grid.Item>
108109 )}
@@ -119,9 +120,14 @@ export default function PartySetPoolSize() {
119120 className={cn('f5 wrap', {
120121 green3: completed,
121122 })}>
122− {completed
123− ? `${values.poolSize} invites have been allocated to ${values.poolOwner}`
124− : `Allocate invites to a child point.`}
123+ {completed ? (
124+ <>
125+ {values.poolSize} invites have been allocated to{' '}
126+ <CopiableAddress>{values.poolOwner}</CopiableAddress>
127+ </>
128+ ) : (
129+ `Allocate invites to a child point.`
130+ )}
125131 </Grid.Item>
126132
127133 {!completed && (
src/views/Points.js+8−2
@@ -20,6 +20,7 @@ import useRejectedIncomingPointTransfers from 'lib/useRejectedIncomingPointTrans
2020import pluralize from 'lib/pluralize';
2121import Footer from 'components/Footer';
2222import { ForwardButton } from 'components/Buttons';
23+import useCopiable from 'lib/useCopiable';
2324
2425const maybeGetResult = (obj, key, defaultValue) =>
2526 obj.matchWith({
@@ -162,6 +163,7 @@ export default function Points() {
162163 ]);
163164
164165 const address = need.addressFromWallet(wallet);
166+ const [doCopy, didCopy] = useCopiable(address);
165167
166168 const loading = Nothing.hasInstance(controlledPoints);
167169
@@ -208,8 +210,12 @@ export default function Points() {
208210 return (
209211 <View pop={pop} inset>
210212 <Grid>
211− <Grid.Item full as={H1} className="f6 mono gray4 mb4">
212− {abbreviateAddress(address)}
213+ <Grid.Item
214+ full
215+ as={H1}
216+ className="f6 mono gray4 mb4 us-none clickable"
217+ onClick={doCopy}>
218+ {`${abbreviateAddress(address)}${didCopy ? ' (copied!)' : ''}`}
213219 </Grid.Item>
214220
215221 {loading && (