diff --git a/apps/studio/src/components/Modals/ConfirmNewFileModal.tsx b/apps/studio/src/components/Modals/ConfirmNewFileModal.tsx new file mode 100644 index 000000000..2263632d3 --- /dev/null +++ b/apps/studio/src/components/Modals/ConfirmNewFileModal.tsx @@ -0,0 +1,31 @@ +import { create } from '@ebay/nice-modal-react'; +import { NewFileModal } from './NewFileModal'; +import { ConfirmModal } from './ConfirmModal'; +import { show as showModal } from '@ebay/nice-modal-react'; + +export const ConfirmNewFileModal = create(() => { + const onConfirm = () => { + showModal(NewFileModal) + }; + + return ( + +
+
+
+ Would you like to create a new file? +

+ All the existing changes will be lost and overwritten. +

+
+
+
+
+ ); +}); diff --git a/apps/studio/src/components/Modals/index.tsx b/apps/studio/src/components/Modals/index.tsx index 97154ba7f..b89162281 100644 --- a/apps/studio/src/components/Modals/index.tsx +++ b/apps/studio/src/components/Modals/index.tsx @@ -8,3 +8,4 @@ export * from './ImportBase64Modal'; export * from './ImportURLModal'; export * from './NewFileModal'; export * from './RedirectedModal'; +export * from './ConfirmNewFileModal'; \ No newline at end of file diff --git a/apps/studio/src/components/Sidebar.tsx b/apps/studio/src/components/Sidebar.tsx index 6e8e9c7a7..2d6f32065 100644 --- a/apps/studio/src/components/Sidebar.tsx +++ b/apps/studio/src/components/Sidebar.tsx @@ -2,7 +2,7 @@ import { VscListSelection, VscCode, VscOpenPreview, VscGraph, VscNewFile, VscSet import { show as showModal } from '@ebay/nice-modal-react'; import { Tooltip } from './common'; -import { SettingsModal, NewFileModal } from './Modals'; +import { SettingsModal, ConfirmNewFileModal } from './Modals'; import { usePanelsState, panelsState, useDocumentsState } from '../state'; @@ -105,7 +105,7 @@ export const Sidebar: FunctionComponent = () => { name: 'newFile', title: 'New file', isActive: false, - onClick: () => showModal(NewFileModal), + onClick: () => showModal(ConfirmNewFileModal), icon: , tooltip: 'New file', enabled: true