From 477bbd0975f6b0b7635847f31bbcd6c92bef6bcf Mon Sep 17 00:00:00 2001 From: Manuel Brandstetter <36969812+brandstetterm@users.noreply.github.com> Date: Wed, 24 Jan 2024 15:32:48 +0100 Subject: [PATCH] fix: changes for the new landing page (#3784) --- src/components/BoardHeader/BoardHeader.tsx | 5 +---- .../PassphraseDialog/PassphraseDialog.tsx | 5 ++--- .../PassphraseDialog.test.tsx.snap | 1 + .../RejectionPage/RejectionPage.test.tsx | 20 ++----------------- .../RejectionPage/RejectionPage.tsx | 9 ++++++--- src/routes/Legal/Legal.tsx | 5 ++--- src/routes/LoginBoard/LoginBoard.tsx | 9 ++++----- src/routes/NewBoard/NewBoard.tsx | 5 ++--- src/routes/NotFound/NotFound.test.tsx | 20 ++----------------- src/routes/NotFound/NotFound.tsx | 9 ++++++--- 10 files changed, 28 insertions(+), 60 deletions(-) diff --git a/src/components/BoardHeader/BoardHeader.tsx b/src/components/BoardHeader/BoardHeader.tsx index 6be689851b..a9c79842ef 100644 --- a/src/components/BoardHeader/BoardHeader.tsx +++ b/src/components/BoardHeader/BoardHeader.tsx @@ -10,7 +10,6 @@ import {HeaderMenu} from "components/BoardHeader/HeaderMenu"; import {useTranslation} from "react-i18next"; import {Actions} from "store/action"; import {ConfirmationDialog} from "components/ConfirmationDialog"; -import {useNavigate} from "react-router-dom"; import {shallowEqual} from "react-redux"; import "./BoardHeader.scss"; import {ShareButton} from "components/ShareButton"; @@ -31,8 +30,6 @@ export const BoardHeader: VFC = (props) => { shallowEqual ); - const navigate = useNavigate(); - const [showMenu, setShowMenu] = useState(false); const [showConfirmationDialog, setShowConfirmationDialog] = useState(false); @@ -43,7 +40,7 @@ export const BoardHeader: VFC = (props) => { title={t("ConfirmationDialog.returnToHomepage")} onAccept={() => { store.dispatch(Actions.leaveBoard()); - navigate("/"); + window.location.pathname = "/"; }} onDecline={() => setShowConfirmationDialog(false)} icon={LeaveIcon} diff --git a/src/components/PassphraseDialog/PassphraseDialog.tsx b/src/components/PassphraseDialog/PassphraseDialog.tsx index 4e287d1cf4..cc3cad93ea 100644 --- a/src/components/PassphraseDialog/PassphraseDialog.tsx +++ b/src/components/PassphraseDialog/PassphraseDialog.tsx @@ -2,7 +2,6 @@ import {FC, useState} from "react"; import "./PassphraseDialog.scss"; import {ScrumlrLogo} from "components/ScrumlrLogo"; import {useTranslation} from "react-i18next"; -import {Link} from "react-router-dom"; import {ReactComponent as VisibleIcon} from "assets/icon-visible.svg"; import {ReactComponent as HiddenIcon} from "assets/icon-hidden.svg"; import {TextInputLabel} from "../TextInputLabel"; @@ -31,9 +30,9 @@ export const PassphraseDialog: FC = ({onSubmit}) => { return (
- + - +
diff --git a/src/components/PassphraseDialog/__tests__/__snapshots__/PassphraseDialog.test.tsx.snap b/src/components/PassphraseDialog/__tests__/__snapshots__/PassphraseDialog.test.tsx.snap index bcf246ad63..9b886645e5 100644 --- a/src/components/PassphraseDialog/__tests__/__snapshots__/PassphraseDialog.test.tsx.snap +++ b/src/components/PassphraseDialog/__tests__/__snapshots__/PassphraseDialog.test.tsx.snap @@ -8,6 +8,7 @@ exports[` snapshot test 1`] = ` class="passphrase-dialog" > { @@ -11,20 +11,4 @@ describe("RejectionPage", () => { ); expect(container.firstChild).toMatchSnapshot(); }); - - it("should redirect to homepage on button click", () => { - const {getByText} = render( - - - } /> - Homepage
} /> - - - ); - - const button = getByText("RejectionPage.button"); - expect(button).toBeInTheDocument(); - fireEvent.click(button); - expect(screen.getByText("Homepage")).toBeInTheDocument(); - }); }); diff --git a/src/components/RejectionPage/RejectionPage.tsx b/src/components/RejectionPage/RejectionPage.tsx index 24144ebad1..cb7b3556ce 100644 --- a/src/components/RejectionPage/RejectionPage.tsx +++ b/src/components/RejectionPage/RejectionPage.tsx @@ -1,5 +1,4 @@ import {useTranslation} from "react-i18next"; -import {useNavigate} from "react-router"; import {ScrumlrLogo} from "components/ScrumlrLogo"; import {ReactComponent as StanLight} from "assets/stan/Stan_Toilette_Light.svg"; import {ReactComponent as StanDark} from "assets/stan/Stan_Toilette_Dark.svg"; @@ -10,7 +9,6 @@ import "./RejectionPage.scss"; export const RejectionPage = () => { const {t} = useTranslation(); - const navigate = useNavigate(); return (
@@ -30,7 +28,12 @@ export const RejectionPage = () => {
{t("RejectionPage.title")}
{t("RejectionPage.description")}
-
diff --git a/src/routes/Legal/Legal.tsx b/src/routes/Legal/Legal.tsx index 8d4a875ee0..daecc14435 100644 --- a/src/routes/Legal/Legal.tsx +++ b/src/routes/Legal/Legal.tsx @@ -2,7 +2,6 @@ import {useTranslation, withTranslation} from "react-i18next"; import {FC, useEffect, useState} from "react"; import "./Legal.scss"; import {generatePath} from "react-router"; -import {Link} from "react-router-dom"; import {marked} from "marked"; import {ScrumlrLogo} from "../../components/ScrumlrLogo"; @@ -31,9 +30,9 @@ const LegalWithoutTranslation: FC = ({document}) => { return (
- + - +
{ const {t} = useTranslation(); const location = useLocation(); - const navigate = useNavigate(); const [displayName, setDisplayName] = useState(getRandomName()); const [termsAccepted, setTermsAccepted] = useState(!SHOW_LEGAL_DOCUMENTS); @@ -40,7 +39,7 @@ export const LoginBoard = () => { if (termsAccepted) { try { await Auth.signInAnonymously(displayName); - navigate(redirectPath); + window.location.pathname = redirectPath; } catch (err) { Toast.error({title: t("LoginBoard.errorOnRedirect")}); } @@ -54,9 +53,9 @@ export const LoginBoard = () => {
- + - +

{t("LoginBoard.title")}

diff --git a/src/routes/NewBoard/NewBoard.tsx b/src/routes/NewBoard/NewBoard.tsx index 09efb1d45b..27055ab57d 100644 --- a/src/routes/NewBoard/NewBoard.tsx +++ b/src/routes/NewBoard/NewBoard.tsx @@ -5,7 +5,6 @@ import {AccessPolicySelection} from "components/AccessPolicySelection"; import {AccessPolicy} from "types/board"; import {useTranslation} from "react-i18next"; import {useNavigate} from "react-router"; -import {Link} from "react-router-dom"; import {columnTemplates} from "./columnTemplates"; import {TextInputLabel} from "../../components/TextInputLabel"; import {TextInput} from "../../components/TextInput"; @@ -48,9 +47,9 @@ export const NewBoard = () => {
- + - + {!extendedConfiguration && (
diff --git a/src/routes/NotFound/NotFound.test.tsx b/src/routes/NotFound/NotFound.test.tsx index 23ef09e9d0..6a999b5828 100644 --- a/src/routes/NotFound/NotFound.test.tsx +++ b/src/routes/NotFound/NotFound.test.tsx @@ -1,5 +1,5 @@ -import {screen, fireEvent, render} from "@testing-library/react"; -import {BrowserRouter, MemoryRouter, Routes, Route} from "react-router-dom"; +import {render} from "@testing-library/react"; +import {BrowserRouter} from "react-router-dom"; import {NotFound} from "./NotFound"; describe("NotFound", () => { @@ -11,20 +11,4 @@ describe("NotFound", () => { ); expect(container.firstChild).toMatchSnapshot(); }); - - it("should redirect to homepage on button click", () => { - const {getByText} = render( - - - } /> - Homepage
} /> - - - ); - - const button = getByText("NotFoundPage.navigateHome"); - expect(button).toBeInTheDocument(); - fireEvent.click(button); - expect(screen.getByText("Homepage")).toBeInTheDocument(); - }); }); diff --git a/src/routes/NotFound/NotFound.tsx b/src/routes/NotFound/NotFound.tsx index a80422bc3b..489cccf1e5 100644 --- a/src/routes/NotFound/NotFound.tsx +++ b/src/routes/NotFound/NotFound.tsx @@ -10,12 +10,10 @@ import {ReactComponent as BackgroundFreeFormDark} from "assets/pages/404/404_Bac import {ReactComponent as BackgroundDetails} from "assets/pages/404/Details.svg"; import {useTranslation} from "react-i18next"; -import {useNavigate} from "react-router"; import {ScrumlrLogo} from "../../components/ScrumlrLogo"; export const NotFound = () => { const {t} = useTranslation(); - const navigate = useNavigate(); return (
@@ -35,7 +33,12 @@ export const NotFound = () => {
{t("NotFoundPage.descriptionLine1")}
{t("NotFoundPage.descriptionLine2")}
-