revert fb8e77bb68
Local Build and Deploy / deploy (push) Successful in 1m11s

revert style: clean up code with prettier and eslint
This commit is contained in:
remco committed 2026-07-12 21:02:03 +02:00
1 parent 27de078f54
commit e85e4d74ea
378 files changed
+20710 -22428

No files matched your search

@@ -1,4 +1,4 @@
"use client";
'use client'
import {
AlertTriangle,
@@ -10,9 +10,9 @@ import {
User,
VolumeX,
Zap,
} from "lucide-react";
import Link from "next/link";
import { useState } from "react";
} from 'lucide-react'
import Link from 'next/link'
import { useState } from 'react'
import {
assignCfhTicket,
closeCfhTicket,
@@ -20,37 +20,43 @@ import {
quickKick,
quickMute,
updateCfhState,
} from "@/actions/moderation";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { Input } from "@/components/ui/input";
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
import { Textarea } from "@/components/ui/textarea";
import { useServerAction } from "@/hooks/use-server-action";
} from '@/actions/moderation'
import { Badge } from '@/components/ui/badge'
import { Button } from '@/components/ui/button'
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
import { Input } from '@/components/ui/input'
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from '@/components/ui/select'
import { Textarea } from '@/components/ui/textarea'
import { useServerAction } from '@/hooks/use-server-action'
const CFH_STATES: Record<number, { label: string; class: string }> = {
0: { label: "Open", class: "bg-[var(--admin-error-subtle)] text-[var(--admin-error)]" },
1: { label: "Picked", class: "bg-[var(--admin-warning-subtle)] text-[var(--admin-warning)]" },
2: { label: "Closed", class: "bg-muted text-muted-foreground" },
};
0: { label: 'Open', class: 'bg-[var(--admin-error-subtle)] text-[var(--admin-error)]' },
1: { label: 'Picked', class: 'bg-[var(--admin-warning-subtle)] text-[var(--admin-warning)]' },
2: { label: 'Closed', class: 'bg-muted text-muted-foreground' },
}
interface UserInfo {
id: number;
username: string;
look: string;
rank: number;
online: string;
ipRegister: string;
mail: string | null;
id: number
username: string
look: string
rank: number
online: string
ipRegister: string
mail: string | null
}
interface BanRecord {
id: number;
reason: string;
type: string;
staff: string;
timestamp: number;
id: number
reason: string
type: string
staff: string
timestamp: number
}
export function CfhDetail({
@@ -64,27 +70,27 @@ export function CfhDetail({
currentUserId,
}: {
ticket: {
id: number;
state: number;
type: number;
timestamp: number;
issue: string;
roomId: number;
category: number;
score: number;
};
sender: UserInfo | null;
reported: UserInfo | null;
moderator: UserInfo | null;
banHistory: { count: number; recent: BanRecord[] };
canEdit: boolean;
currentUserId: number;
id: number
state: number
type: number
timestamp: number
issue: string
roomId: number
category: number
score: number
}
sender: UserInfo | null
reported: UserInfo | null
moderator: UserInfo | null
banHistory: { count: number; recent: BanRecord[] }
canEdit: boolean
currentUserId: number
}) {
const { run, isPending } = useServerAction();
const [alertMsg, setAlertMsg] = useState("");
const [muteDuration, setMuteDuration] = useState(10);
const { run, isPending } = useServerAction()
const [alertMsg, setAlertMsg] = useState('')
const [muteDuration, setMuteDuration] = useState(10)
const state = CFH_STATES[ticket.state] ?? CFH_STATES[0];
const state = CFH_STATES[ticket.state] ?? CFH_STATES[0]
return (
<div className="space-y-6">
@@ -123,7 +129,7 @@ export function CfhDetail({
</CardHeader>
<CardContent>
<p className="text-sm leading-relaxed whitespace-pre-wrap">
{ticket.issue || "No description provided."}
{ticket.issue || 'No description provided.'}
</p>
</CardContent>
</Card>
@@ -145,7 +151,7 @@ export function CfhDetail({
<div>
<p className="text-sm font-bold">{sender.username}</p>
<p className="text-xs text-muted-foreground">
Rank {sender.rank} · {sender.online === "1" ? "Online" : "Offline"}
Rank {sender.rank} · {sender.online === '1' ? 'Online' : 'Offline'}
</p>
</div>
</Link>
@@ -171,7 +177,7 @@ export function CfhDetail({
<div>
<p className="text-sm font-bold">{reported.username}</p>
<p className="text-xs text-muted-foreground">
Rank {reported.rank} · {reported.online === "1" ? "Online" : "Offline"} ·{" "}
Rank {reported.rank} · {reported.online === '1' ? 'Online' : 'Offline'} ·{' '}
{banHistory.count} bans
</p>
</div>
@@ -188,7 +194,7 @@ export function CfhDetail({
disabled={isPending}
onClick={() =>
run(() => quickKick({ userId: reported.id }), {
successMessage: "User kicked",
successMessage: 'User kicked',
})
}
>
@@ -200,9 +206,10 @@ export function CfhDetail({
className="flex-1"
disabled={isPending}
onClick={() =>
run(() => quickMute({ userId: reported.id, duration: muteDuration }), {
successMessage: `Muted for ${muteDuration}min`,
})
run(
() => quickMute({ userId: reported.id, duration: muteDuration }),
{ successMessage: `Muted for ${muteDuration}min` },
)
}
>
<VolumeX className="mr-1 h-3 w-3" /> Mute
@@ -231,10 +238,13 @@ export function CfhDetail({
className="shrink-0"
disabled={isPending || !alertMsg.trim()}
onClick={() => {
run(() => quickAlert({ userId: reported.id, message: alertMsg.trim() }), {
successMessage: "Alert sent",
onSuccess: () => setAlertMsg(""),
});
run(
() => quickAlert({ userId: reported.id, message: alertMsg.trim() }),
{
successMessage: 'Alert sent',
onSuccess: () => setAlertMsg(''),
},
)
}}
>
Alert
@@ -263,9 +273,10 @@ export function CfhDetail({
<div className="divide-y divide-border">
{banHistory.recent.map((ban) => (
<div key={ban.id} className="py-2 first:pt-0 last:pb-0 text-xs">
<p className="font-medium">{ban.reason || "No reason"}</p>
<p className="font-medium">{ban.reason || 'No reason'}</p>
<p className="text-muted-foreground">
{ban.type} · by {ban.staff} · {new Date(ban.timestamp * 1000).toLocaleDateString()}
{ban.type} · by {ban.staff} ·{' '}
{new Date(ban.timestamp * 1000).toLocaleDateString()}
</p>
</div>
))}
@@ -290,7 +301,7 @@ export function CfhDetail({
value={String(ticket.state)}
onValueChange={(v) =>
run(() => updateCfhState({ ticketId: ticket.id, state: Number(v) }), {
successMessage: "Status updated",
successMessage: 'Status updated',
})
}
>
@@ -318,7 +329,7 @@ export function CfhDetail({
disabled={isPending}
onClick={() =>
run(() => assignCfhTicket({ ticketId: ticket.id }), {
successMessage: "Assigned to you",
successMessage: 'Assigned to you',
})
}
>
@@ -332,7 +343,7 @@ export function CfhDetail({
disabled={isPending || ticket.state === 2}
onClick={() =>
run(() => closeCfhTicket({ ticketId: ticket.id }), {
successMessage: "Ticket closed",
successMessage: 'Ticket closed',
})
}
>
@@ -393,5 +404,5 @@ export function CfhDetail({
</div>
</div>
</div>
);
)
}