城市列表移除百分比显示,新增当地时'间
This commit is contained in:
@@ -182,22 +182,17 @@ function CityRegionList({
|
|||||||
}) {
|
}) {
|
||||||
const cities = useMemo(() => {
|
const cities = useMemo(() => {
|
||||||
const seen = new Set<string>();
|
const seen = new Set<string>();
|
||||||
const result: { city: string; name: string; contractCount: number; bestEdge: number | null; signal: string }[] = [];
|
const result: { city: string; name: string; contractCount: number; localTime: string | null }[] = [];
|
||||||
rows.forEach((row) => {
|
rows.forEach((row) => {
|
||||||
const key = String(row.city || "").toLowerCase();
|
const key = String(row.city || "").toLowerCase();
|
||||||
if (seen.has(key)) return;
|
if (seen.has(key)) return;
|
||||||
seen.add(key);
|
seen.add(key);
|
||||||
const cityRows = rows.filter((r) => String(r.city || "").toLowerCase() === key);
|
const cityRows = rows.filter((r) => String(r.city || "").toLowerCase() === key);
|
||||||
const bestEdge = cityRows.reduce((best, r) => {
|
|
||||||
const e = r.edge_percent ?? 0;
|
|
||||||
return Math.abs(e) > Math.abs(best) ? e : best;
|
|
||||||
}, 0);
|
|
||||||
result.push({
|
result.push({
|
||||||
city: key,
|
city: key,
|
||||||
name: rowName(row),
|
name: rowName(row),
|
||||||
contractCount: cityRows.length,
|
contractCount: cityRows.length,
|
||||||
bestEdge,
|
localTime: row.local_time || null,
|
||||||
signal: cityRows[0]?.signal_status || "",
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
@@ -206,7 +201,7 @@ function CityRegionList({
|
|||||||
return (
|
return (
|
||||||
<Panel title={isEn ? "Cities" : "城市"}>
|
<Panel title={isEn ? "Cities" : "城市"}>
|
||||||
<div className="divide-y divide-slate-100">
|
<div className="divide-y divide-slate-100">
|
||||||
{cities.map(({ city, name, contractCount, bestEdge }) => (
|
{cities.map(({ city, name, contractCount, localTime }) => (
|
||||||
<button
|
<button
|
||||||
key={city}
|
key={city}
|
||||||
type="button"
|
type="button"
|
||||||
@@ -218,11 +213,11 @@ function CityRegionList({
|
|||||||
>
|
>
|
||||||
<div className="min-w-0">
|
<div className="min-w-0">
|
||||||
<div className="text-[12px] font-bold text-slate-800 truncate">{name}</div>
|
<div className="text-[12px] font-bold text-slate-800 truncate">{name}</div>
|
||||||
<div className="text-[11px] text-slate-400">{contractCount} {isEn ? "contracts" : "个合约"}</div>
|
<div className="text-[11px] text-slate-400">
|
||||||
|
{localTime && <span className="mr-2">{localTime}</span>}
|
||||||
|
{contractCount} {isEn ? "contracts" : "个合约"}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<span className={clsx("shrink-0 font-mono text-[12px] font-black", edgeClass(bestEdge))}>
|
|
||||||
{pct(bestEdge)}
|
|
||||||
</span>
|
|
||||||
</button>
|
</button>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user