File tree Expand file tree Collapse file tree 3 files changed +22
-1
lines changed
Expand file tree Collapse file tree 3 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ export const ProxyNodePreview = (props: {
66 proxyNameList : string [ ]
77 testUrl : string | null
88 now ?: string
9+ onSelect ?: ( name : string ) => void
910} ) => {
1011 const off = ( ) => proxiesPreviewType ( ) === PROXIES_PREVIEW_TYPE . OFF
1112
@@ -45,6 +46,7 @@ export const ProxyNodePreview = (props: {
4546 proxyNameList = { props . proxyNameList }
4647 testUrl = { props . testUrl }
4748 now = { props . now }
49+ onSelect = { props . onSelect }
4850 />
4951 </ Match >
5052 </ Switch >
Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ const LatencyDot = (props: {
66 name : string
77 latency ?: number
88 selected : boolean
9+ clickable ?: boolean
10+ onClick ?: ( ) => void
911} ) => {
1012 let dotClassName = props . selected
1113 ? 'bg-white border-4 border-green-600'
@@ -30,8 +32,19 @@ const LatencyDot = (props: {
3032
3133 return (
3234 < div
33- class = { twMerge ( 'h-4 w-4 rounded-full' , dotClassName ) }
35+ class = { twMerge (
36+ 'h-4 w-4 rounded-full' ,
37+ dotClassName ,
38+ props . clickable &&
39+ 'cursor-pointer transition-transform hover:scale-125' ,
40+ ) }
3441 title = { props . name }
42+ onClick = { ( e ) => {
43+ if ( props . clickable && props . onClick ) {
44+ e . stopPropagation ( )
45+ props . onClick ( )
46+ }
47+ } }
3548 />
3649 )
3750}
@@ -40,6 +53,7 @@ export const ProxyPreviewDots = (props: {
4053 proxyNameList : string [ ]
4154 testUrl : string | null
4255 now ?: string
56+ onSelect ?: ( name : string ) => void
4357} ) => {
4458 const { getLatencyByName } = useProxies ( )
4559
@@ -57,6 +71,8 @@ export const ProxyPreviewDots = (props: {
5771 name = { name }
5872 latency = { latency }
5973 selected = { props . now === name }
74+ clickable = { ! ! props . onSelect }
75+ onClick = { ( ) => props . onSelect ?.( name ) }
6076 />
6177 ) }
6278 </ For >
Original file line number Diff line number Diff line change @@ -293,6 +293,9 @@ export default () => {
293293 proxyNameList = { sortedProxyNames ( ) }
294294 now = { proxyGroup . now }
295295 testUrl = { proxyGroup . testUrl || null }
296+ onSelect = { ( name ) =>
297+ void selectProxyInGroup ( proxyGroup , name )
298+ }
296299 />
297300 </ Show >
298301 </ div >
You can’t perform that action at this time.
0 commit comments