2026-11-19 10:36:18 +00:00
import type { Metadata } from "next" ;
2026-11-15 21:00:50 +00:00
import { redirect } from "next/navigation" ;
2026-11-21 20:31:45 +00:00
import { JsonLd } from "@/components/PublicFooter" ;
import { OPERATOR } from "@/lib/legal" ;
2026-11-19 10:36:18 +00:00
import { BACKEND_URL , getMe } from "@/lib/server" ;
2026-11-19 11:39:32 +00:00
import { siteUrl } from "@/lib/share" ;
2026-11-19 10:36:18 +00:00
import type { PublicConfig } from "@/lib/types" ;
2026-11-15 21:00:50 +00:00
2026-11-19 10:36:18 +00:00
import { Landing } from "./Landing" ;
2026-11-19 11:39:32 +00:00
/** Bumped when the preview image changes, so Facebook and co. fetch it again. */
const PREVIEW_VERSION = 1 ;
export async function generateMetadata () : Promise < Metadata > {
const base = await siteUrl ();
const title = "Sorsfonalak – ahol a csillagok összekötnek" ;
2026-11-19 12:08:08 +00:00
const description =
"Születési képlet, részletes elemzés, éves előrejelzés és kapcsolati összevetés a legfejlettebb AI-modellekkel, töredék áron." ;
2026-11-19 11:39:32 +00:00
const image = {
url : ` ${ base } /kep/fooldal.png?v= ${ PREVIEW_VERSION } ` ,
width : 1200 ,
height : 630 ,
alt : "Egy példa születési képlet a Sorsfonalakon" ,
};
return {
title : { absolute : "Sorsfonalak – születési képlet, éves előrejelzés, kapcsolati összevetés" },
description :
2026-11-20 17:34:24 +00:00
"Percre pontos születési képlet és személyre szóló elemzés a legfejlettebb AI-modellekkel, percek alatt és töredék áron. Éves előrejelzés, kapcsolati összevetés és kártyajóslás." ,
2026-11-19 11:39:32 +00:00
alternates : { canonical : ` ${ base } /` },
openGraph : { type : "website" , siteName : "Sorsfonalak" , locale : "hu_HU" , url : ` ${ base } /` , title , description , images : [ image ] },
twitter : { card : "summary_large_image" , title , description , images : [ image . url ] },
};
}
2026-11-19 10:36:18 +00:00
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). */
2026-11-15 21:00:50 +00:00
export default async function Home() {
2026-11-16 06:37:59 +00:00
const me = await getMe ();
2026-11-19 10:36:18 +00:00
if ( me ) redirect ( me . primary_chart_id ? "/keplet" : "/profil" );
2026-11-21 20:31:45 +00:00
const base = await siteUrl ();
return (
<>
< Landing inviteOnly = {( await signupMode ()) !== "open" } />
< JsonLd
data = {{
"@context" : "https://schema.org" ,
"@graph" : [
{
"@type" : "Organization" ,
"@id" : ` ${ base } /#organization` ,
name : "Sorsfonalak" ,
url : ` ${ base } /` ,
logo : ` ${ base } /apple-icon.png` ,
email : OPERATOR.email ,
},
{
"@type" : "WebSite" ,
"@id" : ` ${ base } /#website` ,
name : "Sorsfonalak" ,
url : ` ${ base } /` ,
inLanguage : "hu" ,
publisher : { "@id" : ` ${ base } /#organization` },
},
],
}}
/>
</>
);
2026-11-15 21:00:50 +00:00
}