diff --git a/apps/skolplattformen-app/components/__tests__/Menu.test.js b/apps/skolplattformen-app/components/__tests__/Menu.test.js index a78811fd6..bbf7c04dc 100644 --- a/apps/skolplattformen-app/components/__tests__/Menu.test.js +++ b/apps/skolplattformen-app/components/__tests__/Menu.test.js @@ -8,15 +8,15 @@ jest.mock('@skolplattformen/hooks') const defaultItemList = [ { - title: 'Måndag vecka 10', + title: 'Måndag', description: 'Krämiga köttbullar', }, { - title: 'Tisdag vecka 10', + title: 'Tisdag', description: 'Kryddig falukorv', }, { - title: 'Onsdag vecka 10', + title: 'Onsdag', description: 'Sushi', }, ] @@ -32,15 +32,15 @@ const setup = (itemList = defaultItemList) => { test('renders multiple days', () => { const screen = setup() - expect(screen.getByText('Måndag vecka 10')).toBeTruthy() - expect(screen.getByText('Tisdag vecka 10')).toBeTruthy() - expect(screen.getByText('Onsdag vecka 10')).toBeTruthy() + expect(screen.getByText('Måndag')).toBeTruthy() + expect(screen.getByText('Tisdag')).toBeTruthy() + expect(screen.getByText('Onsdag')).toBeTruthy() }) test('renders title and description', () => { const screen = setup() - expect(screen.getByText('Måndag vecka 10')).toBeTruthy() + expect(screen.getByText('Måndag')).toBeTruthy() expect(screen.getByText('Krämiga köttbullar')).toBeTruthy() }) diff --git a/apps/skolplattformen-app/components/menu.component.tsx b/apps/skolplattformen-app/components/menu.component.tsx index 3a527adf5..f324ba63b 100644 --- a/apps/skolplattformen-app/components/menu.component.tsx +++ b/apps/skolplattformen-app/components/menu.component.tsx @@ -25,33 +25,42 @@ export const Menu = () => { const styles = useStyleSheet(themedStyles) const child = useChild() const { data, status, reload } = useMenu(child) + const weekNr = data[0]?.title.split('Vecka')[1] ?? '' return ( - - {translate('menu.emptyHeadline')} - - {translate('menu.emptyText')} - - + + {`${translate('menu.week')} ${weekNr}`} + + + {translate('menu.emptyHeadline')} + + {translate('menu.emptyText')} + + + + } + renderItem={({ item }: ListRenderItemInfo) => ( + + )} + style={styles.container} + refreshControl={ + - - } - renderItem={({ item }: ListRenderItemInfo) => ( - - )} - style={styles.container} - refreshControl={ - - } - /> + } + /> + ) } @@ -81,4 +90,8 @@ const themedStyles = StyleService.create({ ...Sizing.aspectRatio(0.8), marginTop: 50, }, + listHeader: { + paddingTop: 10, + paddingLeft: 15, + }, }) diff --git a/apps/skolplattformen-app/components/menuListItem.component.tsx b/apps/skolplattformen-app/components/menuListItem.component.tsx index 235d9c92e..12ce625f1 100644 --- a/apps/skolplattformen-app/components/menuListItem.component.tsx +++ b/apps/skolplattformen-app/components/menuListItem.component.tsx @@ -3,6 +3,7 @@ import { StyleService, Text, useStyleSheet } from '@ui-kitten/components' import React from 'react' import { View } from 'react-native' import { Sizing, Typography } from '../styles' +import { translate } from '../utils/translation' interface MenuListItemProps { item: MenuItem @@ -10,9 +11,10 @@ interface MenuListItemProps { export const MenuListItem = ({ item }: MenuListItemProps) => { const styles = useStyleSheet(themedStyles) + const day = item.title.split(' ')[0] return ( - {item.title} + {translate(`menu.${day}`)} {item.description} ) diff --git a/apps/skolplattformen-app/components/navigationTitle.component.tsx b/apps/skolplattformen-app/components/navigationTitle.component.tsx index 1b7dbba98..5543175bc 100644 --- a/apps/skolplattformen-app/components/navigationTitle.component.tsx +++ b/apps/skolplattformen-app/components/navigationTitle.component.tsx @@ -19,7 +19,11 @@ export const NavigationTitle = ({ title, subtitle }: NavigationTitleProps) => { {title} )} - {subtitle && {subtitle}} + {subtitle && ( + + {subtitle.substring(0, subtitle.indexOf(' '))} + + )} ) } @@ -32,5 +36,5 @@ const styles = StyleSheet.create({ ...fontSize.sm, fontWeight: '500', }, - subtitle: { ...fontSize.xxs }, + subtitle: { ...fontSize.base }, }) diff --git a/apps/skolplattformen-app/translations/en.json b/apps/skolplattformen-app/translations/en.json index b51da78e3..5edadf76a 100644 --- a/apps/skolplattformen-app/translations/en.json +++ b/apps/skolplattformen-app/translations/en.json @@ -96,6 +96,12 @@ "changeLanguageButton": "Save" }, "menu": { + "Måndag":"Monday", + "Tisdag": "Tuesday", + "Onsdag": "Wednesday", + "Torsdag": "Thursday", + "Fredag": "Friday", + "week": "Week", "emptyHeadline": "The lunch menu looks kinda empty", "emptyText": "Couldn't find anything for this week" }, diff --git a/apps/skolplattformen-app/translations/sv.json b/apps/skolplattformen-app/translations/sv.json index bfd4303b2..9369113e7 100644 --- a/apps/skolplattformen-app/translations/sv.json +++ b/apps/skolplattformen-app/translations/sv.json @@ -96,6 +96,12 @@ "changeLanguageButton": "Spara" }, "menu": { + "Måndag":"Måndag", + "Tisdag": "Tisdag", + "Onsdag": "Onsdag", + "Torsdag": "Torsdag", + "Fredag": "Fredag", + "week": "Vecka", "emptyHeadline": "Det ser lite tomt ut i matsedeln", "emptyText": "Hittade ingenting att visa för den här veckan" },