-
Notifications
You must be signed in to change notification settings - Fork 0
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
Emily/bottom play bar #38
base: main
Are you sure you want to change the base?
Changes from all commits
5f85934
4c102df
95d8458
43296a4
d7353c1
da0f75d
b46d7f4
3e19267
9949890
ec782ed
b6f1a0a
39509a3
0004221
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { Audio } from 'expo-av'; | ||
import { | ||
Dispatch, | ||
SetStateAction, | ||
createContext, | ||
useMemo, | ||
useState, | ||
} from 'react'; | ||
|
||
export type AudioPlayerState = { | ||
soundRef: Audio.Sound; | ||
url: string; | ||
title: string; | ||
artist: string; | ||
isPlaying: boolean; | ||
thumbnail: string; | ||
scLink: string; | ||
theme: string[]; | ||
}; | ||
|
||
interface IAudioContext { | ||
audio: AudioPlayerState; | ||
setAudio: Dispatch<SetStateAction<AudioPlayerState>>; | ||
} | ||
|
||
const AudioContext = createContext<IAudioContext>({} as IAudioContext); | ||
|
||
export function AudioProvider({ children }: { children: React.ReactNode }) { | ||
const [audioState, setAudioState] = useState<AudioPlayerState>( | ||
{} as AudioPlayerState, | ||
); | ||
// const value = { audio: audioState, setAudio: setAudioState }; | ||
const value = useMemo( | ||
() => ({ | ||
audio: audioState, | ||
setAudio: setAudioState, | ||
}), | ||
[audioState], | ||
); | ||
|
||
return ( | ||
<AudioContext.Provider value={value}>{children}</AudioContext.Provider> | ||
); | ||
} | ||
|
||
export default AudioContext; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import { Image, Pressable, StyleSheet, Text, View } from 'react-native'; | ||
import Icon from '../../assets/icons'; | ||
|
||
const styles = StyleSheet.create({ | ||
card: { | ||
backgroundColor: '#D9D9D9', | ||
width: 400, | ||
height: 78, | ||
borderRadius: 5, | ||
margin: 0, | ||
}, | ||
title: { | ||
fontSize: 12, | ||
marginLeft: 15, | ||
marginTop: 9, | ||
}, | ||
meta: { | ||
marginTop: 10, | ||
marginLeft: 15, | ||
fontSize: 9, | ||
flexWrap: 'wrap', | ||
}, | ||
}); | ||
|
||
type BottomPlayBarProps = { | ||
onPress?: () => void; | ||
children: React.ReactNode; | ||
style?: object; | ||
}; | ||
|
||
function BottomPlayBar({ onPress, children, style }: BottomPlayBarProps) { | ||
return ( | ||
<Pressable style={[styles.card, style]} onPress={onPress}> | ||
{children} | ||
</Pressable> | ||
); | ||
} | ||
|
||
type SearchBottomPlayBarProps = { | ||
Comment on lines
+31
to
+39
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 would rename this to |
||
name: string; | ||
onPress?: () => void; | ||
author: string; | ||
previewImage?: string; | ||
}; | ||
|
||
export default function SearchBottomPlayBarCard({ | ||
name, | ||
onPress, | ||
author, | ||
previewImage, | ||
}: SearchBottomPlayBarProps) { | ||
return ( | ||
<BottomPlayBar | ||
style={{ | ||
display: 'flex', | ||
flexDirection: 'row', | ||
justifyContent: 'flex-start', | ||
}} | ||
onPress={onPress} | ||
> | ||
<Image | ||
source={{ uri: previewImage }} | ||
style={{ | ||
height: 63, | ||
width: 63, | ||
marginTop: 6.5, | ||
marginLeft: 5, | ||
backgroundColor: '#F3F2F2', | ||
borderRadius: 5, | ||
}} | ||
/> | ||
<View style={{ width: 250 }}> | ||
<Text style={styles.title}>{name}</Text> | ||
<Text style={styles.meta}>{author}</Text> | ||
</View> | ||
<View style={{ marginTop: 13, marginRight: 8 }}> | ||
<Icon type="play_button" /> | ||
</View> | ||
</BottomPlayBar> | ||
); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { View } from 'react-native'; | ||
import globalStyles from '../globalStyles'; | ||
import BottomPlayBar from './BottomPlayBar'; | ||
|
||
type NowPlayingWrapperProps = { | ||
children?: React.ReactNode; | ||
// TODO FIX THIS NAV TYPE | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
navigation: any; | ||
}; | ||
|
||
export default function NowPlayingWrapperContainer({ | ||
children, | ||
navigation, | ||
}: NowPlayingWrapperProps) { | ||
return ( | ||
<View style={globalStyles.container}> | ||
{children} | ||
<BottomPlayBar | ||
name="Green Colonization: An Interview With Maja Kristine Jama" | ||
author="Shaldon Ferris" | ||
onPress={() => navigation.navigate('Play')} | ||
/> | ||
</View> | ||
); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { | ||
Text, | ||
Image, | ||
StyleSheet, | ||
View, | ||
GestureResponderEvent, | ||
Pressable, | ||
} from 'react-native'; | ||
import globalStyles from '../globalStyles'; | ||
|
||
const styles = StyleSheet.create({ | ||
recentsCard: { | ||
paddingRight: 16, | ||
flexDirection: 'column', | ||
justifyContent: 'space-between', | ||
height: 190, | ||
}, | ||
image: { | ||
height: 150, | ||
width: 150, | ||
backgroundColor: 'black', | ||
}, | ||
textContainer: { | ||
width: 150, | ||
}, | ||
}); | ||
|
||
type RecentUploadProps = { | ||
title: string; | ||
artist: string; | ||
image: string; | ||
pressFunction: (event: GestureResponderEvent) => void; | ||
}; | ||
|
||
function RecentUpload({ | ||
title, | ||
artist, | ||
image, | ||
pressFunction, | ||
}: RecentUploadProps) { | ||
return ( | ||
<Pressable onPress={pressFunction}> | ||
<View style={styles.recentsCard}> | ||
<Image style={styles.image} source={{ uri: image }} /> | ||
<View style={styles.textContainer}> | ||
<Text style={globalStyles.body1} numberOfLines={1}> | ||
{title} | ||
</Text> | ||
<Text style={globalStyles.body2} numberOfLines={1}> | ||
{artist} | ||
</Text> | ||
</View> | ||
</View> | ||
</Pressable> | ||
); | ||
} | ||
|
||
export default RecentUpload; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ const createI18n = (language: string): i18nInstance => { | |
const i18n = i18next.createInstance().use(initReactI18next); | ||
|
||
i18n.init({ | ||
compatibilityJSON: 'v3', | ||
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. This change shouldn't be relevant here |
||
lng: language, | ||
fallbackLng: language, | ||
resources: { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,27 @@ | ||
import { NavigationContainer } from '@react-navigation/native'; | ||
|
||
import { createNativeStackNavigator } from '@react-navigation/native-stack'; | ||
import PlayScreen from '../screens/PlayScreen/Play'; | ||
import NavigationBar from './NavigationBar'; | ||
import { RootStackParamList } from '../types/navigation'; | ||
import { AudioProvider } from '../AudioContext'; | ||
|
||
const RootStack = createNativeStackNavigator<RootStackParamList>(); | ||
|
||
export default function RootNavigation() { | ||
return ( | ||
<NavigationContainer> | ||
<NavigationBar /> | ||
</NavigationContainer> | ||
<AudioProvider> | ||
<NavigationContainer> | ||
<RootStack.Navigator | ||
screenOptions={{ | ||
headerShown: false, | ||
}} | ||
> | ||
<RootStack.Screen name="NavigationBar" component={NavigationBar} /> | ||
<RootStack.Group screenOptions={{ presentation: 'modal' }}> | ||
<RootStack.Screen name="Play" component={PlayScreen} /> | ||
</RootStack.Group> | ||
</RootStack.Navigator> | ||
</NavigationContainer> | ||
</AudioProvider> | ||
); | ||
} |
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.
If there's a corresponding color in
Colors.ts
, use that! If it doesn't exist but there should be one, feel free to define a new color constant there.