@wger-project/react-components 25.11.22 → 25.12.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/assets/index.css +1 -1
- package/build/locales/de/translation.json +13 -4
- package/build/locales/en/translation.json +9 -0
- package/build/locales/hi/translation.json +5 -0
- package/build/locales/nl/translation.json +242 -238
- package/build/locales/pt_BR/translation.json +340 -255
- package/build/main.js +156 -152
- package/build/main.js.map +1 -1
- package/package.json +5 -2
- package/src/components/Dashboard/ConfigurableDashboard.tsx +228 -0
- package/src/components/Dashboard/DashboardCard.tsx +121 -0
- package/src/components/Dashboard/EmptyCard.tsx +3 -3
- package/src/components/Dashboard/GoalCard.tsx +71 -0
- package/src/components/Dashboard/NutritionCard.tsx +88 -96
- package/src/components/Dashboard/RoutineCard.tsx +54 -69
- package/src/components/Dashboard/WeightCard.tsx +36 -42
- package/src/components/Exercises/Detail/Head/ExerciseDeleteDialog.tsx +1 -1
- package/src/components/WorkoutRoutines/Detail/WorkoutStats.tsx +1 -1
- package/src/components/WorkoutRoutines/widgets/forms/DayTypeSelect.tsx +1 -2
- package/src/components/WorkoutRoutines/widgets/forms/SlotForm.tsx +0 -4
- package/src/index.tsx +0 -46
- package/src/routes.tsx +82 -79
- package/src/services/exerciseTranslation.ts +5 -6
- package/src/services/video.test.ts +4 -4
- package/src/components/Dashboard/Dashboard.tsx +0 -22
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import ExpandLessIcon from "@mui/icons-material/ExpandLess";
|
|
2
|
-
import ExpandMoreIcon from
|
|
3
|
-
import HistoryEduIcon from
|
|
2
|
+
import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
|
|
3
|
+
import HistoryEduIcon from "@mui/icons-material/HistoryEdu";
|
|
4
4
|
import PhotoIcon from "@mui/icons-material/Photo";
|
|
5
5
|
import {
|
|
6
6
|
Alert,
|
|
7
7
|
Avatar,
|
|
8
8
|
Button,
|
|
9
|
-
Card,
|
|
10
|
-
CardActions,
|
|
11
|
-
CardContent,
|
|
12
|
-
CardHeader,
|
|
13
9
|
Collapse,
|
|
14
10
|
IconButton,
|
|
15
11
|
List,
|
|
@@ -19,7 +15,7 @@ import {
|
|
|
19
15
|
ListItemIcon,
|
|
20
16
|
ListItemText,
|
|
21
17
|
Snackbar,
|
|
22
|
-
} from
|
|
18
|
+
} from "@mui/material";
|
|
23
19
|
import Tooltip from "@mui/material/Tooltip";
|
|
24
20
|
import { LoadingPlaceholder } from "components/Core/LoadingWidget/LoadingWidget";
|
|
25
21
|
import { WgerModal } from "components/Core/Modals/WgerModal";
|
|
@@ -31,16 +27,15 @@ import { useAddDiaryEntryQuery, useFetchLastNutritionalPlanQuery } from "compone
|
|
|
31
27
|
import { NutritionalValuesDashboardChart } from "components/Nutrition/widgets/charts/NutritionalValuesDashboardChart";
|
|
32
28
|
import { NutritionDiaryEntryForm } from "components/Nutrition/widgets/forms/NutritionDiaryEntryForm";
|
|
33
29
|
import { PlanForm } from "components/Nutrition/widgets/forms/PlanForm";
|
|
34
|
-
import React, { useState } from
|
|
30
|
+
import React, { useState } from "react";
|
|
35
31
|
import { useTranslation } from "react-i18next";
|
|
36
32
|
import { SNACKBAR_AUTO_HIDE_DURATION } from "utils/consts";
|
|
37
33
|
import { dateTimeToLocaleHHMM } from "utils/date";
|
|
38
34
|
import { numberGramLocale } from "utils/numbers";
|
|
39
35
|
import { makeLink, WgerLink } from "utils/url";
|
|
40
|
-
|
|
36
|
+
import { DashboardCard } from "./DashboardCard";
|
|
41
37
|
|
|
42
38
|
export const NutritionCard = () => {
|
|
43
|
-
|
|
44
39
|
const [t] = useTranslation();
|
|
45
40
|
const planQuery = useFetchLastNutritionalPlanQuery();
|
|
46
41
|
|
|
@@ -48,13 +43,11 @@ export const NutritionCard = () => {
|
|
|
48
43
|
return <LoadingPlaceholder />;
|
|
49
44
|
}
|
|
50
45
|
|
|
51
|
-
return planQuery.data !== null
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
modalTitle={t('add')}
|
|
57
|
-
/>;
|
|
46
|
+
return planQuery.data !== null ? (
|
|
47
|
+
<NutritionCardContent plan={planQuery.data!} />
|
|
48
|
+
) : (
|
|
49
|
+
<EmptyCard title={t("nutritionalPlan")} modalContent={<PlanForm />} modalTitle={t("add")} />
|
|
50
|
+
);
|
|
58
51
|
};
|
|
59
52
|
|
|
60
53
|
function NutritionCardContent(props: { plan: NutritionalPlan }) {
|
|
@@ -64,53 +57,50 @@ function NutritionCardContent(props: { plan: NutritionalPlan }) {
|
|
|
64
57
|
const handleOpenLogModal = () => setOpenLogModal(true);
|
|
65
58
|
const handleCloseLogModal = () => setOpenLogModal(false);
|
|
66
59
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
title={t('nutritionalPlan')}
|
|
60
|
+
return (
|
|
61
|
+
<>
|
|
62
|
+
<DashboardCard
|
|
63
|
+
title={t("nutritionalPlan")}
|
|
72
64
|
subheader={props.plan.description}
|
|
73
|
-
|
|
74
|
-
|
|
65
|
+
actions={
|
|
66
|
+
<>
|
|
67
|
+
<Button
|
|
68
|
+
size="small"
|
|
69
|
+
href={makeLink(WgerLink.NUTRITION_DETAIL, i18n.language, { id: props.plan.id! })}
|
|
70
|
+
>
|
|
71
|
+
{t("seeDetails")}
|
|
72
|
+
</Button>
|
|
73
|
+
<Tooltip title={t("nutrition.logThisMealItem")}>
|
|
74
|
+
<IconButton onClick={handleOpenLogModal}>
|
|
75
|
+
<HistoryEduIcon />
|
|
76
|
+
</IconButton>
|
|
77
|
+
</Tooltip>
|
|
78
|
+
</>
|
|
79
|
+
}
|
|
80
|
+
>
|
|
75
81
|
<NutritionalValuesDashboardChart
|
|
76
82
|
percentage={props.plan.percentageValuesLoggedToday}
|
|
77
83
|
planned={props.plan.plannedNutritionalValues}
|
|
78
84
|
logged={props.plan.loggedNutritionalValuesToday}
|
|
79
85
|
/>
|
|
80
86
|
<List>
|
|
81
|
-
{props.plan.meals.map(meal =>
|
|
87
|
+
{props.plan.meals.map((meal) => (
|
|
82
88
|
<MealListItem meal={meal} planId={props.plan.id!} key={meal.id} />
|
|
83
|
-
)}
|
|
89
|
+
))}
|
|
84
90
|
</List>
|
|
85
|
-
</
|
|
86
|
-
<
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
<IconButton onClick={handleOpenLogModal}>
|
|
96
|
-
<HistoryEduIcon />
|
|
97
|
-
</IconButton>
|
|
98
|
-
</Tooltip>
|
|
99
|
-
</CardActions>
|
|
100
|
-
</Card>
|
|
101
|
-
<WgerModal title={t('nutrition.addNutritionalDiary')}
|
|
102
|
-
isOpen={openLogModal}
|
|
103
|
-
closeFn={handleCloseLogModal}>
|
|
104
|
-
<NutritionDiaryEntryForm
|
|
105
|
-
closeFn={handleCloseLogModal}
|
|
106
|
-
planId={props.plan.id!}
|
|
107
|
-
meals={props.plan.meals}
|
|
108
|
-
/>
|
|
109
|
-
</WgerModal>
|
|
110
|
-
</>;
|
|
91
|
+
</DashboardCard>
|
|
92
|
+
<WgerModal title={t("nutrition.addNutritionalDiary")} isOpen={openLogModal} closeFn={handleCloseLogModal}>
|
|
93
|
+
<NutritionDiaryEntryForm
|
|
94
|
+
closeFn={handleCloseLogModal}
|
|
95
|
+
planId={props.plan.id!}
|
|
96
|
+
meals={props.plan.meals}
|
|
97
|
+
/>
|
|
98
|
+
</WgerModal>
|
|
99
|
+
</>
|
|
100
|
+
);
|
|
111
101
|
}
|
|
112
102
|
|
|
113
|
-
const MealListItem = (props: { meal: Meal
|
|
103
|
+
const MealListItem = (props: { meal: Meal; planId: number }) => {
|
|
114
104
|
const [t, i18n] = useTranslation();
|
|
115
105
|
const addDiaryEntryQuery = useAddDiaryEntryQuery(props.planId);
|
|
116
106
|
|
|
@@ -120,7 +110,7 @@ const MealListItem = (props: { meal: Meal, planId: number }) => {
|
|
|
120
110
|
const handleToggleExpand = () => setExpandView(!expandView);
|
|
121
111
|
|
|
122
112
|
const handleCloseSnackbar = (event?: React.SyntheticEvent | Event, reason?: string) => {
|
|
123
|
-
if (reason ===
|
|
113
|
+
if (reason === "clickaway") {
|
|
124
114
|
return;
|
|
125
115
|
}
|
|
126
116
|
setOpenSnackbar(false);
|
|
@@ -134,45 +124,47 @@ const MealListItem = (props: { meal: Meal, planId: number }) => {
|
|
|
134
124
|
const primaryHeader = props.meal.name ? props.meal.name : dateTimeToLocaleHHMM(props.meal.time);
|
|
135
125
|
const secondaryHeader = props.meal.name ? dateTimeToLocaleHHMM(props.meal.time) : null;
|
|
136
126
|
|
|
137
|
-
return
|
|
138
|
-
|
|
139
|
-
<
|
|
140
|
-
{expandView ? <ExpandLessIcon /> : <ExpandMoreIcon />}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
<
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
<
|
|
174
|
-
{
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
127
|
+
return (
|
|
128
|
+
<>
|
|
129
|
+
<ListItemButton onClick={handleToggleExpand} selected={expandView}>
|
|
130
|
+
<ListItemIcon>{expandView ? <ExpandLessIcon /> : <ExpandMoreIcon />}</ListItemIcon>
|
|
131
|
+
<ListItemText primary={primaryHeader} secondary={secondaryHeader} />
|
|
132
|
+
</ListItemButton>
|
|
133
|
+
<Collapse in={expandView} timeout="auto" unmountOnExit>
|
|
134
|
+
<List>
|
|
135
|
+
{props.meal.items.map((item) => (
|
|
136
|
+
<ListItem
|
|
137
|
+
key={item.id}
|
|
138
|
+
secondaryAction={
|
|
139
|
+
<Tooltip title={t("nutrition.logThisMealItem")}>
|
|
140
|
+
<IconButton edge="end" onClick={() => handleAddDiaryEntry(item)}>
|
|
141
|
+
<HistoryEduIcon />
|
|
142
|
+
</IconButton>
|
|
143
|
+
</Tooltip>
|
|
144
|
+
}
|
|
145
|
+
>
|
|
146
|
+
<ListItemAvatar>
|
|
147
|
+
<Avatar
|
|
148
|
+
alt={item.ingredient?.name}
|
|
149
|
+
src={item.ingredient?.image?.url}
|
|
150
|
+
sx={{ width: 45, height: 45 }}
|
|
151
|
+
>
|
|
152
|
+
<PhotoIcon />
|
|
153
|
+
</Avatar>
|
|
154
|
+
</ListItemAvatar>
|
|
155
|
+
<ListItemText
|
|
156
|
+
primary={item.ingredient?.name}
|
|
157
|
+
secondary={numberGramLocale(item.amount, i18n.language)}
|
|
158
|
+
/>
|
|
159
|
+
</ListItem>
|
|
160
|
+
))}
|
|
161
|
+
</List>
|
|
162
|
+
</Collapse>
|
|
163
|
+
<Snackbar open={openSnackbar} autoHideDuration={SNACKBAR_AUTO_HIDE_DURATION} onClose={handleCloseSnackbar}>
|
|
164
|
+
<Alert onClose={handleCloseSnackbar} severity="success" sx={{ width: "100%" }}>
|
|
165
|
+
{t("nutrition.diaryEntrySaved")}
|
|
166
|
+
</Alert>
|
|
167
|
+
</Snackbar>
|
|
168
|
+
</>
|
|
169
|
+
);
|
|
170
|
+
};
|
|
@@ -1,18 +1,7 @@
|
|
|
1
1
|
import ExpandLessIcon from "@mui/icons-material/ExpandLess";
|
|
2
2
|
import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
|
|
3
3
|
import TodayIcon from "@mui/icons-material/Today";
|
|
4
|
-
import {
|
|
5
|
-
Button,
|
|
6
|
-
Card,
|
|
7
|
-
CardActions,
|
|
8
|
-
CardContent,
|
|
9
|
-
CardHeader,
|
|
10
|
-
Collapse,
|
|
11
|
-
List,
|
|
12
|
-
ListItemButton,
|
|
13
|
-
ListItemIcon,
|
|
14
|
-
ListItemText,
|
|
15
|
-
} from '@mui/material';
|
|
4
|
+
import { Button, Collapse, List, ListItemButton, ListItemIcon, ListItemText } from "@mui/material";
|
|
16
5
|
import { LoadingPlaceholder } from "components/Core/LoadingWidget/LoadingWidget";
|
|
17
6
|
import { EmptyCard } from "components/Dashboard/EmptyCard";
|
|
18
7
|
import { getDayName } from "components/WorkoutRoutines/models/Day";
|
|
@@ -20,11 +9,11 @@ import { Routine } from "components/WorkoutRoutines/models/Routine";
|
|
|
20
9
|
import { RoutineDayData } from "components/WorkoutRoutines/models/RoutineDayData";
|
|
21
10
|
import { useActiveRoutineQuery } from "components/WorkoutRoutines/queries";
|
|
22
11
|
import { SetConfigDataDetails } from "components/WorkoutRoutines/widgets/RoutineDetailsCard";
|
|
23
|
-
import React, { useState } from
|
|
12
|
+
import React, { useState } from "react";
|
|
24
13
|
import { useTranslation } from "react-i18next";
|
|
25
14
|
import { isSameDay } from "utils/date";
|
|
26
15
|
import { makeLink, WgerLink } from "utils/url";
|
|
27
|
-
|
|
16
|
+
import { DashboardCard } from "./DashboardCard";
|
|
28
17
|
|
|
29
18
|
export const RoutineCard = () => {
|
|
30
19
|
const [t, i18n] = useTranslation();
|
|
@@ -34,37 +23,33 @@ export const RoutineCard = () => {
|
|
|
34
23
|
return <LoadingPlaceholder />;
|
|
35
24
|
}
|
|
36
25
|
|
|
37
|
-
return routineQuery.data !== null
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
/>;
|
|
26
|
+
return routineQuery.data !== null ? (
|
|
27
|
+
<RoutineCardContent routine={routineQuery.data!} />
|
|
28
|
+
) : (
|
|
29
|
+
<EmptyCard title={t("routines.routine")} link={makeLink(WgerLink.ROUTINE_ADD, i18n.language)} />
|
|
30
|
+
);
|
|
43
31
|
};
|
|
44
32
|
|
|
45
33
|
const RoutineCardContent = (props: { routine: Routine }) => {
|
|
46
34
|
const [t, i18n] = useTranslation();
|
|
47
35
|
|
|
48
|
-
return
|
|
49
|
-
<
|
|
50
|
-
title={t(
|
|
36
|
+
return (
|
|
37
|
+
<DashboardCard
|
|
38
|
+
title={t("routines.routine")}
|
|
51
39
|
subheader={props.routine.name ?? "."}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
40
|
+
actions={
|
|
41
|
+
<Button size="small" href={makeLink(WgerLink.ROUTINE_DETAIL, i18n.language, { id: props.routine.id! })}>
|
|
42
|
+
{t("seeDetails")}
|
|
43
|
+
</Button>
|
|
44
|
+
}
|
|
45
|
+
>
|
|
55
46
|
<List>
|
|
56
|
-
{props.routine.dayDataCurrentIterationNoNulls.map((dayData) =>
|
|
57
|
-
<DayListItem dayData={dayData} key={`dayDetails-${dayData.date.toISOString()}`} />
|
|
47
|
+
{props.routine.dayDataCurrentIterationNoNulls.map((dayData) => (
|
|
48
|
+
<DayListItem dayData={dayData} key={`dayDetails-${dayData.date.toISOString()}`} />
|
|
49
|
+
))}
|
|
58
50
|
</List>
|
|
59
|
-
</
|
|
60
|
-
|
|
61
|
-
<CardActions>
|
|
62
|
-
<Button size="small"
|
|
63
|
-
href={makeLink(WgerLink.ROUTINE_DETAIL, i18n.language, { id: props.routine.id! })}>
|
|
64
|
-
{t('seeDetails')}
|
|
65
|
-
</Button>
|
|
66
|
-
</CardActions>
|
|
67
|
-
</Card>;
|
|
51
|
+
</DashboardCard>
|
|
52
|
+
);
|
|
68
53
|
};
|
|
69
54
|
|
|
70
55
|
const DayListItem = (props: { dayData: RoutineDayData }) => {
|
|
@@ -72,36 +57,36 @@ const DayListItem = (props: { dayData: RoutineDayData }) => {
|
|
|
72
57
|
|
|
73
58
|
const handleToggleExpand = () => setExpandView(!expandView);
|
|
74
59
|
|
|
75
|
-
return (
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
{expandView ? <ExpandLessIcon /> : <ExpandMoreIcon />}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
{isSameDay(props.dayData.date, new Date()) ? <TodayIcon /> : undefined}
|
|
91
|
-
</ListItemIcon>
|
|
92
|
-
</ListItemButton>
|
|
60
|
+
return (
|
|
61
|
+
<>
|
|
62
|
+
<ListItemButton
|
|
63
|
+
onClick={handleToggleExpand}
|
|
64
|
+
selected={expandView}
|
|
65
|
+
disabled={props.dayData.day === null || props.dayData.day?.isRest}
|
|
66
|
+
>
|
|
67
|
+
<ListItemIcon>{expandView ? <ExpandLessIcon /> : <ExpandMoreIcon />}</ListItemIcon>
|
|
68
|
+
<ListItemText
|
|
69
|
+
primary={getDayName(props.dayData.day)}
|
|
70
|
+
slotProps={{ secondary: { noWrap: true, style: { overflow: "hidden", textOverflow: "ellipsis" } } }}
|
|
71
|
+
secondary={props.dayData.day?.description}
|
|
72
|
+
/>
|
|
73
|
+
<ListItemIcon>{isSameDay(props.dayData.date, new Date()) ? <TodayIcon /> : undefined}</ListItemIcon>
|
|
74
|
+
</ListItemButton>
|
|
93
75
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
76
|
+
<Collapse in={expandView} timeout="auto" unmountOnExit>
|
|
77
|
+
{props.dayData.slots.map((slotData, index) => (
|
|
78
|
+
<div key={index}>
|
|
79
|
+
{slotData.setConfigs.map((setConfigData, index) => (
|
|
80
|
+
<SetConfigDataDetails
|
|
81
|
+
setConfigData={setConfigData}
|
|
82
|
+
key={index}
|
|
83
|
+
rowHeight={"70px"}
|
|
84
|
+
showExercise={true}
|
|
85
|
+
/>
|
|
86
|
+
))}
|
|
87
|
+
</div>
|
|
88
|
+
))}
|
|
89
|
+
</Collapse>
|
|
90
|
+
</>
|
|
91
|
+
);
|
|
92
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import AddIcon from "@mui/icons-material/Add";
|
|
2
|
-
import { Box, Button,
|
|
2
|
+
import { Box, Button, IconButton } from "@mui/material";
|
|
3
3
|
import Tooltip from "@mui/material/Tooltip";
|
|
4
4
|
import { WeightForm } from "components/BodyWeight/Form/WeightForm";
|
|
5
5
|
import { WeightEntry } from "components/BodyWeight/model";
|
|
@@ -9,64 +9,58 @@ import { WeightChart } from "components/BodyWeight/WeightChart";
|
|
|
9
9
|
import { LoadingPlaceholder } from "components/Core/LoadingWidget/LoadingWidget";
|
|
10
10
|
import { WgerModal } from "components/Core/Modals/WgerModal";
|
|
11
11
|
import { EmptyCard } from "components/Dashboard/EmptyCard";
|
|
12
|
-
import React from
|
|
12
|
+
import React from "react";
|
|
13
13
|
import { useTranslation } from "react-i18next";
|
|
14
14
|
import { makeLink, WgerLink } from "utils/url";
|
|
15
|
+
import { DashboardCard } from "./DashboardCard";
|
|
15
16
|
|
|
16
17
|
export const WeightCard = () => {
|
|
17
|
-
|
|
18
18
|
const [t] = useTranslation();
|
|
19
|
-
const weightyQuery = useBodyWeightQuery(
|
|
19
|
+
const weightyQuery = useBodyWeightQuery("lastYear");
|
|
20
20
|
|
|
21
21
|
if (weightyQuery.isLoading) {
|
|
22
22
|
return <LoadingPlaceholder />;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
return weightyQuery.data?.length !== undefined && weightyQuery.data?.length > 0
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
/>;
|
|
25
|
+
return weightyQuery.data?.length !== undefined && weightyQuery.data?.length > 0 ? (
|
|
26
|
+
<WeightCardContent entries={weightyQuery.data} />
|
|
27
|
+
) : (
|
|
28
|
+
<EmptyCard title={t("weight")} modalContent={<WeightForm />} />
|
|
29
|
+
);
|
|
31
30
|
};
|
|
32
31
|
export const WeightCardContent = (props: { entries: WeightEntry[] }) => {
|
|
33
|
-
|
|
34
32
|
const [openModal, setOpenModal] = React.useState(false);
|
|
35
33
|
const handleOpenModal = () => setOpenModal(true);
|
|
36
34
|
const handleCloseModal = () => setOpenModal(false);
|
|
37
35
|
const [t, i18n] = useTranslation();
|
|
38
36
|
|
|
39
|
-
return (
|
|
40
|
-
|
|
41
|
-
<
|
|
42
|
-
title={t(
|
|
43
|
-
subheader={
|
|
44
|
-
|
|
45
|
-
|
|
37
|
+
return (
|
|
38
|
+
<>
|
|
39
|
+
<DashboardCard
|
|
40
|
+
title={t("weight")}
|
|
41
|
+
subheader={"."}
|
|
42
|
+
actions={
|
|
43
|
+
<>
|
|
44
|
+
<Button size="small" href={makeLink(WgerLink.WEIGHT_OVERVIEW, i18n.language)}>
|
|
45
|
+
{t("seeDetails")}
|
|
46
|
+
</Button>
|
|
47
|
+
<Tooltip title={t("addEntry")}>
|
|
48
|
+
<IconButton onClick={handleOpenModal}>
|
|
49
|
+
<AddIcon />
|
|
50
|
+
</IconButton>
|
|
51
|
+
</Tooltip>
|
|
52
|
+
</>
|
|
53
|
+
}
|
|
54
|
+
>
|
|
46
55
|
<WeightChart weights={props.entries} height={200} />
|
|
47
|
-
<Box sx={{ mt: 2
|
|
56
|
+
<Box sx={{ mt: 2 }}>
|
|
48
57
|
<WeightTableDashboard weights={props.entries} />
|
|
49
58
|
</Box>
|
|
50
|
-
</
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
>
|
|
59
|
-
{t('seeDetails')}
|
|
60
|
-
</Button>
|
|
61
|
-
<Tooltip title={t('addEntry')}>
|
|
62
|
-
<IconButton onClick={handleOpenModal}>
|
|
63
|
-
<AddIcon />
|
|
64
|
-
</IconButton>
|
|
65
|
-
</Tooltip>
|
|
66
|
-
</CardActions>
|
|
67
|
-
</Card>
|
|
68
|
-
<WgerModal title={t('add')} isOpen={openModal} closeFn={handleCloseModal}>
|
|
69
|
-
<WeightForm closeFn={handleCloseModal} />
|
|
70
|
-
</WgerModal>
|
|
71
|
-
</>);
|
|
72
|
-
};
|
|
59
|
+
</DashboardCard>
|
|
60
|
+
|
|
61
|
+
<WgerModal title={t("add")} isOpen={openModal} closeFn={handleCloseModal}>
|
|
62
|
+
<WeightForm closeFn={handleCloseModal} />
|
|
63
|
+
</WgerModal>
|
|
64
|
+
</>
|
|
65
|
+
);
|
|
66
|
+
};
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
import React, { useState } from "react";
|
|
31
31
|
import { useTranslation } from "react-i18next";
|
|
32
32
|
import { useParams } from "react-router-dom";
|
|
33
|
-
import { CartesianGrid, Legend, Line, LineChart,
|
|
33
|
+
import { CartesianGrid, Legend, Line, LineChart, Tooltip, XAxis, YAxis } from 'recharts';
|
|
34
34
|
import { getLanguageByShortName } from "services";
|
|
35
35
|
import { generateChartColors } from "utils/colors";
|
|
36
36
|
import { makeLink, WgerLink } from "utils/url";
|
|
@@ -10,8 +10,7 @@ interface DayTypeSelectProps {
|
|
|
10
10
|
|
|
11
11
|
export const DayTypeSelect = (props: DayTypeSelectProps) => {
|
|
12
12
|
const { t } = useTranslation();
|
|
13
|
-
const [field
|
|
14
|
-
|
|
13
|
+
const [field] = useField(props.fieldName);
|
|
15
14
|
const options = [
|
|
16
15
|
{
|
|
17
16
|
value: 'custom',
|
|
@@ -10,10 +10,6 @@ export const SlotForm = (props: { slot: Slot, routineId: number }) => {
|
|
|
10
10
|
const editSlotQuery = useEditSlotQuery(props.routineId);
|
|
11
11
|
const [slotComment, setSlotComment] = useState<string>(props.slot.comment);
|
|
12
12
|
|
|
13
|
-
const handleChange = (value: string) => {
|
|
14
|
-
setSlotComment(value);
|
|
15
|
-
};
|
|
16
|
-
|
|
17
13
|
const handleBlur = () => {
|
|
18
14
|
editSlotQuery.mutate(Slot.clone(props.slot, { comment: slotComment }));
|
|
19
15
|
};
|
package/src/index.tsx
CHANGED
|
@@ -4,9 +4,6 @@ import { ThemeProvider } from '@mui/material/styles';
|
|
|
4
4
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
5
5
|
import { ReactQueryDevtools } from '@tanstack/react-query-devtools';
|
|
6
6
|
import { LoadingWidget } from "components/Core/LoadingWidget/LoadingWidget";
|
|
7
|
-
import { NutritionCard } from "components/Dashboard/NutritionCard";
|
|
8
|
-
import { RoutineCard } from "components/Dashboard/RoutineCard";
|
|
9
|
-
import { WeightCard } from "components/Dashboard/WeightCard";
|
|
10
7
|
import { IngredientSearch } from "components/Nutrition/components/IngredientSearch";
|
|
11
8
|
import React, { Suspense } from 'react';
|
|
12
9
|
import { createRoot } from "react-dom/client";
|
|
@@ -123,49 +120,6 @@ renderComponentShadowDom('react-page');
|
|
|
123
120
|
/*
|
|
124
121
|
* Components used in the wger django app, don't change the IDs here
|
|
125
122
|
*/
|
|
126
|
-
const weightDashboard = document.getElementById("react-weight-dashboard");
|
|
127
|
-
if (weightDashboard) {
|
|
128
|
-
const root = createRoot(weightDashboard);
|
|
129
|
-
root.render(
|
|
130
|
-
<Suspense fallback={<LoadingWidget />}>
|
|
131
|
-
<ThemeProvider theme={theme}>
|
|
132
|
-
<QueryClientProvider client={queryClient}>
|
|
133
|
-
<WeightCard />
|
|
134
|
-
</QueryClientProvider>
|
|
135
|
-
</ThemeProvider>
|
|
136
|
-
</Suspense>
|
|
137
|
-
);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
const nutritionDashboard = document.getElementById('react-nutrition-dashboard');
|
|
141
|
-
if (nutritionDashboard) {
|
|
142
|
-
const root = createRoot(nutritionDashboard);
|
|
143
|
-
root.render(
|
|
144
|
-
<Suspense fallback={<LoadingWidget />}>
|
|
145
|
-
<ThemeProvider theme={theme}>
|
|
146
|
-
<QueryClientProvider client={queryClient}>
|
|
147
|
-
<NutritionCard />
|
|
148
|
-
</QueryClientProvider>
|
|
149
|
-
</ThemeProvider>
|
|
150
|
-
</Suspense>
|
|
151
|
-
);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
const routineDashboard = document.getElementById('react-routine-dashboard');
|
|
155
|
-
if (routineDashboard) {
|
|
156
|
-
const root = createRoot(routineDashboard);
|
|
157
|
-
root.render(
|
|
158
|
-
<Suspense fallback={<LoadingWidget />}>
|
|
159
|
-
<ThemeProvider theme={theme}>
|
|
160
|
-
<QueryClientProvider client={queryClient}>
|
|
161
|
-
<RoutineCard />
|
|
162
|
-
</QueryClientProvider>
|
|
163
|
-
</ThemeProvider>
|
|
164
|
-
</Suspense>
|
|
165
|
-
);
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
|
|
169
123
|
const ingredientSearchBox = document.getElementById("react-ingredient-search");
|
|
170
124
|
if (ingredientSearchBox) {
|
|
171
125
|
const root = createRoot(ingredientSearchBox);
|