-
Notifications
You must be signed in to change notification settings - Fork 0
[APP] Dish detail page #359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
ec2da1a
feat(356): add dish detail modal page
timothyrusso 2bad097
feat(356): add image and description body
timothyrusso 597e36c
feat(256): add dish description
timothyrusso f4a2bfe
feat(356): badge components
timothyrusso c1affe4
feat(356): add food badges
timothyrusso fc83f8c
fix(356): add in line badges
timothyrusso 62cc72b
fix(356): architecture rule violation
timothyrusso 5291d02
fix(356): use i18n key for ingredients list title
timothyrusso 8296e93
fix(356): add accessibilityLabel to badge image for screen readers
timothyrusso 95737d8
fix(356): add accessibility role and label to dish item pressable
timothyrusso 77b8e97
fix(356): add accessibilityLabel to dietary badge images in dish item
timothyrusso File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
7 changes: 7 additions & 0 deletions
7
app/(main)/(authenticated)/create-trip/dish-details-modal.tsx
This file contains hidden or 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,7 @@ | ||
| import { DishDetailsModalPage } from '@/features/trips/pages'; | ||
|
|
||
| const DishDetailsModal = () => { | ||
| return <DishDetailsModalPage />; | ||
| }; | ||
|
|
||
| export default DishDetailsModal; |
This file contains hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| export const Modals = { | ||
| TypicalDishes: 'typical-dishes-modal', | ||
| DishDetails: 'dish-details-modal', | ||
| } as const; | ||
|
|
||
| export type Modals = (typeof Modals)[keyof typeof Modals]; |
This file contains hidden or 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 hidden or 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 hidden or 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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
47 changes: 47 additions & 0 deletions
47
features/core/ui/components/composite/Badge/Badge.style.ts
This file contains hidden or 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,47 @@ | ||
| import { colors } from '@/features/core/ui/style/colors'; | ||
| import { components } from '@/features/core/ui/style/dimensions/components'; | ||
| import { fontSize } from '@/features/core/ui/style/dimensions/fontSize'; | ||
| import { spacing } from '@/features/core/ui/style/dimensions/spacing'; | ||
| import { fontFamily } from '@/features/core/ui/style/fontFamily'; | ||
| import { StyleSheet } from 'react-native'; | ||
|
|
||
| export const styles = (active: boolean, backgroundColor: string) => | ||
| StyleSheet.create({ | ||
| container: { | ||
| alignItems: 'center', | ||
| gap: spacing.Single, | ||
| }, | ||
| circleWrapper: { | ||
| width: components.badgeCircleSize, | ||
| height: components.badgeCircleSize, | ||
| }, | ||
| circle: { | ||
| width: components.badgeCircleSize, | ||
| height: components.badgeCircleSize, | ||
| borderRadius: components.badgeCircleSize / 2, | ||
| alignItems: 'center', | ||
| justifyContent: 'center', | ||
| backgroundColor: active ? backgroundColor : colors.primaryRed, | ||
| }, | ||
| checkBadge: { | ||
| position: 'absolute', | ||
| bottom: 0, | ||
| right: 0, | ||
| width: components.badgeCheckSize, | ||
| height: components.badgeCheckSize, | ||
| borderRadius: components.badgeCheckSize / 2, | ||
| backgroundColor: colors.primaryWhite, | ||
| alignItems: 'center', | ||
| justifyContent: 'center', | ||
| }, | ||
| badgeImage: { | ||
| width: components.badgeCircleSize * 0.6, | ||
| height: components.badgeCircleSize * 0.6, | ||
| }, | ||
| label: { | ||
| fontSize: fontSize.XS, | ||
| fontFamily: fontFamily.interBold, | ||
| color: colors.primaryBlack, | ||
| textAlign: 'center', | ||
| }, | ||
| }); | ||
|
timothyrusso marked this conversation as resolved.
|
||
This file contains hidden or 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,39 @@ | ||
| import { CustomIcon } from '@/features/core/ui/components/basic/CustomIcon/CustomIcon'; | ||
| import { CustomImage } from '@/features/core/ui/components/basic/CustomImage/CustomImage'; | ||
| import { CustomText } from '@/features/core/ui/components/basic/CustomText/CustomText'; | ||
| import { styles as badgeStyle } from '@/features/core/ui/components/composite/Badge/Badge.style'; | ||
| import { colors } from '@/features/core/ui/style/colors'; | ||
| import { spacing } from '@/features/core/ui/style/dimensions/spacing'; | ||
| import { icons } from '@/features/core/ui/style/icons'; | ||
| import type { FC } from 'react'; | ||
| import type { ImageSourcePropType } from 'react-native'; | ||
| import { View } from 'react-native'; | ||
|
|
||
| type BadgeProps = { | ||
| label: string; | ||
| image: ImageSourcePropType; | ||
| backgroundColor: string; | ||
| active: boolean; | ||
| }; | ||
|
|
||
| export const Badge: FC<BadgeProps> = ({ label, image, backgroundColor, active }) => { | ||
| const styles = badgeStyle(active, backgroundColor); | ||
|
|
||
| return ( | ||
| <View style={styles.container}> | ||
| <View style={styles.circleWrapper}> | ||
| <View style={styles.circle}> | ||
| <CustomImage source={image} style={styles.badgeImage} accessibilityLabel={label} /> | ||
| </View> | ||
| <View style={styles.checkBadge}> | ||
| <CustomIcon | ||
| name={active ? icons.success : icons.closeCircle} | ||
|
sourcery-ai[bot] marked this conversation as resolved.
|
||
| size={spacing.TripleAndHalf} | ||
| color={active ? colors.tertiaryGreen : colors.primaryRed} | ||
| /> | ||
| </View> | ||
| </View> | ||
| <CustomText text={label.toLocaleUpperCase()} style={styles.label} /> | ||
| </View> | ||
| ); | ||
| }; | ||
|
timothyrusso marked this conversation as resolved.
|
||
19 changes: 19 additions & 0 deletions
19
features/core/ui/components/composite/BottomSheetHeader/BottomSheetHeader.style.ts
This file contains hidden or 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,19 @@ | ||
| import { fontSize } from '@/features/core/ui/style/dimensions/fontSize'; | ||
| import { spacing } from '@/features/core/ui/style/dimensions/spacing'; | ||
| import { fontFamily } from '@/features/core/ui/style/fontFamily'; | ||
| import { StyleSheet } from 'react-native'; | ||
|
|
||
| export const styles = StyleSheet.create({ | ||
| container: { | ||
| flexDirection: 'row', | ||
| justifyContent: 'space-between', | ||
| alignItems: 'center', | ||
| paddingBottom: spacing.Double, | ||
| marginBottom: spacing.Fourfold, | ||
| }, | ||
| title: { | ||
| fontFamily: fontFamily.interExtraBold, | ||
| fontSize: fontSize.XL2, | ||
| maxWidth: '90%', | ||
| }, | ||
| }); |
19 changes: 19 additions & 0 deletions
19
features/core/ui/components/composite/BottomSheetHeader/BottomSheetHeader.tsx
This file contains hidden or 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,19 @@ | ||
| import { ButtonType } from '@/features/core/ui/components/basic/CustomButton/CustomButton.logic'; | ||
| import { CustomIconButtonMedium } from '@/features/core/ui/components/basic/CustomIconButton/CustomIconButtonMedium'; | ||
| import { CustomText } from '@/features/core/ui/components/basic/CustomText/CustomText'; | ||
| import { styles } from '@/features/core/ui/components/composite/BottomSheetHeader/BottomSheetHeader.style'; | ||
| import { icons } from '@/features/core/ui/style/icons'; | ||
| import type { FC } from 'react'; | ||
| import { View } from 'react-native'; | ||
|
|
||
| type BottomSheetHeaderProps = { | ||
| title: string; | ||
| onClose: () => void; | ||
| }; | ||
|
|
||
| export const BottomSheetHeader: FC<BottomSheetHeaderProps> = ({ title, onClose }) => ( | ||
| <View style={styles.container}> | ||
| <CustomText text={title} style={styles.title} numberOfLines={2} ellipsizeMode="tail" /> | ||
| <CustomIconButtonMedium iconName={icons.close} buttonType={ButtonType.Quaternary} onPress={onClose} /> | ||
| </View> | ||
| ); |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -5,4 +5,5 @@ export const images = { | |
| logoRoundHeight: 80, | ||
| logoRoundWidth: 80, | ||
| dishImageSize: 80, | ||
| dishFullImageSize: 110, | ||
| }; | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
26 changes: 23 additions & 3 deletions
26
features/trips/ui/components/FoodCard/components/DishItem/DishItem.logic.ts
This file contains hidden or 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 |
|---|---|---|
| @@ -1,6 +1,26 @@ | ||
| import { useGetWikimediaDishImage } from '@/features/core/images'; | ||
| import type { TypicalDish } from '@/features/trips'; | ||
|
|
||
| export const useDishItemLogic = (searchTerm: string) => { | ||
| const { data, isLoading } = useGetWikimediaDishImage(searchTerm); | ||
| return { image: data?.url, isLoading }; | ||
| const glutenFreeImage = require('@/features/core/ui/assets/images/gluten_free.png'); | ||
|
timothyrusso marked this conversation as resolved.
|
||
| const veganImage = require('@/features/core/ui/assets/images/vegan.png'); | ||
| const vegetarianImage = require('@/features/core/ui/assets/images/vegetarian.png'); | ||
|
|
||
| export const useDishItemLogic = (dish: TypicalDish) => { | ||
| const { data, isLoading } = useGetWikimediaDishImage(dish.searchTerm); | ||
| const hasBadge = dish.isGlutenFree || dish.isVegan || dish.isVegetarian; | ||
|
|
||
| return { | ||
| image: data?.url, | ||
| isLoading, | ||
| glutenFreeImage, | ||
| veganImage, | ||
| vegetarianImage, | ||
| hasBadge, | ||
| isGlutenFree: dish.isGlutenFree, | ||
| isVegan: dish.isVegan, | ||
| isVegetarian: dish.isVegetarian, | ||
| glutenFreeLabel: 'MY_TRIP.GLUTEN_FREE', | ||
| veganLabel: 'MY_TRIP.VEGAN', | ||
| vegetarianLabel: 'MY_TRIP.VEGETARIAN', | ||
| }; | ||
| }; | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.