1- import { Box , Stack , Button , ButtonGroup } from "@mui/material" ;
1+ import { Box , Stack } from "@mui/material" ;
22import { useBodyWeightQuery } from "components/BodyWeight/queries" ;
33import { WeightTable } from "components/BodyWeight/Table" ;
44import { WeightChart } from "components/BodyWeight/WeightChart" ;
55import { AddBodyWeightEntryFab } from "components/BodyWeight/widgets/fab" ;
6+ import { FilterButtons , FilterType } from "components/BodyWeight/widgets/FilterButtons" ;
67import { LoadingPlaceholder } from "components/Core/LoadingWidget/LoadingWidget" ;
78import { WgerContainerRightSidebar } from "components/Core/Widgets/Container" ;
89import { OverviewEmpty } from "components/Core/Widgets/OverviewEmpty" ;
9- import { useTranslation } from "react-i18next" ;
10- import { FilterButtons , FilterType } from "components/BodyWeight/widgets/FilterButtons" ;
1110import { useState } from "react" ;
11+ import { useTranslation } from "react-i18next" ;
1212
1313
1414export const BodyWeight = ( ) => {
1515 const [ t ] = useTranslation ( ) ;
16- const [ filter , setFilter ] = useState < FilterType > ( 'lastYear' ) ;
16+ const [ filter , setFilter ] = useState < FilterType > ( 'lastYear' ) ;
1717 const weightyQuery = useBodyWeightQuery ( filter ) ;
1818 const handleFilterChange = ( newFilter : FilterType ) => {
1919 setFilter ( newFilter ) ;
2020 } ;
2121
22- return weightyQuery . isLoading
23- ? < LoadingPlaceholder />
24- : < WgerContainerRightSidebar
25- title = { t ( "weight" ) }
26- mainContent = { < Stack spacing = { 2 } >
22+ if ( weightyQuery . isLoading ) {
23+ return < LoadingPlaceholder /> ;
24+ }
25+
26+ return < WgerContainerRightSidebar
27+ title = { t ( "weight" ) }
28+ mainContent = { < Stack spacing = { 2 } >
2729 < FilterButtons currentFilter = { filter } onFilterChange = { handleFilterChange } />
28- { weightyQuery . data ! . length === 0 && < OverviewEmpty /> }
30+ { weightyQuery . data ! . length === 0 && < OverviewEmpty /> }
31+ { weightyQuery . data ! . length !== 0 && < >
2932 < WeightChart weights = { weightyQuery . data ! } />
3033 < Box sx = { { mt : 4 } } />
3134 < WeightTable weights = { weightyQuery . data ! } />
32- </ Stack >
33- }
34- fab = { < AddBodyWeightEntryFab /> }
35- /> ;
35+ </ > }
36+ </ Stack >
37+ }
38+ fab = { < AddBodyWeightEntryFab /> }
39+ /> ;
3640} ;
0 commit comments