Skip to content

Commit e66b02b

Browse files
committed
Remove dialog and support fullscreen
1 parent d4d722d commit e66b02b

File tree

4 files changed

+23
-101
lines changed

4 files changed

+23
-101
lines changed

src/browser/components/ConfirmationDialog.tsx

Lines changed: 0 additions & 63 deletions
This file was deleted.

src/browser/modules/Frame/FrameTitlebar.tsx

Lines changed: 12 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ import {
4747
} from 'shared/modules/stream/streamDuck'
4848
import { sleep } from 'shared/services/utils'
4949
import { FrameButton } from 'browser-components/buttons'
50-
import ConfirmationDialog from 'browser-components/ConfirmationDialog'
5150
import Render from 'browser-components/Render'
5251
import { CSVSerializer } from 'services/serializer'
5352
import {
@@ -133,7 +132,6 @@ function FrameTitlebar(props: FrameTitleBarProps) {
133132
// makes sure the frame is updated as links in frame is followed
134133
editorRef.current?.setValue(props.frame.cmd)
135134
}, [props.frame.cmd])
136-
const [confirmationDialogOpen, setConfirmationDialogOpen] = useState(false)
137135
const editorRef = useRef<MonacoHandles>(null)
138136

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

164+
useEffect(() => {
165+
if (props.bus && props.fullscreen) {
166+
return props.bus.take(editor.SET_CONTENT, ({ message }) => {
167+
setRenderEditor(true)
168+
// timeout needed for editor to mount if not yet mounted.
169+
setTimeout(() => editorRef.current?.setValue(message), 0)
170+
})
171+
}
172+
return undefined
173+
}, [props.bus, props.fullscreen])
174+
166175
function hasData() {
167176
return props.numRecords > 0
168177
}
@@ -400,34 +409,10 @@ function FrameTitlebar(props: FrameTitleBarProps) {
400409
<SVGInline svg={controlsPlay} width="12px" />
401410
</FrameButton>
402411
</Render>
403-
<ConfirmationDialog
404-
confirmLabel="Yes, close frame"
405-
onClose={() => {
406-
setConfirmationDialogOpen(false)
407-
}}
408-
onConfirm={() => {
409-
setConfirmationDialogOpen(false)
410-
props.onCloseClick(frame.id, frame.requestId, props.request)
411-
}}
412-
open={confirmationDialogOpen}
413-
>
414-
<h2 style={{ fontWeight: 'normal' }}>Close frame?</h2>
415-
<p>
416-
Closing the frame cannot be undone.
417-
<br />
418-
You can access you query history by running <code>
419-
:history
420-
</code>{' '}
421-
command.
422-
</p>
423-
<p>Do you want to close the frame anyway?</p>
424-
</ConfirmationDialog>
425412
<FrameButton
426413
title="Close"
427414
onClick={() => {
428-
frame.isRerun
429-
? setConfirmationDialogOpen(true)
430-
: props.onCloseClick(frame.id, frame.requestId, props.request)
415+
props.onCloseClick(frame.id, frame.requestId, props.request)
431416
}}
432417
>
433418
<CloseIcon />

src/browser/modules/Frame/styled.tsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,13 @@ export const StyledFrame = styled.article<FullscreenProps>`
3131
${props =>
3232
props.fullscreen
3333
? `margin: 0;
34-
position: fixed;
35-
left: 0;
34+
position: absolute;
35+
left: -9px;
3636
top: 0;
37-
bottom: 0;
38-
right: 0;
39-
z-index: 130;`
37+
bottom: 0px;
38+
right: -10px;
39+
z-index: 130;
40+
`
4041
: 'margin 0 0 10px 0;'}
4142
4243
&:hover .carousel-intro-animation {
@@ -105,9 +106,9 @@ export const StyledFrameContents = styled.div<FullscreenProps>`
105106
min-height: ${dim.frameBodyHeight / 2}px;
106107
max-height: ${props =>
107108
props.fullscreen
108-
? '100vh'
109+
? 'auto'
109110
: dim.frameBodyHeight - dim.frameStatusbarHeight * 2 + 'px'};
110-
${props => (props.fullscreen ? 'height: 100vh' : null)};
111+
${props => (props.fullscreen ? 'height: calc(100vh - 40px)' : null)};
111112
flex: auto;
112113
display: flex;
113114
width: 100%;

src/browser/modules/Stream/CypherFrame/VisualizationView.styled.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,12 @@
2121
import styled from 'styled-components'
2222
import { dim } from 'browser-styles/constants'
2323

24-
export const StyledVisContainer: any = styled.div`
24+
export const StyledVisContainer = styled.div<{ fullscreen: boolean }>`
2525
width: 100%;
2626
overflow: hidden;
27-
${(props: any) => (props.fullscreen ? 'padding-bottom: 39px' : null)};
28-
height: ${(props: any) =>
27+
height: ${props =>
2928
props.fullscreen
30-
? '100vh'
29+
? 'calc(100vh - 40px)'
3130
: dim.frameBodyHeight - dim.frameTitlebarHeight * 2 + 'px'};
3231
> svg {
3332
width: 100%;

0 commit comments

Comments
 (0)