Skip to content

Commit

Permalink
fix(proxy): proxy preview dots layout issue
Browse files Browse the repository at this point in the history
  • Loading branch information
kunish committed Sep 25, 2023
1 parent c4bfde2 commit 4b7f4c8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/components/ProxyPreviewBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const ProxyPreviewBar = (props: {
)

return (
<div class="flex h-6 w-full items-center gap-2">
<div class="flex items-center gap-2 py-2">
<div class="flex flex-1 overflow-hidden rounded-2xl">
<div
class="h-2 bg-success"
Expand Down
23 changes: 19 additions & 4 deletions src/components/ProxyPreviewDots.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ import { twMerge } from 'tailwind-merge'
import { Latency } from '~/components'
import { latencyQualityMap, useProxies } from '~/signals'

const LatencyDots = (props: { latency?: number; selected: boolean }) => {
const LatencyDots = (props: {
name: string
latency?: number
selected: boolean
}) => {
let dotClassName = props.selected
? 'bg-white border-4 border-success'
: 'bg-success'
Expand All @@ -25,7 +29,12 @@ const LatencyDots = (props: { latency?: number; selected: boolean }) => {
: 'bg-warning'
}

return <div class={twMerge('h-4 w-4 rounded-full', dotClassName)} />
return (
<div
class={twMerge('h-4 w-4 rounded-full', dotClassName)}
title={props.name}
/>
)
}

export const ProxyPreviewDots = (props: {
Expand All @@ -35,7 +44,7 @@ export const ProxyPreviewDots = (props: {
const { latencyMap } = useProxies()

return (
<div class="flex h-6 items-center gap-2">
<div class="flex items-center gap-2 py-2">
<div class="flex flex-1 flex-wrap items-center gap-1">
<For
each={props.proxyNameList.map((name): [string, number] => [
Expand All @@ -46,7 +55,13 @@ export const ProxyPreviewDots = (props: {
{([name, latency]) => {
const isSelected = props.now === name

return <LatencyDots latency={latency} selected={isSelected} />
return (
<LatencyDots
name={name}
latency={latency}
selected={isSelected}
/>
)
}}
</For>
</div>
Expand Down

0 comments on commit 4b7f4c8

Please sign in to comment.