diff --git a/libs/remix-ui/workspace/src/lib/components/workspace-hamburger.tsx b/libs/remix-ui/workspace/src/lib/components/workspace-hamburger.tsx index 03dcc6cb1ae..0dad1489990 100644 --- a/libs/remix-ui/workspace/src/lib/components/workspace-hamburger.tsx +++ b/libs/remix-ui/workspace/src/lib/components/workspace-hamburger.tsx @@ -7,6 +7,7 @@ import { WorkspaceMetadata } from '../types' export interface HamburgerMenuProps { selectedWorkspace: WorkspaceMetadata createWorkspace: () => void + createBlankWorkspace: () => Promise renameCurrentWorkspace: () => void downloadCurrentWorkspace: () => void deleteCurrentWorkspace: () => void @@ -41,7 +42,7 @@ export function HamburgerMenu(props: HamburgerMenuProps) { fa="far fa-plus" hideOption={hideWorkspaceOptions} actionOnClick={() => { - props.createWorkspace() + props.createBlankWorkspace() props.hideIconsMenu(!showIconsMenu) }} platforms={[appPlatformTypes.web]} diff --git a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx index 287691cdb2b..96a74ed5dca 100644 --- a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx +++ b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx @@ -18,6 +18,7 @@ import { AppContext, appPlatformTypes, platformContext } from '@remix-ui/app' import { ElectronMenu } from './components/electron-menu' import { ElectronWorkspaceName } from './components/electron-workspace-name' import { branch, GitHubUser, gitUIPanels, userEmails } from '@remix-ui/git' +import { createModalMessage } from './components/createModal' const _paq = (window._paq = window._paq || []) @@ -335,9 +336,23 @@ export function Workspace() { ) } + const [counter, setCounter] = useState(0) const createBlankWorkspace = async () => { + const username = await global.plugin.call('settings', 'get', 'settings/github-user-name') + const email = await global.plugin.call('settings', 'get', 'settings/github-email') + const gitNotSet = !username || !email + const defaultName = await global.plugin.call('filePanel', 'getAvailableWorkspaceName', 'blank') + let workspace = defaultName + let gitInit = false + setCounter((previous) => { + return previous + 1 + }) global.modal( - + intl.formatMessage({ id: 'filePanel.workspace.createBlank' }), + await createModalMessage(`blank - 1`, gitNotSet, (value) => { workspace = value }, (value) => gitInit = false), + intl.formatMessage({ id: 'filePanel.ok' }), + () => global.dispatchCreateWorkspace(`blank - ${counter}`, 'blank', false), + intl.formatMessage({ id: 'filePanel.cancel' }) ) } @@ -932,6 +947,7 @@ export function Workspace() {