File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ export function CompareForm({
3939 } , [ ] ) ;
4040
4141 const canSubmit = Boolean ( username1 . trim ( ) && username2 . trim ( ) && ! loading ) ;
42+ const isEmpty = ! username1 . trim ( ) && ! username2 . trim ( ) ;
4243
4344 const handleSwap = ( ) => {
4445 setUsername1 ( username2 ) ;
@@ -90,28 +91,24 @@ export function CompareForm({
9091 >
9192 { loading ? t ( "form.compare.ing" ) : t ( "form.compare" ) }
9293 </ Button >
93- { data && (
94- < >
95- < Button
96- onClick = { handleSwap }
97- disabled = { loading }
98- type = "button"
99- title = { t ( "form.swap" ) }
100- className = "shadow-sm transition-transform hover:-translate-y-0.5"
101- >
102- < ArrowLeftRight className = "h-4 w-4" />
103- </ Button >
104- < Button
105- onClick = { handleReset }
106- disabled = { loading }
107- title = { t ( "form.reset" ) }
108- type = "button"
109- className = "shadow-sm transition-transform hover:-translate-y-0.5"
110- >
111- < RefreshCw className = "h-4 w-4" />
112- </ Button >
113- </ >
114- ) }
94+ < Button
95+ onClick = { handleSwap }
96+ type = "button"
97+ disabled = { isEmpty || loading }
98+ title = { t ( "form.swap" ) }
99+ className = "shadow-sm transition-transform hover:-translate-y-0.5"
100+ >
101+ < ArrowLeftRight className = "h-4 w-4" />
102+ </ Button >
103+ < Button
104+ onClick = { handleReset }
105+ title = { t ( "form.reset" ) }
106+ disabled = { isEmpty || loading }
107+ type = "button"
108+ className = "shadow-sm transition-transform hover:-translate-y-0.5"
109+ >
110+ < RefreshCw className = "h-4 w-4" />
111+ </ Button >
115112 </ div >
116113 { error && (
117114 < Alert variant = "destructive" className = "mt-4" >
You can’t perform that action at this time.
0 commit comments