Files
sorsfonalak/services/frontend/src/components/AdminNav.tsx
T
fecoandClaude Opus 5.5 0d62888831
CI / test (push) Successful in 3m25s
CI / build (push) Skipped
CI / deploy (push) Skipped
Gift withdrawal: admin refund (Stripe) and invoice storno (Billingo)
- The buyer may withdraw from a gift purchase within 14 days while the
  code is not redeemed (ÁSZF 3., 5., 6.; terms version 2026-11-23); the
  consent on Stripe's page and the confirmation e-mail say so
- Admin → Ajándékok: the gifts with payment, invoice and storno; the
  refund button locks the gift and refuses a redeemed one, withdraws the
  code, refunds the PaymentIntent on Stripe (one refund per gift via the
  Idempotency-Key, retry when Stripe refuses) and queues the storno
- Worker: cancels the issued invoice in Billingo (POST /documents/{id}/
  cancel, e-mailed to the buyer), keeps the storno invoice's id and
  number; a lost answer is not asked again but left for an admin
- A withdrawn code cannot be redeemed, sent or downloaded; "My gifts"
  shows it as refunded

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
2026-11-23 21:22:46 +00:00

34 lines
1.2 KiB
TypeScript

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/ajandekok", label: "Ajándékok" },
{ 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ó" },
];
/** 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.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>
))}
</nav>
);
}