"use client"; import { useEffect, useState } from "react"; import Shell from "@/components/Shell"; import { TableSkeleton } from "@/components/Skeleton"; import { api } from "@/lib/api"; import { toastError } from "@/lib/toast"; type Tier = { id: string; label: string; c1: string; c2: string; sort: number; }; const hex = (s: string) => { const v = String(s || "").replace("#", "").trim(); return /^[0-9a-fA-F]{6}$/.test(v) ? `#${v}` : null; }; function Swatch({ c1, c2 }: { c1: string; c2: string }) { const a = hex(c1); const b = hex(c2); return (
); } export default function RankTiersPage() { const [tiers, setTiers] = useState([]); const [busy, setBusy] = useState(null); const [loading, setLoading] = useState(true); async function load() { setLoading(true); try { const r = await api.get<{ rank_tiers: Tier[] }>("/rank-tiers"); setTiers(r.rank_tiers || []); } finally { setLoading(false); } } useEffect(() => { load(); }, []); const patch = (id: string, key: keyof Tier, val: string | number) => setTiers((ts) => ts.map((t) => (t.id === id ? { ...t, [key]: val } : t))); async function save(t: Tier) { setBusy(t.id); try { await api.post("/rank-tiers", t); } catch (e) { toastError((e as Error).message); } finally { setBusy(null); } } return (

رنگ و برچسبِ رتبه‌ها (برنز تا پادشاه). این‌ها در حلقه‌ی آواتار و نشانِ رتبه‌ی داخلِ بازی دیده می‌شوند و بدونِ به‌روزرسانیِ اپ اعمال می‌شوند. رنگ را با کدِ hex (مثلِ FFD54F) وارد کنید.

{loading ? ( ) : (
{tiers.map((t) => ( ))}
پیش‌نمایش شناسه برچسب رنگ ۱ (hex) رنگ ۲ (hex) ترتیب
{t.id} patch(t.id, "label", e.target.value)} /> patch(t.id, "c1", e.target.value)} /> patch(t.id, "c2", e.target.value)} /> patch(t.id, "sort", +e.target.value)} />
)}
); }