-
Notifications
You must be signed in to change notification settings - Fork 0
Feat/diet recipe card #68
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
Changes from all commits
69cd3b0
116dc06
3fa7170
9134d7d
6e25e4f
3e5af6b
e2a0b97
58bf42c
fbc4cd0
bf81af7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| allowBuilds: | ||
| '@swc/core': false | ||
| esbuild: false |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| import { Box, useTheme } from '@mui/material' | ||
| import { getDividerStyles } from './styles' | ||
|
|
||
| interface SGLDividerProps { | ||
| orientation?: 'horizontal' | 'vertical' | ||
| } | ||
|
|
||
| export const SGLDivider = ({ orientation = 'horizontal' }: SGLDividerProps = {}) => { | ||
| const theme = useTheme() | ||
| const dividerStyles = getDividerStyles(theme) | ||
|
|
||
| const styles = | ||
| orientation === 'vertical' ? dividerStyles.dividerVertical : dividerStyles.dividerHorizontal | ||
|
|
||
| return <Box style={styles} /> | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export { SGLDivider } from './SGLDivider' |
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why does the divider here? |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,25 @@ | ||
| import { styled } from '@mui/material' | ||
| import type { Theme } from '@mui/material' | ||
| import type { CSSProperties } from 'react' | ||
|
|
||
| export const SGLDivider = styled('div')(() => ({ | ||
| display: 'none', | ||
| })) | ||
| export interface DividerStylesInterface { | ||
| dividerHorizontal: CSSProperties | ||
| dividerVertical: CSSProperties | ||
| } | ||
|
|
||
| export const getDividerStyles = (theme: Theme): DividerStylesInterface => ({ | ||
| dividerHorizontal: { | ||
| width: '100%', | ||
| height: '1px', | ||
| backgroundColor: theme.palette.mediumGrey?.main || '#e0e0e0', | ||
| marginTop: '1.5rem', | ||
| marginBottom: '1.5rem', | ||
| }, | ||
|
|
||
| dividerVertical: { | ||
| width: '1px', | ||
| height: '100%', | ||
| backgroundColor: theme.palette.mediumGrey?.main || '#e0e0e0', | ||
| marginLeft: '1.5rem', | ||
| marginRight: '1.5rem', | ||
| }, | ||
| }) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,16 @@ | ||
| import { useTranslation } from 'react-i18next' | ||
| import { BalanceTraining } from './physioAndTrainingTab/balanceTraining/BalanceTraining' | ||
| import { DietTabExample } from './dietTab/DietTabExample' | ||
| import { RecomendationTraining } from './physioAndTrainingTab/recomendationTraining/RecomendationTraining' | ||
|
|
||
| export const LifeStyle = () => { | ||
| return <RecomendationTraining /> | ||
| const { t } = useTranslation() | ||
| return ( | ||
| <> | ||
| <div>{t('lifestyle.page')}</div> | ||
| <BalanceTraining /> | ||
| <RecomendationTraining /> | ||
| <DietTabExample /> | ||
| </> | ||
| ) | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| import { useTranslation } from 'react-i18next' | ||
| import { SGLMealRecommendation } from './mealRecommendation' | ||
|
|
||
| export const DietTabExample = () => { | ||
| const { t } = useTranslation() | ||
| const mealsData = [ | ||
| { | ||
| mealType: 'ארוחת צהריים מומלצת', | ||
| name: 'סלמון אפוי', | ||
| recipe: 'סלמון טרי אפוי עם לימון וצמחי תיבול', | ||
| fullRecipe: `סלמון אפוי עם לימון וצמחי תיבול - מומלץ מאוד לבריאות הלב | ||
|
|
||
| חומרים: | ||
| • 200 גר סלמון טרי | ||
| • לימון אחד | ||
| • בזיליקום, כוסברה, דיל | ||
| • שמן זית | ||
|
|
||
| הוראות: | ||
| 1. חמם תנור ל-180 מעלות | ||
| 2. הנח סלמון על נייר אפייה | ||
| 3. ריסה עם שמן זית, מלח ופלפל | ||
| 4. פזר צמחי תיבול | ||
| 5. אפה 15-20 דקות עד שהסלמון בשל | ||
| 6. הגש עם לימון טרי`, | ||
| }, | ||
| { | ||
| mealType: 'חטיף מומלץ', | ||
| name: 'סלט ירוקים', | ||
| recipe: 'תערובת ירוקים טרייה עם עגבניה ומלפפון', | ||
| fullRecipe: `סלט ירוקים טרי ובריא | ||
|
|
||
| חומרים: | ||
| • עלי סלט מעורבים 150 גר | ||
| • 2 עגבניות בינוניות | ||
| • מלפפון אחד | ||
| • בצל אדום קצוץ | ||
| • זיתים שחורים | ||
| • שמן זית וחומץ בלסמי | ||
|
|
||
| הוראות: | ||
| 1. שטוף את הירוקים היטב | ||
| 2. חתוך את הירקות לגדלים נוחים | ||
| 3. מיזג את כל החומרים בקערה | ||
| 4. מחבל שמן זית וחומץ בחומס בנפרד | ||
| 5. מוזג את הרוטב על הסלט | ||
| 6. ערבב ברכות`, | ||
| }, | ||
| { | ||
| mealType: 'ארוחת ערב מומלצת', | ||
| name: 'עוף ברוטב עלים', | ||
| recipe: 'עוף צלול עם רוטב עלים טבעי וחומרים מזינים', | ||
| fullRecipe: `עוף ברוטב עלים טבעי | ||
|
|
||
| חומרים: | ||
| • 250 גר בקע עוף | ||
| • 100 מ"ל מרק עוף | ||
| • כוסברית, בזיליקום, כוסבר | ||
| • שום 2 שיניים | ||
| • שמן זית | ||
|
|
||
| הוראות: | ||
| 1. חמם שמן זית בחליה | ||
| 2. הוסף בקע עוף עד להשחמה | ||
| 3. הוסף שום קצוץ | ||
| 4. שפוך מרק עוף | ||
| 5. הוסף צמחי תיבול | ||
| 6. בישול על אש בינונית 15-20 דקות | ||
| 7. הגש חם`, | ||
| }, | ||
| ] | ||
|
Comment on lines
+6
to
+71
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Move meal data to i18n translations or a data service. The meal data is hardcoded in Hebrew within the component, preventing internationalization and making maintenance difficult. Since the codebase uses react-i18next (and the PR adds i18n keys for other fields), these meal definitions should follow the same pattern. Consider:
🤖 Prompt for AI Agents |
||
|
|
||
| return ( | ||
| <div style={{ padding: '16px' }}> | ||
| <h2>{t('mealRecommendation.dailyMeals')}</h2> | ||
| {mealsData.map((meal, index) => ( | ||
| <SGLMealRecommendation | ||
| key={index} | ||
| mealType={meal.mealType} | ||
| name={meal.name} | ||
| recipe={meal.recipe} | ||
| fullRecipe={meal.fullRecipe} | ||
| /> | ||
| ))} | ||
| </div> | ||
| ) | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| import { Typography } from '@mui/material' | ||
| import { useTheme } from '@mui/material' | ||
| import { useTranslation } from 'react-i18next' | ||
| import { getMealRecommendationStyles } from './styles' | ||
| import { SGLButton } from '../../../../components/UI/Button/SGLButton' | ||
| import { SGLCard } from '../../../../components/UI/Card/SGLCard' | ||
| import { SGLLink } from '../../../../components/UI/Icons/Link/SGLLink' | ||
| import { SGLTypography } from '../../../../components/UI/Typography/SGLTypography' | ||
| import { variantMap } from '../../../../components/UI/Typography/types' | ||
|
|
||
| interface MealCardProps { | ||
| mealType: string | ||
| name: string | ||
| recipe: string | ||
| imageUrl?: string | ||
| onOpenDialog: () => void | ||
| } | ||
|
|
||
| export const MealCard = ({ mealType, name, recipe, imageUrl, onOpenDialog }: MealCardProps) => { | ||
| const theme = useTheme() | ||
| const { t } = useTranslation() | ||
| const styles = getMealRecommendationStyles(theme) | ||
|
|
||
| return ( | ||
| <> | ||
| <Typography variant="h6" sx={{ marginBottom: 1, fontWeight: 600 }}> | ||
| {mealType} | ||
| </Typography> | ||
| <SGLCard variant="white"> | ||
| <div style={styles.container}> | ||
| <div style={styles.heroImage(imageUrl)}> | ||
| <div style={styles.iconContainer}> | ||
| <SGLLink {...styles.linkIcon} /> | ||
| </div> | ||
| </div> | ||
| <div style={styles.content}> | ||
| <Typography variant={variantMap.smallTitle}>{name}</Typography> | ||
| <Typography variant={variantMap.smallText}>{recipe}</Typography> | ||
| </div> | ||
| <div style={styles.buttonWrapper}> | ||
| <SGLButton onClick={onOpenDialog} variant="outlined" sx={styles.mealButton(theme)}> | ||
| <SGLTypography variant="smallTitle"> | ||
| {t('mealRecommendation.viewFullRecipe')} | ||
| </SGLTypography> | ||
| </SGLButton> | ||
| </div> | ||
| </div> | ||
| </SGLCard> | ||
| </> | ||
| ) | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| import { Typography, Dialog, DialogTitle, DialogContent, DialogActions } from '@mui/material' | ||
| import { useTheme } from '@mui/material' | ||
| import { useTranslation } from 'react-i18next' | ||
| import { getMealRecommendationStyles } from './styles' | ||
| import { SGLButton } from '../../../../components/UI/Button/SGLButton' | ||
| import { variantMap } from '../../../../components/UI/Typography/types' | ||
|
|
||
| interface MealDialogProps { | ||
| name: string | ||
| recipe: string | ||
| fullRecipe?: string | ||
| open: boolean | ||
| onClose: () => void | ||
| } | ||
|
|
||
| export const MealDialog = ({ name, recipe, fullRecipe, open, onClose }: MealDialogProps) => { | ||
| const theme = useTheme() | ||
| const { t } = useTranslation() | ||
| const styles = getMealRecommendationStyles(theme) | ||
|
|
||
| return ( | ||
| <Dialog open={open} onClose={onClose} fullWidth> | ||
| <DialogTitle sx={styles.dialogTitle}>{name}</DialogTitle> | ||
| <DialogContent> | ||
| <Typography variant={variantMap.mediumText}>{fullRecipe || recipe}</Typography> | ||
| </DialogContent> | ||
| <DialogActions> | ||
| <SGLButton onClick={onClose} fullWidth variant="contained" sx={styles.closeButton}> | ||
| {t('mealRecommendation.close')} | ||
| </SGLButton> | ||
| </DialogActions> | ||
| </Dialog> | ||
| ) | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| import { useState } from 'react' | ||
| import { MealCard } from './MealCard' | ||
| import { MealDialog } from './MealDialog' | ||
|
|
||
| interface SGLMealRecommendationProps { | ||
| mealType: string | ||
| name: string | ||
| recipe: string | ||
| fullRecipe?: string | ||
| imageUrl?: string | ||
| } | ||
|
|
||
| export const SGLMealRecommendation = ({ | ||
| mealType, | ||
| name, | ||
| recipe, | ||
| fullRecipe, | ||
| imageUrl, | ||
| }: SGLMealRecommendationProps) => { | ||
| const [openDialog, setOpenDialog] = useState(false) | ||
|
|
||
| return ( | ||
| <> | ||
| <MealCard | ||
| mealType={mealType} | ||
| name={name} | ||
| recipe={recipe} | ||
| imageUrl={imageUrl} | ||
| onOpenDialog={() => setOpenDialog(true)} | ||
| /> | ||
| <MealDialog | ||
| name={name} | ||
| recipe={recipe} | ||
| fullRecipe={fullRecipe} | ||
| open={openDialog} | ||
| onClose={() => setOpenDialog(false)} | ||
| /> | ||
| </> | ||
| ) | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export { SGLMealRecommendation } from './MealRecommendation' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you have divider changes in this pr?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tg14102005-a11y please address this comment from @Tamir198
https://github.com/ColmanDevClubORG/Sagol360Management/pull/68/changes#r3215472919