Files
MineGeo/app/servers/[id]/page.tsx
pavel444-byte e1a6ab5730
Some checks failed
Deploy MineGeo to Dokploy / deploy (push) Failing after 3m22s
Add map community reactions, comments, and moderation
2026-10-17 12:45:18 +05:00

84 lines
2.8 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { getI18n } from "@/lib/i18n";
import { Username } from "@/components/Username";
import { notFound } from "next/navigation";
import Image from "next/image";
import { Header, Footer } from "@/components/Shell";
import { StartGame } from "@/components/StartGame";
import { getMap } from "@/lib/catalog";
import { ContributionInstructions } from "@/components/ContributionInstructions";
import { ReportContent } from "@/components/ReportContent";
import { user } from "@/lib/supabase";
import { accountProfile } from "@/lib/profile";
import { ExportMap } from "@/components/MapTransfer";
import { MapCommunity } from "@/components/MapCommunity";
export default async function ServerPage({
params,
}: {
params: Promise<{ id: string }>;
}) {
const { t } = await getI18n();
const { id } = await params;
const map = await getMap(id);
if (!map) notFound();
const account = await user();
const profile = account ? await accountProfile(account) : null;
return (
<>
<Header />
<main className="section page-content">
<span className="eyebrow">
{map.source === "plugin"
? t("SERVER EXPORT")
: t("PLAYER CONTRIBUTION")}{" "}
{t("· MINECRAFT 1.21.11")}
</span>
<h1>{map.name}</h1>
<p className="lead">{map.description}</p>
<p className="map-credit">
{t("Created by")}{" "}
<Username name={map.credit} appearance={map.creditAppearance} />
</p>
<ReportContent datasetId={id} />
{account?.id === map.owner_id && <ExportMap id={id} />}
<p className="muted">
{t("Map ID:")} <code>{map.id}</code>
</p>
<div className="detail-grid">
<div>
<div className="detail-map">
<Image
src={map.mapImage || map.image || "/images/example-map.webp"}
alt={`${map.name} surface map`}
width={1024}
height={1024}
loading="eager"
unoptimized
/>
</div>
<div className="card-meta">
<span>
{map.panorama_count} {t("panoramas")}
</span>
<span>{t("Overworld surface")}</span>
<span>
{map.bounds.maxX - map.bounds.minX} ×{" "}
{map.bounds.maxZ - map.bounds.minZ} {t("blocks")}
</span>
</div>
</div>
<StartGame datasetId={id} hostName={profile?.display_name ?? null} />
</div>
{map.allow_contributions && (
<ContributionInstructions
id={id}
bounds={map.bounds}
serverAddress={map.contribution_server_address}
/>
)}
<MapCommunity datasetId={id} ownerId={map.owner_id} />
</main>
<Footer />
</>
);
}