From fa086dcf8d342774c1b7af670cce1d41bcff273f Mon Sep 17 00:00:00 2001 From: Raymond Jacobson Date: Tue, 23 Apr 2024 20:01:06 -0700 Subject: [PATCH] [PAY-2727] Add images to oauth popup --- .../OAuthLoginPage.module.css | 24 +------ .../pages/oauth-login-page/OAuthLoginPage.tsx | 70 ++++++++++++++----- .../components/ContentWrapper.tsx | 11 +-- .../components/PermissionsSection.tsx | 41 ++++++----- .../web/src/pages/oauth-login-page/hooks.ts | 3 + .../src/pages/oauth-login-page/messages.ts | 18 +++-- 6 files changed, 94 insertions(+), 73 deletions(-) diff --git a/packages/web/src/pages/oauth-login-page/OAuthLoginPage.module.css b/packages/web/src/pages/oauth-login-page/OAuthLoginPage.module.css index b30eeb79788..374e458d0b0 100644 --- a/packages/web/src/pages/oauth-login-page/OAuthLoginPage.module.css +++ b/packages/web/src/pages/oauth-login-page/OAuthLoginPage.module.css @@ -43,16 +43,6 @@ margin-top: var(--harmony-unit-8); } -.infoSectionTitle { - color: var(--harmony-n-700); - line-height: 100%; - font-size: var(--harmony-font-m); - font-weight: var(--harmony-font-bold); - text-transform: uppercase; - letter-spacing: 0.5px; - margin-bottom: var(--harmony-unit-4); -} - .container { width: 375px; flex-direction: column; @@ -74,10 +64,11 @@ } .tile { + margin-top: var(--harmony-unit-2); background-color: var(--harmony-n-25); border: 1px solid var(--harmony-n-100); border-radius: 8px; - padding: var(--harmony-unit-4) var(--harmony-unit-3); + padding: var(--harmony-unit-3) var(--harmony-unit-3); } .permissionContainer { @@ -109,15 +100,6 @@ border-top: solid 1px var(--harmony-n-100); } -.permissionTextContainer { - overflow: auto; - margin-left: var(--harmony-unit-4); -} - -.permissionDetailTextContainer { - margin-top: var(--harmony-unit-2); -} - .permissionText { color: var(--harmony-neutral); font-weight: var(--harmony-font-medium); @@ -182,7 +164,7 @@ /* Add padding bottom because Safari has issue where it clips off the bottom of the text otherwise */ padding-bottom: 2px; background: none; - color: var(--harmony-secondary); + color: var(--harmony-primary); font-size: var(--harmony-font-s); font-weight: var(--harmony-font-medium); line-height: 100%; diff --git a/packages/web/src/pages/oauth-login-page/OAuthLoginPage.tsx b/packages/web/src/pages/oauth-login-page/OAuthLoginPage.tsx index 14f279b77ee..1cfef988140 100644 --- a/packages/web/src/pages/oauth-login-page/OAuthLoginPage.tsx +++ b/packages/web/src/pages/oauth-login-page/OAuthLoginPage.tsx @@ -2,10 +2,18 @@ import { FormEvent, useLayoutEffect, useState } from 'react' import { Name, ErrorLevel } from '@audius/common/models' import { accountSelectors, signOutActions } from '@audius/common/store' -import { IconValidationX } from '@audius/harmony' +import { + Flex, + IconEmbed, + IconTransaction, + IconValidationX, + Text, + TextLink +} from '@audius/harmony' import cn from 'classnames' import { useDispatch, useSelector } from 'react-redux' +import AppIcon from 'assets/img/appIcon.png' import { make, useRecord } from 'common/store/analytics/actions' import Input from 'components/data-entry/Input' import LoadingSpinner from 'components/loading-spinner/LoadingSpinner' @@ -145,6 +153,7 @@ export const OAuthLoginPage = () => { userAlreadyWriteAuthorized, apiKey, appName, + appImage, userEmail, authorize, txParams @@ -236,15 +245,6 @@ export const OAuthLoginPage = () => { const isSubmitDisabled = generalSubmitError === messages.disconnectDashboardWalletWrongUserError - let titleText - if (!isLoggedIn) { - titleText = messages.signInAndAuthorizePrompt(appName as string) - } else if (userAlreadyWriteAuthorized) { - titleText = messages.alreadyAuthorizedContinuePrompt(appName as string) - } else { - titleText = messages.alreadyLoggedInAuthorizePrompt(appName as string) - } - if (queryParamsError) { return ( @@ -272,9 +272,36 @@ export const OAuthLoginPage = () => { return ( -
-

{titleText}

-
+ + + + {'Audius + + + + {appImage ? ( + {`${appName} + ) : ( + + + + )} + + + {`${messages.allow}:`} + + {appName} + + {userAlreadyWriteAuthorized ? null : ( {
{isLoggedIn ? (
-

{messages.signedInAs}

+ + {messages.signedInAs} +
{ />
- +
(
-
-
-
- -
-
- {children} -
+
{children}
) diff --git a/packages/web/src/pages/oauth-login-page/components/PermissionsSection.tsx b/packages/web/src/pages/oauth-login-page/components/PermissionsSection.tsx index 10f2edaed4b..661fdfd722e 100644 --- a/packages/web/src/pages/oauth-login-page/components/PermissionsSection.tsx +++ b/packages/web/src/pages/oauth-login-page/components/PermissionsSection.tsx @@ -1,9 +1,11 @@ import { PropsWithChildren } from 'react' import { + Flex, IconEmailAddress, IconPencil, - IconVisibilityPublic + IconVisibilityPublic, + Text } from '@audius/harmony' import cn from 'classnames' @@ -15,7 +17,7 @@ import { WriteOnceParams, WriteOnceTx } from '../utils' type PermissionTextProps = PropsWithChildren<{}> const PermissionText = ({ children }: PermissionTextProps) => { - return {children} + return
{children}
} type PermissionDetailProps = PropsWithChildren<{ @@ -23,7 +25,7 @@ type PermissionDetailProps = PropsWithChildren<{ }> const PermissionDetail = ({ className, children }: PermissionDetailProps) => { return ( -
+
-

+ {messages.permissionsRequestedHeader} -

+
@@ -85,27 +87,34 @@ export const PermissionsSection = ({ )}
-
- + + {scope === 'write' ? messages.writeAccountAccess : scope === 'write_once' ? getWriteOncePermissionTitle(tx) : messages.readOnlyAccountAccess} - + {scope === 'write' ? ( - - {messages.doesNotGrantAccessTo} -
- {messages.walletsOrDMs} -
+ + + {messages.writeAccessGrants} + + ) : null} {scope === 'write_once' ? ( {txParams?.wallet.slice(0, 6)}...{txParams?.wallet.slice(-4)} ) : null} -
+ {scope === 'read' ? ( + + + {messages.readOnlyGrants} + + + ) : null} +
-
+ {messages.emailAddressAccess} {isLoggedIn ? ( ) : null} -
+
diff --git a/packages/web/src/pages/oauth-login-page/hooks.ts b/packages/web/src/pages/oauth-login-page/hooks.ts index 5373093b65a..70587e3ea86 100644 --- a/packages/web/src/pages/oauth-login-page/hooks.ts +++ b/packages/web/src/pages/oauth-login-page/hooks.ts @@ -197,6 +197,7 @@ export const useOAuthSetup = ({ const [registeredDeveloperAppName, setRegisteredDeveloperAppName] = useState() const appName = registeredDeveloperAppName ?? queryParamAppName + const [appImage, setAppImage] = useState() const [userAlreadyWriteAuthorized, setUserAlreadyWriteAuthorized] = useState() @@ -250,6 +251,7 @@ export const useOAuthSetup = ({ return } setRegisteredDeveloperAppName(developerApp.name) + setAppImage(developerApp.imageUrl) } fetchDeveloperAppName() }, [apiKey, queryParamAppName, queryParamsError, scope]) @@ -512,6 +514,7 @@ export const useOAuthSetup = ({ userAlreadyWriteAuthorized, apiKey, appName, + appImage, userEmail, authorize, tx, diff --git a/packages/web/src/pages/oauth-login-page/messages.ts b/packages/web/src/pages/oauth-login-page/messages.ts index 53082239186..455a9a0fe05 100644 --- a/packages/web/src/pages/oauth-login-page/messages.ts +++ b/packages/web/src/pages/oauth-login-page/messages.ts @@ -1,21 +1,19 @@ export const messages = { - alreadyLoggedInAuthorizePrompt: (appName: string) => - `Authorize ${appName} to use your Audius account?`, - signInAndAuthorizePrompt: (appName: string) => - `Sign in to allow ${appName} to use your Audius account?`, - alreadyAuthorizedContinuePrompt: (appName: string) => `Sign in to ${appName}`, + allow: 'Allow Audius to Connect to', permissionsRequestedHeader: 'This application will receive', - readOnlyAccountAccess: 'Read-only access to your account', + readOnlyAccountAccess: 'Read-only Access', + readOnlyGrants: + 'This app cannot interact with or make changes to your account.', connectDashboardWalletAccess: 'Permission to link this wallet to your account', disconnectDashboardWalletAccess: 'Permission to unlink this wallet from your account', - writeAccountAccess: 'Read/Write access to your account', + writeAccountAccess: 'Read/Write Access', emailLoading: 'Email loading', emailAddressAccess: 'Your Email Address', - doesNotGrantAccessTo: 'Does not grant access to:', - walletsOrDMs: 'Wallets or Direct Messages', - signOut: 'Not you? Sign Out & Switch Account', + writeAccessGrants: + 'Grant this app permission to make changes to your account on your behalf.', + signOut: 'Sign Out', signUp: `Don't have an account? Sign up`, authorizeButton: 'Authorize App', continueButton: 'Continue',