style(frontend): refactor analytics components with sky palette, semantic tokens, and visual polish

This commit is contained in:
MythEclipse
2026-06-03 03:20:07 +07:00
parent e8deba93cc
commit 115dacb997
5 changed files with 40 additions and 25 deletions
@@ -1,6 +1,6 @@
import { Siren } from "lucide-react";
import { cn } from "../../../shared/lib/utils";
import type { ViolatorStat } from "../../../shared/api/client";
import { cn } from "../../../shared/lib/utils";
import {
Badge,
Card,
@@ -45,7 +45,7 @@ export function ViolatorTable({ users, loading }: ViolatorTableProps) {
<div className="flex items-center justify-between">
<div>
<CardTitle className="flex items-center gap-2 text-sm font-semibold">
<Siren className="h-4 w-4 text-red-400" />
<Siren className="h-4 w-4 text-accent" />
Pelanggar Terbanyak
</CardTitle>
<CardDescription className="text-xs">
@@ -59,20 +59,28 @@ export function ViolatorTable({ users, loading }: ViolatorTableProps) {
<ScrollArea className="max-h-[260px]">
<table className="w-full text-sm">
<thead>
<tr className="sticky top-0 z-10 bg-card/95 backdrop-blur border-b border-border text-left text-[10px] uppercase tracking-wider text-muted-foreground">
<tr className="sticky top-0 z-10 bg-white border-b border-sky-100 text-left text-[10px] uppercase tracking-wider text-muted-foreground">
<th className="py-2 pl-4 pr-2 font-semibold">#</th>
<th className="py-2 pr-2 font-semibold">User</th>
<th className="py-2 pr-2 font-semibold text-right">Flagged</th>
<th className="py-2 pr-4 font-semibold text-right">Skor</th>
</tr>
</thead>
<tbody className="divide-y divide-border/20">
<tbody className="divide-y divide-sky-50">
{users.map((user, i) => {
const danger = dangerLabel(user.violation_score);
return (
<tr
key={user.user_id}
className="hover:bg-red-500/5 transition-colors"
className={cn(
"transition-colors border-l-2",
i % 2 === 0 ? "bg-white" : "bg-sky-50/20",
danger.variant === "destructive"
? "border-l-accent/60"
: danger.variant === "warning"
? "border-l-pink-300/60"
: "border-l-pink-200/40",
)}
>
<td className="py-1.5 pl-4 pr-2 font-mono text-[10px] text-muted-foreground tabular-nums">
{i + 1}
@@ -83,11 +91,11 @@ export function ViolatorTable({ users, loading }: ViolatorTableProps) {
<img
src={user.avatar_url}
alt=""
className="h-6 w-6 rounded-full"
className="h-6 w-6 rounded-full ring-2 ring-pink-100"
loading="lazy"
/>
) : (
<div className="flex h-6 w-6 items-center justify-center rounded-full bg-muted text-[10px] font-bold">
<div className="flex h-6 w-6 items-center justify-center rounded-full bg-pink-100 text-[10px] font-bold text-accent">
{user.username.charAt(0).toUpperCase()}
</div>
)}
@@ -102,20 +110,20 @@ export function ViolatorTable({ users, loading }: ViolatorTableProps) {
</Badge>
</div>
</td>
<td className="py-1.5 pr-2 text-right font-mono text-xs text-red-400 tabular-nums">
<td className="py-1.5 pr-2 text-right font-mono text-xs text-accent tabular-nums">
{user.flagged_count}
</td>
<td className="py-1.5 pr-4 text-right">
<div className="flex items-center justify-end gap-1.5">
<div className="h-1.5 w-14 overflow-hidden rounded-full bg-muted">
<div className="h-1.5 w-14 overflow-hidden rounded-full bg-pink-50">
<div
className={cn(
"h-full rounded-full",
user.violation_score >= 10
? "bg-gradient-to-r from-red-600 to-red-400"
? "bg-gradient-to-r from-accent to-pink-400"
: user.violation_score >= 5
? "bg-gradient-to-r from-amber-500 to-amber-400"
: "bg-gradient-to-r from-yellow-500 to-yellow-400",
? "bg-gradient-to-r from-pink-400 to-pink-300"
: "bg-gradient-to-r from-pink-300 to-pink-200",
)}
style={{
width: `${(user.violation_score / maxScore) * 100}%`,
@@ -138,8 +146,6 @@ export function ViolatorTable({ users, loading }: ViolatorTableProps) {
);
}
import { cn } from "../../../shared/lib/utils";
function LoadingBox() {
return (
<Card>