-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/type of task screen #45
Merged
Merged
Changes from 10 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
b6dc1ad
feat: task type rough screen and type/category enum
oliviaseds 5cb2b67
feat: all hands screen (no functionality)
oliviaseds f088c0a
feat: filter button
oliviaseds 8383ae5
Merge branch 'main' into feature/task-type-frontend
oliviaseds 724465b
refactor: remove ScrollView and non-Tailwind styling
oliviaseds db9dd79
style: prettier
oliviaseds d1da5d0
feat: can press buttons in not text area
oliviaseds 9e7362e
refactor: export close cross as group for close button
oliviaseds 02e36d2
fix: remove redundant SafeView, Other button not cut off
oliviaseds 94952c5
style: remove unnecessary imports
oliviaseds 4235140
feat: bottom sheet closes when filter is selected
oliviaseds 79ba769
style: fix formatting
oliviaseds File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<AppStackNavigation>(); | ||
|
||
return ( | ||
<IconButton | ||
className="align-center m-2 flex h-[50px] w-[52px] justify-center rounded-xl bg-carewallet-gray" | ||
mode="contained" | ||
icon={({ color }) => <BackArrow fill={color} />} | ||
onPress={() => navigation.goBack()} | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 ( | ||
<IconButton | ||
className="align-center m-2 flex h-[50px] w-[52px] justify-center rounded-xl bg-carewallet-gray" | ||
mode="contained" | ||
icon={Close} | ||
onPress={onPress} | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
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<AppStackNavigation>(); | ||
|
||
const [open, setOpen] = useState(false); | ||
const [selectedCategory, setSelectedCategory] = useState<null | Category>( | ||
null | ||
); | ||
const [selectedTypes, setSelectedTypes] = useState<TypeOfTask[]>( | ||
Object.values(TypeOfTask) | ||
); | ||
|
||
useEffect(() => { | ||
setSelectedTypes( | ||
selectedCategory | ||
? categoryToTypeMap[selectedCategory] | ||
: Object.values(TypeOfTask) | ||
); | ||
}, [selectedCategory]); | ||
|
||
const filters = Object.values(Category).map((filter) => ({ | ||
label: filter, | ||
value: filter | ||
})); | ||
|
||
const snapPoints = useMemo(() => ['60%'], []); | ||
|
||
const bottomSheetRef = useRef<BottomSheet>(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) => ( | ||
<BottomSheetBackdrop | ||
appearsOnIndex={0} | ||
disappearsOnIndex={-1} | ||
{...props} | ||
/> | ||
), | ||
[] | ||
); | ||
|
||
return ( | ||
<GestureHandlerRootView className="mt-10"> | ||
<View className="flex w-full flex-row items-center justify-center"> | ||
<View className="mr-[95px]"> | ||
<BackButton /> | ||
</View> | ||
<Text className="mr-auto self-center text-center text-carewallet-gray"> | ||
Step 1 of 2 | ||
</Text> | ||
</View> | ||
|
||
<Text className="text-center text-2xl font-bold">Type of Task</Text> | ||
<View className="mr-2 flex flex-row justify-end"> | ||
<Button | ||
className="h-[40px] items-center justify-center rounded-xl text-sm" | ||
textColor="black" | ||
mode="outlined" | ||
onPress={() => snapToIndex(0)} | ||
> | ||
Filter | ||
</Button> | ||
</View> | ||
|
||
<FlatList | ||
className="h-full" | ||
data={selectedTypes} | ||
renderItem={({ item }) => ( | ||
<TouchableOpacity | ||
className="m-2 h-[50px] overflow-hidden rounded-xl" | ||
onPress={() => navigation.navigate('New ' + item + ' Task')} | ||
> | ||
<Button | ||
className="m-2 h-[50px] items-center justify-center rounded-xl" | ||
oliviaseds marked this conversation as resolved.
Show resolved
Hide resolved
|
||
textColor="black" | ||
mode="outlined" | ||
> | ||
{item} | ||
</Button> | ||
</TouchableOpacity> | ||
)} | ||
/> | ||
|
||
<BottomSheet | ||
ref={bottomSheetRef} | ||
index={-1} | ||
snapPoints={snapPoints} | ||
enablePanDownToClose={true} | ||
backdropComponent={renderBackdrop} | ||
> | ||
<View> | ||
<View className="flex flex-row justify-between"> | ||
<Text className="m-5 text-2xl font-bold">Filter</Text> | ||
<CloseButton onPress={closeBottomSheet} /> | ||
</View> | ||
|
||
<DropDownPicker | ||
open={open} | ||
value={selectedCategory} | ||
items={filters} | ||
setOpen={setOpen} | ||
setValue={setSelectedCategory} | ||
placeholder="Category" | ||
style={{ | ||
width: '95%', | ||
marginLeft: 'auto', | ||
marginRight: 'auto', | ||
borderRadius: 0, | ||
borderColor: 'transparent', | ||
borderBottomColor: 'black' | ||
}} | ||
/> | ||
</View> | ||
</BottomSheet> | ||
</GestureHandlerRootView> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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, TypeOfTask[]> = { | ||
[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] | ||
}; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
before merging can login be placed back in the first position?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doneeee