@@ -36,6 +36,7 @@ const IndexPage = () => {
3636 const [ isTranslating , setIsTranslating ] = useState ( false ) ;
3737 const [ error , setError ] = useState < string > ( '' ) ;
3838 const [ lastCurlRequest , setLastCurlRequest ] = useState < string > ( '' ) ;
39+ const [ isCurlExpanded , setIsCurlExpanded ] = useState < boolean > ( true ) ;
3940
4041 const handleProcess = async ( ) => {
4142 if ( ! file ) {
@@ -62,6 +63,7 @@ const IndexPage = () => {
6263 ${ sourceLang ? `-F "language=${ sourceLang } "` : '' } ` ;
6364
6465 setLastCurlRequest ( curlCommand ) ;
66+ setIsCurlExpanded ( true ) ;
6567
6668 try {
6769 // Step 1: Transcribe Audio
@@ -114,23 +116,50 @@ const IndexPage = () => {
114116 { lastCurlRequest && (
115117 < div className = "mb-6 w-full animate-in fade-in slide-in-from-top-2 duration-200" >
116118 < div className = "flex items-center justify-between mb-2" >
117- < span className = "text-xs font-bold text-gray-500 uppercase tracking-wider flex items-center gap-1" >
118- < svg className = "h-3 w-3" fill = "none" viewBox = "0 0 24 24" stroke = "currentColor" >
119+ < button
120+ onClick = { ( ) => setIsCurlExpanded ( ! isCurlExpanded ) }
121+ className = "text-xs font-bold text-gray-500 uppercase tracking-wider flex items-center gap-1.5 hover:text-gray-700 transition-colors focus:outline-none cursor-pointer"
122+ title = { isCurlExpanded ? "Collapse" : "Expand" }
123+ >
124+ < svg
125+ className = { `h-3 w-3 transform transition-transform duration-200 ${
126+ isCurlExpanded ? 'rotate-90' : ''
127+ } `}
128+ fill = "none"
129+ viewBox = "0 0 24 24"
130+ stroke = "currentColor"
131+ >
132+ < path strokeLinecap = "round" strokeLinejoin = "round" strokeWidth = { 2 } d = "M9 5l7 7-7 7" />
133+ </ svg >
134+ < svg className = "h-3.5 w-3.5" fill = "none" viewBox = "0 0 24 24" stroke = "currentColor" >
119135 < path strokeLinecap = "round" strokeLinejoin = "round" strokeWidth = { 2 } d = "M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" />
120136 </ svg >
121137 Last Request (cURL)
122- </ span >
123- < button
124- onClick = { ( ) => setLastCurlRequest ( '' ) }
125- className = "text-xs text-gray-400 hover:text-gray-600 underline"
126- >
127- Clear
128138 </ button >
139+ < div className = "flex items-center gap-2" >
140+ < button
141+ onClick = { ( ) => setIsCurlExpanded ( ! isCurlExpanded ) }
142+ className = "text-xs text-gray-400 hover:text-gray-600 cursor-pointer"
143+ >
144+ { isCurlExpanded ? 'Hide' : 'Show' }
145+ </ button >
146+ < span className = "text-gray-300 text-xs" > |</ span >
147+ < button
148+ onClick = { ( ) => setLastCurlRequest ( '' ) }
149+ className = "text-xs text-gray-400 hover:text-gray-600 underline cursor-pointer"
150+ >
151+ Clear
152+ </ button >
153+ </ div >
129154 </ div >
130- < div className = "bg-gray-900 rounded-lg p-4 shadow-inner overflow-x-auto border border-gray-700" >
131- < pre className = "text-[11px] font-mono text-green-400 leading-relaxed whitespace-pre" >
132- { lastCurlRequest }
133- </ pre >
155+ < div className = { `transition-all duration-200 overflow-hidden ${
156+ isCurlExpanded ? 'max-h-[1000px] opacity-100 mt-1' : 'max-h-0 opacity-0'
157+ } `} >
158+ < div className = "bg-gray-900 rounded-lg p-4 shadow-inner overflow-x-auto border border-gray-700" >
159+ < pre className = "text-[11px] font-mono text-green-400 leading-relaxed whitespace-pre" >
160+ { lastCurlRequest }
161+ </ pre >
162+ </ div >
134163 </ div >
135164 </ div >
136165 ) }
0 commit comments