@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.
@@ -1,15 +1,11 @@
1
1
  import ExpandLessIcon from "@mui/icons-material/ExpandLess";
2
- import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
3
- import HistoryEduIcon from '@mui/icons-material/HistoryEdu';
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 '@mui/material';
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 'react';
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
- ? <NutritionCardContent plan={planQuery.data!} />
53
- : <EmptyCard
54
- title={t('nutritionalPlan')}
55
- modalContent={<PlanForm />}
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
- return <>
69
- <Card>
70
- <CardHeader
71
- title={t('nutritionalPlan')}
60
+ return (
61
+ <>
62
+ <DashboardCard
63
+ title={t("nutritionalPlan")}
72
64
  subheader={props.plan.description}
73
- />
74
- <CardContent sx={{ height: "500px", overflow: "auto" }}>
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
- </CardContent>
86
- <CardActions sx={{
87
- justifyContent: "space-between",
88
- alignItems: "flex-start",
89
- }}>
90
- <Button size="small"
91
- href={makeLink(WgerLink.NUTRITION_DETAIL, i18n.language, { id: props.plan.id! })}>
92
- {t('seeDetails')}
93
- </Button>
94
- <Tooltip title={t('nutrition.logThisMealItem')}>
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, planId: number }) => {
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 === 'clickaway') {
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
- <ListItemButton onClick={handleToggleExpand} selected={expandView}>
139
- <ListItemIcon>
140
- {expandView ? <ExpandLessIcon /> : <ExpandMoreIcon />}
141
- </ListItemIcon>
142
- <ListItemText primary={primaryHeader} secondary={secondaryHeader} />
143
-
144
- </ListItemButton>
145
- <Collapse in={expandView} timeout="auto" unmountOnExit>
146
- <List>
147
- {props.meal.items.map((item) =>
148
- <ListItem key={item.id} secondaryAction={
149
- <Tooltip title={t('nutrition.logThisMealItem')}>
150
- <IconButton edge="end" onClick={() => handleAddDiaryEntry(item)}>
151
- <HistoryEduIcon />
152
- </IconButton>
153
- </Tooltip>
154
- }>
155
- <ListItemAvatar>
156
- <Avatar
157
- alt={item.ingredient?.name}
158
- src={item.ingredient?.image?.url}
159
- sx={{ width: 45, height: 45 }}
160
- >
161
- <PhotoIcon />
162
- </Avatar>
163
- </ListItemAvatar>
164
- <ListItemText
165
- primary={item.ingredient?.name}
166
- secondary={numberGramLocale(item.amount, i18n.language)}
167
- />
168
- </ListItem>
169
- )}
170
- </List>
171
- </Collapse>
172
- <Snackbar open={openSnackbar} autoHideDuration={SNACKBAR_AUTO_HIDE_DURATION} onClose={handleCloseSnackbar}>
173
- <Alert onClose={handleCloseSnackbar} severity="success" sx={{ width: '100%' }}>
174
- {t('nutrition.diaryEntrySaved')}
175
- </Alert>
176
- </Snackbar>
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 'react';
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
- ? <RoutineCardContent routine={routineQuery.data!} />
39
- : <EmptyCard
40
- title={t('routines.routine')}
41
- link={makeLink(WgerLink.ROUTINE_ADD, i18n.language)}
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 <Card>
49
- <CardHeader
50
- title={t('routines.routine')}
36
+ return (
37
+ <DashboardCard
38
+ title={t("routines.routine")}
51
39
  subheader={props.routine.name ?? "."}
52
- />
53
- {/* Note: not 500 like the other cards, but a bit more since we don't have an action icon... */}
54
- <CardContent sx={{ height: "510px", overflow: "auto" }}>
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
- </CardContent>
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
- <ListItemButton
77
- onClick={handleToggleExpand}
78
- selected={expandView}
79
- disabled={props.dayData.day === null || props.dayData.day?.isRest}
80
- >
81
- <ListItemIcon>
82
- {expandView ? <ExpandLessIcon /> : <ExpandMoreIcon />}
83
- </ListItemIcon>
84
- <ListItemText
85
- primary={getDayName(props.dayData.day)}
86
- slotProps={{ secondary: { noWrap: true, style: { overflow: 'hidden', textOverflow: 'ellipsis' } } }}
87
- secondary={props.dayData.day?.description}
88
- />
89
- <ListItemIcon>
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
- <Collapse in={expandView} timeout="auto" unmountOnExit>
95
- {props.dayData.slots.map((slotData, index) => (<div key={index}>
96
- {slotData.setConfigs.map((setConfigData, index) =>
97
- <SetConfigDataDetails
98
- setConfigData={setConfigData}
99
- key={index}
100
- rowHeight={'70px'}
101
- showExercise={true}
102
- />
103
- )}
104
- </div>))}
105
- </Collapse>
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, Card, CardActions, CardContent, CardHeader, IconButton, } from '@mui/material';
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 'react';
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('lastYear');
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
- ? <WeightCardContent entries={weightyQuery.data} />
27
- : <EmptyCard
28
- title={t('weight')}
29
- modalContent={<WeightForm />}
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
- <Card>
41
- <CardHeader
42
- title={t('weight')}
43
- subheader={'.'}
44
- />
45
- <CardContent sx={{ height: '500px', overflow: 'auto' }}>
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
- </CardContent>
51
- <CardActions sx={{
52
- justifyContent: "space-between",
53
- alignItems: "flex-start",
54
- }}>
55
- <Button
56
- size="small"
57
- href={makeLink(WgerLink.WEIGHT_OVERVIEW, i18n.language)}
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
+ };
@@ -65,7 +65,7 @@ export function ExerciseDeleteDialog(props: {
65
65
  try {
66
66
  const exercise = await getExercise(id);
67
67
  setReplacementExercise(exercise);
68
- } catch (e) {
68
+ } catch {
69
69
  setReplacementExercise(null);
70
70
  }
71
71
  }
@@ -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, ResponsiveContainer, Tooltip, XAxis, YAxis } from 'recharts';
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, meta] = useField(props.fieldName);
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);