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

Emily/bottom play bar #38

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
14,793 changes: 7,407 additions & 7,386 deletions package-lock.json

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
"@react-navigation/stack": "^6.3.16",
"dotenv": "^16.0.3",
"expo": "~47.0.12",
"expo-build-properties": "~0.4.1",
"expo-av": "~13.0.3",
"expo-build-properties": "^0.4.1",
"expo-cli": "^6.3.2",
"expo-font": "~11.0.1",
"expo-splash-screen": "~0.17.5",
"expo-status-bar": "~1.4.2",
Expand All @@ -29,15 +31,13 @@
"react-i18next": "^12.1.5",
"react-native": "0.70.5",
"react-native-dotenv": "^3.4.7",
"react-native-gesture-handler": "~2.8.0",
"react-native-gesture-handler": "^2.9.0",
"react-native-reanimated": "~2.12.0",
"react-native-safe-area-context": "4.4.1",
"react-native-screens": "~3.18.0",
"react-native-svg": "13.4.0",
"react-navigation": "^4.4.4",
"react-native-web": "~0.18.9",
"react-dom": "18.1.0",
"@expo/webpack-config": "^0.17.2"
"react-native-track-player": "^3.2.0",
"react-navigation": "^4.4.4"
},
"devDependencies": {
"@babel/core": "^7.12.9",
Expand Down
81 changes: 81 additions & 0 deletions src/components/BottomPlayBar.tsx
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',
Copy link
Member

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.

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
Copy link
Member

Choose a reason for hiding this comment

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

I would rename this to NowPlayingBar or something for consistency with your wrapper naming. Also bc this bar doesn't actually handle any of the positioning logic, so including the word 'bottom' could be misleading.

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>
);
}
1 change: 1 addition & 0 deletions src/i18n/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const createI18n = (language: string): i18nInstance => {
const i18n = i18next.createInstance().use(initReactI18next);

i18n.init({
compatibilityJSON: 'v3',
Copy link
Member

Choose a reason for hiding this comment

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

This change shouldn't be relevant here

lng: language,
fallbackLng: language,
resources: {
Expand Down
17 changes: 15 additions & 2 deletions src/navigation/RootNavigator.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
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';

const RootStack = createNativeStackNavigator<RootStackParamList>();

export default function RootNavigation() {
return (
<NavigationContainer>
<NavigationBar />
<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>
);
}
133 changes: 71 additions & 62 deletions src/screens/AudioScreen/Audio.tsx
Original file line number Diff line number Diff line change
@@ -1,75 +1,84 @@
import { ScrollView, Text, TextInput, View } from 'react-native';
import AudioCard from '../../components/AudioCard';
import BottomPlayBar from '../../components/BottomPlayBar';
import '../../i18n/i18n';
import Colors from '../../styles/Colors';
import { RootStackScreenProps } from '../../types/navigation';
import { SearchStackScreensProps } from '../../types/navigation';
import styles from './styles';

function AudioScreen({ navigation }: RootStackScreenProps<'Audio'>) {
function AudioScreen({ navigation }: SearchStackScreensProps<'Audio'>) {
return (
<View style={styles.view}>
<TextInput
placeholder="Search"
style={{
width: '95%',
height: '7%',
backgroundColor: Colors.surfaceGrey,
borderRadius: 10,
padding: '3%',
marginBottom: '5%',
}}
/>
<Text
style={{
fontSize: 24,
marginBottom: 22,
fontWeight: '500',
textAlign: 'left',
color: Colors.textPrimary,
}}
>
Recent Search History
</Text>
<ScrollView
horizontal={false}
showsHorizontalScrollIndicator={false}
bounces={false}
>
<AudioCard
<>
<View style={styles.view}>
<TextInput
placeholder="Search"
style={{
width: '95%',
height: '7%',
backgroundColor: '#D9D9D9',
borderRadius: 10,
padding: '3%',
marginBottom: '5%',
}}
/>
<Text
style={{
fontSize: 24,
marginBottom: 22,
fontWeight: '500',
textAlign: 'left',
color: '#525454',
}}
>
Recent Search History
</Text>
<ScrollView
horizontal={false}
showsHorizontalScrollIndicator={false}
bounces={false}
>
<AudioCard
name="Green Colonization: An Interview With Maja Kristine Jama"
author="Shaldon Ferris"
onPress={() => navigation.navigate('Play')}
/>
<AudioCard
name="The Threatened Cultures of the Danube Delta"
author="Tristan Taylor and Natalie Berthram"
/>
<AudioCard
name="An Interview with Preston Hardison on the Convention on Biodiversity"
author="Preson Hardison"
/>
<AudioCard
name="Mrinalini Rai on the Convention on Biodiversity and Gender Rights "
author="Mrinali Rai"
/>
<AudioCard
name="Threatened Cultures of the Danube Delta"
author="Tristan Taylor and Natalie Berthram"
/>
<AudioCard
name="Threatened Cultures of the Danube Delta"
author="Tristan Taylor and Natalie Berthram"
/>
<AudioCard
name="Threatened Cultures of the Danube Delta"
author="Tristan Taylor and Natalie Berthram"
/>
<AudioCard
name="Threatened Cultures of the Danube Delta"
author="Tristan Taylor and Natalie Berthram"
/>
</ScrollView>
</View>
<View>
<BottomPlayBar
name="Green Colonization: An Interview With Maja Kristine Jama"
author="Shaldon Ferris"
onPress={() => navigation.navigate('Play')}
/>
<AudioCard
name="The Threatened Cultures of the Danube Delta"
author="Tristan Taylor and Natalie Berthram"
/>
<AudioCard
name="An Interview with Preston Hardison on the Convention on Biodiversity"
author="Preson Hardison"
/>
<AudioCard
name="Mrinalini Rai on the Convention on Biodiversity and Gender Rights "
author="Mrinali Rai"
/>
<AudioCard
name="Threatened Cultures of the Danube Delta"
author="Tristan Taylor and Natalie Berthram"
/>
<AudioCard
name="Threatened Cultures of the Danube Delta"
author="Tristan Taylor and Natalie Berthram"
/>
<AudioCard
name="Threatened Cultures of the Danube Delta"
author="Tristan Taylor and Natalie Berthram"
/>
<AudioCard
name="Threatened Cultures of the Danube Delta"
author="Tristan Taylor and Natalie Berthram"
/>
</ScrollView>
</View>
</View>
</>
);
}

Expand Down
42 changes: 26 additions & 16 deletions src/screens/GrantsScreen/Grants.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { ScrollView, Text, View } from 'react-native';
import { useEffect, useState } from 'react';
import GrantCard from '../../components/GrantCard';
import BottomPlayBar from '../../components/BottomPlayBar';
import ViewContainer from '../../components/ViewContainer';
import { GrantsStackScreensProps } from '../../types/navigation';
import globalStyles from '../../globalStyles';
import styles from './styles';
import { Grant } from '../../types/schema';

import '../../i18n/i18n';
import { GrantsStackScreensProps } from '../../types/navigation';
import { getAllGrants } from '../../firebase/queries/grantsQueries';

function GrantsScreen({ navigation }: GrantsStackScreensProps<'Grants'>) {
Expand All @@ -27,22 +28,31 @@ function GrantsScreen({ navigation }: GrantsStackScreensProps<'Grants'>) {
}, []);

return (
<ScrollView style={styles.container}>
<ViewContainer>
<Text style={globalStyles.h2}>Grants Available</Text>
</ViewContainer>
<>
<ScrollView style={styles.container}>
<ViewContainer>
<Text style={globalStyles.h2}>Grants Available</Text>
</ViewContainer>

{grants.map(grant => (
<View key={grant.grant_id}>
<GrantCard
grantObj={grant}
onPress={() =>
navigation.navigate('GrantInfo', { grantObj: grant })
}
/>
</View>
))}
</ScrollView>
{grants.map(grant => (
<View key={grant.grant_id}>
<GrantCard
grantObj={grant}
onPress={() =>
navigation.navigate('GrantInfo', { grantObj: grant })
}
/>
</View>
))}
</ScrollView>
<View>
<BottomPlayBar
name="Green Colonization: An Interview With Maja Kristine Jama"
author="Shaldon Ferris"
onPress={() => navigation.navigate('Play')}
/>
</View>
</>
);
}

Expand Down
13 changes: 10 additions & 3 deletions src/screens/HomeScreen/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import { Text, View, ScrollView, SafeAreaView } from 'react-native';
import globalStyles from '../../globalStyles';
import styles from './styles';
import CategoryCard from '../../components/CategoryCard';
import { RootStackScreenProps } from '../../types/navigation';

import { HomeStackScreenProps } from '../../types/navigation';
import BottomPlayBar from '../../components/BottomPlayBar';
import climateImage from '../../../assets/climateChangeImage.png';
import languageImage from '../../../assets/language.png';
import womenImage from '../../../assets/women.png';
import educationImage from '../../../assets/education.png';
import communicationImage from '../../../assets/communication.png';

function HomeScreen({ navigation }: RootStackScreenProps<'Home'>) {
function HomeScreen({ navigation }: HomeStackScreenProps<'Home'>) {
return (
<SafeAreaView style={styles.container}>
<ScrollView>
Expand Down Expand Up @@ -62,6 +62,13 @@ function HomeScreen({ navigation }: RootStackScreenProps<'Home'>) {
/>
</View>
</ScrollView>
<View>
<BottomPlayBar
name="Green Colonization: An Interview With Maja Kristine Jama"
author="Shaldon Ferris"
onPress={() => navigation.navigate('Play')}
/>
</View>
</SafeAreaView>
);
}
Expand Down
Loading