fix: hide start-end if we have no schedule

This commit is contained in:
Christian Landgren 2021-09-01 10:28:32 +02:00
parent b05dc42a94
commit 616362d14b
2 changed files with 19 additions and 15 deletions

View File

@ -120,11 +120,6 @@ export const ChildListItem = ({ child, color }: ChildListItemProps) => {
/>
</View>
</View>
<Text category="c2" style={styles.label}>
{translate('schedule.start')} - {translate('schedule.end')}
</Text>
<DaySummary child={child} />
{scheduleAndCalendarThisWeek.slice(0, 3).map((calendarItem, i) => (
<Text category="p1" key={i}>

View File

@ -33,17 +33,23 @@ export const DaySummary = ({ child, date = moment() }: DaySummaryProps) => {
const gymBag = lessons.some((lesson) => lesson.code === 'IDH')
return (
<View style={styles.summary}>
<Text category="s1">
{lessons[0].timeStart.slice(0, 5)}-
{lessons[lessons.length - 1].timeEnd.slice(0, 5)}
{gymBag
? ` (🤼‍♀️ ${translate('schedule.gymBag', {
defaultValue: 'Gympapåse',
})})`
: ''}
<>
<Text category="c2" style={styles.label}>
{translate('schedule.start')} - {translate('schedule.end')}
</Text>
</View>
<View style={styles.summary}>
<Text category="s1">
{lessons[0].timeStart.slice(0, 5)}-
{lessons[lessons.length - 1].timeEnd.slice(0, 5)}
{gymBag
? ` (🤼‍♀️ ${translate('schedule.gymBag', {
defaultValue: 'Gympapåse',
})})`
: ''}
</Text>
</View>
</>
)
}
@ -51,4 +57,7 @@ const themedStyles = StyleService.create({
summary: {
flexDirection: 'row',
},
label: {
marginTop: 10,
},
})