diff --git a/src/components/manage-productions/manage-productions.tsx b/src/components/manage-productions/manage-productions.tsx index 27230088..4852b37a 100644 --- a/src/components/manage-productions/manage-productions.tsx +++ b/src/components/manage-productions/manage-productions.tsx @@ -52,6 +52,7 @@ const VerifyButtons = styled.div` const Button = styled(ActionButton)` margin: 0 1rem 0 0; `; + const StyledBackBtnIcon = styled.div` margin: 0 0 3rem 0; `; @@ -108,7 +109,6 @@ export const ManageProductions = () => { setRemoveId(parseInt(value.productionId, 10)); }; - // TODO return button return ( diff --git a/src/components/navigate-to-root-button/navigate-to-root-button.tsx b/src/components/navigate-to-root-button/navigate-to-root-button.tsx index 868e5d31..5bd1930a 100644 --- a/src/components/navigate-to-root-button/navigate-to-root-button.tsx +++ b/src/components/navigate-to-root-button/navigate-to-root-button.tsx @@ -9,11 +9,23 @@ const StyledBackBtn = styled(ActionButton)` width: 4rem; `; -export const NavigateToRootButton = () => { +export const NavigateToRootButton = ({ + resetOnExit, +}: { + resetOnExit?: () => void; +}) => { const navigate = useNavigate(); return ( - navigate("/")}> + { + if (resetOnExit) { + resetOnExit(); + } + navigate("/"); + }} + > ); diff --git a/src/components/production-line/production-line.tsx b/src/components/production-line/production-line.tsx index a15006f9..054f3110 100644 --- a/src/components/production-line/production-line.tsx +++ b/src/components/production-line/production-line.tsx @@ -1,6 +1,6 @@ import styled from "@emotion/styled"; import { FC, useCallback, useEffect, useState } from "react"; -import { useNavigate, useParams } from "react-router-dom"; +import { useParams } from "react-router-dom"; import { useGlobalState } from "../../global-state/context-provider.tsx"; import { useAudioInput } from "./use-audio-input.ts"; import { useRtcConnection } from "./use-rtc-connection.ts"; @@ -26,6 +26,7 @@ import { useLinePolling } from "./use-line-polling.ts"; import { useFetchProduction } from "../landing-page/use-fetch-production.ts"; import { useIsLoading } from "./use-is-loading.ts"; import { useCheckBadLineData } from "./use-check-bad-line-data.ts"; +import { NavigateToRootButton } from "../navigate-to-root-button/navigate-to-root-button.tsx"; const TempDiv = styled.div` padding: 1rem 0; @@ -41,10 +42,6 @@ const SmallText = styled.span` font-size: 1.6rem; `; -const ButtonWrapper = styled.span` - margin: 0 2rem 0 0; -`; - const ButtonIcon = styled.div` width: 2.5rem; display: inline-block; @@ -58,10 +55,13 @@ const UserControlBtn = styled(ActionButton)` text-align: left; `; +const ButtonWrapper = styled.span` + margin: 0 2rem 0 0; +`; + export const ProductionLine: FC = () => { const { productionId: paramProductionId, lineId: paramLineId } = useParams(); const [{ joinProductionOptions }, dispatch] = useGlobalState(); - const navigate = useNavigate(); const [isInputMuted, setIsInputMuted] = useState(true); const [isOutputMuted, setIsOutputMuted] = useState(false); @@ -87,8 +87,7 @@ export const ProductionLine: FC = () => { type: "UPDATE_JOIN_PRODUCTION_OPTIONS", payload: null, }); - navigate("/"); - }, [dispatch, navigate]); + }, [dispatch]); useLineHotkeys({ muteInput, @@ -154,7 +153,7 @@ export const ProductionLine: FC = () => { <> - Exit + {!loading && production && line && (