Skip to content

Commit

Permalink
v3.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
maxaleks authored Aug 17, 2023
2 parents 9bf9e98 + 259c0d9 commit 73c9dbb
Show file tree
Hide file tree
Showing 23 changed files with 107 additions and 44 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zkbob-ui",
"version": "3.2.0",
"version": "3.2.1",
"private": true,
"dependencies": {
"@dicebear/avatars": "^4.10.2",
Expand Down
6 changes: 5 additions & 1 deletion src/components/AccountSetUpModal/Confirm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ export default ({ mnemonic, confirmMnemonic }) => {
);
})}
</Words>
<Button disabled={!match} onClick={confirmMnemonic}>Verify</Button>
<Button
disabled={!match}
onClick={confirmMnemonic}
data-ga-id="signup-secret-phrase-confirm"
>Verify</Button>
</Container>
);
};
Expand Down
5 changes: 4 additions & 1 deletion src/components/AccountSetUpModal/Generate/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ export default ({ next, isCreation }) => {
: 'Select the wallet you used to create your zkAccount'
}
</Description>
<WalletConnectors callback={next} />
<WalletConnectors
callback={next}
gaIdPrefix={(isCreation ? 'signup-' : 'login-')}
/>
</Container>
);
};
Expand Down
2 changes: 1 addition & 1 deletion src/components/AccountSetUpModal/Password/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default ({ confirmPassword }) => {
<Rule $error={lengthError}>Please enter 6 or more characters</Rule>
<Rule $error={matchError}>Password should match</Rule>
</RulesContainer>
<Button onClick={confirm}>Verify</Button>
<Button onClick={confirm} data-ga-id="password-confirm">Verify</Button>
</Container>
);
};
Expand Down
4 changes: 3 additions & 1 deletion src/components/AccountSetUpModal/Restore/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ export default ({ restore }) => {
Input your saved secret phrase to restore an existing account
</Description>
<TextArea value={mnemonic} onChange={onChange} $error={error} />
<Button onClick={onRestore}>Restore account</Button>
<Button onClick={onRestore} data-ga-id="login-secret-phrase-confirm">
Restore account
</Button>
</Container>
);
};
Expand Down
18 changes: 9 additions & 9 deletions src/components/AccountSetUpModal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,21 @@ const Start = ({ setStep }) => (
<Description>
To start working with zkBob you need a zkAccount
</Description>
<Button onClick={() => setStep(STEP.CREATE_OPTIONS)}>
<Button onClick={() => setStep(STEP.CREATE_OPTIONS)} data-ga-id="signup-start">
Create new zkAccount
</Button>
<SecondButton onClick={() => setStep(STEP.RESTORE_OPTIONS)}>
<SecondButton onClick={() => setStep(STEP.RESTORE_OPTIONS)} data-ga-id="login-start">
I already have a zkAccount
</SecondButton>
</Container>
);

