@@ -25,6 +25,7 @@ export default function ProjectHubPage() {
2525 const [ engineVersion , setEngineVersion ] = useState ( '' ) ;
2626 const [ recentProjects , setRecentProjects ] = useState ( Array < RecentProjectInfo > ) ;
2727 const [ projectTemplates , setProjectTemplates ] = useState ( Array < ProjectTemplateInfo > ) ;
28+ const [ projectPath , setProjectPath ] = useState ( '' ) ;
2829
2930 useEffect ( ( ) => {
3031 new QWebChannel ( window . qt . webChannelTransport , ( channel : QWebChannel ) : void => {
@@ -47,10 +48,12 @@ export default function ProjectHubPage() {
4748 console . error ( 'onOpenProject:' , index ) ;
4849 }
4950
50- async function onBrowseProjectPath ( ) : Promise < void > {
51- // TODO
52- const dirHandle = await window . showDirectoryPicker ( { startIn : 'desktop' } ) ;
53- console . error ( dirHandle ) ;
51+ function onBrowseProjectPath ( ) : void {
52+ window . backend . BrowseDirectory ( ( path : string ) => {
53+ if ( path ) {
54+ setProjectPath ( path ) ;
55+ }
56+ } ) ;
5457 }
5558
5659 return (
@@ -91,7 +94,7 @@ export default function ProjectHubPage() {
9194 < Form className = 'w-full ml-4' >
9295 < Input fullWidth isRequired label = 'Project Name' labelPlacement = 'outside' placeholder = 'HelloExplosion' />
9396 < div className = 'flex w-full' >
94- < Input isRequired label = 'Project Path' labelPlacement = 'outside' placeholder = '/path/to/your/project' />
97+ < Input isRequired label = 'Project Path' labelPlacement = 'outside' placeholder = '/path/to/your/project' value = { projectPath } onValueChange = { setProjectPath } />
9598 < Button className = 'ml-2 mt-6' onPress = { ( ) => onBrowseProjectPath ( ) } >
9699 Browse
97100 </ Button >
0 commit comments