11import { useRenderer } from '@opentui/react'
2- import open from 'open'
32import React , { useCallback , useEffect , useRef , useState } from 'react'
43
54import { Button } from './button'
6- import { TerminalLink } from './terminal-link'
75import { useLoginMutation } from '../hooks/use-auth-query'
6+ import { useClipboard } from '../hooks/use-clipboard'
87import { useFetchLoginUrl } from '../hooks/use-fetch-login-url'
98import { useLoginKeyboardHandlers } from '../hooks/use-login-keyboard-handlers'
109import { useLoginPolling } from '../hooks/use-login-polling'
@@ -216,19 +215,6 @@ export const LoginModal = ({
216215 [ maxUrlWidth ] ,
217216 )
218217
219- // Handle login URL activation
220- const handleActivateLoginUrl = useCallback ( async ( ) => {
221- if ( ! loginUrl ) {
222- return
223- }
224- try {
225- await open ( loginUrl )
226- } catch ( err ) {
227- logger . error ( err , 'Failed to open browser on link click' )
228- }
229- return copyToClipboard ( loginUrl )
230- } , [ loginUrl , copyToClipboard ] )
231-
232218 // Use custom hook for sheen animation
233219 const blockColor = getLogoBlockColor ( theme . name )
234220 const accentColor = getLogoAccentColor ( theme . name )
@@ -248,6 +234,10 @@ export const LoginModal = ({
248234 textColor : theme . foreground ,
249235 } )
250236
237+ // Enable auto-copy when user selects text (drag to select)
238+ // hasSelection provides visual feedback when text is being selected
239+ const { hasSelection } = useClipboard ( )
240+
251241 // Format URL for display (wrap if needed)
252242 return (
253243 < box
@@ -385,29 +375,30 @@ export const LoginModal = ({
385375 </ text >
386376 < box
387377 style = { {
388- marginTop : isVerySmall ? 1 : 2 ,
389378 width : '100%' ,
390379 flexShrink : 0 ,
380+ flexDirection : 'column' ,
381+ alignItems : 'flex-start' ,
391382 } }
392383 >
393- < TerminalLink
394- text = { loginUrl }
395- maxWidth = { maxUrlWidth }
396- formatLines = { formatLoginUrlLines }
397- color = { theme . primary }
398- activeColor = { theme . success }
399- underlineOnHover = { true }
400- isActive = { justCopied }
401- onActivate = { handleActivateLoginUrl }
402- containerStyle = { {
403- alignItems : 'flex-start' ,
404- flexShrink : 0 ,
405- } }
406- />
384+ { formatLoginUrlLines ( loginUrl , maxUrlWidth ) . map ( ( line , index ) => (
385+ < text key = { index } style = { { wrapMode : 'none' } } >
386+ < span
387+ fg = {
388+ justCopied
389+ ? theme . success
390+ : hasSelection
391+ ? theme . info
392+ : theme . primary
393+ }
394+ >
395+ { line }
396+ </ span >
397+ </ text >
398+ ) ) }
407399 </ box >
408400 < box
409401 style = { {
410- marginTop : isVerySmall ? 1 : 2 ,
411402 flexDirection : 'column' ,
412403 alignItems : 'center' ,
413404 width : '100%' ,
0 commit comments