From 8af068946d566d6a3f4575b9cea6d65abd2a2a8d Mon Sep 17 00:00:00 2001 From: Palmn72 Date: Mon, 9 Oct 2023 11:35:57 +0200 Subject: [PATCH] feat (navigate to specific tabs from childlist) Co-authored-by: Lee Sheppard Co-authored-by: Lvan Ni --- .../components/childListItem.component.tsx | 116 ++++++++++++------ 1 file changed, 80 insertions(+), 36 deletions(-) diff --git a/apps/skolplattformen-app/components/childListItem.component.tsx b/apps/skolplattformen-app/components/childListItem.component.tsx index 8ca199f5..bd8af4c6 100644 --- a/apps/skolplattformen-app/components/childListItem.component.tsx +++ b/apps/skolplattformen-app/components/childListItem.component.tsx @@ -18,7 +18,7 @@ import { } from '@ui-kitten/components' import moment, { Moment } from 'moment' import React, { useEffect } from 'react' -import { TouchableOpacity, useColorScheme, View } from 'react-native' +import { TouchableOpacity, useColorScheme, View, Pressable } from 'react-native' import { useTranslation } from '../hooks/useTranslation' import { Colors, Layout, Sizing } from '../styles' import { getMeaningfulStartingDate } from '../utils/calendarHelpers' @@ -162,46 +162,81 @@ export const ChildListItem = ({ > - - - - {studentName(child.name)} - {className ? {className} : null} + [ + styles.cardHeader || {}, + { opacity: pressed ? 0.5 : 1 }, + ]} + onPress={() => + navigation.navigate('Child', { + child, + color, + }) + } + > + + + + {studentName(child.name)} + {className ? {className} : null} + - - - - + + + + - + ['' || {}, { opacity: pressed ? 0.5 : 1 }]} + onPress={() => + navigation.navigate('Child', { + child, + color, + initialRouteName: 'Calendar', + }) + } + > + - {scheduleAndCalendarThisWeek.slice(0, 3).map((calendarItem, i) => ( - - {`${calendarItem.title} (${displayDate(calendarItem.startDate)})`} - - ))} + {scheduleAndCalendarThisWeek.slice(0, 3).map((calendarItem, i) => ( + + {`${calendarItem.title} (${displayDate(calendarItem.startDate)})`} + + ))} + - - {t('navigation.news')} - - {notificationsThisWeek.slice(0, 3).map((notification, i) => ( - - {notification.message} + ['' || {}, { opacity: pressed ? 0.5 : 1 }]} + onPress={() => + navigation.navigate('Child', { + child, + color, + initialRouteName: 'News', + }) + } + > + + {t('navigation.news')} - ))} + {notificationsThisWeek.slice(0, 3).map((notification, i) => ( + + {notification.message} + + ))} - {newsThisWeek.slice(0, 3).map((newsItem, i) => ( - - {newsItem.header ?? ''} - - ))} + {newsThisWeek.slice(0, 3).map((newsItem, i) => ( + + {newsItem.header ?? ''} + + ))} + {scheduleAndCalendarThisWeek.length || notificationsThisWeek.length || @@ -211,7 +246,16 @@ export const ChildListItem = ({ )} {shouldShowLunchMenu ? ( - <> + ['' || {}, { opacity: pressed ? 0.5 : 1 }]} + onPress={() => + navigation.navigate('Child', { + child, + color, + initialRouteName: 'Menu', + }) + } + > {meaningfulStartingDate.format( '[' + t('schedule.lunch') + '] dddd' @@ -220,7 +264,7 @@ export const ChildListItem = ({ {menu[meaningfulStartingDate.isoWeekday() - 1]?.description} - + ) : null}