This commit is contained in:
Manav Rathi 2024-05-26 21:31:18 +05:30
parent cbcfc243fc
commit 8ebd50606a
No known key found for this signature in database

View file

@ -1,7 +1,6 @@
import log from "@/next/log"; import log from "@/next/log";
import { Login } from "@ente/accounts/components/Login"; import { Login } from "@ente/accounts/components/Login";
import { SignUp } from "@ente/accounts/components/SignUp"; import { SignUp } from "@ente/accounts/components/SignUp";
import { APPS } from "@ente/shared/apps/constants";
import { EnteLogo } from "@ente/shared/components/EnteLogo"; import { EnteLogo } from "@ente/shared/components/EnteLogo";
import EnteSpinner from "@ente/shared/components/EnteSpinner"; import EnteSpinner from "@ente/shared/components/EnteSpinner";
import { PHOTOS_PAGES as PAGES } from "@ente/shared/constants/pages"; import { PHOTOS_PAGES as PAGES } from "@ente/shared/constants/pages";
@ -21,18 +20,18 @@ import { t } from "i18next";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
import { CarouselProvider, DotGroup, Slide, Slider } from "pure-react-carousel"; import { CarouselProvider, DotGroup, Slide, Slider } from "pure-react-carousel";
import "pure-react-carousel/dist/react-carousel.es.css"; import "pure-react-carousel/dist/react-carousel.es.css";
import { useContext, useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { Trans } from "react-i18next"; import { Trans } from "react-i18next";
import { AppContext } from "./_app"; import { useAppContext } from "./_app";
export default function LandingPage() { export default function LandingPage() {
const { appName, showNavBar, setDialogMessage } = useAppContext();
const router = useRouter(); const router = useRouter();
const appContext = useContext(AppContext);
const [loading, setLoading] = useState(true); const [loading, setLoading] = useState(true);
const [showLogin, setShowLogin] = useState(true); const [showLogin, setShowLogin] = useState(true);
useEffect(() => { useEffect(() => {
appContext.showNavBar(false); showNavBar(false);
const currentURL = new URL(window.location.href); const currentURL = new URL(window.location.href);
const albumsURL = new URL(getAlbumsURL()); const albumsURL = new URL(getAlbumsURL());
currentURL.pathname = router.pathname; currentURL.pathname = router.pathname;
@ -90,7 +89,7 @@ export default function LandingPage() {
await localForage.ready(); await localForage.ready();
} catch (e) { } catch (e) {
log.error("usage in incognito mode tried", e); log.error("usage in incognito mode tried", e);
appContext.setDialogMessage({ setDialogMessage({
title: t("LOCAL_STORAGE_NOT_ACCESSIBLE"), title: t("LOCAL_STORAGE_NOT_ACCESSIBLE"),
nonClosable: true, nonClosable: true,
@ -134,13 +133,9 @@ export default function LandingPage() {
<DesktopBox> <DesktopBox>
<SideBox> <SideBox>
{showLogin ? ( {showLogin ? (
<Login signUp={signUp} appName={APPS.PHOTOS} /> <Login {...{ signUp, appName }} />
) : ( ) : (
<SignUp <SignUp {...{ router, appName, login }} />
router={router}
appName={APPS.PHOTOS}
login={login}
/>
)} )}
</SideBox> </SideBox>
</DesktopBox> </DesktopBox>