diff --git a/client/assets/close.svg b/client/assets/close.svg new file mode 100644 index 0000000..9bdd105 --- /dev/null +++ b/client/assets/close.svg @@ -0,0 +1,4 @@ + + + + diff --git a/client/components/TaskType/CloseButton.tsx b/client/components/TaskType/CloseButton.tsx index 45167ee..8d617ee 100644 --- a/client/components/TaskType/CloseButton.tsx +++ b/client/components/TaskType/CloseButton.tsx @@ -2,20 +2,14 @@ import React from 'react'; import { IconButton } from 'react-native-paper'; -import Close1 from '../../assets/close/close1.svg'; -import Close2 from '../../assets/close/close2.svg'; +import Close from '../../assets/close.svg'; export function CloseButton({ onPress }: { onPress: () => void }) { return ( ( - <> - - - - )} + icon={Close} onPress={onPress} /> ); diff --git a/client/navigation/AppNavigation.tsx b/client/navigation/AppNavigation.tsx index fba06b2..8cb6ab7 100644 --- a/client/navigation/AppNavigation.tsx +++ b/client/navigation/AppNavigation.tsx @@ -4,6 +4,7 @@ import { NavigationProp } from '@react-navigation/native'; import { createNativeStackNavigator } from '@react-navigation/native-stack'; import LoginPage from '../screens/LoginPage'; +import { TaskType } from '../screens/TaskType'; import { AppStackBottomTabNavigator } from './AppStackBottomTabNavigator'; export type AppStackParamList = { @@ -12,6 +13,7 @@ export type AppStackParamList = { Home: undefined; Login: undefined; Profile: undefined; + TaskType: undefined; }; export type AppStackNavigation = NavigationProp; @@ -31,6 +33,11 @@ export function AppNavigation() { options={{ headerShown: false }} component={AppStackBottomTabNavigator} /> + ); } diff --git a/client/package.json b/client/package.json index 55f2462..e224d3f 100644 --- a/client/package.json +++ b/client/package.json @@ -43,6 +43,7 @@ "devDependencies": { "@babel/core": "^7.20.0", "@trivago/prettier-plugin-sort-imports": "^4.3.0", + "@types/react-native": "^0.73.0", "@typescript-eslint/eslint-plugin": "^6.21.0", "@typescript-eslint/parser": "6.18.0", "eslint": "^8.56.0", diff --git a/client/screens/TaskType.tsx b/client/screens/TaskType.tsx new file mode 100644 index 0000000..35bc59d --- /dev/null +++ b/client/screens/TaskType.tsx @@ -0,0 +1,151 @@ +import React, { + useCallback, + useEffect, + useMemo, + useRef, + useState +} from 'react'; +import { FlatList, View } from 'react-native'; + +import BottomSheet, { + BottomSheetBackdrop, + TouchableOpacity +} from '@gorhom/bottom-sheet'; +import { BottomSheetDefaultBackdropProps } from '@gorhom/bottom-sheet/lib/typescript/components/bottomSheetBackdrop/types'; +import { useNavigation } from '@react-navigation/native'; +import DropDownPicker from 'react-native-dropdown-picker'; +import { GestureHandlerRootView } from 'react-native-gesture-handler'; +import { Button, Text } from 'react-native-paper'; + +import { BackButton } from '../components/TaskType/BackButton'; +import { CloseButton } from '../components/TaskType/CloseButton'; +import { AppStackNavigation } from '../navigation/AppNavigation'; +import { Category, categoryToTypeMap, TypeOfTask } from '../types/type'; + +export function TaskType() { + const navigation = useNavigation(); + + const [open, setOpen] = useState(false); + const [selectedCategory, setSelectedCategory] = useState( + null + ); + const [selectedTypes, setSelectedTypes] = useState( + Object.values(TypeOfTask) + ); + + useEffect(() => { + setSelectedTypes( + selectedCategory + ? categoryToTypeMap[selectedCategory] + : Object.values(TypeOfTask) + ); + }, [selectedCategory]); + + const filters = Object.values(Category).map((filter) => ({ + label: filter, + value: filter + })); + + const bottomSheetSnapPoints = useMemo(() => ['60%'], []); + + const bottomSheetRef = useRef(null); + + const closeBottomSheet = () => { + if (bottomSheetRef.current) { + bottomSheetRef.current.close(); // Close the BottomSheet + } + }; + + const snapToIndex = (index: number) => + bottomSheetRef.current?.snapToIndex(index); + + const renderBackdrop = useCallback( + (props: BottomSheetDefaultBackdropProps) => ( + + ), + [] + ); + + return ( + + + + + + + Step 1 of 2 + + + + Type of Task + + + + + ( + navigation.navigate('New ' + item + ' Task')} + > + + + )} + /> + + + + + Filter + + + + { + closeBottomSheet(); + }} + style={{ + width: '95%', + marginLeft: 'auto', + marginRight: 'auto', + borderRadius: 0, + borderColor: 'transparent', + borderBottomColor: 'black' + }} + /> + + + + ); +} diff --git a/client/types/type.ts b/client/types/type.ts new file mode 100644 index 0000000..985283d --- /dev/null +++ b/client/types/type.ts @@ -0,0 +1,66 @@ +export enum TypeOfTask { + MEDICATION = 'Medication Management', + APPOINTMENT = 'Physician Appointment', + // LABS = 'Labs & Outpatient Services', + // REHAB = 'Rehab & Home Therapies', + // TRANSITIONAL = 'Transitional Care', + GROOMING = 'Grooming', + CONVERSATIONS = 'Family Conversations', + // TRANSPORTATION = 'Transportation', + // RESPITE = 'Respite', + ERRANDS = 'Groceries, Shopping, & Errands', + BILLS = 'Pay Bills', + // PRESCRIPTION = 'Prescription Management', + // SAFETY = 'Home Safety', + DIET = 'Diet & Nutrition', + ACTIVITIES = 'Activities', + INSURANCE = 'Health Insurance', + // FINANCIAL = 'Financial', + // LEGAL = 'Legal', + OTHER = 'Other' +} + +export enum Category { + ALL = '', + HEALTH = 'Health & Medical', + PERSONAL = 'Personal', + HOME = 'Home & Lifestyle', + FINANCIAL = 'Financial & Legal', + OTHER = 'Other' +} + +export const categoryToTypeMap: Record = { + [Category.ALL]: [], + [Category.HEALTH]: [ + TypeOfTask.MEDICATION, + TypeOfTask.APPOINTMENT, + // TypeOfTask.LABS, + // TypeOfTask.REHAB, + // TypeOfTask.TRANSITIONAL, + TypeOfTask.GROOMING, + // TypeOfTask.PRESCRIPTION, + TypeOfTask.DIET + ], + [Category.PERSONAL]: [ + TypeOfTask.GROOMING, + TypeOfTask.CONVERSATIONS, + // TypeOfTask.TRANSPORTATION, + // TypeOfTask.RESPITE, + TypeOfTask.ERRANDS, + // TypeOfTask.SAFETY, + TypeOfTask.BILLS + ], + [Category.HOME]: [ + // TypeOfTask.REHAB, + // TypeOfTask.SAFETY, + TypeOfTask.DIET, + TypeOfTask.ACTIVITIES + ], + [Category.FINANCIAL]: [ + TypeOfTask.BILLS, + TypeOfTask.INSURANCE + // TypeOfTask.FINANCIAL, + // TypeOfTask.LEGAL + ], + [Category.OTHER]: [TypeOfTask.OTHER] +};