1- import { getPreferenceValues , MenuBarExtra , open , showHUD , showToast , Toast , getApplications } from "@raycast/api" ;
1+ import { getPreferenceValues , MenuBarExtra , open , showHUD , getApplications , useNavigation , LocalStorage , launchCommand , LaunchType } from "@raycast/api" ;
22import { usePromise } from "@raycast/utils" ;
33import { useEffect , useState } from "react" ;
44
@@ -8,9 +8,7 @@ import { IWorkspace } from "./api/Gitpod/Models/IWorkspace";
88import { IWorkspaceError } from "./api/Gitpod/Models/IWorkspaceError" ;
99import { WorkspaceManager } from "./api/Gitpod/WorkspaceManager" ;
1010import { getCodeEncodedURI } from "./helpers/getVSCodeEncodedURI" ;
11- import { useHistory } from "./helpers/repository" ;
1211import { dashboardPreferences } from "./preferences/dashboard_preferences" ;
13- import { getGitpodEndpoint } from "./preferences/gitpod_endpoint" ;
1412import { Preferences } from "./preferences/repository_preferences" ;
1513
1614
@@ -19,9 +17,6 @@ export default function command() {
1917 const preferences = getPreferenceValues < dashboardPreferences > ( ) ;
2018 const EditorPreferences = getPreferenceValues < Preferences > ( ) ;
2119
22- const { data } = useHistory ( "" , "" ) ;
23- const gitpodEndpoint = getGitpodEndpoint ( ) ;
24-
2520 const workspaceManager = new WorkspaceManager (
2621 preferences . access_token ?? "" ,
2722 ) ;
@@ -122,15 +117,27 @@ export default function command() {
122117 />
123118 ) ) }
124119 </ MenuBarExtra . Section > }
125- < MenuBarExtra . Section title = "Recent Repositories" >
126- { data . slice ( 0 , 7 ) . map ( ( repository ) => (
127- < MenuBarExtra . Item
128- key = { repository . nameWithOwner }
129- title = { repository . nameWithOwner }
130- icon = { GitpodIcons . repoIcon }
131- onAction = { ( ) => open ( `${ gitpodEndpoint } #https://github.com/${ repository . nameWithOwner } ` ) }
132- />
133- ) ) }
120+ < MenuBarExtra . Section >
121+ < MenuBarExtra . Item
122+ title = "Launch New Empty Workspace"
123+ icon = { GitpodIcons . gitpod_logo_primary }
124+ key = { "Launch New Empty Workspace" }
125+ onAction = { async ( ) => {
126+ const item = await LocalStorage . getItem ( "default_organization" )
127+ console . log ( item ) ;
128+ if ( item !== undefined ) {
129+ IWorkspace . create ( WorkspaceManager . api , {
130+ contextUrl : "https://github.com/gitpod-io/empty" ,
131+ organizationId : item . toString ( )
132+ } )
133+ } else {
134+ launchCommand ( {
135+ name : "gitpod_dashboard" ,
136+ type : LaunchType . UserInitiated
137+ } )
138+ }
139+ } }
140+ />
134141 </ MenuBarExtra . Section >
135142 </ MenuBarExtra >
136143 ) ;
0 commit comments