diff --git a/backend/schema/tasks/task_test.go b/backend/schema/tasks/task_test.go index 84d36c1..f461c4a 100644 --- a/backend/schema/tasks/task_test.go +++ b/backend/schema/tasks/task_test.go @@ -264,8 +264,6 @@ func TestTaskGroup(t *testing.T) { }, } - fmt.Println("Expected: ", expectedTasks) - fmt.Println("Response: ", responseTasks) if !reflect.DeepEqual(expectedTasks, responseTasks) { t.Error("Result was not correct") } diff --git a/backend/schema/tasks/transactions.go b/backend/schema/tasks/transactions.go index 459a109..787cc93 100644 --- a/backend/schema/tasks/transactions.go +++ b/backend/schema/tasks/transactions.go @@ -137,7 +137,6 @@ func GetTasksByAssignedFromDB(pool *pgx.Conn, userIDs []string) ([]models.Task, print(err, "error scanning task ID") return nil, err } - fmt.Println(task_id) task_ids = append(task_ids, task_id) } } diff --git a/client/assets/back-arrow.svg b/client/assets/back-arrow.svg new file mode 100644 index 0000000..99dedf4 --- /dev/null +++ b/client/assets/back-arrow.svg @@ -0,0 +1,4 @@ + + + + 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/babel.config.js b/client/babel.config.js index 3bcdc6f..9fba2f7 100644 --- a/client/babel.config.js +++ b/client/babel.config.js @@ -3,6 +3,10 @@ module.exports = function (api) { return { presets: ['babel-preset-expo'], - plugins: ['react-native-paper/babel', 'nativewind/babel'] + plugins: [ + 'react-native-paper/babel', + 'nativewind/babel', + 'react-native-reanimated/plugin' + ] }; }; diff --git a/client/components/TaskType/BackButton.tsx b/client/components/TaskType/BackButton.tsx new file mode 100644 index 0000000..aab16bf --- /dev/null +++ b/client/components/TaskType/BackButton.tsx @@ -0,0 +1,20 @@ +import React from 'react'; + +import { useNavigation } from '@react-navigation/native'; +import { IconButton } from 'react-native-paper'; + +import BackArrow from '../../assets/back-arrow.svg'; +import { AppStackNavigation } from '../../navigation/AppNavigation'; + +export function BackButton() { + const navigation = useNavigation(); + + return ( + } + onPress={() => navigation.goBack()} + /> + ); +} diff --git a/client/components/TaskType/CloseButton.tsx b/client/components/TaskType/CloseButton.tsx new file mode 100644 index 0000000..8d617ee --- /dev/null +++ b/client/components/TaskType/CloseButton.tsx @@ -0,0 +1,16 @@ +import React from 'react'; + +import { IconButton } from 'react-native-paper'; + +import Close from '../../assets/close.svg'; + +export function CloseButton({ onPress }: { onPress: () => void }) { + return ( + + ); +} diff --git a/client/navigation/AppNavigation.tsx b/client/navigation/AppNavigation.tsx index 724fff7..c407636 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 = { @@ -11,6 +12,7 @@ export type AppStackParamList = { Home: undefined; Login: undefined; Profile: undefined; + TaskType: undefined; }; export type AppStackNavigation = NavigationProp; @@ -30,6 +32,11 @@ export function AppNavigation() { options={{ headerShown: false }} component={AppStackBottomTabNavigator} /> + ); } diff --git a/client/package.json b/client/package.json index 9f2db30..e224d3f 100644 --- a/client/package.json +++ b/client/package.json @@ -24,7 +24,7 @@ "@types/react": "^18.2.55", "axios": "^1.6.4", "clsx": "^2.1.0", - "expo": "50.0.6", + "expo": "^50.0.11", "expo-document-picker": "~11.10.1", "expo-file-system": "~16.0.6", "expo-status-bar": "~1.11.1", @@ -32,6 +32,7 @@ "nativewind": "^2.0.11", "react": "18.2.0", "react-native": "0.73.4", + "react-native-dropdown-picker": "^5.4.6", "react-native-gesture-handler": "~2.14.0", "react-native-paper": "^5.12.3", "react-native-reanimated": "~3.6.2", @@ -42,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] +};