Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove "Are you sure you want to close this" modal #1355

Merged
merged 2 commits into from
Apr 13, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 0 additions & 63 deletions src/browser/components/ConfirmationDialog.tsx

This file was deleted.

39 changes: 12 additions & 27 deletions src/browser/modules/Frame/FrameTitlebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ import {
} from 'shared/modules/stream/streamDuck'
import { sleep } from 'shared/services/utils'
import { FrameButton } from 'browser-components/buttons'
import ConfirmationDialog from 'browser-components/ConfirmationDialog'
import Render from 'browser-components/Render'
import { CSVSerializer } from 'services/serializer'
import {
Expand Down Expand Up @@ -133,7 +132,6 @@ function FrameTitlebar(props: FrameTitleBarProps) {
// makes sure the frame is updated as links in frame is followed
editorRef.current?.setValue(props.frame.cmd)
}, [props.frame.cmd])
const [confirmationDialogOpen, setConfirmationDialogOpen] = useState(false)
const editorRef = useRef<MonacoHandles>(null)

/* When the frametype is changed the titlebar is unmounted
Expand Down Expand Up @@ -163,6 +161,17 @@ function FrameTitlebar(props: FrameTitleBarProps) {
}, [props.frame.isRerun])
useEffect(gainFocusCallback, [gainFocusCallback])

useEffect(() => {
jharris4 marked this conversation as resolved.
Show resolved Hide resolved
if (props.bus && props.fullscreen) {
return props.bus.take(editor.SET_CONTENT, ({ message }) => {
setRenderEditor(true)
// timeout needed for editor to mount if not yet mounted.
setTimeout(() => editorRef.current?.setValue(message), 0)
})
}
return undefined
}, [props.bus, props.fullscreen])

function hasData() {
return props.numRecords > 0
}
Expand Down Expand Up @@ -400,34 +409,10 @@ function FrameTitlebar(props: FrameTitleBarProps) {
<SVGInline svg={controlsPlay} width="12px" />
</FrameButton>
</Render>
<ConfirmationDialog
confirmLabel="Yes, close frame"
onClose={() => {
setConfirmationDialogOpen(false)
}}
onConfirm={() => {
setConfirmationDialogOpen(false)
props.onCloseClick(frame.id, frame.requestId, props.request)
}}
open={confirmationDialogOpen}
>
<h2 style={{ fontWeight: 'normal' }}>Close frame?</h2>
<p>
Closing the frame cannot be undone.
<br />
You can access you query history by running <code>
:history
</code>{' '}
command.
</p>
<p>Do you want to close the frame anyway?</p>
</ConfirmationDialog>
<FrameButton
title="Close"
onClick={() => {
frame.isRerun
? setConfirmationDialogOpen(true)
: props.onCloseClick(frame.id, frame.requestId, props.request)
props.onCloseClick(frame.id, frame.requestId, props.request)
}}
>
<CloseIcon />
Expand Down