mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-01-29 08:45:41 +08:00
feat: adjust the delay display interval and color, close #836
This commit is contained in:
@@ -107,6 +107,21 @@ class DelayManager {
|
||||
for (let i = 0; i < concurrency; ++i) help();
|
||||
});
|
||||
}
|
||||
|
||||
formatDelay(delay: number) {
|
||||
if (delay < 0) return "-";
|
||||
if (delay > 1e5) return "Error";
|
||||
if (delay >= 10000) return "Timeout"; // 10s
|
||||
return `${delay}`;
|
||||
}
|
||||
|
||||
formatDelayColor(delay: number) {
|
||||
if (delay <= 0) return "text.secondary";
|
||||
if (delay >= 10000) return "error.main";
|
||||
if (delay > 500) return "warning.main";
|
||||
if (delay > 100) return "text.secondary";
|
||||
return "success.main";
|
||||
}
|
||||
}
|
||||
|
||||
export default new DelayManager();
|
||||
|
||||
Reference in New Issue
Block a user