Skip to content

Commit

Permalink
seek help to resource list
Browse files Browse the repository at this point in the history
  • Loading branch information
angelinetu committed Oct 20, 2024
1 parent 05c3951 commit e010424
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 65 deletions.
10 changes: 5 additions & 5 deletions src/navigation/seekHelpNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import ResourceList from '@/screens/SeekHelp/ResourceList';
const Stack = createNativeStackNavigator();
export default function seekHelpNav() {
return (
<Stack.Navigator initialRouteName="Home">
<Stack.Screen name="Resource List" component={ResourceList} />
<Stack.Screen name="Seek Help" component={SeekHelp} />
</Stack.Navigator>
<Stack.Navigator initialRouteName="Home">
<Stack.Screen name="Resource List" component={ResourceList} />
<Stack.Screen name="Seek Help" component={SeekHelp} />
</Stack.Navigator>
);
}
}
83 changes: 45 additions & 38 deletions src/screens/SeekHelp/ResourceList/index.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,31 @@
import React, { useEffect, useState } from 'react';
import { Button, Text, View, TouchableOpacity } from 'react-native';
import { Button, Text, TouchableOpacity, View } from 'react-native';
import { getSeekHelpData } from '@/supabase/queries/generalQueries';
import { Resource } from '@/types/types';
import {styles} from './styles'
import { styles } from './styles';

export default function ResourceList() {
const filters = ['General Resources', 'Health Organizations', 'LGBT Organizations', 'Legal Services', 'Government Resources']
const filters = [
'General Resources',
'Health Organizations',
'LGBT Organizations',
'Legal Services',
'Government Resources',
];
const [summaries, setSummaries] = useState<Resource[]>([]);

useEffect(() => {
fetchData();
}, []);
useEffect(() => {
fetchData();
}, []);

const fetchData = async () => {
try {
const data = await getSeekHelpData();
setSummaries(data);
} catch (error) {
console.error('Error fetching data:', error);
}
};
const fetchData = async () => {
try {
const data = await getSeekHelpData();
setSummaries(data);
} catch (error) {
console.error('Error fetching data:', error);
}
};
return (
<View style={styles.container}>
<View style={styles.leftPanel}>
Expand All @@ -30,36 +37,36 @@ export default function ResourceList() {
</View>
<View style={styles.rightPanel}>
<View>
{summaries.length > 0 ? (
summaries.map((resource, index) => (
<Text key={index}>{resource.summary}</Text>
))
) : (
<Text>Loading...</Text>
)}
{summaries.length > 0 ? (
summaries.map((resource, index) => (
<Text key={index}>{resource.summary}</Text>
))
) : (
<Text>Loading...</Text>
)}
</View>
</View>
</View>
);
}
// return(
// <View style={styles.container}>
// <View style={styles.leftPanel}>
// <Button title="General Resources" />
// <Button title="Health Organizations" />
// <Button title="LGBT Organizations" />
// <Button title="Legal Services" />
// <Button title="Government Resources" />
// </View>
// return(
// <View style={styles.container}>

// <View style={styles.leftPanel}>
// <Button title="General Resources" />
// <Button title="Health Organizations" />
// <Button title="LGBT Organizations" />
// <Button title="Legal Services" />
// <Button title="Government Resources" />
// </View>

// <View style={styles.rightPanel}>
// <Button title="Resource 1" />
// <Button title="Resource 2" />
// <Button title="Resource 3" />
// </View>
// </View>
// )
// <View style={styles.rightPanel}>
// <Button title="Resource 1" />
// <Button title="Resource 2" />
// <Button title="Resource 3" />
// </View>
// </View>
// )

/*
const [summaries, setSummaries] = useState<Resource[]>([]);
Expand Down
20 changes: 10 additions & 10 deletions src/screens/SeekHelp/ResourceList/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,32 @@ import { StyleSheet } from 'react-native';
export const styles = StyleSheet.create({
container: {
display: 'flex',
flexDirection: 'row',
flexDirection: 'row',
marginTop: 10,
padding: 30,
},
leftPanel: {
display: 'flex',
flexDirection: 'column',
justifyContent: 'flex-start',
width: '25%',
paddingRight: 20,
flexDirection: 'column',
justifyContent: 'flex-start',
width: '25%',
paddingRight: 20,
},
rightPanel: {
display: 'flex',
flexDirection: 'column',
width: '75%',
backgroundColor: '#f8f8f8',
flexDirection: 'column',
width: '75%',
backgroundColor: '#f8f8f8',
padding: 10,
},
filterButton: {
backgroundColor: '#e8e8e8',
alignItems: 'center',
justifyContent: 'center',
borderRadius: 5,
marginVertical: 10,
marginVertical: 10,
paddingVertical: 15,
width: '100%',
width: '100%',
},
buttonText: {
fontSize: 16,
Expand Down
16 changes: 11 additions & 5 deletions src/screens/SeekHelp/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,29 @@
// }

import React from 'react';
import { View, Text, TouchableOpacity } from 'react-native';
import {styles} from './styles'; // Make sure this is the correct path
import { Text, TouchableOpacity, View } from 'react-native';
import { styles } from './styles'; // Make sure this is the correct path

export default function SeekHelp({ navigation }: { navigation: any }) {
return (
<View style={styles.container}>
<TouchableOpacity style={styles.button} onPress={() => navigation.navigate('Resource List')}>
<TouchableOpacity
style={styles.button}
onPress={() => navigation.navigate('Resource List')}
>
<Text style={styles.buttonText}>California</Text>
</TouchableOpacity>
<TouchableOpacity style={styles.button} onPress={() => navigation.navigate('Resource List')}>
<TouchableOpacity
style={styles.button}
onPress={() => navigation.navigate('Resource List')}
>
<Text style={styles.buttonText}>National</Text>
</TouchableOpacity>
</View>
);
}

/*
/*
const [summaries, setSummaries] = useState<Resource[]>([]);
useEffect(() => {
Expand Down
14 changes: 7 additions & 7 deletions src/screens/SeekHelp/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { StyleSheet } from 'react-native';

export const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
flex: 1,
justifyContent: 'center',
alignItems: 'center',
marginTop: 10,
padding: 30,
},
Expand All @@ -13,13 +13,13 @@ export const styles = StyleSheet.create({
alignItems: 'center',
justifyContent: 'center',
borderRadius: 5,
marginVertical: 10,
marginVertical: 10,
paddingVertical: 15,
width: '100%',
width: '100%',
},
buttonText: {
fontSize: 18,
color: '#333',
fontWeight: '500',
color: '#333',
fontWeight: '500',
},
});

0 comments on commit e010424

Please sign in to comment.