diff --git a/client/components/QuickTaskCard.tsx b/client/components/QuickTaskCard.tsx index 302a985..9a499ad 100644 --- a/client/components/QuickTaskCard.tsx +++ b/client/components/QuickTaskCard.tsx @@ -1,12 +1,17 @@ import React from 'react'; import { Text, View } from 'react-native'; +import { TaskTypeDescriptions } from '../types/type'; + interface QuickTaskCardProps { name: string; label: string; } -function QuickTaskCard({ name, label }: QuickTaskCardProps): JSX.Element { +export function QuickTaskCard({ + name, + label +}: QuickTaskCardProps): JSX.Element { return ( @@ -16,11 +21,9 @@ function QuickTaskCard({ name, label }: QuickTaskCardProps): JSX.Element { - {label} + {TaskTypeDescriptions[label]} ); } - -export { QuickTaskCard }; diff --git a/client/components/TaskInfoCard.tsx b/client/components/TaskInfoCard.tsx index 883db9f..fe13294 100644 --- a/client/components/TaskInfoCard.tsx +++ b/client/components/TaskInfoCard.tsx @@ -6,6 +6,7 @@ import moment from 'moment'; import Calendar from '../assets/Date_today.svg'; import Time from '../assets/Time.svg'; import { useTaskById } from '../services/task'; +import { TaskTypeDescriptions } from '../types/type'; export function TaskInfoComponent({ name, @@ -40,7 +41,7 @@ export function TaskInfoComponent({ - {category} + {TaskTypeDescriptions[category]} diff --git a/client/screens/Calendar.tsx b/client/screens/Calendar.tsx index d8d287a..54ec378 100644 --- a/client/screens/Calendar.tsx +++ b/client/screens/Calendar.tsx @@ -5,7 +5,7 @@ import React, { useRef, useState } from 'react'; -import { ActivityIndicator, Text, View } from 'react-native'; +import { ActivityIndicator, Pressable, Text, View } from 'react-native'; import BottomSheet, { BottomSheetBackdrop } from '@gorhom/bottom-sheet'; import { BottomSheetDefaultBackdropProps } from '@gorhom/bottom-sheet/lib/typescript/components/bottomSheetBackdrop/types'; @@ -222,7 +222,13 @@ export default function TimelineCalendarScreen() { ItemSeparatorComponent={() => } keyExtractor={(item) => item.task_id.toString()} renderItem={({ item }) => ( - + + navigation.navigate('TaskDisplay', { id: item.task_id }) + } + > + + )} /> diff --git a/client/screens/SingleTask.tsx b/client/screens/SingleTask.tsx index 714d73b..42362bb 100644 --- a/client/screens/SingleTask.tsx +++ b/client/screens/SingleTask.tsx @@ -7,9 +7,9 @@ import DropDownPicker from 'react-native-dropdown-picker'; import CheckMark from '../assets/checkmark.svg'; import Reject from '../assets/reject.svg'; -import { BackButton } from '../components/BackButton'; +import { BackButton } from '../components/task-type/BackButton'; import { useTaskById } from '../services/task'; -import { Category, categoryToTypeMap, TypeOfTask } from '../types/type'; +import { TaskTypeDescriptions, TypeToCategoryMap } from '../types/type'; type ParamList = { mt: { @@ -21,25 +21,9 @@ export default function SingleTaskScreen() { const route = useRoute>(); const { id } = route.params; const [open, setOpen] = useState(false); - const [taskType, setTaskType] = useState(TypeOfTask.ACTIVITIES); const { task, taskIsLoading, taskLabels, taskLabelsIsLoading } = useTaskById(id); - // Gets category based on Task Type - const getCategoryFromTaskType = (taskType: TypeOfTask): Category => { - if (!taskType) { - return Category.ALL; // Return a default category if taskType is undefined - } - // Iterate over each category in the categoryToTypeMap object - for (const category in categoryToTypeMap) { - // Check if the taskType exists in the current category's array of task types - if (categoryToTypeMap[category as Category].includes(taskType)) { - return category as Category; // Return the category if found - } - } - return Category.ALL; // Return a default category if no match is found - }; - if (taskIsLoading || taskLabelsIsLoading) return ( @@ -58,27 +42,34 @@ export default function SingleTaskScreen() { - + ''} + placeholder="To-Do" + style={{ + backgroundColor: 'lightgray', + borderColor: 'gray', + position: 'relative', + zIndex: 10 + }} /> - - {task?.task_title} {'\n'} + + {task?.task_title} + + {moment(task?.start_date).format('hh:mm A')} + {task?.end_date && `- ${moment(task?.end_date).format('hh:mm A')}`} {taskLabels?.map((label) => ( @@ -86,7 +77,8 @@ export default function SingleTaskScreen() { ))} - {getCategoryFromTaskType(taskType)} | {taskType} + {task && + `${TypeToCategoryMap[task.task_type]} | ${TaskTypeDescriptions[task.task_type]}`} diff --git a/client/types/type.ts b/client/types/type.ts index 985283d..a2c8a3c 100644 --- a/client/types/type.ts +++ b/client/types/type.ts @@ -29,7 +29,14 @@ export enum Category { OTHER = 'Other' } -export const categoryToTypeMap: Record = { +export const TypeToCategoryMap: Record = { + med_mgmt: Category.HEALTH, + dr_appt: Category.HEALTH, + financial: Category.FINANCIAL, + other: Category.OTHER +}; + +export const CategoryToTypeMap: Record = { [Category.ALL]: [], [Category.HEALTH]: [ TypeOfTask.MEDICATION, @@ -64,3 +71,10 @@ export const categoryToTypeMap: Record = { ], [Category.OTHER]: [TypeOfTask.OTHER] }; + +export const TaskTypeDescriptions: Record = { + med_mgmt: 'Medication Management', + dr_appt: 'Doctor Appointment', + financial: 'Financial Task', + other: 'Other Task' +};