2026-11-26 10:29:49 +00:00
|
|
|
|
import Link from "next/link";
|
|
|
|
|
|
import { notFound } from "next/navigation";
|
|
|
|
|
|
|
|
|
|
|
|
import { Avatar } from "@/components/forum/Avatar";
|
|
|
|
|
|
import { ThreadList, WaitingCard } from "@/components/forum/ThreadList";
|
|
|
|
|
|
import { MoonPhaseIcon } from "@/components/MoonChip";
|
|
|
|
|
|
import { MOON_PHASES, SIGNS } from "@/lib/astro";
|
|
|
|
|
|
import { type ForumHome, ago, memberHref } from "@/lib/forum";
|
|
|
|
|
|
import { forumGet } from "@/lib/forumServer";
|
|
|
|
|
|
import { loadSky } from "@/lib/sky";
|
|
|
|
|
|
import { MOON_IN_SIGN, SIGN_IN, withArticle } from "@/lib/skyText";
|
|
|
|
|
|
import type { SkyNow } from "@/lib/types";
|
|
|
|
|
|
|
|
|
|
|
|
export const metadata = { title: { absolute: "Fórum · Sorsfonalak" } };
|
|
|
|
|
|
|
|
|
|
|
|
function TopicIcon({ slug }: { slug: string }) {
|
|
|
|
|
|
return (
|
|
|
|
|
|
<svg viewBox="0 0 24 24" aria-hidden="true" className="topic-icon">
|
|
|
|
|
|
{slug === "ami-a-szivemen-van" && (
|
|
|
|
|
|
<path d="M12 20s-7.5-4.6-7.5-10.2A4.2 4.2 0 0 1 12 7.3a4.2 4.2 0 0 1 7.5 2.5C19.5 15.4 12 20 12 20z" />
|
|
|
|
|
|
)}
|
|
|
|
|
|
{slug === "belso-utak" && (
|
|
|
|
|
|
<>
|
|
|
|
|
|
<path d="M12 12a1.2 1.2 0 1 0 1.2-1.2" />
|
|
|
|
|
|
<path d="M13.2 10.8A3.4 3.4 0 1 0 15.4 14" />
|
|
|
|
|
|
<path d="M15.4 14A5.6 5.6 0 1 1 12 6.4" />
|
|
|
|
|
|
<path d="M12 6.4a7.8 7.8 0 1 1-7.6 9.4" />
|
|
|
|
|
|
</>
|
|
|
|
|
|
)}
|
|
|
|
|
|
{slug === "egbolt-es-kepletek" && (
|
|
|
|
|
|
<>
|
|
|
|
|
|
<circle cx="12" cy="12" r="8.5" />
|
|
|
|
|
|
<path d="M12 7.5l1.2 3.3 3.3 1.2-3.3 1.2L12 16.5l-1.2-3.3L7.5 12l3.3-1.2z" />
|
|
|
|
|
|
</>
|
|
|
|
|
|
)}
|
|
|
|
|
|
{slug === "torzsasztal" && (
|
|
|
|
|
|
<>
|
|
|
|
|
|
<path d="M4.5 10h11v4.5a5 5 0 0 1-5 5h-1a5 5 0 0 1-5-5z" />
|
|
|
|
|
|
<path d="M15.5 11.5h1.3a2.4 2.4 0 0 1 0 4.8h-1.6" />
|
|
|
|
|
|
<path d="M8.5 3.5c0 1.4 1 1.6 1 3M12 3.5c0 1.4 1 1.6 1 3" />
|
|
|
|
|
|
</>
|
|
|
|
|
|
)}
|
|
|
|
|
|
{!["ami-a-szivemen-van", "belso-utak", "egbolt-es-kepletek", "torzsasztal"].includes(slug) && (
|
|
|
|
|
|
<circle cx="12" cy="12" r="8.5" />
|
|
|
|
|
|
)}
|
|
|
|
|
|
</svg>
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** "Mai égbolt": the Moon today, the same for everyone; never empty. */
|
|
|
|
|
|
function SkyCard({ sky }: { sky: SkyNow }) {
|
|
|
|
|
|
const moon = sky.moon;
|
|
|
|
|
|
const sign = moon.position.sign;
|
|
|
|
|
|
const date = new Date(sky.local_time.slice(0, 10) + "T12:00:00Z").toLocaleDateString("hu-HU", {
|
|
|
|
|
|
month: "long",
|
|
|
|
|
|
day: "numeric",
|
|
|
|
|
|
weekday: "long",
|
|
|
|
|
|
timeZone: "UTC",
|
|
|
|
|
|
});
|
|
|
|
|
|
return (
|
|
|
|
|
|
<section className="fh-card fh-sky" aria-labelledby="fh-sky-title">
|
|
|
|
|
|
<div className="fh-card-head">
|
|
|
|
|
|
<span className="eyebrow">Mai égbolt</span>
|
|
|
|
|
|
<span className="hint">{date}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div className="fh-sky-body">
|
|
|
|
|
|
<span className="fh-moon">
|
|
|
|
|
|
<MoonPhaseIcon illumination={moon.illumination} waxing={moon.waxing} />
|
|
|
|
|
|
</span>
|
|
|
|
|
|
<div className="fh-sky-text">
|
|
|
|
|
|
<h2 id="fh-sky-title">
|
|
|
|
|
|
{MOON_PHASES[moon.phase] ?? moon.phase}, <span className="sym">{SIGNS[sign]?.glyph}</span> Hold{" "}
|
|
|
|
|
|
{withArticle(SIGN_IN[sign] ?? sign)}
|
|
|
|
|
|
</h2>
|
|
|
|
|
|
<p>{MOON_IN_SIGN[sign]}</p>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<Link href="/holdnaptar" className="fh-sky-link">
|
|
|
|
|
|
Holdnaptár és a következő holdfázisok
|
|
|
|
|
|
</Link>
|
|
|
|
|
|
</section>
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export default async function ForumHomePage() {
|
|
|
|
|
|
const [home, sky] = await Promise.all([forumGet<ForumHome>("/v1/forum/home"), loadSky()]);
|
|
|
|
|
|
if (!home.ok) notFound();
|
|
|
|
|
|
const { viewer, followed, topics, unanswered, hot } = home.data;
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
|
<div className="fh fh-home">
|
|
|
|
|
|
<div className="fh-col fh-col-main">
|
|
|
|
|
|
{!viewer.logged_in && (
|
|
|
|
|
|
<section className="fh-card fh-intro o-1">
|
|
|
|
|
|
<h1>Fórum</h1>
|
|
|
|
|
|
<p>
|
|
|
|
|
|
Beszélgetés a spiritualitásról, az égboltról, az álmokról és arról, ami a szívedet nyomja. Itt mindenki
|
|
|
|
|
|
álnéven ír, a tempó nyugodt, és a meghallgatás fontosabb a vitánál.
|
|
|
|
|
|
</p>
|
|
|
|
|
|
<p className="hint">
|
|
|
|
|
|
Olvasni belépés nélkül is lehet. Hozzászólni és az „Ami a szívemen van” témát olvasni belépve.
|
|
|
|
|
|
</p>
|
|
|
|
|
|
<Link href="/belepes?vissza=/forum" className="btn btn-primary">
|
|
|
|
|
|
Belépés
|
|
|
|
|
|
</Link>
|
|
|
|
|
|
</section>
|
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
|
|
{viewer.needs_nickname && (
|
|
|
|
|
|
<Link href="/forum/beallitasok" className="fh-banner o-2">
|
|
|
|
|
|
<span>
|
|
|
|
|
|
<strong>Válassz álnevet</strong>, hogy hozzászólhass. A valódi neved soha nem jelenik meg a fórumon.
|
|
|
|
|
|
</span>
|
|
|
|
|
|
<span aria-hidden="true">›</span>
|
|
|
|
|
|
</Link>
|
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
|
|
{viewer.member?.banned && (
|
|
|
|
|
|
<p className="fh-banner fh-banner-warn o-2">
|
|
|
|
|
|
Most nem írhatsz a fórumba. A részleteket a beállításaidnál látod.
|
|
|
|
|
|
</p>
|
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
|
|
{followed && followed.new_replies > 0 && (
|
|
|
|
|
|
<Link href="/forum/kovetett" className="fh-banner o-2">
|
|
|
|
|
|
<span>
|
|
|
|
|
|
<strong>{followed.new_replies} új válasz</strong> a követett szálaidban
|
|
|
|
|
|
</span>
|
|
|
|
|
|
<span aria-hidden="true">›</span>
|
|
|
|
|
|
</Link>
|
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
|
|
{unanswered.length > 0 && (
|
|
|
|
|
|
<section className="fh-section o-4" aria-labelledby="fh-waiting">
|
|
|
|
|
|
<div className="fh-section-head">
|
|
|
|
|
|
<h2 id="fh-waiting">Várják a válaszod</h2>
|
|
|
|
|
|
<span className="hint">még senki nem válaszolt</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div className="fh-waiting-grid">
|
|
|
|
|
|
{unanswered.map((t) => (
|
|
|
|
|
|
<WaitingCard key={t.id} thread={t} />
|
|
|
|
|
|
))}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</section>
|
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
|
|
{hot.length > 0 && (
|
|
|
|
|
|
<section className="fh-section o-5" aria-labelledby="fh-hot">
|
|
|
|
|
|
<div className="fh-section-head">
|
|
|
|
|
|
<h2 id="fh-hot">Pörgős most</h2>
|
|
|
|
|
|
<span className="hint">az utóbbi 24 órában</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div className="fh-card fh-flush">
|
|
|
|
|
|
<ThreadList threads={hot} />
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</section>
|
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
|
|
<section className="fh-section o-6" aria-labelledby="fh-topics">
|
|
|
|
|
|
<div className="fh-section-head">
|
|
|
|
|
|
<h2 id="fh-topics">Témák</h2>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<ul className="fh-card fh-flush fh-topics">
|
|
|
|
|
|
{topics.map((t) => (
|
|
|
|
|
|
<li key={t.slug}>
|
|
|
|
|
|
<Link href={t.readable ? `/forum/${t.slug}` : `/belepes?vissza=/forum/${t.slug}`} className="fh-topic">
|
|
|
|
|
|
<span className="fh-topic-icon">
|
|
|
|
|
|
<TopicIcon slug={t.slug} />
|
|
|
|
|
|
</span>
|
|
|
|
|
|
<span className="fh-topic-text">
|
|
|
|
|
|
<span className="fh-topic-name">
|
|
|
|
|
|
{t.name}
|
|
|
|
|
|
{t.visibility !== "public" && (
|
|
|
|
|
|
<svg viewBox="0 0 24 24" className="fh-lock" role="img" aria-label="Csak tagoknak">
|
|
|
|
|
|
<rect x="5" y="11" width="14" height="9" rx="2" />
|
|
|
|
|
|
<path d="M8 11V8a4 4 0 0 1 8 0v3" />
|
|
|
|
|
|
</svg>
|
|
|
|
|
|
)}
|
|
|
|
|
|
</span>
|
|
|
|
|
|
<span className="fh-topic-desc">{t.description}</span>
|
|
|
|
|
|
{t.readable && t.last && (
|
|
|
|
|
|
<span className="fh-topic-last">
|
|
|
|
|
|
{t.last.author && (
|
|
|
|
|
|
<Avatar avatar={t.last.author.avatar} size={18} online={t.last.author.online} />
|
|
|
|
|
|
)}
|
|
|
|
|
|
{t.last.author?.nickname ?? "Törölt tag"},{" "}
|
|
|
|
|
|
<time suppressHydrationWarning dateTime={t.last.at}>
|
|
|
|
|
|
{ago(t.last.at)}
|
|
|
|
|
|
</time>
|
|
|
|
|
|
</span>
|
|
|
|
|
|
)}
|
|
|
|
|
|
{!t.readable && <span className="fh-topic-last">Belépés után olvasható</span>}
|
|
|
|
|
|
</span>
|
|
|
|
|
|
{t.readable && (
|
|
|
|
|
|
<span className="fh-topic-count">
|
|
|
|
|
|
<strong>{t.thread_count ?? 0}</strong> szál
|
|
|
|
|
|
</span>
|
|
|
|
|
|
)}
|
|
|
|
|
|
{t.readable && t.new_count ? (
|
|
|
|
|
|
<span className="ft-new">{t.new_count > 99 ? "99+" : t.new_count} új</span>
|
|
|
|
|
|
) : null}
|
|
|
|
|
|
</Link>
|
|
|
|
|
|
</li>
|
|
|
|
|
|
))}
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
</section>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<aside className="fh-col fh-col-side" aria-label="Oldalsáv">
|
|
|
|
|
|
{sky && (
|
|
|
|
|
|
<div className="o-3">
|
|
|
|
|
|
<SkyCard sky={sky} />
|
|
|
|
|
|
</div>
|
|
|
|
|
|
)}
|
|
|
|
|
|
{viewer.member && (
|
|
|
|
|
|
<section className="fh-card fh-me o-7" aria-label="Saját">
|
|
|
|
|
|
<div className="fh-me-head">
|
|
|
|
|
|
<Avatar avatar={viewer.member.avatar} size={48} />
|
|
|
|
|
|
<span className="fh-me-names">
|
|
|
|
|
|
<Link href={memberHref(viewer.member.nickname)} className="fa-name">
|
|
|
|
|
|
{viewer.member.nickname}
|
|
|
|
|
|
</Link>
|
|
|
|
|
|
<span className="fa-rank">{viewer.member.rank_name}</span>
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div className="fh-me-actions">
|
|
|
|
|
|
<Link href="/forum/uj" className="btn btn-primary btn-sm">
|
|
|
|
|
|
Új szál
|
|
|
|
|
|
</Link>
|
|
|
|
|
|
<Link href="/forum/beallitasok" className="btn btn-sm">
|
|
|
|
|
|
Fórumprofil
|
|
|
|
|
|
</Link>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</section>
|
|
|
|
|
|
)}
|
|
|
|
|
|
{viewer.moderator && (
|
|
|
|
|
|
<Link href="/forum/moderalas" className="fh-side-link o-8">
|
2026-11-26 10:48:28 +00:00
|
|
|
|
Moderálás: jelentések és napló
|
2026-11-26 10:29:49 +00:00
|
|
|
|
</Link>
|
|
|
|
|
|
)}
|
|
|
|
|
|
</aside>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|