fix: fixed latency color (#1251)

This commit is contained in:
Plutonium141 2024-12-19 18:54:14 +08:00 committed by GitHub
parent aec579b372
commit 1a66ee6847
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 12 additions and 12 deletions

View File

@ -44,19 +44,19 @@ export const ProxyPreviewBar = (props: {
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<div class="my-1 flex flex-1 items-center justify-center overflow-hidden rounded-2xl [&>*]:h-2"> <div class="my-1 flex flex-1 items-center justify-center overflow-hidden rounded-2xl [&>*]:h-2">
<div <div
class="bg-success" class="bg-green-600"
style={{ style={{
width: `${(good() * 100) / all()}%`, // cant use tw class, otherwise dynamic classname won't be generated width: `${(good() * 100) / all()}%`, // cant use tw class, otherwise dynamic classname won't be generated
}} }}
/> />
<div <div
class="bg-warning" class="bg-yellow-500"
style={{ style={{
width: `${(middle() * 100) / all()}%`, width: `${(middle() * 100) / all()}%`,
}} }}
/> />
<div <div
class="bg-error" class="bg-red-500"
style={{ style={{
width: `${(slow() * 100) / all()}%`, width: `${(slow() * 100) / all()}%`,
}} }}

View File

@ -8,8 +8,8 @@ const LatencyDot = (props: {
selected: boolean selected: boolean
}) => { }) => {
let dotClassName = props.selected let dotClassName = props.selected
? 'bg-white border-4 border-success' ? 'bg-white border-4 border-green-600'
: 'bg-success' : 'bg-green-600'
if ( if (
typeof props.latency !== 'number' || typeof props.latency !== 'number' ||
@ -20,12 +20,12 @@ const LatencyDot = (props: {
: 'bg-neutral' : 'bg-neutral'
} else if (props.latency > latencyQualityMap().HIGH) { } else if (props.latency > latencyQualityMap().HIGH) {
dotClassName = props.selected dotClassName = props.selected
? 'bg-white border-4 border-error' ? 'bg-white border-4 border-red-500'
: 'bg-error' : 'bg-red-500'
} else if (props.latency > latencyQualityMap().MEDIUM) { } else if (props.latency > latencyQualityMap().MEDIUM) {
dotClassName = props.selected dotClassName = props.selected
? 'bg-white border-4 border-warning' ? 'bg-white border-4 border-yellow-500'
: 'bg-warning' : 'bg-yellow-500'
} }
return ( return (

View File

@ -31,13 +31,13 @@ export const formatProxyType = (type = '') => {
export const getLatencyClassName = (latency: LATENCY_QUALITY_MAP_HTTP) => { export const getLatencyClassName = (latency: LATENCY_QUALITY_MAP_HTTP) => {
if (latency > latencyQualityMap().HIGH) { if (latency > latencyQualityMap().HIGH) {
return 'text-error' return 'text-red-500'
} else if (latency > latencyQualityMap().MEDIUM) { } else if (latency > latencyQualityMap().MEDIUM) {
return 'text-warning' return 'text-yellow-500'
} else if (latency === LATENCY_QUALITY_MAP_HTTP.NOT_CONNECTED) { } else if (latency === LATENCY_QUALITY_MAP_HTTP.NOT_CONNECTED) {
return 'text-gray' return 'text-gray'
} else { } else {
return 'text-success' return 'text-green-600'
} }
} }