Add account restrictions, appeals, and admin moderation tools

This commit is contained in:
2026-10-13 12:32:37 +05:00
parent 018be5049e
commit cfe5820802
28 changed files with 1936 additions and 125 deletions

View File

@@ -3,7 +3,8 @@ import "server-only";
import Link from "next/link";
import { Compass, ArrowUpRight } from "lucide-react";
import { LanguageSwitcher } from "./LanguageSwitcher";
import { user } from "@/lib/supabase";
import { rawUser, admin, required } from "@/lib/supabase";
import { canReviewMaps, isAdministrator } from "@/shared/permissions";
import { Brand } from "./Brand";
import { SiteNav } from "./SiteNav";
import { ReportBugButton } from "./ReportBugButton";
@@ -12,7 +13,7 @@ import { CommunityLinks } from "./CommunityLinks";
import { forumUrl } from "@/lib/forum";
export async function Header() {
const { t } = await getI18n();
const account = await user();
const account = await rawUser();
return (
<header className="site-header">
<div className="header-inner">
@@ -35,6 +36,17 @@ export async function Header() {
export async function Footer() {
const { t } = await getI18n();
const forum = forumUrl();
const account = await rawUser();
const result = account
? await admin()
.from("profiles")
.select("role,account_status")
.eq("id", account.id)
.maybeSingle()
: null;
if (result?.error) required(result);
const role =
result?.data?.account_status === "active" ? result.data.role : undefined;
return (
<footer className="site-footer">
<div>
@@ -60,7 +72,10 @@ export async function Footer() {
{t("Status")}
</a>
<Link href="/leaderboard">{t("Leaderboard")}</Link>
<Link href="/moderation">{t("Moderation")}</Link>
{canReviewMaps(role) && (
<Link href="/moderation">{t("Moderation Tools")}</Link>
)}
{isAdministrator(role) && <Link href="/admin">{t("Admin Tools")}</Link>}
</div>
<p className="disclaimer">
{t(