-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
b233a8c
commit ce1c9a9
Showing
31 changed files
with
491 additions
and
106 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
2 changes: 1 addition & 1 deletion
2
packages/mobile/src/components/suggested-follows/SelectArtistCategoryButtons.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
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
2 changes: 1 addition & 1 deletion
2
packages/mobile/src/screens/sign-up-screen/screens/CreatePasswordScreen.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
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
46 changes: 46 additions & 0 deletions
46
packages/mobile/src/screens/sign-up-screen/screens/SelectArtistsScreen.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,46 @@ | ||
import { useState } from 'react' | ||
|
||
import { getGenres } from 'common/store/pages/signon/selectors' | ||
import { Pressable, View } from 'react-native' | ||
import { useSelector } from 'react-redux' | ||
|
||
import { Text } from 'app/components/core' | ||
|
||
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.', | ||
continue: 'Continue' | ||
} | ||
|
||
export const SelectArtistsScreen = () => { | ||
const genres = useSelector((state: any) => ['Featured', ...getGenres(state)]) | ||
const [currentGenre, setCurrentGenre] = useState('Featured') | ||
|
||
return ( | ||
<View> | ||
<View> | ||
<Text>{messages.header}</Text> | ||
<Text>{messages.description}</Text> | ||
</View> | ||
<View accessibilityRole='radiogroup'> | ||
{genres.map((genre) => { | ||
const checked = genre === currentGenre | ||
return ( | ||
<Pressable | ||
key={genre} | ||
testID={genre} | ||
accessibilityRole='radio' | ||
accessibilityState={{ checked }} | ||
accessibilityLiveRegion='polite' | ||
onPress={() => setCurrentGenre(genre)} | ||
style={{ backgroundColor: checked ? 'purple' : undefined }} | ||
> | ||
<Text>{genre}</Text> | ||
</Pressable> | ||
) | ||
})} | ||
</View> | ||
</View> | ||
) | ||
} |
98 changes: 98 additions & 0 deletions
98
packages/mobile/src/screens/sign-up-screen/screens/SelectGenreScreen.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,98 @@ | ||
import { useCallback } from 'react' | ||
|
||
import { GENRES, convertGenreLabelToValue } from '@audius/common' | ||
import { setField } from 'common/store/pages/signon/actions' | ||
import { | ||
getHandleField, | ||
getNameField | ||
} from 'common/store/pages/signon/selectors' | ||
import { Formik } from 'formik' | ||
import { Pressable, ScrollView, View } from 'react-native' | ||
import { useDispatch, useSelector } from 'react-redux' | ||
|
||
import { Button, Text } from 'app/components/core' | ||
import { useNavigation } from 'app/hooks/useNavigation' | ||
|
||
import type { SignUpScreenParamList } from '../types' | ||
|
||
const messages = { | ||
header: 'Select Your Genres', | ||
description: 'Start by picking some of your favorite genres.', | ||
continue: 'Continue' | ||
} | ||
|
||
const genres = GENRES.map((genre) => ({ | ||
value: genre, | ||
label: convertGenreLabelToValue(genre) | ||
})) | ||
|
||
type SelectGenreValues = Record<string, boolean> | ||
|
||
const initialValues = genres.reduce( | ||
(acc, genre) => ({ | ||
...acc, | ||
[genre.value]: false | ||
}), | ||
{} as SelectGenreValues | ||
) | ||
|
||
export const SelectGenreScreen = () => { | ||
const { value: displayName } = useSelector(getNameField) | ||
const { value: handle } = useSelector(getHandleField) | ||
const dispatch = useDispatch() | ||
const navigation = useNavigation<SignUpScreenParamList>() | ||
|
||
const handleSubmit = useCallback( | ||
(values: SelectGenreValues) => { | ||
const genres = Object.keys(values).filter((genre) => values[genre]) | ||
dispatch(setField('genres', genres)) | ||
navigation.navigate('SelectArtists') | ||
}, | ||
[dispatch, navigation] | ||
) | ||
|
||
return ( | ||
<ScrollView testID='genreScrollView'> | ||
<View> | ||
<Text>{displayName}</Text> | ||
<Text>{handle}</Text> | ||
</View> | ||
<View> | ||
<Text>{messages.header}</Text> | ||
<Text>{messages.description}</Text> | ||
</View> | ||
<Formik initialValues={initialValues} onSubmit={handleSubmit}> | ||
{({ values, setValues, handleSubmit }) => ( | ||
<View> | ||
{genres.map((genre) => { | ||
const { label, value } = genre | ||
const checked = !!values[value] | ||
|
||
const handleChange = () => { | ||
setValues({ | ||
...values, | ||
[value]: !checked | ||
}) | ||
} | ||
|
||
return ( | ||
<Pressable | ||
key={value} | ||
testID={label} | ||
accessibilityRole='checkbox' | ||
accessibilityState={{ checked }} | ||
accessibilityLiveRegion='polite' | ||
onPress={handleChange} | ||
style={{ backgroundColor: checked ? 'purple' : undefined }} | ||
> | ||
<Text>{label}</Text> | ||
</Pressable> | ||
) | ||
})} | ||
<Button title={messages.continue} onPress={() => handleSubmit()} /> | ||
</View> | ||
)} | ||
</Formik> | ||
</ScrollView> | ||
) | ||
} |
2 changes: 1 addition & 1 deletion
2
packages/mobile/src/screens/sign-up-screen/screens/SignUpScreen.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
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
Oops, something went wrong.