File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change 11'use client'
22
3- import { useState } from 'react'
3+ import { useState , useEffect } from 'react'
44import { Button } from '@/components/ui/button'
55import {
66 Dialog ,
@@ -36,6 +36,19 @@ export function CreatePRDialog({
3636 const [ title , setTitle ] = useState ( defaultTitle )
3737 const [ body , setBody ] = useState ( defaultBody )
3838 const [ isCreating , setIsCreating ] = useState ( false )
39+ const [ isMobile , setIsMobile ] = useState ( false )
40+
41+ useEffect ( ( ) => {
42+ // Check if the device is mobile
43+ const checkMobile = ( ) => {
44+ setIsMobile ( window . innerWidth < 768 )
45+ }
46+
47+ checkMobile ( )
48+ window . addEventListener ( 'resize' , checkMobile )
49+
50+ return ( ) => window . removeEventListener ( 'resize' , checkMobile )
51+ } , [ ] )
3952
4053 const handleSubmit = async ( e : React . FormEvent ) => {
4154 e . preventDefault ( )
@@ -103,6 +116,7 @@ export function CreatePRDialog({
103116 value = { title }
104117 onChange = { ( e ) => setTitle ( e . target . value ) }
105118 disabled = { isCreating }
119+ autoFocus = { ! isMobile }
106120 />
107121 </ div >
108122 < div className = "grid gap-2" >
You can’t perform that action at this time.
0 commit comments