@@ -4,11 +4,12 @@ import React from 'react';
4
4
import posed , { PoseGroup } from 'react-pose' ;
5
5
import styled from 'react-emotion' ;
6
6
7
- import { alertStyles } from 'app/components/alert' ;
8
7
import { analytics } from 'app/utils/analytics' ;
9
8
import { loadDocs } from 'app/actionCreators/projects' ;
10
9
import { t , tct } from 'app/locale' ;
10
+ import Alert , { alertStyles } from 'app/components/alert' ;
11
11
import Button from 'app/components/button' ;
12
+ import ExternalLink from 'app/components/links/externalLink' ;
12
13
import FirstEventIndicator from 'app/views/onboarding/projectSetup/firstEventIndicator' ;
13
14
import LoadingError from 'app/components/loadingError' ;
14
15
import Panel from 'app/components/panels/panel' ;
@@ -20,6 +21,12 @@ import space from 'app/styles/space';
20
21
import withApi from 'app/utils/withApi' ;
21
22
import withOrganization from 'app/utils/withOrganization' ;
22
23
24
+ /**
25
+ * The documentation will include the following string should it be missing the
26
+ * verification example, which currently a lot of docs are.
27
+ */
28
+ const INCOMPLETE_DOC_FLAG = 'TODO-ADD-VERIFICATION-EXAMPLE' ;
29
+
23
30
const recordAnalyticsDocsClicked = ( { organization, project, platform} ) =>
24
31
analytics ( 'onboarding_v2.full_docs_clicked' , {
25
32
org_id : parseInt ( organization . id , 10 ) ,
@@ -83,6 +90,34 @@ class ProjectDocs extends React.Component {
83
90
recordAnalyticsDocsClicked ( { organization, project, platform} ) ;
84
91
} ;
85
92
93
+ /**
94
+ * TODO(epurkhiser): This can be removed once all documentation has an
95
+ * example for sending the users first event.
96
+ */
97
+ get missingExampleWarning ( ) {
98
+ const { loadedPlatform, platformDocs} = this . state ;
99
+ const missingExample = platformDocs ?. html ?. includes ( INCOMPLETE_DOC_FLAG ) ;
100
+
101
+ if ( ! missingExample ) {
102
+ return null ;
103
+ }
104
+
105
+ return (
106
+ < Alert type = "warning" icon = "icon-circle-info" >
107
+ { tct (
108
+ `Looks like this getting started example is still undergoing some
109
+ work and doesn't include an example for triggering an event quite
110
+ yet! If you have trouble sending your first event be sure to consult
111
+ the [docsLink:full documentation] for [platform].` ,
112
+ {
113
+ docsLink : < ExternalLink href = { platformDocs ?. link } /> ,
114
+ platform : platforms . find ( p => p . id === loadedPlatform ) . name ,
115
+ }
116
+ ) }
117
+ </ Alert >
118
+ ) ;
119
+ }
120
+
86
121
render ( ) {
87
122
const { organization, project, platform, scrollTargetId} = this . props ;
88
123
const { loadedPlatform, platformDocs, hasError} = this . state ;
@@ -123,10 +158,10 @@ class ProjectDocs extends React.Component {
123
158
124
159
const docs = platformDocs !== null && (
125
160
< PoseGroup preEnterPose = "init" animateOnMount >
126
- < DocsWrapper
127
- key = { platformDocs . html }
128
- dangerouslySetInnerHTML = { { __html : platformDocs . html } }
129
- / >
161
+ < DocsWrapper key = { platformDocs . html } >
162
+ < div dangerouslySetInnerHTML = { { __html : platformDocs . html } } />
163
+ { this . missingExampleWarning }
164
+ </ DocsWrapper >
130
165
</ PoseGroup >
131
166
) ;
132
167
0 commit comments