Admin: paged user list with a dialog; creators manage famous people
- The user list pages (25 per page, with the total from the backend); roles, packages and single units are set in a dialog instead of in the row. - Creators may add, edit and publish famous people and rewrite their portraits (own regenerate route); they delete only their own. The rest of the admin stays closed to them; the header links them to their page. - No free-horoscope offer on the star sign and famous people lists. - .table-wrap is a containing block, so .sr-only text inside it no longer widens the page on phones. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
@@ -1,20 +1,28 @@
|
||||
import Link from "next/link";
|
||||
|
||||
import type { Role } from "@/lib/types";
|
||||
|
||||
const PAGES = [
|
||||
{ href: "/admin", label: "Felhasználók" },
|
||||
{ href: "/admin/meghivok", label: "Meghívók" },
|
||||
{ href: "/admin/promokodok", label: "Promókódok" },
|
||||
{ href: "/admin/hires-emberek", label: "Híres emberek" },
|
||||
{ href: "/admin/hires-emberek", label: "Híres emberek", creator: true },
|
||||
{ href: "/admin/promptok", label: "Promptok" },
|
||||
{ href: "/admin/modellek", label: "Modellek" },
|
||||
{ href: "/admin/hibak", label: "Hibanapló" },
|
||||
];
|
||||
|
||||
/** Switches between the admin pages. */
|
||||
export function AdminNav({ current }: { current: string }) {
|
||||
/** May manage the famous people (an admin or a creator). */
|
||||
export function canEditCelebrities(roles: Role[]): boolean {
|
||||
return roles.includes("admin") || roles.includes("creator");
|
||||
}
|
||||
|
||||
/** Switches between the admin pages (a creator who is no admin: only theirs). */
|
||||
export function AdminNav({ current, roles }: { current: string; roles?: Role[] }) {
|
||||
const admin = !roles || roles.includes("admin");
|
||||
return (
|
||||
<nav className="admin-nav" aria-label="Admin oldalak">
|
||||
{PAGES.map((p) => (
|
||||
{PAGES.filter((p) => admin || ("creator" in p && p.creator)).map((p) => (
|
||||
<Link key={p.href} href={p.href} aria-current={p.href === current ? "page" : undefined}>
|
||||
{p.label}
|
||||
</Link>
|
||||
|
||||
Reference in New Issue
Block a user