From 4286bc37b33bc8a7e42994461efd3ad48110977c Mon Sep 17 00:00:00 2001 From: Sam Keen Date: Mon, 20 Feb 2023 15:56:12 +0000 Subject: [PATCH] feat(wallet): tighten up the flow for "view as vega user" (#2934) --- .../connect-dialog-elements.tsx | 2 +- .../src/connect-dialog/connect-dialog.tsx | 14 +++- .../connect-dialog/view-connector-form.tsx | 70 +++++++++++++------ 3 files changed, 64 insertions(+), 22 deletions(-) diff --git a/libs/wallet/src/connect-dialog/connect-dialog-elements.tsx b/libs/wallet/src/connect-dialog/connect-dialog-elements.tsx index ea5861b0b..ba6ffbe70 100644 --- a/libs/wallet/src/connect-dialog/connect-dialog-elements.tsx +++ b/libs/wallet/src/connect-dialog/connect-dialog-elements.tsx @@ -7,7 +7,7 @@ export const ConnectDialogTitle = ({ children }: { children: ReactNode }) => { return (

{children}

diff --git a/libs/wallet/src/connect-dialog/connect-dialog.tsx b/libs/wallet/src/connect-dialog/connect-dialog.tsx index 293532534..d3a6b330b 100644 --- a/libs/wallet/src/connect-dialog/connect-dialog.tsx +++ b/libs/wallet/src/connect-dialog/connect-dialog.tsx @@ -229,6 +229,7 @@ const ConnectorList = ({ )}
  • +
    {t('OR')}
    + {t('Connect')}
    @@ -315,7 +323,11 @@ const SelectedForm = ({ return ( <> - + diff --git a/libs/wallet/src/connect-dialog/view-connector-form.tsx b/libs/wallet/src/connect-dialog/view-connector-form.tsx index 87496a7b9..835258a7f 100644 --- a/libs/wallet/src/connect-dialog/view-connector-form.tsx +++ b/libs/wallet/src/connect-dialog/view-connector-form.tsx @@ -1,5 +1,11 @@ import { t } from '@vegaprotocol/react-helpers'; -import { Button, FormGroup, Input, InputError } from '@vegaprotocol/ui-toolkit'; +import { + Button, + FormGroup, + Icon, + Input, + InputError, +} from '@vegaprotocol/ui-toolkit'; import { useForm } from 'react-hook-form'; import type { ViewConnector } from '../connectors'; import { useVegaWallet } from '../use-vega-wallet'; @@ -11,11 +17,13 @@ interface FormFields { interface RestConnectorFormProps { connector: ViewConnector; onConnect: (connector: ViewConnector) => void; + reset: () => void; } export function ViewConnectorForm({ connector, onConnect, + reset, }: RestConnectorFormProps) { const { connect } = useVegaWallet(); const { @@ -41,24 +49,46 @@ export function ViewConnectorForm({ } return ( -
    - - - {errors.address?.message && ( - {errors.address.message} - )} - - -
    + <> + +
    +

    + {t('VIEW AS VEGA USER')} +

    +

    + {t( + 'Browse from the perspective of another Vega user in read-only mode.' + )} +

    + + + {errors.address?.message && ( + {errors.address.message} + )} + + +
    + ); }