feat(admin): 完善玩家管理与角色配置

This commit is contained in:
wchino
2026-07-21 21:11:07 +08:00
parent 44fd0633d6
commit 33d887d252
22 changed files with 659 additions and 82 deletions

View File

@@ -0,0 +1,67 @@
"use client";
import type { ReactNode } from "react";
import { CircleHelp } from "lucide-react";
import { Button } from "@/components/ui/button";
import { Label } from "@/components/ui/label";
import {
Tooltip,
TooltipContent,
TooltipTrigger,
} from "@/components/ui/tooltip";
type AdminFieldLabelProps = {
htmlFor: string;
children: ReactNode;
helpText?: string;
helpAriaLabel?: string;
className?: string;
};
export function AdminFieldLabel({
htmlFor,
children,
helpText,
helpAriaLabel,
className,
}: AdminFieldLabelProps): React.ReactElement {
if (!helpText) {
return (
<Label htmlFor={htmlFor} className={className}>
{children}
</Label>
);
}
return (
<div className="flex items-center gap-1">
<Label htmlFor={htmlFor} className={className}>
{children}
</Label>
<Tooltip>
<TooltipTrigger
render={
<Button
type="button"
variant="ghost"
size="icon-xs"
className="text-muted-foreground"
aria-label={helpAriaLabel}
data-field-help={htmlFor}
/>
}
>
<CircleHelp aria-hidden="true" />
</TooltipTrigger>
<TooltipContent
side="top"
align="start"
className="max-w-80 whitespace-normal text-left leading-relaxed"
>
<p>{helpText}</p>
</TooltipContent>
</Tooltip>
</div>
);
}