-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Moved Publish dialog to the application * Removed "Revert" button * Implemented UnsavedChanges dialog * Added getIsFileOrResourceUpdated * Don't use proxy/almost empty index files * Moved ClickAwayListener to the Application component * Implemented closeDesktopApp * Warn the user about unsaved changes even if the cell editing is not commited (#517)
- Loading branch information
Showing
30 changed files
with
249 additions
and
223 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
client/components/Application/Dialogs/CloseWithUnsavedChanges.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import DangerousIcon from '@mui/icons-material/Dangerous' | ||
import ConfirmDialog from '../../Parts/Dialogs/Confirm' | ||
import * as store from '@client/store' | ||
|
||
export default function CloseWithUnsavedChangesDialog() { | ||
const onSave = async () => { | ||
await store.saveFile() | ||
store.closeDesktopApp() | ||
} | ||
|
||
const onDiscard = async () => { | ||
await store.revertFile() | ||
store.closeDesktopApp() | ||
} | ||
|
||
return ( | ||
<ConfirmDialog | ||
open={true} | ||
title="Unsaved Changes" | ||
cancelLabel="Discard" | ||
label="Save" | ||
Icon={DangerousIcon} | ||
description="There are unsaved changes. Please click Save or Discard" | ||
onCancel={onDiscard} | ||
onConfirm={onSave} | ||
disableClosing={true} | ||
/> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import DangerousIcon from '@mui/icons-material/Dangerous' | ||
import ConfirmDialog from '../../Parts/Dialogs/Confirm' | ||
import * as store from '@client/store' | ||
|
||
export default function UnsavedChangesDialog() { | ||
const onSave = async () => { | ||
await store.saveFile() | ||
store.closeDialog() | ||
} | ||
|
||
const onDiscard = async () => { | ||
await store.revertFile() | ||
store.closeDialog() | ||
} | ||
|
||
return ( | ||
<ConfirmDialog | ||
open={true} | ||
title="Unsaved Changes" | ||
cancelLabel="Discard" | ||
label="Save" | ||
Icon={DangerousIcon} | ||
description="There are unsaved changes. Please click Save or Discard" | ||
onCancel={onDiscard} | ||
onConfirm={onSave} | ||
/> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,28 @@ | ||
export { default } from './File' | ||
import Box from '@mui/material/Box' | ||
import { useTheme } from '@mui/material/styles' | ||
import ScrollBox from '../../Parts/Boxes/Scroll' | ||
import Action from './Action' | ||
import Menu from './Menu' | ||
import Panel from './Panel' | ||
import View from './View' | ||
import * as store from '@client/store' | ||
|
||
export default function File() { | ||
const theme = useTheme() | ||
const panel = store.useStore((state) => state.panel) | ||
|
||
const height = `calc(100vh - ${theme.spacing(8)})` | ||
const panelHeight = panel ? 42 : 0 | ||
const contentHeight = `calc(100vh - ${theme.spacing(8 + 8 + 8 + panelHeight)})` | ||
|
||
return ( | ||
<Box sx={{ height }}> | ||
<Menu /> | ||
<ScrollBox height={contentHeight}> | ||
<View /> | ||
</ScrollBox> | ||
<Panel /> | ||
<Action /> | ||
</Box> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,23 @@ | ||
export { default } from './Table' | ||
import Box from '@mui/material/Box' | ||
import ScrollBox from '../../Parts/Boxes/Scroll' | ||
import { useTheme } from '@mui/material/styles' | ||
import Action from './Action' | ||
import Editor from './Editor' | ||
import Menu from './Menu' | ||
import Panel from './Panel' | ||
|
||
export default function Table() { | ||
const theme = useTheme() | ||
const contentHeight = `calc(100vh - ${theme.spacing(8 + 8)})` | ||
|
||
return ( | ||
<Box sx={{ height: '100%', width: '100%' }}> | ||
<Menu /> | ||
<ScrollBox height={contentHeight}> | ||
<Editor /> | ||
</ScrollBox> | ||
<Panel /> | ||
<Action /> | ||
</Box> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.