import { FC, ReactNode } from 'react'; import { Main } from '@/app/ui/Main'; import { authConfig, myAuth } from "@/app/lib/auth"; import { SignInButton } from '@/app/ui/SignInButton'; import Image from 'next/image'; import { getTranslations, getLocale } from "next-intl/server"; import isWebview from "is-ua-webview"; import { headers } from 'next/headers'; import { ExclamationTriangleIcon } from "@heroicons/react/24/outline"; import Link from 'next/link'; import { MultiParagraphText } from '../ui/MultiParagrpahText'; type Provider = { id: string; name: string; type: string; style: { logo: string; bg: string; text: string; }; }; function getProviders(): Provider[] { const providerKeys: (keyof Provider)[] = ["id", "name", "type", "style"]; return authConfig.providers.map((provider) => getKeyValuesFromObject(provider, providerKeys) ); } function getKeyValuesFromObject(obj: any, keys: (keyof T)[]): T { return keys.reduce((acc, key) => { if (obj[key]) { acc[key] = obj[key]; } return acc; }, {} as T); } const Page:FC = async () => { const session = await myAuth(); const locale = await getLocale(); const providers = await getProviders(); const t = await getTranslations("login-page"); // get userAgent from NextJS const headersList = headers(); const userAgent = headersList.get("user-agent") as string; const insideWebeview = isWebview(userAgent); return (

{t("main-card.title-1")} {t("main-card.title-2")} {t("main-card.title-3")}

{t.rich("main-card.text-1", { strong: (chunks) => {chunks}, p: (chunks) =>

{chunks}

})} Man burried under bills Robot sortira papire { t("main-card.text-2").split("\n").map((line, index) => (

{line}

)) } { session ? ( {t("main-card.cta-try-it-for-free")} ) : ( Object.values(providers).map((provider) => (
)) ) }
{ // Google will refuse OAuth signin if it's inside a webview (i.e. Facebook) insideWebeview &&
{ t.rich("main-card.in-app-browser-warning", { br: () =>
, strong: (chunks:ReactNode) => {chunks}, hint: (chunks:ReactNode) => {chunks} }) }
} man-burried-under-paper.png

{t("card-1.title")}

{t("card-1.text")}

{t("card-2.title")}

{t("card-2.text")}

Boje označavaju status računa

{t("card-3.title")}

{t("card-3.text")}

); } export default Page;