Skip to content

Commit

Permalink
fix(MeditationByMonthForPeriod): do not display if there are no medit…
Browse files Browse the repository at this point in the history
…ations
  • Loading branch information
benji6 committed Dec 31, 2023
1 parent 858548e commit ce704f5
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
formatIsoDateInLocalTimezone,
formatIsoMonthInLocalTimezone,
} from "../../../../utils";
import { RootState } from "../../../../store";
import { TIME } from "../../../../constants";
import { eachMonthOfInterval } from "date-fns";
import eventsSlice from "../../../../store/eventsSlice";
Expand All @@ -20,11 +21,16 @@ export default function MeditationByMonthForPeriod({
dateFrom,
dateTo,
}: Props) {
const meditationIdsInPeriod = useSelector((state: RootState) =>
eventsSlice.selectors.meditationIdsInPeriod(state, dateFrom, dateTo),
);
const noramlizedTotalSecondsMeditatedByMonth = useSelector(
eventsSlice.selectors.normalizedTotalSecondsMeditatedByMonth,
);
const navigate = useNavigate();

if (!meditationIdsInPeriod.length) return null;

const months = eachMonthOfInterval({ start: dateFrom, end: dateTo }).slice(
0,
-1,
Expand Down

0 comments on commit ce704f5

Please sign in to comment.