Files
sorsfonalak/services/frontend/src/app/page.tsx
T

37 lines
1.4 KiB
TypeScript
Raw Normal View History

2026-11-19 10:36:18 +00:00
import type { Metadata } from "next";
import { redirect } from "next/navigation";
2026-11-19 10:36:18 +00:00
import { BACKEND_URL, getMe } from "@/lib/server";
import type { PublicConfig } from "@/lib/types";
2026-11-19 10:36:18 +00:00
import { Landing } from "./Landing";
export const metadata: Metadata = {
title: { absolute: "Sorsfonalak – születési képlet, éves előrejelzés, kapcsolati összevetés" },
description:
"Percre pontos születési képlet és személyre szóló elemzés, éves előrejelzés és kapcsolati összevetés: mennyire illetek össze?",
openGraph: {
type: "website",
siteName: "Sorsfonalak",
locale: "hu_HU",
title: "Sorsfonalak – ahol a csillagok összekötnek",
description: "Születési képlet, részletes elemzés, éves előrejelzés és kapcsolati összevetés.",
},
};
async function signupMode(): Promise<PublicConfig["signup_mode"]> {
try {
const res = await fetch(`${BACKEND_URL}/v1/config`, { next: { revalidate: 300 } });
return res.ok ? ((await res.json()) as PublicConfig).signup_mode : "invite";
} catch {
return "invite";
}
}
/** Visitors get the home page; logged-in users go to their chart (or to the profile for their birth data). */
export default async function Home() {
const me = await getMe();
2026-11-19 10:36:18 +00:00
if (me) redirect(me.primary_chart_id ? "/keplet" : "/profil");
return <Landing inviteOnly={(await signupMode()) !== "open"} />;
}