1
0

refactor: 移除 success 字段,简化为 matched 单层判定模型

This commit is contained in:
2026-05-11 13:12:55 +08:00
parent 548b44d28e
commit 35ba56888b
93 changed files with 3893 additions and 103 deletions

View File

@@ -9,7 +9,7 @@ interface TargetCardProps {
}
export function TargetCard({ target, onClick }: TargetCardProps) {
const isUp = target.latestCheck?.success && target.latestCheck?.matched;
const isUp = target.latestCheck?.matched;
return (
<div className="target-card" onClick={onClick} role="button" tabIndex={0}>

View File

@@ -37,7 +37,7 @@ export function TargetDetailModal({
onPageChange,
onClose,
}: TargetDetailModalProps) {
const isUp = target.latestCheck?.success && target.latestCheck?.matched;
const isUp = target.latestCheck?.matched;
const totalChecks = trendData.reduce((sum, p) => sum + p.totalChecks, 0);
const upChecks = trendData.reduce((sum, p) => sum + Math.round((p.availability / 100) * p.totalChecks), 0);
@@ -89,8 +89,8 @@ export function TargetDetailModal({
{historyData.items.map((item, idx) => (
<tr key={idx}>
<td>
<span className={`ht-status ${item.success && item.matched ? "text-up" : "text-down"}`}>
{item.success && item.matched ? "UP" : "DOWN"}
<span className={`ht-status ${item.matched ? "text-up" : "text-down"}`}>
{item.matched ? "UP" : "DOWN"}
</span>
</td>
<td className="ht-time">{new Date(item.timestamp).toLocaleString("zh-CN")}</td>

View File

@@ -9,7 +9,7 @@ interface TargetGroupProps {
}
export function TargetGroup({ name, targets, onTargetClick }: TargetGroupProps) {
const up = targets.filter((t) => t.latestCheck?.success && t.latestCheck?.matched).length;
const up = targets.filter((t) => t.latestCheck?.matched).length;
const down = targets.length - up;
return (