-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(exams): provide a feedback when an exam cannot be booked, Ref #495 (
#499) * fix(exams): provide a feedback when an exam cannot be booked, Ref #495 * fix(exams): fix icon not bookable and places not available, Refs #495
- Loading branch information
1 parent
03b9104
commit e1f6822
Showing
12 changed files
with
117 additions
and
10 deletions.
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
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,41 @@ | ||
import { PropsWithChildren } from 'react'; | ||
import { Platform, ViewProps } from 'react-native'; | ||
|
||
import { Card } from '@lib/ui/components/Card'; | ||
import { Text } from '@lib/ui/components/Text'; | ||
import { useTheme } from '@lib/ui/hooks/useTheme'; | ||
|
||
type Props = PropsWithChildren< | ||
ViewProps & { | ||
text: string; | ||
} | ||
>; | ||
|
||
export const ErrorCard = ({ text, ...rest }: Props) => { | ||
const { spacing, fontSizes, colors } = useTheme(); | ||
return ( | ||
<Card | ||
accessible={Platform.select({ android: true, ios: false })} | ||
rounded | ||
// rounded={rounded ?? Platform.select({ android: false })} | ||
spaced | ||
translucent={false} | ||
style={{ | ||
borderStyle: 'solid', | ||
borderWidth: 1, | ||
borderColor: colors.errorCardBorder, | ||
}} | ||
{...rest} | ||
> | ||
<Text | ||
style={{ | ||
padding: spacing[5], | ||
color: colors.errorCardText, | ||
fontSize: fontSizes.sm, | ||
}} | ||
> | ||
{text.charAt(0).toUpperCase() + text.slice(1).toLowerCase()} | ||
</Text> | ||
</Card> | ||
); | ||
}; |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,12 @@ | ||
import { DateTime } from 'luxon'; | ||
|
||
export const isExamPassed = (bookingEndsAt: Date) => { | ||
return DateTime.now().setZone('Europe/Rome').toJSDate() > bookingEndsAt; | ||
}; | ||
|
||
export const getExam = (bookedCount: number, availableCount: number) => { | ||
if (availableCount === 999) { | ||
return `${bookedCount}`; | ||
} | ||
return `${bookedCount}/${availableCount + bookedCount}`; | ||
}; |