24 lines
1.4 KiB
TypeScript
24 lines
1.4 KiB
TypeScript
import { comparisonDelta, comparisonReferenceNames } from "@/lib/guides/comparison";
|
|
|
|
type WeaponRows = Parameters<typeof comparisonReferenceNames>[0];
|
|
|
|
export function ComparisonContext({ rows, metric }: {
|
|
rows?: WeaponRows;
|
|
metric?: "overallPercent" | "personalPercent";
|
|
}) {
|
|
const references = rows && metric ? comparisonReferenceNames(rows, metric) : [];
|
|
return <div className="flex flex-col gap-1 text-sm text-muted-foreground">
|
|
{!rows && <p>100% = ค่าฐานของเงื่อนไขนี้ เช่น 109% หมายถึงสูงกว่าค่าฐาน 9% เปรียบเทียบภายในเงื่อนไขเดียวกัน</p>}
|
|
{rows && metric ? <p>
|
|
{metric === "overallPercent" ? "ดาเมจทั้งทีม" : "ดาเมจส่วนตัว"} - {references.length
|
|
? `รายการที่แสดง 100%: ${references.join(" / ")}`
|
|
: "ดูหมายเหตุของเงื่อนไขสำหรับรายการที่ใช้เป็นค่าฐาน"}
|
|
</p> : null}
|
|
</div>;
|
|
}
|
|
|
|
export function ComparisonValue({ value }: { value: string | null }) {
|
|
const delta = comparisonDelta(value);
|
|
return <p className="text-xs opacity-75">{delta ?? "ไม่มีข้อมูลเปรียบเทียบ"}</p>;
|
|
}
|