From 2cce5896b6ebbeb1f90e6a8773f1b58df73d929a Mon Sep 17 00:00:00 2001 From: Aniket-Engg Date: Tue, 7 Mar 2023 13:09:19 +0530 Subject: [PATCH] download option added --- apps/remix-ide/src/app/tabs/locales/en/filePanel.json | 2 ++ .../src/lib/components/workspace-hamburger.tsx | 9 +++++++-- libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx | 10 +++++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/apps/remix-ide/src/app/tabs/locales/en/filePanel.json b/apps/remix-ide/src/app/tabs/locales/en/filePanel.json index 8e4d6eaa07..4e9d753cfa 100644 --- a/apps/remix-ide/src/app/tabs/locales/en/filePanel.json +++ b/apps/remix-ide/src/app/tabs/locales/en/filePanel.json @@ -10,6 +10,8 @@ "filePanel.workspace.rename": "Rename Workspace", "filePanel.workspace.delete": "Delete Workspace", "filePanel.workspace.deleteConfirm": "Are you sure to delete the current workspace?", + "filePanel.workspace.download": "Download Workspace", + "filePanel.workspace.downloadConfirm": "This will download current workspace in a zip file. Do you want to continue?", "filePanel.workspace.deleteAll": "Delete All Workspaces", "filePanel.workspace.deleteAllConfirm1": "Are you absolutely sure you want to delete all your workspaces?", "filePanel.workspace.deleteAllConfirm2": "Deleted workspaces can not be restored in any manner.", 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 32ba47b55b..2ad7ca667b 100644 --- a/libs/remix-ui/workspace/src/lib/components/workspace-hamburger.tsx +++ b/libs/remix-ui/workspace/src/lib/components/workspace-hamburger.tsx @@ -4,9 +4,10 @@ import { HamburgerMenuItem } from './workspace-hamburger-item' export interface HamburgerMenuProps { createWorkspace: () => void, + renameCurrentWorkspace: () => void, + downloadCurrentWorkspace: () => void, deleteCurrentWorkspace: () => void, deleteAllWorkspaces: () => void, - renameCurrentWorkspace: () => void, cloneGitRepository: () => void, downloadWorkspaces: () => void, restoreBackup: () => void, @@ -27,10 +28,14 @@ export function HamburgerMenu (props: HamburgerMenuProps) { props.createWorkspace() props.hideIconsMenu(!showIconsMenu) }}> - { + { props.renameCurrentWorkspace() props.hideIconsMenu(!showIconsMenu) }}> + { + props.downloadCurrentWorkspace() + props.hideIconsMenu(!showIconsMenu) + }}> { props.deleteCurrentWorkspace() props.hideIconsMenu(!showIconsMenu) 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 43fefe1b2e..4539b13f68 100644 --- a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx +++ b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx @@ -76,6 +76,9 @@ export function Workspace () { global.modal(intl.formatMessage({ id: 'filePanel.workspace.rename' }), renameModalMessage(), intl.formatMessage({ id: 'filePanel.ok' }), onFinishRenameWorkspace, intl.formatMessage({ id: 'filePanel.cancel' })) } + const downloadCurrentWorkspace = () => { + global.modal(intl.formatMessage({ id: 'filePanel.workspace.download' }), intl.formatMessage({ id: 'filePanel.workspace.downloadConfirm' }), intl.formatMessage({ id: 'filePanel.ok' }), onFinishDownloadWorkspace, intl.formatMessage({ id: 'filePanel.cancel' })) + } const createWorkspace = () => { global.modal(intl.formatMessage({ id: 'filePanel.workspace.create' }), createModalMessage(), intl.formatMessage({ id: 'filePanel.ok' }), onFinishCreateWorkspace, intl.formatMessage({ id: 'filePanel.cancel' })) } @@ -156,6 +159,10 @@ export function Workspace () { } } + const onFinishDownloadWorkspace = async () => { + console.log('inside onFinishDownloadWorkspace') + } + const onFinishCreateWorkspace = async () => { if (workspaceCreateInput.current === undefined) return // @ts-ignore: Object is possibly 'null'. @@ -453,9 +460,10 @@ export function Workspace () {