Files
lolympus-tournament-support/apps/web/src/components/AdminPage.tsx
T

83 lines
2.2 KiB
TypeScript

import type { ReactNode } from "react";
import { NavLink } from "react-router";
import { PageBody, PageHero } from "../ui";
const ADMIN_SECTIONS = [
{ path: "matches", label: "내전 관리" },
{ path: "tournament-codes", label: "토너먼트 코드" },
{ path: "legacy-import", label: "과거 기록 가져오기" },
{ path: "legacy-matches", label: "과거 기록 정리" },
] as const;
/**
* 운영 화면 공통 틀. 네 개의 운영 도구를 한 줄 탭으로 오갈 수 있게 한다.
*/
export function AdminPage({
communityId,
title,
description,
actions,
children,
}: {
communityId: string;
title: string;
description?: string;
actions?: ReactNode;
children: ReactNode;
}) {
return (
<>
<PageHero
width="xl"
eyebrow="운영"
title={title}
meta={description}
actions={actions}
/>
<PageBody width="xl">
<nav
aria-label="운영 메뉴"
className="lts-panel no-scrollbar mb-5 flex gap-1 overflow-x-auto p-1"
>
{ADMIN_SECTIONS.map((section) => (
<NavLink
key={section.path}
to={`/admin/communities/${communityId}/${section.path}`}
className={({ isActive }) =>
`flex h-10 shrink-0 items-center rounded-[10px] px-4 text-sm font-bold transition-colors ${
isActive
? "bg-secondary text-secondary-content dark:bg-white dark:text-[#14161b]"
: "text-content-muted hover:bg-sunken hover:text-content"
}`
}
>
{section.label}
</NavLink>
))}
</nav>
{children}
</PageBody>
</>
);
}
/** 운영 화면의 권한·설정 안내. */
export function AdminNotice({
title,
children,
}: {
title: string;
children?: ReactNode;
}) {
return (
<main className="mx-auto w-full max-w-3xl px-4 py-16 sm:px-6">
<div className="lts-panel px-6 py-10 text-center">
<h1 className="text-lg font-bold text-content">{title}</h1>
{children && (
<div className="mt-2 text-sm text-content-muted">{children}</div>
)}
</div>
</main>
);
}