27 lines
1.2 KiB
TypeScript
27 lines
1.2 KiB
TypeScript
import type { Metadata } from "next";
|
|||
|
|
import { notFound, permanentRedirect } from "next/navigation";
|
||
|
|
|
||
|
|
import { getMe } from "@/lib/server";
|
||
|
|
import { calendarYear, currentYear, loadSkyEvents } from "@/lib/sky";
|
||
|
|
|
||
|
|
import { RetrogradeCalendar } from "../RetrogradeCalendar";
|
||
|
|
|
||
|
|
export async function generateMetadata({ params }: { params: Promise<{ ev: string }> }): Promise<Metadata> {
|
||
|
|
const year = calendarYear((await params).ev);
|
||
|
|
if (!year) return {};
|
||
|
|
return {
|
||
|
|
title: `Merkúr retrográd ${year}: mikor retrográd a Merkúr és a többi bolygó?`,
|
||
|
|
description: `Merkúr retrográd ${year}: a retrográd időszakok pontos kezdete és vége magyar idő szerint, árnyékszakaszokkal, a Vénusztól a Plútóig.`,
|
||
|
|
alternates: { canonical: `/retrograd/${year}` },
|
||
|
|
};
|
||
|
|
}
|
||
|
|
|
||
|
|
/** The retrograde periods of another year (the current one is `/retrograd`). */
|
||
|
|
export default async function RetrogradeYearPage({ params }: { params: Promise<{ ev: string }> }) {
|
||
|
|
const year = calendarYear((await params).ev);
|
||
|
|
if (!year) notFound();
|
||
|
|
if (year === currentYear()) permanentRedirect("/retrograd");
|
||
|
|
const [me, events] = await Promise.all([getMe(), loadSkyEvents(year)]);
|
||
|
|
return <RetrogradeCalendar year={year} events={events} sky={null} me={me} />;
|
||
|
|
}
|