diff --git a/lib/linguist/heuristics.rb b/lib/linguist/heuristics.rb index 514ddb8a..ab8c4599 100644 --- a/lib/linguist/heuristics.rb +++ b/lib/linguist/heuristics.rb @@ -465,5 +465,13 @@ module Linguist Language["Scilab"] end end + + disambiguate ".tsx" do |data| + if /^\s*(import.+(from\s+|require\()['"]react|\/\/\/\s* Promise + selectExample: (selectedExample: Example) => any + gettingStartedState: GettingStartedState +} + +interface State { + mouseOver: boolean +} + +class PlaygroundCPopup extends React.Component { + + state = { + mouseOver: false, + } + + refs: { + [key: string]: any + exampleAnchor: HTMLDivElement + congratsAnchor: HTMLDivElement + scroller: HTMLDivElement, + } + + componentDidUpdate(prevProps: Props, prevState: State) { + if (prevProps.gettingStartedState.selectedExample !== this.props.gettingStartedState.selectedExample) { + this.refs.scroller.scrollTop += this.refs.exampleAnchor.getBoundingClientRect().top + } + + if (prevProps.gettingStartedState.isCurrentStep('STEP5_WAITING') + && this.props.gettingStartedState.isCurrentStep('STEP5_DONE')) { + this.refs.scroller.scrollTop += this.refs.congratsAnchor.getBoundingClientRect().top + + const snd = new Audio(require('../../../assets/success.mp3') as string) + snd.volume = 0.5 + snd.play() + } + } + + render() { + const {mouseOver} = this.state + const {selectedExample} = this.props.gettingStartedState + const hovering = !this.props.gettingStartedState.isCurrentStep('STEP4_CLICK_TEASER_STEP5') + const downloadUrl = (example) => `${__BACKEND_ADDR__}/resources/getting-started-example?repository=${examples[example].path}&project_id=${this.props.projectId}&user=graphcool-examples` // tslint:disable-line + return ( +
+
+
this.setState({ mouseOver: false })} + onMouseEnter={() => { + this.setState({ mouseOver: true }) + }} + onMouseOver={(e: any) => { + if (this.props.gettingStartedState.isCurrentStep('STEP4_CLICK_TEASER_STEP5')) { + this.props.nextStep() + } + }} + > +
+
+ You did it! Time to run an example. +
+
+ You have successfully set up your own Instagram backend.{' '} + When building an app with Graphcool you can easily explore queries in the{' '} + playground and "copy & paste" selected queries into your code.{' '} + Of course, to do so, you need to implement the frontend first. +
+
+
We put together a simple app to show and add posts
+
using the backend you just built, to test and run it locally.
+
+
+
+
+ Select your preferred technology to download the example. +
+
+
this.props.selectExample('ReactRelay')} + > + React + Relay +
+
this.props.selectExample('ReactApollo')} + > + React + Apollo +
+
this.props.selectExample('ReactNativeApollo')} + > + React Native + Apollo +
+
this.props.selectExample('AngularApollo')} + > + Angular + Apollo +
+
+
+ {selectedExample && +
+
+