diff --git a/app/_layout.tsx b/app/_layout.tsx index e45856c..2fceb79 100644 --- a/app/_layout.tsx +++ b/app/_layout.tsx @@ -12,7 +12,7 @@ export default function App() { useEffect(() => { if (auth) { - router.replace('/explore'); + router.replace('./landing'); } else { router.replace('/login'); } @@ -20,7 +20,7 @@ export default function App() { useEffect(() => { if (auth) { - router.replace('/explore'); + router.replace('./landing'); } else { router.replace('/login'); } @@ -35,6 +35,7 @@ export default function App() { + ); } \ No newline at end of file diff --git a/app/generalHelpers.jsx b/app/generalHelpers.jsx index 8c3f822..a0a02ce 100644 --- a/app/generalHelpers.jsx +++ b/app/generalHelpers.jsx @@ -208,9 +208,7 @@ export const PageHeader = ({ }) => { return ( - - {children} - + {children} ) } diff --git a/app/landing.jsx b/app/landing.jsx new file mode 100644 index 0000000..a4d9677 --- /dev/null +++ b/app/landing.jsx @@ -0,0 +1,119 @@ +import React, { useState, useRef, useEffect } from 'react'; +import { View, ScrollView, Text, TouchableOpacity } from 'react-native'; +import { StatusBar } from 'expo-status-bar'; +import { SafeAreaView } from 'react-native-safe-area-context'; +import { Ionicons } from '@expo/vector-icons'; +import { + PageHeader, + StyledContainer, +} from './generalHelpers.jsx'; +import ActionSheet from 'react-native-actions-sheet'; + +const typeMap = { + EMS: 'Medical Services', + Fire: 'Fire Department', + Rescue: 'Fire & EMS' +} + +const deptList = [ + { + deptId: 0, + dept: 'Darien EMS', + deptAbv: 'DEMS', + rank: 'Assistant Director', + rankAbv: 'Asst. Director', + type: 'EMS', + primary: true, + selected: true, + admin: true, + }, + { + deptId: 1, + dept: 'Noroton Fire Department', + deptAbv: 'NFD', + rank: 'Lieutenant', + rankAbv: 'Lt.', + type: 'Fire', + primary: false, + selected: false, + admin: true, + }, + { + deptId: 2, + dept: 'Stamford Fire Department', + deptAbv: 'SFD', + rank: 'Paramedic', + rankAbv: 'EMT-P', + type: 'Rescue', + primary: false, + selected: false, + admin: true, + }, +] + +export default function Landing() { + const actionSheetRef = useRef(null); + const selectedDepartment = deptList?.find((dept) => { + return dept?.selected; + }); + + const updateSelectedDepartment = (currentSelectedId, newSelectedId) => { + console.log('items: ', currentSelectedId, newSelectedId); + }; + + return ( + + + + { + actionSheetRef.current?.show(); + }}> + {selectedDepartment?.deptAbv} + + + + + + + + + + {deptList?.map((item) => { + return ( + + + + {item?.dept} + {item?.primary ? * : null} + + {`${item?.deptAbv} - ${typeMap[item?.type]}`} + + + ); + })} + + + + ); + } \ No newline at end of file diff --git a/app/login.jsx b/app/login.jsx index 6f186c3..521d3ba 100644 --- a/app/login.jsx +++ b/app/login.jsx @@ -1,8 +1,9 @@ import React, { useState, useEffect } from 'react'; +import { View } from 'react-native'; import { StatusBar } from 'expo-status-bar'; import { useFormik } from 'formik'; import { SafeAreaView } from 'react-native-safe-area-context'; -import { Link } from 'expo-router'; +import { router, Link } from 'expo-router'; import { PageHeader, StyledContainer, @@ -24,6 +25,7 @@ import { export default function TabLayout() { const [hidePassword, setHidePassword] = useState(true); const [loginButtonDisabled, setLoginButtonDisabled] = useState(true); + const [auth, setAuth] = useState(true); const formik = useFormik({ initialValues: { @@ -33,6 +35,7 @@ export default function TabLayout() { onSubmit: (values) => { values.number = values.number.replace(/[()\-\s]/g, ''); console.log(values); + setAuth(true); }, }); @@ -47,10 +50,18 @@ export default function TabLayout() { } } }, [formValues]) + + useEffect(() => { + if (auth) { + router.navigate('./landing'); + } + }, [auth]) return ( - + + + diff --git a/hooks/useCallFeed/useCallFeed.js b/hooks/useCallFeed/useCallFeed.js new file mode 100644 index 0000000..e69de29 diff --git a/package-lock.json b/package-lock.json index 4678489..5da916c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,6 +23,7 @@ "react": "18.2.0", "react-dom": "18.2.0", "react-native": "0.74.3", + "react-native-actions-sheet": "^0.9.7", "react-native-dropdown-picker": "^5.4.6", "react-native-gesture-handler": "~2.16.1", "react-native-reanimated": "~3.10.1", @@ -15817,6 +15818,17 @@ } } }, + "node_modules/react-native-actions-sheet": { + "version": "0.9.7", + "resolved": "https://registry.npmjs.org/react-native-actions-sheet/-/react-native-actions-sheet-0.9.7.tgz", + "integrity": "sha512-rjUwxUr5dxbdSLDtLDUFAdSlFxpNSpJsbXLhHkBzEBMxEMPUhRT3zqbvKqsPj0JUkjwuRligxrhbIJZkg/6ZDw==", + "license": "MIT", + "peerDependencies": { + "react-native": "*", + "react-native-gesture-handler": "*", + "react-native-safe-area-context": "*" + } + }, "node_modules/react-native-dropdown-picker": { "version": "5.4.6", "resolved": "https://registry.npmjs.org/react-native-dropdown-picker/-/react-native-dropdown-picker-5.4.6.tgz", diff --git a/package.json b/package.json index d443123..2d2a2ae 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "react": "18.2.0", "react-dom": "18.2.0", "react-native": "0.74.3", + "react-native-actions-sheet": "^0.9.7", "react-native-dropdown-picker": "^5.4.6", "react-native-gesture-handler": "~2.16.1", "react-native-reanimated": "~3.10.1",