-
Notifications
You must be signed in to change notification settings - Fork 111
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-3363] FollowArtistsPage initial layout #6692
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
8afbb73
FollowArtistsPage initial layout
amendelsohn 407e3a3
placeholder images; spacing fixes
amendelsohn 820d60f
Merge branch 'main' into am-follow-artists-page
amendelsohn a225f78
remove unnecessary flex args
amendelsohn 0fbbf9d
working design prototype
amendelsohn 1866961
add ContinueFooter
amendelsohn 900fa30
cleanup
amendelsohn 0726888
Merge branch 'main' into am-follow-artists-page
amendelsohn b7717a9
fix type error
amendelsohn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
102 changes: 102 additions & 0 deletions
102
packages/web/src/pages/sign-up-page/components/FollowArtistTile.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
import { HTMLProps } from 'react' | ||
|
||
import { UserMetadata } from '@audius/common' | ||
import { | ||
Avatar, | ||
Box, | ||
Divider, | ||
Flex, | ||
IconNote, | ||
IconUser, | ||
IconUserFollow, | ||
IconVerified, | ||
Paper, | ||
Text | ||
} from '@audius/harmony' | ||
|
||
import audiusCoverPhoto from 'assets/img/4-Conductor-16-9.jpg' | ||
import audiusProfilePic from 'assets/img/appIcon240.png' | ||
|
||
type FollowArtistTileProps = { | ||
user: UserMetadata | ||
} & HTMLProps<HTMLInputElement> | ||
|
||
const FollowArtistTile = (props: FollowArtistTileProps) => { | ||
const { | ||
user: { name, user_id, is_verified, track_count, follower_count }, | ||
onChange | ||
} = props | ||
return ( | ||
<Paper w={235} h={220}> | ||
<Flex w='100%' direction='column' alignItems='center'> | ||
<Box w={72} h={72} css={{ position: 'absolute', top: 34 }}> | ||
<Avatar variant='strong' src={audiusProfilePic} /> | ||
</Box> | ||
<Box | ||
w='100%' | ||
h={68} | ||
css={{ backgroundImage: `url(${audiusCoverPhoto})` }} | ||
/> | ||
<Flex | ||
direction='column' | ||
alignItems='center' | ||
gap='l' | ||
pt='3xl' | ||
pb='l' | ||
ph='s' | ||
w='100%' | ||
> | ||
<Flex direction='column' alignItems='center' gap='s'> | ||
<Flex direction='row' gap='xs' alignItems='center'> | ||
<Text | ||
variant='title' | ||
size='s' | ||
strength='default' | ||
css={{ | ||
// TODO: Need to contain width | ||
textOverflow: 'ellipsis', | ||
whiteSpace: 'nowrap' | ||
}} | ||
> | ||
{name} | ||
</Text> | ||
{is_verified ? ( | ||
<IconVerified css={{ width: 12, height: 12 }} /> | ||
) : null} | ||
</Flex> | ||
<Flex direction='row' gap='s' alignItems='center'> | ||
<Flex direction='row' gap='xs' alignItems='center'> | ||
<IconNote width={16} height={16} color='subdued' /> | ||
<Text variant='body' size='s' strength='strong'> | ||
{track_count} | ||
</Text> | ||
</Flex> | ||
{/* TODO: Divider height not working */} | ||
<Divider /> | ||
<Flex direction='row' gap='xs' alignItems='center'> | ||
<IconUser width={16} height={16} color='subdued' /> | ||
<Text variant='body' size='s' strength='strong'> | ||
{follower_count} | ||
</Text> | ||
</Flex> | ||
</Flex> | ||
</Flex> | ||
{/* TODO: Use Harmony FollowButton */} | ||
<label key={user_id}> | ||
<Flex alignItems='center' gap='xs'> | ||
<input | ||
type='checkbox' | ||
name={String(user_id)} | ||
onChange={onChange} | ||
/> | ||
<IconUserFollow color='subdued' /> | ||
Follow | ||
</Flex> | ||
</label> | ||
</Flex> | ||
</Flex> | ||
</Paper> | ||
) | ||
} | ||
|
||
export default FollowArtistTile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,15 @@ import { | |
useGetFeaturedArtists, | ||
useGetTopArtistsInGenre | ||
} from '@audius/common' | ||
import { Button } from '@audius/harmony' | ||
import { | ||
Button, | ||
Flex, | ||
Text, | ||
IconArrowRight, | ||
SelectablePill, | ||
Paper, | ||
Box | ||
} from '@audius/harmony' | ||
import { Form, Formik } from 'formik' | ||
import { useDispatch } from 'react-redux' | ||
|
||
|
@@ -17,12 +25,16 @@ import { useNavigateToPage } from 'hooks/useNavigateToPage' | |
import { useSelector } from 'utils/reducer' | ||
import { TRENDING_PAGE } from 'utils/route' | ||
|
||
import { ContinueFooter } from '../components/ContinueFooter' | ||
import FollowArtistTile from '../components/FollowArtistTile' | ||
|
||
const messages = { | ||
header: 'Follow At Least 3 Artists', | ||
description: | ||
'Curate your feed with tracks uploaded or reposted by anyone you follow. Click the artist’s photo to preview their music.', | ||
genresLabel: 'Selected genres', | ||
continue: 'Continue', | ||
goBack: 'Go Back', | ||
pickArtists: (genre: string) => `Pick ${genre} Artists` | ||
} | ||
|
||
|
@@ -41,9 +53,10 @@ export const SelectArtistsPage = () => { | |
const dispatch = useDispatch() | ||
const navigate = useNavigateToPage() | ||
|
||
const handleChangeGenre = useCallback((e: ChangeEvent<HTMLInputElement>) => { | ||
setCurrentGenre(e.target.value) | ||
}, []) | ||
// TODO: adopt SelectablePill as input | ||
// const handleChangeGenre = useCallback((e: ChangeEvent<HTMLInputElement>) => { | ||
// setCurrentGenre(e.target.value) | ||
// }, []) | ||
|
||
const handleSubmit = useCallback( | ||
(values: SelectArtistsValues) => { | ||
|
@@ -74,61 +87,104 @@ export const SelectArtistsPage = () => { | |
Status.LOADING | ||
|
||
return ( | ||
<div> | ||
<h1>{messages.header}</h1> | ||
<p>{messages.description}</p> | ||
<div role='radiogroup' aria-label={messages.genresLabel}> | ||
{genres.map((genre) => ( | ||
<label key={genre}> | ||
<input | ||
type='radio' | ||
value={genre} | ||
checked={genre === currentGenre} | ||
onChange={handleChangeGenre} | ||
<Flex | ||
direction='column' | ||
gap='2xl' | ||
css={{ | ||
overflow: 'scroll', | ||
// Hide scrollbar | ||
scrollbarWidth: 'none', // Firefox | ||
msOverflowStyle: 'none', // IE + Edge | ||
// Chrome + Safari | ||
'::-webkit-scrollbar': { | ||
display: 'none' | ||
} | ||
Comment on lines
+96
to
+101
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i wish there was some emotion autoprefix magic for this |
||
}} | ||
> | ||
<Flex direction='column' gap='2xl' mh='5xl' mb='xl'> | ||
{/* TODO: Placeholder for AccountHeader */} | ||
<Box /> | ||
<Flex direction='column' gap='l'> | ||
<Text variant='heading' size='l' strength='default' color='heading'> | ||
{messages.header} | ||
</Text> | ||
<Text variant='body' size='l' strength='default'> | ||
{messages.description} | ||
</Text> | ||
</Flex> | ||
<Flex | ||
w='100%' | ||
gap='s' | ||
justifyContent='center' | ||
role='radiogroup' | ||
aria-label={messages.genresLabel} | ||
> | ||
{genres.map((genre) => ( | ||
// TODO: max of 6, kebab overflow | ||
<SelectablePill | ||
key={genre} | ||
label={genre} | ||
onClick={() => { | ||
setCurrentGenre(genre) | ||
}} | ||
/> | ||
{genre} | ||
</label> | ||
))} | ||
</div> | ||
<Formik initialValues={initialValues} onSubmit={handleSubmit}> | ||
{({ values, setValues }) => { | ||
const { artists: selectedArtists } = values | ||
const handleChange = (e: ChangeEvent<HTMLInputElement>) => { | ||
const { checked, name } = e.target | ||
const userId = parseInt(name, 10) | ||
const newArtists = checked | ||
? [userId, ...selectedArtists] | ||
: selectedArtists.filter((value) => value !== userId) | ||
|
||
setValues({ artists: newArtists }) | ||
} | ||
return ( | ||
<Form> | ||
<fieldset> | ||
<legend>{messages.pickArtists(currentGenre)}</legend> | ||
{isLoading | ||
? null | ||
: artists?.map((user) => { | ||
const { user_id, name } = user | ||
))} | ||
</Flex> | ||
<Formik initialValues={initialValues} onSubmit={handleSubmit}> | ||
{({ values, setValues }) => { | ||
const { artists: selectedArtists } = values | ||
const handleChange = (e: ChangeEvent<HTMLInputElement>) => { | ||
const { checked, name } = e.target | ||
const userId = parseInt(name, 10) | ||
const newArtists = checked | ||
? [userId, ...selectedArtists] | ||
: selectedArtists.filter((value) => value !== userId) | ||
|
||
return ( | ||
<label key={user_id}> | ||
<input | ||
type='checkbox' | ||
name={String(user_id)} | ||
onChange={handleChange} | ||
checked={selectedArtists.includes(user_id)} | ||
/> | ||
{name} | ||
</label> | ||
) | ||
})} | ||
</fieldset> | ||
<Button type='submit'>{messages.continue}</Button> | ||
</Form> | ||
) | ||
}} | ||
</Formik> | ||
</div> | ||
setValues({ artists: newArtists }) | ||
} | ||
return ( | ||
<Form> | ||
<fieldset> | ||
<Paper | ||
css={{ | ||
background: 'var(--harmony-bg-default)', | ||
boxShadow: 'none' | ||
}} | ||
p='xl' | ||
gap='m' | ||
rowGap='m' | ||
wrap='wrap' | ||
> | ||
{isLoading | ||
? null | ||
: artists?.map((user) => { | ||
return ( | ||
<FollowArtistTile | ||
key={user.user_id} | ||
user={user} | ||
onChange={handleChange} | ||
/> | ||
) | ||
})} | ||
</Paper> | ||
</fieldset> | ||
</Form> | ||
) | ||
}} | ||
</Formik> | ||
</Flex> | ||
<ContinueFooter> | ||
<Button | ||
minWidth={343} | ||
type='submit' | ||
// disabled={!isValid || isSubmitting} | ||
// isLoading={isSubmitting || isValidating} | ||
iconRight={IconArrowRight} | ||
> | ||
{messages.continue} | ||
</Button> | ||
<Text variant='body'>Selected TODO/3</Text> | ||
</ContinueFooter> | ||
</Flex> | ||
) | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these TODOs to be addressed in this PR or in a future one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Future. Just wanted to get what I have merged so we can work off it and it's not all in one big PR at the end