82 lines
2.9 KiB
TypeScript
82 lines
2.9 KiB
TypeScript
import { FC } from 'react';
|
|
import { Main } from '@/app/ui/Main';
|
|
|
|
import { authConfig } from "@/app/lib/auth";
|
|
import { SignInButton } from '@/app/ui/SignInButton';
|
|
import Image from 'next/image';
|
|
import { getTranslations } from "next-intl/server";
|
|
|
|
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>(provider, providerKeys)
|
|
);
|
|
}
|
|
|
|
function getKeyValuesFromObject<T>(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 providers = await getProviders();
|
|
const t = await getTranslations("login-page");
|
|
|
|
return (
|
|
<Main>
|
|
<h1 className="text-3xl font-bold text-center">
|
|
<span className="text-neutral-50 mr-3">{t("main-card.title-1")}</span>
|
|
<span className="text-indigo-400">{t("main-card.title-2")}</span>
|
|
<span className="text-neutral-50 ml-3">{t("main-card.title-3")}</span>
|
|
</h1>
|
|
<p className="p mt-[1em] text-center">{t("main-card.text-1")}</p>
|
|
<p className="p mb-[1em] text-center">{t("main-card.text-2")}</p>
|
|
<span className="text-center">
|
|
{
|
|
Object.values(providers).map((provider) => (
|
|
<div key={provider.name}>
|
|
<SignInButton provider={provider} />
|
|
</div>
|
|
))
|
|
}
|
|
</span>
|
|
<video className="m-auto mt-4" title={t("main-card.video-title")} role="img" data-js-id="hero" loop muted playsInline autoPlay poster={t("main-card.image-url")}>
|
|
<source src={t("main-card.video-url")} type="video/webm" />
|
|
</video>
|
|
|
|
<h1 className="text-2xl font-bold text-neutral-50 my-5">{t("card-1.title")}</h1>
|
|
<p className="p mt-[1em]">{t("card-1.text")}</p>
|
|
<video className="m-auto mt-4" title={t("card-1.video-title")} role="img" data-js-id="hero" loop muted playsInline autoPlay poster={t("card-1.image-url")}>
|
|
<source src={t("card-1.video-url")} type="video/webm" />
|
|
</video>
|
|
|
|
<h1 className="text-2xl font-bold text-neutral-50 my-5">{t("card-2.title")}</h1>
|
|
<p className="p mt-[1em]">{t("card-2.text")}</p>
|
|
<Image src="/status-color-demo.png" alt="Boje označavaju status računa" className="m-auto mt-4" width={423} height={145} />
|
|
|
|
<h1 className="text-2xl font-bold text-neutral-50 my-5">{t("card-3.title")}</h1>
|
|
<p className="p mt-[1em]">{t("card-3.text")}</p>
|
|
<video className="m-auto mt-4" title={t("card-3.video-title")} role="img" data-js-id="hero" loop muted playsInline autoPlay poster={t("card-3.image-url")}>
|
|
<source src={t("card-3.video-url")} type="video/webm" />
|
|
</video>
|
|
</Main>
|
|
);
|
|
}
|
|
|
|
export default Page; |