From c7adbfcbb18c0b7fed716796676ac7be830d6758 Mon Sep 17 00:00:00 2001 From: OlenaIa <121794911+OlenaIa@users.noreply.github.com> Date: Sat, 18 Nov 2023 14:02:51 +0200 Subject: [PATCH] FixBig Nan and adaptive --- src/components/DayDashboard/DayDashboard.jsx | 7 +++--- .../DayDashboard/DayDashboard.styled.js | 5 ++++ src/components/DayExercises/DayExercises.jsx | 12 +++++----- .../DayExercisesItem/DayExercisesItem.jsx | 24 +++++++++---------- src/pages/Diary.jsx | 5 ++++ src/pages/Diary/Diary.styled.js | 4 ++++ .../userIndicators/userIndicatorsSlice.js | 5 +++- 7 files changed, 40 insertions(+), 22 deletions(-) diff --git a/src/components/DayDashboard/DayDashboard.jsx b/src/components/DayDashboard/DayDashboard.jsx index 32cd1e66..e4b15f83 100644 --- a/src/components/DayDashboard/DayDashboard.jsx +++ b/src/components/DayDashboard/DayDashboard.jsx @@ -8,6 +8,7 @@ import { WrapDashText, DashIconExclamationWrapper, IconWrapper, + Message, } from './DayDashboard.styled'; import { useSelector } from 'react-redux'; import { @@ -60,7 +61,7 @@ const DayDashboard = () => { Daily calorie intake - {dayCalories} + {dayCalories !== 0 ? dayCalories : Please enter your details in the profile} @@ -98,7 +99,7 @@ const DayDashboard = () => { {burnCalories} - + { {restCalories} - + { {workouts.length !== 0 ? ( <> - + Body Part - + Equipment - + Name - + Target - + Burned Calories - + Time diff --git a/src/components/DayExercisesItem/DayExercisesItem.jsx b/src/components/DayExercisesItem/DayExercisesItem.jsx index d81a4afa..ec228008 100644 --- a/src/components/DayExercisesItem/DayExercisesItem.jsx +++ b/src/components/DayExercisesItem/DayExercisesItem.jsx @@ -29,34 +29,34 @@ const DayExercisesItem = ({ workout, points }) => { Body Part - = 768) ? '204px' : ((points >= 1440) ? '212px' : '100%')}>{bodyPart} + = 768) ? '90px' : ((points >= 1440) ? '115px' : '100%')}> + {bodyPart} Equipment - = 768) ? '128px' : ((points >= 1440) ? '166px' : '100%')}>{equipment} + = 768) ? '132px' : ((points >= 1440) ? '157px' : '100%')}> + {equipment} Name - = 768) ? '128px' : ((points >= 1440) ? '166px' : '100%')}>{name} + = 768) ? '128px' : ((points >= 1440) ? '131px' : '100%')}> + {name} Target - = 768) ? '90px' : ((points >= 1440) ? '105px' : '100%')}> - {target} - + = 768) ? '84px' : ((points >= 1440) ? '106px' : '100%')}> + {target} Burned Calories - = 768) ? '90px' : ((points >= 1440) ? '105px' : '100%')}> - {burnedCalories} - + = 768) ? '78px' : ((points >= 1440) ? '91px' : '100%')}> + {burnedCalories} Time - = 768) ? '80px' : ((points >= 1440) ? '110px' : '100%')}> - {time} - + = 768) ? '72px' : ((points >= 1440) ? '82px' : '100%')}> + {time} { const dispatch = useDispatch(); @@ -44,6 +45,10 @@ const Diary = () => { dispatch(getDiaryWorkoutThunk(selectedDate)); }, [selectedDate]); + useEffect(() => { + dispatch(getIndicatorsThunk()); + }, []); + return ( diff --git a/src/pages/Diary/Diary.styled.js b/src/pages/Diary/Diary.styled.js index 82676014..8832b739 100644 --- a/src/pages/Diary/Diary.styled.js +++ b/src/pages/Diary/Diary.styled.js @@ -120,7 +120,11 @@ export const WrapTitlesTablet = styled.ul` `; export const DiarySupTitleTablet = styled.li` + display: inline-block; width: ${(props) => props.width || '100%'}; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; `; export const DiaryLists = styled.ul` diff --git a/src/redux/userIndicators/userIndicatorsSlice.js b/src/redux/userIndicators/userIndicatorsSlice.js index 183c515c..538ef127 100644 --- a/src/redux/userIndicators/userIndicatorsSlice.js +++ b/src/redux/userIndicators/userIndicatorsSlice.js @@ -2,7 +2,10 @@ import { createSlice } from '@reduxjs/toolkit'; import { getIndicatorsThunk } from './userIndicOperations'; const initialIndState = { - indicators: {}, + indicators: { + targetBmr: 0, + targetTime: 110 + }, isLoading: false, error: null, };