const CreateOptions = ({ setStep }) => (
<Container>
<Button onClick={() => setStep(STEP.CREATE_WITH_WALLET)}>
<Button onClick={() => setStep(STEP.CREATE_WITH_WALLET)} data-ga-id="signup-web3-wallet">
Use my Web3 wallet
</Button>
<SecondButton onClick={() => setStep(STEP.CREATE_WITH_SECRET)}>
<SecondButton onClick={() => setStep(STEP.CREATE_WITH_SECRET)} data-ga-id="signup-secret-phrase">
Use zkBob secret phrase
</SecondButton>
<Description>
Expand All @@ -63,10 +63,10 @@ const CreateOptions = ({ setStep }) => (

const RestoreOptions = ({ setStep }) => (
<Container>
<Button onClick={() => setStep(STEP.RESTORE_WITH_WALLET)}>
<Button onClick={() => setStep(STEP.RESTORE_WITH_WALLET)} data-ga-id="login-web3-wallet">
I used a Web3 wallet
</Button>
<SecondButton onClick={() => setStep(STEP.RESTORE_WITH_SECRET)}>
<SecondButton onClick={() => setStep(STEP.RESTORE_WITH_SECRET)} data-ga-id="login-secret-phrase">
I used zkBob secret phrase
</SecondButton>
</Container>
Expand All @@ -77,10 +77,10 @@ const PasswordPrompt = ({ setStep, close }) => (
<Description>
You can create a secure password that we'll ask you every time when you log in to zkAccount
</Description>
<Button onClick={() => setStep(STEP.CREATE_PASSWORD)}>
<Button onClick={() => setStep(STEP.CREATE_PASSWORD)} data-ga-id="password-set">
Set a password
</Button>
<SecondButton onClick={close}>
<SecondButton onClick={close} data-ga-id="password-skip">
Skip
</SecondButton>
</Container>
Expand Down Expand Up @@ -163,7 +163,7 @@ export default ({ isOpen, onClose, saveZkAccountMnemonic, closePasswordModal })
break;
case STEP.CREATE_WITH_WALLET:
title = 'Create new zkAccount';
component = <Generate next={() => setStep(STEP.SING_MESSAGE_TO_CREATE)} />;
component = <Generate isCreation next={() => setStep(STEP.SING_MESSAGE_TO_CREATE)} />;
prevStep = STEP.CREATE_OPTIONS;
break;
case STEP.CREATE_WITH_SECRET:
Expand Down
7 changes: 6 additions & 1 deletion src/components/ConfirmTransactionModal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,12 @@ export default ({
)}
</Row>
</DetailsContainer>
<Button onClick={onConfirm}>Confirm {isMultitransfer && 'multitransfer'}</Button>
<Button
onClick={onConfirm}
data-ga-id="confirm-operation"
>
Confirm {isMultitransfer && 'multitransfer'}
</Button>
</Container>
</Modal>
);
Expand Down
7 changes: 6 additions & 1 deletion src/components/ConvertOptions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ export default ({
<Text style={{ marginRight: 8 }}>
Convert some {currentPool.tokenSymbol} to {details.toTokenSymbol} on withdrawal
</Text>
<Switch checked={isConverting} onChange={setIsConverting} />
<Switch
checked={isConverting}
onChange={setIsConverting}
data-ga-id={`turn-${isConverting ? 'off' : 'on'}-convert-native-token`}
/>
</Row>
{isConverting && (
<Row>
Expand All @@ -45,6 +49,7 @@ export default ({
onClick={() => setAmountToConvert(option)}
active={amountToConvert.eq(option)}
disabled={option.gt(amountToWithdraw) || option.gt(maxAmountToWithdraw)}
data-ga-id={`native-token-convert-tier${index + 1}`}
>
<TextBold>{formatNumber(option, currentPool.tokenDecimals)} {currentPool.tokenSymbol}</TextBold>
<Text>
Expand Down
9 changes: 5 additions & 4 deletions src/components/Header/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,14 @@ export default ({ empty }) => {
</AccountDropdownButton>
</WalletDropdown>
) : (
<Button small onClick={openWalletModal}>
<Button small onClick={openWalletModal} data-ga-id="wallet-header">
Connect wallet
</Button>
);

const zkAccountDropdown = zkAccount ? (
<ZkAccountDropdown>
<AccountDropdownButton $refreshing={isLoadingState}>
<AccountDropdownButton $refreshing={isLoadingState} data-ga-id="zkaccount-profile">
<Row>
<ZkAvatar seed={zkAccount} size={16} />
<Address>zkAccount</Address>
Expand All @@ -141,6 +141,7 @@ export default ({ empty }) => {
contrast
disabled={isLoadingZkAccount}
onClick={openAccountSetUpModal}
data-ga-id="zkaccount-header"
>
{isLoadingZkAccount ? (isMobile ? 'Loading' : 'Loading zkAccount') : 'zkAccount'}
</Button>
Expand All @@ -154,7 +155,7 @@ export default ({ empty }) => {
</LogoSection>
<AccountSection>
{!isMobile && networkDropdown}
<BridgeButton small onClick={openSwapModal}>
<BridgeButton small onClick={openSwapModal} data-ga-id="get-token-header">
Get {currentPool.tokenSymbol}
</BridgeButton>
{!isMobile && walletDropdown}
Expand All @@ -169,7 +170,7 @@ export default ({ empty }) => {
</RefreshButtonContainer>
)}
<MoreDropdown>
<DropdownButton>
<DropdownButton data-ga-id="extra-menu-header">
<DotsIcon />
</DropdownButton>
</MoreDropdown>
Expand Down
2 changes: 1 addition & 1 deletion src/components/IncreasedLimitsBanner/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default ({ status, account, openModal, kycUrls }) => {
component = <>
<InfinityLoopIcon />
<Text>Want to increase your deposit limits?</Text>
<Button type="link" onClick={openModal}>Learn more</Button>
<Button type="link" onClick={openModal} data-ga-id="kyc-banner">Learn more</Button>
</>;
break;
case INCREASED_LIMITS_STATUSES.ACTIVE:
Expand Down
9 changes: 7 additions & 2 deletions src/components/IncreasedLimitsModal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,16 @@ export default ({ isOpen, onClose, account, isWalletModalOpen, openWalletModal,
That's it. Your deposit limits will automatically increase if your connected wallet contains a BAB token.
</Text>
{account ? (
<LinkButton href={currentPool.kycUrls?.homepage.replace('%s', account)}>
<LinkButton
href={currentPool.kycUrls?.homepage.replace('%s', account)}
data-ga-id="kyc-banner-verify-bab"
>
Verify my BAB token
</LinkButton>
) : (
<Button onClick={openWalletModal}>Connect wallet</Button>
<Button onClick={openWalletModal} data-ga-id="kyc-banner-connect-wallet">
Connect wallet
</Button>
)}
</Container>
</Modal>
Expand Down
7 changes: 4 additions & 3 deletions src/components/MoreDropdown/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import OptionButton from 'components/OptionButton';
import { ModalContext } from 'contexts';

const links = [
{ name: 'Dune Analytics', href: 'https://dune.com/projects/zkBob' },
{ name: 'Documentation', href: 'https://docs.zkbob.com/' },
{ name: 'Linktree', href: 'https://linktr.ee/zkbob' },
{ name: 'Dune Analytics', href: 'https://dune.com/projects/zkBob', gaIdPostfix: 'dune' },
{ name: 'Documentation', href: 'https://docs.zkbob.com/', gaIdPostfix: 'docs' },
{ name: 'Linktree', href: 'https://linktr.ee/zkbob', gaIdPostfix: 'linktree' },
];

const Content = ({ close }) => (
Expand All @@ -21,6 +21,7 @@ const Content = ({ close }) => (
type="link"
href={link.href}
onClick={close}
data-ga-id={'extra-menu-' + link.gaIdPostfix}
>
{link.name}
</OptionButton>
Expand Down
1 change: 1 addition & 0 deletions src/components/NetworkDropdown/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ const Content = ({ switchToPool, currentPool, close }) => {
key={index}
onClick={() => onSwitchPool(pool.alias)}
className={currentPool.alias === pool.alias ? 'active' : ''}
data-ga-id={`pool-${pool.alias.toLowerCase()}`}
>
<RowSpaceBetween>
<Row>
Expand Down
1 change: 1 addition & 0 deletions src/components/Tabs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export default ({ tabs, activeTab, onTabClick, showBadge }) => {
active={activeTab === index}
onClick={() => onTabClick(index)}
$showBadge={showBadge && tab.badge}
data-ga-id={`tab-${tab.name.toLowerCase()}`}
>{tab.name}</Tab>
)}
</Tabs>
Expand Down
9 changes: 7 additions & 2 deletions src/components/TransferInput/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { TOKENS_ICONS } from 'constants';
export default ({
amount, onChange, balance, nativeBalance, isLoadingBalance, fee,
shielded, setMax, maxAmountExceeded, isLoadingFee, currentPool,
isNativeSelected, setIsNativeSelected, isNativeTokenUsed,
isNativeSelected, setIsNativeSelected, isNativeTokenUsed, gaIdPostfix,
}) => {
const displayedFee = useDisplayedFee(currentPool, fee);
const [showTooltip, setShowTooltip] = useState(false);
Expand Down Expand Up @@ -74,7 +74,12 @@ export default ({
{formatNumber(isNativeTokenUsed ? nativeBalance : balance, currentPool.tokenDecimals)}{' '}
{currentPool.tokenSymbol}
</Text>
<MaxButton type="link" onClick={setMax} tabIndex="-1">Max</MaxButton>
<MaxButton
type="link"
onClick={setMax}
tabIndex="-1"
data-ga-id={`max-${gaIdPostfix}`}
>Max</MaxButton>
<Tooltip
content={`Click Max to set the maximum amount of ${currentPool.tokenSymbol} you can send including all fees and limits`}
placement="right"
Expand Down
3 changes: 2 additions & 1 deletion src/components/WalletConnectors/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const getConnectorName = connector => {
return connector.name;
}

export default ({ callback }) => {
export default ({ callback, gaIdPrefix = '' }) => {
const { connector: activeConnector } = useAccount();
const { connectAsync, connectors } = useConnect();
const { disconnectAsync } = useDisconnect();
Expand All @@ -29,6 +29,7 @@ export default ({ callback }) => {
<WalletConnector
key={index}
onClick={() => connectWallet(connector)}
data-ga-id={gaIdPrefix + connector.name}
>
<WalletConnectorName>{getConnectorName(connector)}</WalletConnectorName>
<WalletConnectorIcon src={CONNECTORS_ICONS[connector.name]} />
Expand Down
39 changes: 30 additions & 9 deletions src/components/ZkAccountDropdown/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,16 @@ const Content = ({
}, [close]);

const settingsOptions = [
{ text: 'Show secret phrase', action: showSeedPhrase },
{ text: `${hasPassword ? 'Disable' : 'Set'} password`, action: hasPassword ? removePassword : setPassword },
{
text: 'Show secret phrase',
action: showSeedPhrase,
gaIdPostfix: 'secret-phrase',
},
{
text: `${hasPassword ? 'Disable' : 'Set'} password`,
action: hasPassword ? removePassword : setPassword,
gaIdPostfix: `${hasPassword ? 'disable' : 'enable'}-password`,
},
];

if (showQRCode) {
Expand All @@ -88,7 +96,11 @@ const Content = ({
<BackIcon onClick={() => setShowSettings(false)} />
<Title style={{ marginBottom: 20 }}>Settings</Title>
{settingsOptions.map((item, index) =>
<OptionButton key={index} onClick={() => handleOptionClick(item.action)}>
<OptionButton
key={index}
onClick={() => handleOptionClick(item.action)}
data-ga-id={`zkaccount-settings-${item.gaIdPostfix}`}
>
{item.text}
</OptionButton>
)}
Expand All @@ -108,13 +120,22 @@ const Content = ({
<Balance style={{ marginLeft: 5 }}>{currentPool.tokenSymbol}</Balance>
</Row>
</RowSpaceBetween>
<Button style={{ marginBottom: 10 }} onClick={generateQRCode} disabled={isLoadingState}>
<Button
style={{ marginBottom: 10 }}
onClick={generateQRCode}
disabled={isLoadingState}
data-ga-id="zkaccount-generate-qr-code"
>
Generate QR code address
</Button>
{privateAddress ? (
<PrivateAddress>{privateAddress}</PrivateAddress>
) : (
<Button onClick={generatePrivateAddress} disabled={isLoadingState}>
<Button
onClick={generatePrivateAddress}
disabled={isLoadingState}
data-ga-id="zkaccount-generate-address"
>
Generate receiving address
</Button>
)}
Expand All @@ -124,17 +145,17 @@ const Content = ({
Receive tokens to this address or a previously generated address.
</Description>
{currentPool.paymentContractAddress && (
<OptionButton onClick={() => handleOptionClick(generatePaymentLink)}>
<OptionButton onClick={() => handleOptionClick(generatePaymentLink)} data-ga-id="zkaccount-payment-link">
Get payment link
</OptionButton>
)}
<QRCodeReader onResult={initGiftCard}>
<OptionButton>Redeem gift card</OptionButton>
<OptionButton data-ga-id="zkaccount-gift-card">Redeem gift card</OptionButton>
</QRCodeReader>
<OptionButton onClick={() => setShowSettings(true)}>
<OptionButton onClick={() => setShowSettings(true)} data-ga-id="zkaccount-settings">
Settings
</OptionButton>
<OptionButton onClick={() => handleOptionClick(logout)}>
<OptionButton onClick={() => handleOptionClick(logout)} data-ga-id="zkaccount-logout">
Log out
</OptionButton>
</Container>
Expand Down
1 change: 1 addition & 0 deletions src/containers/AccountSetUpButton/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export default () => {
contrast
disabled={isLoadingZkAccount}
onClick={openAccountSetUpModal}
data-ga-id="zkaccount-get-started"
>
{isLoadingZkAccount ? 'Loading...' : 'Get started!'}
</Button>
Expand Down
Loading

0 comments on commit 73c9dbb

Please sign in to comment.