Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/components/WorkoutRoutines/Detail/RoutineDetails.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Add, Delete } from "@mui/icons-material";
import { ArrowBack } from "@mui/icons-material";
import MoreVertIcon from "@mui/icons-material/MoreVert";
import {
Box,
Expand All @@ -24,7 +25,7 @@ import { WorkoutSetting } from "components/WorkoutRoutines/models/WorkoutSetting
import { useRoutineDetailQuery } from "components/WorkoutRoutines/queries";
import React from "react";
import { useTranslation } from "react-i18next";
import { useParams } from "react-router-dom";
import { useParams, useNavigate } from "react-router-dom";
import { daysOfWeek } from "utils/date";
import { makeLink, WgerLink } from "utils/url";

Expand All @@ -36,11 +37,21 @@ export const RoutineDetails = () => {
const [t, i18n] = useTranslation();
const routineQuery = useRoutineDetailQuery(routineId);

const navigate = useNavigate();
const handleBack = () => { //Go back to previous page
navigate(-1);
};
// TODO: remove this when we add the logic in react
const navigateAddDay = () => window.location.href = makeLink(WgerLink.ROUTINE_ADD_DAY, i18n.language, { id: routineId });

return <>
<Container maxWidth="lg">
<Button
startIcon={<ArrowBack />} //add back arrow icon
onClick={handleBack} //handle back button click
>
{t('back')} {/* Display back text */}
</Button>
{routineQuery.isLoading
? <LoadingPlaceholder />
: <>
Expand Down