import React from 'react' import { Dimensions, View } from 'react-native' import { OButton, OIcon, OText } from '../shared' import { useLanguage, useSession } from 'ordering-components/native' import { useTheme } from 'styled-components/native' export const ScheduleBlocked = (props : any) => { const { nextSchedule } = props const [, t] = useLanguage() const [, {logout}] = useSession() const theme = useTheme() const deviceWidth = Dimensions.get('screen').width const daysOfWeek = [ t('SUNDAY', 'Sunday'), t('MONDAY', 'Monday'), t('TUESDAY', 'Tuesday'), t('WEDNESDAY', 'Wednesday'), t('THURSDAY', 'Thurday'), t('FRIDAY', 'Friday'), t('SATURDAY', 'Saturday'), ] const scheduleFormatted = ({ hour, minute }: any) => { const checkTime = (val: number) => val < 10 ? `0${val}` : val return `${checkTime(hour)}:${checkTime(minute)}` } const goBack = () => { logout() } return ( {t('YOU_CANT_LOGIN', 'You can\'t login')} {t('OUTSIDE_ESTABLISHED_SCHEDULE', 'You are outside the established schedule')} {t('NEXT_TIME', 'Next time')}: {daysOfWeek[nextSchedule?.day]} {scheduleFormatted(nextSchedule?.schedule?.open)} ) }