1+ import { ActionIcon , Badge , Box , Checkbox , Grid , Group , Text } from '@mantine/core'
12import { PiDotsSixVertical , PiLock , PiProhibit , PiPulse } from 'react-icons/pi'
2- import { ActionIcon , Badge , Box , Checkbox , Group , Text } from '@mantine/core'
33import { Draggable } from '@hello-pangea/dnd'
44import ColorHash from 'color-hash'
55import { useState } from 'react'
@@ -29,7 +29,7 @@ export function HostCardWidget(props: IProps) {
2929 const isFiltered = selectedInboundTag !== 'ALL' && inbound . tag !== selectedInboundTag
3030 const isHostActive = ! item . isDisabled
3131
32- const ch = new ColorHash ( )
32+ const ch = new ColorHash ( { lightness : [ 0.65 , 0.65 , 0.65 ] } )
3333
3434 const handleEdit = ( ) => {
3535 actions . setHost ( item )
@@ -53,66 +53,101 @@ export function HostCardWidget(props: IProps) {
5353 ref = { provided . innerRef }
5454 { ...provided . draggableProps }
5555 >
56- < Group gap = "xs" >
57- < Checkbox checked = { isSelected } onChange = { onSelect } size = "md" />
58-
59- < div { ...provided . dragHandleProps } className = { classes . dragHandle } >
60- { ! isFiltered && < PiDotsSixVertical color = "white" size = "2rem" /> }
61- { isFiltered && (
62- < PiLock color = "white" size = "2rem" style = { { opacity : 0.5 } } />
63- ) }
64- </ div >
65- </ Group >
56+ < Grid align = "center" gutter = "md" >
57+ < Grid . Col span = { { base : 2 , xs : 2 , sm : 1 } } >
58+ < Group gap = "xs" wrap = "nowrap" >
59+ < Checkbox checked = { isSelected } onChange = { onSelect } size = "md" />
6660
61+ < Box { ...provided . dragHandleProps } className = { classes . dragHandle } >
62+ { ! isFiltered && < PiDotsSixVertical color = "white" size = "2rem" /> }
63+ { isFiltered && (
64+ < PiLock
65+ color = "white"
66+ size = "2rem"
67+ style = { { opacity : 0.5 } }
68+ />
69+ ) }
70+ </ Box >
71+ </ Group >
72+ </ Grid . Col >
73+ </ Grid >
6774 < Box
6875 onClick = { handleEdit }
6976 onMouseEnter = { ( ) => setIsHovered ( true ) }
7077 onMouseLeave = { ( ) => setIsHovered ( false ) }
71- style = { { cursor : 'pointer' } }
78+ style = { { cursor : 'pointer' , width : '100%' } }
7279 >
73- < Group gap = "xs" >
74- < ActionIcon
75- color = { isHostActive ? 'teal' : 'gray' }
76- radius = "md"
77- variant = "light"
78- >
79- { isHostActive ? (
80- < PiPulse
81- size = { 18 }
82- style = { {
83- color : 'var(--mantine-color-teal-6)'
84- } }
85- />
86- ) : (
87- < PiProhibit
88- size = { 18 }
80+ < Grid align = "center" gutter = "md" >
81+ < Grid . Col span = { { base : 12 , xs : 12 , sm : 6 , md : 4 } } >
82+ < Group >
83+ < ActionIcon
84+ color = { isHostActive ? 'teal' : 'gray' }
85+ radius = "md"
86+ variant = "light"
87+ >
88+ { isHostActive ? (
89+ < PiPulse
90+ size = { 18 }
91+ style = { {
92+ color : 'var(--mantine-color-teal-6)'
93+ } }
94+ />
95+ ) : (
96+ < PiProhibit
97+ size = { 18 }
98+ style = { {
99+ color : 'var(--mantine-color-gray-6)'
100+ } }
101+ />
102+ ) }
103+ </ ActionIcon >
104+
105+ < Badge
106+ autoContrast
107+ color = { ch . hex ( item . inboundUuid ) }
108+ radius = "md"
109+ size = "lg"
89110 style = { {
90- color : 'var(--mantine-color-gray-6)'
111+ width : '100%' ,
112+ maxWidth : '200px' ,
113+ overflow : 'hidden' ,
114+ textOverflow : 'ellipsis'
91115 } }
92- />
93- ) }
94- </ ActionIcon >
95-
96- < Badge
97- autoContrast
98- color = { ch . hex ( item . inboundUuid ) }
99- miw = { '15ch' }
100- radius = "md"
101- size = "lg"
102- variant = "light"
103- >
104- { inbound . tag }
105- </ Badge >
116+ variant = "light"
117+ >
118+ { inbound . tag }
119+ </ Badge >
120+ </ Group >
121+ </ Grid . Col >
106122
107- < Text className = { classes . label } fw = { 400 } miw = { '40ch' } >
108- { item . remark }
109- </ Text >
123+ < Grid . Col span = { { base : 12 , xs : 12 , sm : 6 , md : 4 } } >
124+ < Text
125+ className = { classes . label }
126+ fw = { 400 }
127+ style = { {
128+ overflow : 'hidden' ,
129+ textOverflow : 'ellipsis' ,
130+ whiteSpace : 'nowrap'
131+ } }
132+ >
133+ { item . remark }
134+ </ Text >
135+ </ Grid . Col >
110136
111- < Text className = { classes . hostInfoLabel } miw = { '40ch' } >
112- { item . address }
113- { item . port ? `:${ item . port } ` : '' }
114- </ Text >
115- </ Group >
137+ < Grid . Col span = { { base : 12 , xs : 12 , sm : 12 , md : 3 } } >
138+ < Text
139+ className = { classes . hostInfoLabel }
140+ style = { {
141+ overflow : 'hidden' ,
142+ textOverflow : 'ellipsis' ,
143+ whiteSpace : 'nowrap'
144+ } }
145+ >
146+ { item . address }
147+ { item . port ? `:${ item . port } ` : '' }
148+ </ Text >
149+ </ Grid . Col >
150+ </ Grid >
116151 </ Box >
117152 </ Box >
118153 ) }
0 commit comments