Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/update line exit btn #96

Merged
merged 6 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/components/manage-productions/manage-productions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
`;
Expand Down Expand Up @@ -108,7 +109,6 @@ export const ManageProductions = () => {

setRemoveId(parseInt(value.productionId, 10));
};
// TODO return button

return (
<Container>
Expand Down
16 changes: 14 additions & 2 deletions src/components/navigate-to-root-button/navigate-to-root-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,23 @@ const StyledBackBtn = styled(ActionButton)`
width: 4rem;
`;

export const NavigateToRootButton = () => {
export const NavigateToRootButton = ({
resetOnExit,
}: {
resetOnExit?: () => void;
}) => {
const navigate = useNavigate();

return (
<StyledBackBtn type="button" onClick={() => navigate("/")}>
<StyledBackBtn
type="button"
onClick={() => {
if (resetOnExit) {
resetOnExit();
}
navigate("/");
}}
>
<BackArrow />
</StyledBackBtn>
);
Expand Down
17 changes: 8 additions & 9 deletions src/components/production-line/production-line.tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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);

Expand All @@ -87,8 +87,7 @@ export const ProductionLine: FC = () => {
type: "UPDATE_JOIN_PRODUCTION_OPTIONS",
payload: null,
});
navigate("/");
}, [dispatch, navigate]);
}, [dispatch]);

useLineHotkeys({
muteInput,
Expand Down Expand Up @@ -154,7 +153,7 @@ export const ProductionLine: FC = () => {
<>
<HeaderWrapper>
<ButtonWrapper>
<ActionButton onClick={exit}>Exit</ActionButton>
<NavigateToRootButton resetOnExit={exit} />
</ButtonWrapper>
{!loading && production && line && (
<DisplayContainerHeader>
Expand Down
Loading