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

CodyGarciaa/Prea-Pages-Cont #20

Merged
merged 40 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
81d2c83
changed page setup to render supabase data
CodyGarciaa Oct 24, 2024
99712ed
display is now sorted based on page number
CodyGarciaa Oct 24, 2024
c929884
passing in full data for each language to video page
CodyGarciaa Oct 24, 2024
ee7fdb3
new videos kinda working, just not playing rip; having problems with …
CodyGarciaa Oct 24, 2024
87e7b03
lowk finished, but useState making solution a bit scuffed... video's …
CodyGarciaa Oct 24, 2024
1b1ad24
not much, only rerendered on index now, comments for better understan…
CodyGarciaa Oct 24, 2024
dc43a08
finished sprint, video plays bc of useref instead of usestate
CodyGarciaa Oct 26, 2024
db5b1c9
fixed very minor bug where the first page wont display
CodyGarciaa Oct 26, 2024
aba552a
5 create resources sub pages (#15)
angelinetu Oct 22, 2024
1c3c904
8-healing-resource-pages (#19)
arfamomin Oct 25, 2024
aa7ab8e
[bug fix] removed extra type file
philipye314 Oct 25, 2024
d965282
Charlottelaw/jdi 14 tab navigation (#12)
CharlotteLaw Oct 25, 2024
ba3b19c
fixed some style, tried video player a bit
CodyGarciaa Oct 26, 2024
80a54e2
Charlottelaw/jdi 14 tab navigation (#12)
CharlotteLaw Oct 25, 2024
76dda2e
changed page setup to render supabase data
CodyGarciaa Oct 24, 2024
77e0000
passing in full data for each language to video page
CodyGarciaa Oct 24, 2024
e3c5911
fixed type errors
CodyGarciaa Oct 30, 2024
fe12ac2
deleted unnecessary files
philipye314 Oct 30, 2024
1159b88
fixed philip's comments besides english/spanishModule's defualt usestate
CodyGarciaa Oct 30, 2024
3ea9d36
fixed some pretty warnings
CodyGarciaa Oct 30, 2024
51c12ec
done seekHelp midfi (#21)
angelinetu Nov 1, 2024
038c9c2
changed page setup to render supabase data
CodyGarciaa Oct 24, 2024
2ab374b
display is now sorted based on page number
CodyGarciaa Oct 24, 2024
148ce0d
passing in full data for each language to video page
CodyGarciaa Oct 24, 2024
c5a68b3
new videos kinda working, just not playing rip; having problems with …
CodyGarciaa Oct 24, 2024
8b69c33
lowk finished, but useState making solution a bit scuffed... video's …
CodyGarciaa Oct 24, 2024
1dbdcd7
not much, only rerendered on index now, comments for better understan…
CodyGarciaa Oct 24, 2024
c2c2403
finished sprint, video plays bc of useref instead of usestate
CodyGarciaa Oct 26, 2024
c1f1430
fixed very minor bug where the first page wont display
CodyGarciaa Oct 26, 2024
6377902
Charlottelaw/jdi 14 tab navigation (#12)
CharlotteLaw Oct 25, 2024
c965484
fixed some style, tried video player a bit
CodyGarciaa Oct 26, 2024
76ddfa6
Charlottelaw/jdi 14 tab navigation (#12)
CharlotteLaw Oct 25, 2024
4d26729
changed page setup to render supabase data
CodyGarciaa Oct 24, 2024
a92add8
passing in full data for each language to video page
CodyGarciaa Oct 24, 2024
9c6dc49
fixed type errors
CodyGarciaa Oct 30, 2024
7370c81
deleted unnecessary files
philipye314 Oct 30, 2024
f9369b0
fixed philip's comments besides english/spanishModule's defualt usestate
CodyGarciaa Oct 30, 2024
ff06874
fixed some pretty warnings
CodyGarciaa Oct 30, 2024
9d2dcba
deleted useless file
philipye314 Nov 1, 2024
d5bf8c7
fixed conflicts
philipye314 Nov 1, 2024
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
19 changes: 3 additions & 16 deletions App.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,11 @@
import * as React from 'react';
import { NavigationContainer } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import HealingResources from '@/screens/HealingResources';
import Home from '@/screens/Home';
import LegalRights from '@/screens/LegalRights/index';
import VideoPage from '@/screens/LegalRights/VideoPage';
import SeekHelp from '@/screens/SeekHelp';

const Stack = createNativeStackNavigator();
import NavigationBar from '@/navigation/BottomTabNavigator';

export default function App() {
return (
<NavigationContainer independent={true}>
<Stack.Navigator initialRouteName="Home">
<Stack.Screen name="Home" component={Home} />
<Stack.Screen name="Healing Resources" component={HealingResources} />
<Stack.Screen name="Legal Rights" component={LegalRights} />
<Stack.Screen name="Seek Help" component={SeekHelp} />
<Stack.Screen name="Video Page" component={VideoPage} />
</Stack.Navigator>
<NavigationContainer>
<NavigationBar />
</NavigationContainer>
);
}
4,389 changes: 3,227 additions & 1,162 deletions package-lock.json

Large diffs are not rendered by default.

10 changes: 8 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,23 @@
"pre-commit": "(npm run tsc || true) && (npm run lint:check || true) && npm run prettier:check"
},
"dependencies": {
"@react-navigation/bottom-tabs": "^6.6.1",
"@react-navigation/material-bottom-tabs": "^6.2.29",
"@react-navigation/native": "^6.1.18",
"@react-navigation/native-stack": "^6.11.0",
"@supabase/supabase-js": "^2.45.4",
"@supabase/supabase-js": "^2.45.6",
"expo": "~51.0.21",
"expo-av": "~14.0.7",
"expo-status-bar": "~1.12.1",
"react": "18.2.0",
"react-native": "^0.74.5",
"react-native-paper": "^5.12.5",
"react-native-media-controls": "^2.3.0",
"react-native-safe-area-context": "4.10.5",
"react-native-screens": "3.31.1",
"react-native-slider": "^0.11.0",
"react-native-video": "^6.6.4",
"expo-av": "~14.0.7"
"react-native-video-controls": "^2.8.1"
},
"devDependencies": {
"@babel/core": "^7.20.0",
Expand Down
5 changes: 5 additions & 0 deletions src/HealingResources/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Text } from 'react-native';

export default function HealingResources() {
return <Text>HEALING!!!!</Text>;
}
51 changes: 51 additions & 0 deletions src/navigation/BottomTabNavigator.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import * as React from 'react';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import HomeScreen from 'src/screens/Home/';
import HealingResourcesNavigator from './stacks/HealingResourcesNavigator';
import LegalRightsNavigator from './stacks/LegalRightsNavigator';
import SeekHelpNavigator from './stacks/SeekHelpNavigator';
import { BottomTabParams } from './types';

const initialRouteName = 'Healing';

const Tab = createBottomTabNavigator<BottomTabParams>();

export default function NavigationBar() {
return (
<Tab.Navigator
initialRouteName={initialRouteName}
screenOptions={{
headerShown: false,
}}
>
<Tab.Screen
name="Home"
component={HomeScreen}
options={{
tabBarLabel: 'Home',
}}
/>
<Tab.Screen
name="Healing"
component={HealingResourcesNavigator}
options={{
tabBarLabel: 'Healing Resources',
}}
/>
<Tab.Screen
name="Legal"
component={LegalRightsNavigator}
options={{
tabBarLabel: 'Legal Rights',
}}
/>
<Tab.Screen
name="Seek"
component={SeekHelpNavigator}
options={{
tabBarLabel: 'Seek Help',
}}
/>
</Tab.Navigator>
);
}
15 changes: 0 additions & 15 deletions src/navigation/LegalRightsNav.tsx

This file was deleted.

Empty file removed src/navigation/mainTabNav.tsx
Empty file.
24 changes: 24 additions & 0 deletions src/navigation/stacks/HealingResourcesNavigator.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import React from 'react';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import HealingResources from '@/screens/HealingResources';
import HealingCatalogue from '@/screens/HealingResources/HealingCatalogue';
import HFHGuide from '@/screens/HealingResources/HFHGuide';
import { HealingStackParams } from '../types';

const HealingStack = createNativeStackNavigator<HealingStackParams>();

export default function HealingResourcesNavigator() {
return (
<HealingStack.Navigator>
<HealingStack.Screen
name="HealingResources"
component={HealingResources}
/>
<HealingStack.Screen
name="HealingCatalogue"
component={HealingCatalogue}
/>
<HealingStack.Screen name="HopeForHealingGuide" component={HFHGuide} />
</HealingStack.Navigator>
);
}
16 changes: 16 additions & 0 deletions src/navigation/stacks/LegalRightsNavigator.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from 'react';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import LegalRights from '@/screens/LegalRights';
import VideoPage from '@/screens/LegalRights/VideoPage';
import { LegalStackParams } from '../types';

const LegalStack = createNativeStackNavigator<LegalStackParams>();

export default function LegalRightsNavigator() {
return (
<LegalStack.Navigator>
<LegalStack.Screen name="LegalRights" component={LegalRights} />
<LegalStack.Screen name="VideoPage" component={VideoPage} />
</LegalStack.Navigator>
);
}
16 changes: 16 additions & 0 deletions src/navigation/stacks/SeekHelpNavigator.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from 'react';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import SeekHelp from '@/screens/SeekHelp';
import ResourceList from '@/screens/SeekHelp/ResourceList';
import { SeekHelpStackParams } from '../types';

const SeekHelpStack = createNativeStackNavigator<SeekHelpStackParams>();

export default function SeekHelpNavigator() {
return (
<SeekHelpStack.Navigator>
<SeekHelpStack.Screen name="SeekHelp" component={SeekHelp} />
<SeekHelpStack.Screen name="ResourceList" component={ResourceList} />
</SeekHelpStack.Navigator>
);
}
37 changes: 37 additions & 0 deletions src/navigation/types.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { MaterialBottomTabNavigationProp } from '@react-navigation/material-bottom-tabs';
import { NativeStackScreenProps } from '@react-navigation/native-stack';

export type LegalStackParams = {
LegalRights: undefined;
VideoPage: undefined;
};

export type HealingStackParams = {
HealingResources: undefined;
HopeForHealingGuide: undefined;
HealingCatalogue: undefined;
};

export type SeekHelpStackParams = {
SeekHelp: undefined;
ResourceList: undefined;
};

export type BottomTabParams = {
Legal: undefined;
Healing: undefined;
Seek: undefined;
Home: undefined;
};

export type LegalScreenProps<T extends keyof LegalStackParams> =
NativeStackScreenProps<LegalStackParams, T>;

export type HealingScreenProps<T extends keyof HealingStackParams> =
NativeStackScreenProps<HealingStackParams, T>;

export type SeekHelpScreenProps<T extends keyof SeekHelpStackParams> =
NativeStackScreenProps<SeekHelpStackParams, T>;

export type BottomTabScreenProps<T extends keyof BottomTabParams> =
MaterialBottomTabNavigationProp<BottomTabParams, T>;
9 changes: 9 additions & 0 deletions src/screens/HealingResources/HFHGuide/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { Text, View } from 'react-native';

export default function HFHGuide() {
return (
<View>
<Text> This is the HFH page </Text>
</View>
);
}
91 changes: 91 additions & 0 deletions src/screens/HealingResources/HealingCatalogue/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
import React, { useEffect, useRef, useState } from 'react';
import { ScrollView, Text, TouchableOpacity, View } from 'react-native';
import { getHealingResourceData } from '@/supabase/queries/generalQueries';
import { HealingResource } from '@/types/types';
import styles from './styles';

const themes = ['Breathing', 'Meditation', 'Joy', 'Resilience'];

export default function HealingCatalogue() {
const [resources, setResources] = useState<HealingResource[]>([]);
const scrollViewRef = useRef<ScrollView | null>(null);
const [headerPositions, setHeaderPositions] = useState<number[]>([]);

useEffect(() => {
const fetchResources = async () => {
const data = await getHealingResourceData();
setResources(data);
};
fetchResources();
}, []);

const groupedResources = themes.reduce(
(acc, theme) => {
acc[theme] = resources.filter(resource =>
resource.topics.includes(theme),
);
return acc;
},
{} as Record<string, HealingResource[]>,
);

const scrollToTheme = (index: number) => {
const targetY = headerPositions[index] || 0;
const paddingTop = 30;
scrollViewRef.current?.scrollTo({
y: targetY - paddingTop,
animated: true,
});
};

const onLayoutHeader =
(index: number) => (event: { nativeEvent: { layout: { y: number } } }) => {
const { y } = event.nativeEvent.layout;
setHeaderPositions(prevPositions => {
const newPositions = [...prevPositions];
newPositions[index] = y;
return newPositions;
});
};

return (
<View style={styles.container}>
<View style={styles.themesContainer}>
{themes.map((theme, index) => (
<TouchableOpacity
key={index}
style={styles.themeButton}
onPress={() => scrollToTheme(index)}
>
<Text>{theme}</Text>
</TouchableOpacity>
))}
</View>
<ScrollView ref={scrollViewRef}>
<View style={styles.resourcesContainer}>
{themes.map((theme, index) => (
<>
<View
style={styles.themeHeader}
onLayout={onLayoutHeader(index)}
key={index}
>
<Text style={styles.themeHeaderText}>{theme}</Text>
</View>
<View style={styles.cardsContainer}>
{groupedResources[theme].map((resource, resourcesIndex) => (
<View style={styles.resourceContainer} key={resourcesIndex}>
<View style={styles.resourceCard}></View>
<Text style={styles.resourceText}>
{resource.text_content}
</Text>
</View>
))}
</View>
</>
))}
</View>
</ScrollView>
</View>
);
}
Loading
Loading