Skip to content

Commit

Permalink
fix: fixed latency color (#1251)
Browse files Browse the repository at this point in the history
  • Loading branch information
Plutonium141 authored Dec 19, 2024
1 parent aec579b commit 1a66ee6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/components/ProxyPreviewBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,19 @@ export const ProxyPreviewBar = (props: {
<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="bg-success"
class="bg-green-600"
style={{
width: `${(good() * 100) / all()}%`, // cant use tw class, otherwise dynamic classname won't be generated
}}
/>
<div
class="bg-warning"
class="bg-yellow-500"
style={{
width: `${(middle() * 100) / all()}%`,
}}
/>
<div
class="bg-error"
class="bg-red-500"
style={{
width: `${(slow() * 100) / all()}%`,
}}
Expand Down
12 changes: 6 additions & 6 deletions src/components/ProxyPreviewDots.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ const LatencyDot = (props: {
selected: boolean
}) => {
let dotClassName = props.selected
? 'bg-white border-4 border-success'
: 'bg-success'
? 'bg-white border-4 border-green-600'
: 'bg-green-600'

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

return (
Expand Down
6 changes: 3 additions & 3 deletions src/helpers/proxies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ export const formatProxyType = (type = '') => {

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

Expand Down

0 comments on commit 1a66ee6

Please sign in to comment.