Skip to content

Commit 9e144a9

Browse files
committed
feat(onboarding): Add warning for when docs are missing examples
1 parent 6ccb203 commit 9e144a9

File tree

1 file changed

+40
-5
lines changed

1 file changed

+40
-5
lines changed

src/sentry/static/sentry/app/views/onboarding/projectSetup/projectDocs.jsx

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@ import React from 'react';
44
import posed, {PoseGroup} from 'react-pose';
55
import styled from 'react-emotion';
66

7-
import {alertStyles} from 'app/components/alert';
87
import {analytics} from 'app/utils/analytics';
98
import {loadDocs} from 'app/actionCreators/projects';
109
import {t, tct} from 'app/locale';
10+
import Alert, {alertStyles} from 'app/components/alert';
1111
import Button from 'app/components/button';
12+
import ExternalLink from 'app/components/links/externalLink';
1213
import FirstEventIndicator from 'app/views/onboarding/projectSetup/firstEventIndicator';
1314
import LoadingError from 'app/components/loadingError';
1415
import Panel from 'app/components/panels/panel';
@@ -20,6 +21,12 @@ import space from 'app/styles/space';
2021
import withApi from 'app/utils/withApi';
2122
import withOrganization from 'app/utils/withOrganization';
2223

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+
2330
const recordAnalyticsDocsClicked = ({organization, project, platform}) =>
2431
analytics('onboarding_v2.full_docs_clicked', {
2532
org_id: parseInt(organization.id, 10),
@@ -83,6 +90,34 @@ class ProjectDocs extends React.Component {
8390
recordAnalyticsDocsClicked({organization, project, platform});
8491
};
8592

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+
86121
render() {
87122
const {organization, project, platform, scrollTargetId} = this.props;
88123
const {loadedPlatform, platformDocs, hasError} = this.state;
@@ -123,10 +158,10 @@ class ProjectDocs extends React.Component {
123158

124159
const docs = platformDocs !== null && (
125160
<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>
130165
</PoseGroup>
131166
);
132167

0 commit comments

Comments
 (0)