"use client"; import { FC } from "react"; import Link from "next/link"; import Image from "next/legacy/image"; import { Box, Grid, Container, IconButton } from "@mui/material"; import { Apple as AppleIcon, Google as GoogleIcon } from "@mui/icons-material"; import { useTranslate } from "react-polyglot"; import { LanguageSelect } from "app/_components/LanguageSelect"; import LeafcutterLogoLarge from "images/leafcutter-logo-large.png"; import { signIn } from "next-auth/react"; import { useLeafcutterContext } from "leafcutter-ui"; type LoginProps = { session: any; }; export const Login: FC = ({ session }) => { const t = useTranslate(); const { colors: { leafcutterElectricBlue, lightGray }, typography: { h1, h4 }, } = useLeafcutterContext(); const buttonStyles = { backgroundColor: lightGray, borderRadius: 500, width: "100%", fontSize: "16px", fontWeight: "bold", }; return ( <> {t("welcomeToLeafcutter")} {t("welcomeToLeafcutterDescription")} {!session ? ( signIn("google", { callbackUrl: `${window.location.origin}/setup`, }) } > {`${t("signInWith")} Google`} signIn("apple", { callbackUrl: `${window.location.origin}/setup`, }) } > {`${t("signInWith")} Apple`} {t("dontHaveAccount")}{" "} {t("requestAccessHere")} ) : null} {session ? ( <> {`${t("welcome")}, ${ session.user.name ?? session.user.email }.`} {t("goHome")} ) : null} ); };