feat(mod): lite /mod panel + clarify ACL vs housekeeping legacy
Co-authored-by: Cursor <[email protected]>
This commit is contained in:
1 parent
a384c9a8bb
commit
084cca6ea4
18 files changed
+931
-77
No files matched your search
@@ -20,9 +20,26 @@ export interface CfhRow {
|
||||
stateLabel: string;
|
||||
}
|
||||
|
||||
export function CfhTable({ data }: { data: PaginatedResult<CfhRow> }) {
|
||||
export function CfhTable({
|
||||
data,
|
||||
basePath = "/admin/moderation/cfh",
|
||||
userLinkMode = "admin",
|
||||
}: {
|
||||
data: PaginatedResult<CfhRow>;
|
||||
/** Detail URL prefix (no trailing slash). */
|
||||
basePath?: string;
|
||||
/** Admin user show vs public profile. */
|
||||
userLinkMode?: "admin" | "public";
|
||||
}) {
|
||||
const t = useTranslations("pages.admin.cfh");
|
||||
|
||||
function userHref(id: number, username: string) {
|
||||
if (userLinkMode === "public" && username && username !== "—") {
|
||||
return `/u/${encodeURIComponent(username)}`;
|
||||
}
|
||||
return `/admin/users/${id}`;
|
||||
}
|
||||
|
||||
const columns: DataTableColumn<CfhRow>[] = [
|
||||
{ key: "id", label: t("colId"), sortable: true },
|
||||
{
|
||||
@@ -32,7 +49,7 @@ export function CfhTable({ data }: { data: PaginatedResult<CfhRow> }) {
|
||||
render: (_value, row) => (
|
||||
<div className="min-w-0">
|
||||
<Link
|
||||
href={`/admin/moderation/cfh/${row.id}`}
|
||||
href={`${basePath}/${row.id}`}
|
||||
className="text-sm font-medium truncate block hover:underline"
|
||||
>
|
||||
{row.issue || t("noDescription")}
|
||||
@@ -50,7 +67,7 @@ export function CfhTable({ data }: { data: PaginatedResult<CfhRow> }) {
|
||||
render: (_value, row) =>
|
||||
row.senderId ? (
|
||||
<Link
|
||||
href={`/admin/users/${row.senderId}`}
|
||||
href={userHref(row.senderId, row.sender)}
|
||||
className="hover:underline"
|
||||
>
|
||||
{row.sender}
|
||||
@@ -66,7 +83,7 @@ export function CfhTable({ data }: { data: PaginatedResult<CfhRow> }) {
|
||||
render: (_value, row) =>
|
||||
row.reportedId ? (
|
||||
<Link
|
||||
href={`/admin/users/${row.reportedId}`}
|
||||
href={userHref(row.reportedId, row.reported)}
|
||||
className="font-medium hover:underline"
|
||||
>
|
||||
{row.reported}
|
||||
|
||||
Reference in new issue
Block a user