Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[C-3354, C-3396, C-3397] Sign up QA #6780

Merged
merged 14 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion packages/common/src/audius-query/AudiusQueryContext.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createContext } from 'react'
import { createContext, useContext } from 'react'

import type { AudiusSdk } from '@audius/sdk'
import type { Dispatch } from 'redux'
Expand All @@ -22,3 +22,15 @@ export type AudiusQueryContextType = {
export const AudiusQueryContext = createContext<AudiusQueryContextType | null>(
null
)

export const useAudiusQueryContext = () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this prevents the null checks on all the context

const audiusQueryContext = useContext(AudiusQueryContext)

if (!audiusQueryContext) {
throw new Error(
'useQueryContext has to be used within <AudiusQueryContext.Provider>'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'useQueryContext has to be used within <AudiusQueryContext.Provider>'
'useAudiusQueryContext has to be used within <AudiusQueryContext.Provider>'

)
}

return audiusQueryContext
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const BaseButton = forwardRef<HTMLButtonElement, BaseButtonProps>(
const {
iconLeft: LeftIconComponent,
iconRight: RightIconComponent,
isStaticIcon,
disabled,
isLoading,
widthToHideText,
Expand Down Expand Up @@ -93,7 +94,7 @@ export const BaseButton = forwardRef<HTMLButtonElement, BaseButtonProps>(
})
}

const iconCss = {
const iconCss = !isStaticIcon && {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this fixes issue where metamask icon was being slightly overriden by the button icon styles

'& path': {
fill: 'currentcolor'
}
Expand Down
4 changes: 4 additions & 0 deletions packages/harmony/src/components/button/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ export type BaseButtonProps = {
*/
iconRight?: IconComponent

/**
* When true, do not override icon's fill colors
*/
isStaticIcon?: boolean
/**
* Show a spinning loading state instead of the left icon
*/
Expand Down
3 changes: 2 additions & 1 deletion packages/harmony/src/components/layout/Divider/Divider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ export const Divider = (props: DividerProps) => {
...(!children &&
orientation === 'vertical' && {
borderRight: border,
alignSelf: 'stretch'
alignSelf: 'stretch',
height: 'auto'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixes issue where vertical divider was not working in all contexts.

}),
...(!children &&
orientation === 'horizontal' && {
Expand Down
8 changes: 3 additions & 5 deletions packages/harmony/src/components/layout/Paper/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import type {
ShadowOptions
} from 'foundations'

import type { FlexProps } from '../Flex'

/**
* An elevated container which stands out from the background.
*/
Expand All @@ -15,7 +13,7 @@ export type PaperProps = {
* Background Color
* @default white
*/
backgroundColor?: Exclude<BackgroundColors, 'default'>
backgroundColor?: BackgroundColors
Comment on lines 14 to +16
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bit weird now that 'default' is an option but not the default option. I guess it's ok though

could argue it's an issue with naming semantic colors 'default'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, but sure why I removed that actually... will investigate


/**
* Border type. If not provided, no border will be used.
Expand All @@ -33,5 +31,5 @@ export type PaperProps = {
* Elevation Shadow
* @default mid
*/
shadow?: Exclude<ShadowOptions, 'drop'> | 'none'
} & FlexProps
shadow?: Exclude<ShadowOptions, 'drop'>
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const meta: Meta<typeof TextLink> = {
render: (props) => (
<Flex direction='row' gap='4xl'>
<TextLink {...props} />
<TextLink {...props} _isHovered />
<TextLink {...props} showUnderline />
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sometimes we want links to stand out from text that has the same color

</Flex>
)
}
Expand Down
4 changes: 2 additions & 2 deletions packages/harmony/src/components/text-link/TextLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import type { TextLinkProps } from './types'
*/
export const TextLink = (props: TextLinkProps) => {
const {
_isHovered = false,
asChild = false,
children,
variant = 'default',
isExternal = false,
onClick,
textVariant,
showUnderline,
...other
} = props

Expand Down Expand Up @@ -48,7 +48,7 @@ export const TextLink = (props: TextLinkProps) => {
color: variantColors[variant],
textDecoration: 'none',
':hover': hoverStyles,
...(_isHovered && hoverStyles)
...(showUnderline && hoverStyles)
}}
variant={textVariant}
{...other}
Expand Down
13 changes: 3 additions & 10 deletions packages/harmony/src/components/text-link/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,15 @@ export type TextLinkProps = TextLinkTextProps &
textVariant?: TextProps['variant']

/**
* If true, prevent the click event from being propagated to other elements.
* @default true
* When true, always show the link underline. This can help emphasize that
* a text-link is present when next to other text.
*/
stopPropagation?: boolean
showUnderline?: boolean

/**
* Mark as true if the link destination is outside of the app. Causes the
* link to open in a new tab.
* @default false
*/
isExternal?: boolean

// Internal props

/**
* @ignore: This prop is for internal use only
*/
_isHovered?: boolean
}
3 changes: 2 additions & 1 deletion packages/harmony/src/foundations/color/semantic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ const createSemanticTheme = (primitives: PrimitiveColors) => ({
default: primitives.special.background,
white: primitives.special.white,
surface1: primitives.neutral.n25,
surface2: primitives.neutral.n100
surface2: primitives.neutral.n100,
accent: primitives.secondary.s300
},
border: {
default: primitives.neutral.n100,
Expand Down
3 changes: 2 additions & 1 deletion packages/harmony/src/foundations/shadows/shadows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ export const shadows = {
emphasis:
'0px 1.34018px 8px 0px rgba(0, 0, 0, 0.2), 0px 6px 15px 0px rgba(0, 0, 0, 0.1)',
special: '0px 1px 20px -3px #565776',
drop: 'drop-shadow(0px 1.34018px 8px rgba(0, 0, 0, 0.2)) drop-shadow(0px 6px 15px rgba(0, 0, 0, 0.1))'
drop: 'drop-shadow(0px 1.34018px 8px rgba(0, 0, 0, 0.2)) drop-shadow(0px 6px 15px rgba(0, 0, 0, 0.1))',
flat: undefined
}

export type Shadows = typeof shadows
Expand Down
2 changes: 2 additions & 0 deletions packages/harmony/src/icons/Logos.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
IconLogoLinkByStripe,
IconDiscord,
IconFacebook,
IconMetamask,
IconSnapChat,
IconTelegram,
IconTwitter,
Expand Down Expand Up @@ -67,6 +68,7 @@ Logos are used as a visual representation of our brand and other businesses we p
<IconTelegram />
<IconSnapChat />
<IconTikTok />
<IconMetamask />
</Flex>

<Divider />
Expand Down
1 change: 1 addition & 0 deletions packages/harmony/src/icons/logos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export { default as IconLogoCoinbase } from '../assets/icons/Coinbase.svg'
export { default as IconLogoLinkByStripe } from '../assets/icons/LinkByStripe.svg'
export { default as IconDiscord } from '../assets/icons/Discord.svg'
export { default as IconFacebook } from '../assets/icons/Facebook.svg'
export { default as IconMetamask } from '../assets/icons/Metamask.svg'
export { default as IconSnapChat } from '../assets/icons/SnapChat.svg'
export { default as IconTelegram } from '../assets/icons/Telegram.svg'
export { default as IconTwitter } from '../assets/icons/Twitter.svg'
Expand Down
10 changes: 3 additions & 7 deletions packages/web/src/app/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ import WebPlayer from './web-player/WebPlayer'
import '../services/webVitals'

const SignOn = lazy(() => import('pages/sign-on/SignOn'))
const SignInPage = lazy(() => import('pages/sign-in-page'))
const SignUpPage = lazy(() => import('pages/sign-up-page'))
const SignOnPage = lazy(() => import('pages/sign-on-page'))

export const AppInner = () => {
const { isEnabled: isSignInRedesignEnabled } = useFlag(
Expand All @@ -31,11 +30,8 @@ export const AppInner = () => {
<>
<SomethingWrong />
<Switch>
<Route path={SIGN_IN_PAGE}>
{isSignInRedesignEnabled ? <SignInPage /> : <SignOn signIn />}
</Route>
<Route path={SIGN_UP_PAGE}>
{isSignInRedesignEnabled ? <SignUpPage /> : <SignOn signIn={false} />}
<Route path={[SIGN_IN_PAGE, SIGN_UP_PAGE]}>
{isSignInRedesignEnabled ? <SignOnPage /> : <SignOn signIn />}
</Route>
<Route exact path='/oauth/auth'>
<OAuthLoginPage />
Expand Down
Binary file added packages/web/src/assets/img/DJportrait.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ const BackgroundWaves = (props) => {
<div
ref={canvasRef}
className={cn({ [props.className]: !!props.className })}
style={{
css={{
position: 'fixed',
top: 0,
left: 0,
Expand Down

This file was deleted.

15 changes: 15 additions & 0 deletions packages/web/src/components/form-fields/PasswordField.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { PasswordInput, PasswordInputProps } from '@audius/harmony'
import { useField } from 'formik'

export type PasswordFieldProps = PasswordInputProps & {
name: string
}

export const PasswordField = (props: PasswordFieldProps) => {
const { name, ...other } = props
const [field, { touched, error }] = useField(name)

const hasError = Boolean(touched && error)

return <PasswordInput {...field} error={hasError} {...other} />
}
4 changes: 2 additions & 2 deletions packages/web/src/components/instagram-auth/InstagramAuth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ const InstagramAuth = ({
const getDefaultButtonContent = useCallback(() => <span>{text}</span>, [text])

return (
<div
<span
role='button'
onClick={handleClick}
style={style}
Expand All @@ -184,7 +184,7 @@ const InstagramAuth = ({
})}
>
{children || getDefaultButtonContent()}
</div>
</span>
)
}

Expand Down
2 changes: 1 addition & 1 deletion packages/web/src/components/preload-image/PreloadImage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const PreloadImage = ({
alt?: string
asBackground?: boolean
preloaded?: boolean
className: string
className?: string
}) => {
const [isLoaded, setIsLoaded] = useState(preloaded)
useEffect(() => {
Expand Down
13 changes: 6 additions & 7 deletions packages/web/src/components/stepped-progress/SteppedProgress.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { forwardRef, useEffect, useRef, useState } from 'react'
import { Fragment, forwardRef, useEffect, useRef, useState } from 'react'

import { Flex, IconComponent, Text } from '@audius/harmony'
import { Box, Flex, IconComponent, Text } from '@audius/harmony'

import { Divider } from 'components/divider'

Expand Down Expand Up @@ -73,10 +73,10 @@ export const SteppedProgress = ({
return () => window.removeEventListener('resize', setTabPosition)
}, [activeStep, steps])
return (
<>
<Box>
<Flex alignItems='center' gap='s'>
{steps.map((s, i) => (
<>
<Fragment key={s.key}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh neat. Didn't know key worked on fragment

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah i wish you could just apply it to the <>

<Step
ref={(el) => {
if (el) {
Expand All @@ -86,18 +86,17 @@ export const SteppedProgress = ({
icon={s.icon}
label={s.label}
isActive={activeStep === s.key}
key={s.key}
/>
{i !== steps.length - 1 ? (
<Divider className={styles.connector} variant='default' />
) : null}
</>
</Fragment>
))}
</Flex>
<span
className={styles.underline}
style={{ left: stepUnderlineLeft, width: stepUnderlineWidth }}
/>
</>
</Box>
)
}
4 changes: 2 additions & 2 deletions packages/web/src/components/twitter-auth/TwitterAuth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,14 @@ const TwitterAuth = (props: TwitterAuthProps) => {
}

return (
<div
<span
role='button'
onClick={onButtonClick}
style={style}
className={className}
>
{children || getDefaultButtonContent()}
</div>
</span>
)
}

Expand Down
7 changes: 0 additions & 7 deletions packages/web/src/pages/sign-in-page/SignInPage.module.css

This file was deleted.

Loading