@@ -66,6 +66,7 @@ const MachineCard = props => {
6666 const [ showDetails , SetShowDetails ] = useState ( false )
6767 const [ showGPUs , SetShowGPUs ] = useState ( false )
6868 const [ showActiveGCP , SetShowActiveGCP ] = useState ( false ) // GCP: GPU Compute Processes
69+ const [ isHiding , setIsHiding ] = useState ( false )
6970
7071 const handleShowDetails = ( ) => {
7172 SetShowDetails ( ( state ) => {
@@ -106,6 +107,18 @@ const MachineCard = props => {
106107 e . stopPropagation ( )
107108 }
108109
110+ // Handle hiding with animation
111+ const handleHideWithAnimation = ( e ) => {
112+ e . stopPropagation ( )
113+ setIsHiding ( true )
114+ // Delay the actual hiding until after animation completes
115+ setTimeout ( ( ) => {
116+ if ( props . onHide ) {
117+ props . onHide ( )
118+ }
119+ } , 250 ) // Match the animation duration (0.25s)
120+ }
121+
109122 const isEmpty = ( s ) => {
110123 if ( s == null || s === undefined || s === "" || s . length === 0 ) {
111124 return true
@@ -130,7 +143,7 @@ const MachineCard = props => {
130143 }
131144
132145 return (
133- < div className = " hacker-card fade-in" style = { {
146+ < div className = { ` hacker-card ${ isHiding ? ' fade-out' : 'fade-in' } ` } style = { {
134147 borderLeft : `4px solid ${ getStatusColor ( ) } ` ,
135148 opacity : isOnline ( ) ? 1 : 0.7
136149 } } >
@@ -151,7 +164,7 @@ const MachineCard = props => {
151164 </ h3 >
152165 </ div >
153166
154- < div className = "d-flex gap-1" >
167+ < div className = "d-flex align-items-center gap-1" style = { { justifyContent : 'flex-end' , flex : 1 } } >
155168 { /* <CopyableText
156169 className="hacker-badge"
157170 style={{
@@ -208,6 +221,47 @@ const MachineCard = props => {
208221 >
209222 { showDetails ? 'HIDE DETAILS' : 'DETAILS' }
210223 </ button >
224+ { props . onHide && (
225+ < >
226+ < span style = { {
227+ display : 'inline-block' ,
228+ width : '1px' ,
229+ height : '1.3em' ,
230+ background : 'var(--hacker-border)' ,
231+ margin : '0 0.5rem' ,
232+ opacity : 0.7 ,
233+ borderRadius : '1px' ,
234+ alignSelf : 'center' ,
235+ } } />
236+ < button
237+ onClick = { handleHideWithAnimation }
238+ title = "Hide this machine"
239+ style = { {
240+ background : 'transparent' ,
241+ border : 'none' ,
242+ borderRadius : '50%' ,
243+ width : '1.8em' ,
244+ height : '1.8em' ,
245+ display : 'flex' ,
246+ alignItems : 'center' ,
247+ justifyContent : 'center' ,
248+ fontWeight : 'bold' ,
249+ fontSize : '1.1em' ,
250+ color : 'var(--hacker-text-secondary)' ,
251+ cursor : 'pointer' ,
252+ transition : 'background 0.15s, box-shadow 0.15s' ,
253+ padding : 0 ,
254+ outline : 'none' ,
255+ } }
256+ onMouseOver = { e => { e . currentTarget . style . background = 'rgba(108,117,125,0.10)' ; e . currentTarget . style . boxShadow = '0 1px 6px 0 rgba(0,0,0,0.10)' ; } }
257+ onMouseOut = { e => { e . currentTarget . style . background = 'transparent' ; e . currentTarget . style . boxShadow = 'none' ; } }
258+ tabIndex = { 0 }
259+ onKeyPress = { e => { if ( e . key === 'Enter' || e . key === ' ' ) { handleHideWithAnimation ( e ) ; } } }
260+ >
261+ x
262+ </ button >
263+ </ >
264+ ) }
211265 </ div >
212266 </ div >
213267
0 commit comments