Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Merged from sdl-tabs https://github.com/Novvum/graphql-playground.git * Added and integrated setting's key for 'schema.disableComments' * Merged changes from disableComments branch * Fixes and style changes matching @kuldar's design specs. Details on graphql/graphql-playground#897 comments * Still not able to cmd+save settings. Might be a deeper issue. However, save button saves disabled comments * Added tabWidth prop to SideTab.tsx to provide specific widths for different tabs. * Fix for Tab Spacing in collapsed state Fix for additional line-breaks after each item * ugly version is done * moved icons to the left * making polling global * Updates for using 'esc' on keydown to close tabs * added polling config * Updated createSDL.tsx Schema will now default to true for commentsDisabled and commentDescription properties * Fixed Electron * Hiding reload icon if polling is enabled * * Updated schema polling icon * Schema only updates in state if it has changed * code cleanup * Merged from sdl-tabs https://github.com/Novvum/graphql-playground.git * Added and integrated setting's key for 'schema.disableComments' * Merged changes from disableComments branch * Fixes and style changes matching @kuldar's design specs. Details on graphql/graphql-playground#897 comments * Added tabWidth prop to SideTab.tsx to provide specific widths for different tabs. * Fix for Tab Spacing in collapsed state Fix for additional line-breaks after each item * ugly version is done * moved icons to the left * making polling global * Updates for using 'esc' on keydown to close tabs * added polling config * Updated createSDL.tsx Schema will now default to true for commentsDisabled and commentDescription properties * Fixed Electron * Hiding reload icon if polling is enabled * * Updated schema polling icon * Schema only updates in state if it has changed * code cleanup * removed questiomark * removed duplicate funciton * updated files from upstream * yarn.lock from upstream * using printSchema instead of JSON.stringify to compare schemas * reusing reload icon * "Refresh to see changes" feature in SCHEMA tab * disabled animation for polling * changed polling icon and moved back to right side. * automatically updating schema view without scrolling when schema updates * moved reload icon back to the left * automatically updating schema view without scrolling when schema updates * more accurate schema diff checking
- Loading branch information
1 parent
16b49d2
commit 7e290dc
Showing
17 changed files
with
242 additions
and
42 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
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
42 changes: 42 additions & 0 deletions
42
packages/graphql-playground-react/src/components/Playground/TopBar/Polling.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,42 @@ | ||
import * as React from 'react' | ||
import PollingIcon from './PollingIcon' | ||
|
||
export interface Props { | ||
isPollingSchema: boolean | ||
onReloadSchema: () => void | ||
} | ||
|
||
class SchemaPolling extends React.Component<Props> { | ||
timer: any | ||
|
||
componentDidMount() { | ||
this.startPolling() | ||
} | ||
componentWillUnmount() { | ||
this.clearTimer() | ||
} | ||
componentWillReceiveProps(nextProps: Props) { | ||
if (nextProps.isPollingSchema !== this.props.isPollingSchema) { | ||
this.startPolling(nextProps) | ||
} | ||
} | ||
|
||
render() { | ||
return <PollingIcon animate={true} /> | ||
} | ||
private startPolling(props: Props = this.props) { | ||
this.clearTimer() | ||
if (props.isPollingSchema) { | ||
this.timer = setInterval(() => props.onReloadSchema(), 2000) | ||
} | ||
} | ||
|
||
private clearTimer() { | ||
if (this.timer) { | ||
clearInterval(this.timer) | ||
this.timer = null | ||
} | ||
} | ||
} | ||
|
||
export default SchemaPolling |
49 changes: 49 additions & 0 deletions
49
packages/graphql-playground-react/src/components/Playground/TopBar/PollingIcon.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,49 @@ | ||
import * as React from 'react' | ||
import { styled, keyframes, css } from '../../../styled/index' | ||
import BasePositioner from './Positioner' | ||
|
||
export interface Props { | ||
animate: boolean | ||
disabled?: boolean | ||
onClick?: () => void | ||
} | ||
|
||
const PollingIcon: React.SFC<Props> = props => ( | ||
<Positioner onClick={props.onClick} title="Polling Schema"> | ||
<Icon animate={props.animate} /> | ||
</Positioner> | ||
) | ||
|
||
export default PollingIcon | ||
|
||
const pulse = keyframes` | ||
0% { | ||
box-shadow: 0 0 0 0 rgba(139, 149, 156, 0.4); | ||
} | ||
70% { | ||
box-shadow: 0 0 0 10px rgba(139, 149, 156, 0); | ||
} | ||
100% { | ||
box-shadow: 0 0 0 0 rgba(139, 149, 156, 0); | ||
} | ||
` | ||
|
||
const Positioner = styled(BasePositioner)` | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
` | ||
const Icon = styled.div` | ||
display: block; | ||
width: 8px; | ||
height: 8px; | ||
border-radius: 50%; | ||
background: ${p => p.theme.editorColours.pollingIcon}; | ||
box-shadow: 0 0 0 ${p => p.theme.editorColours.pollingIconShadow}; | ||
${p => | ||
p.animate | ||
? css` | ||
animation: ${pulse} 2s infinite; | ||
` | ||
: undefined}; | ||
` |
6 changes: 6 additions & 0 deletions
6
packages/graphql-playground-react/src/components/Playground/TopBar/Positioner.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,6 @@ | ||
import { styled } from '../../../styled/index' | ||
|
||
export default styled.div` | ||
width: 20px; | ||
height: 20px; | ||
` |
16 changes: 16 additions & 0 deletions
16
packages/graphql-playground-react/src/components/Playground/TopBar/Reload.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,16 @@ | ||
import * as React from 'react' | ||
import ReloadIcon from './ReloadIcon' | ||
|
||
export interface Props { | ||
isReloadingSchema: boolean | ||
onReloadSchema?: () => void | ||
} | ||
|
||
const Reload: React.SFC<Props> = props => ( | ||
<ReloadIcon | ||
animate={props.isReloadingSchema} | ||
onClick={props.onReloadSchema} | ||
/> | ||
) | ||
|
||
export default Reload |
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
26 changes: 26 additions & 0 deletions
26
packages/graphql-playground-react/src/components/Playground/TopBar/SchemaReload.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,26 @@ | ||
import * as React from 'react' | ||
import ReloadIcon from './Reload' | ||
import PollingIcon from './Polling' | ||
|
||
export interface Props { | ||
isPollingSchema: boolean | ||
isReloadingSchema: boolean | ||
onReloadSchema: () => any | ||
} | ||
|
||
export default (props: Props) => { | ||
if (props.isPollingSchema) { | ||
return ( | ||
<PollingIcon | ||
isPollingSchema={props.isPollingSchema} | ||
onReloadSchema={props.onReloadSchema} | ||
/> | ||
) | ||
} | ||
return ( | ||
<ReloadIcon | ||
isReloadingSchema={props.isReloadingSchema} | ||
onReloadSchema={props.onReloadSchema} | ||
/> | ||
) | ||
} |
Oops, something went wrong.