Skip to content

Commit f97f23b

Browse files
feat: updated Finish Page for first mile (#4438)
1 parent a82f35c commit f97f23b

File tree

9 files changed

+243
-42
lines changed

9 files changed

+243
-42
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@
170170
"amplitude-js": "^8.16.1",
171171
"auth0-js": "^9.13.2",
172172
"babel-polyfill": "^6.26.0",
173+
"canvas-confetti": "^1.5.1",
173174
"chroma-js": "^1.3.6",
174175
"classnames": "^2.2.3",
175176
"connected-react-router": "^6.8.0",
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
import React from 'react'
2+
import {
3+
ComponentSize,
4+
FlexBox,
5+
InfluxColors,
6+
JustifyContent,
7+
} from '@influxdata/clockface'
8+
import {
9+
ThumbsDown,
10+
ThumbsUp,
11+
} from 'src/homepageExperience/components/HomepageIcons'
12+
import {event} from 'src/cloud/utils/reporting'
13+
14+
import 'src/homepageExperience/components/HomepageExperience.scss'
15+
16+
type OwnProps = {
17+
wizardEventName: string
18+
}
19+
type State = {
20+
selectedFeedback: number
21+
}
22+
23+
enum feedbackValue {
24+
THUMBS_DOWN,
25+
THUMBS_UP,
26+
}
27+
28+
export default class FeedbackBar extends React.Component<OwnProps, State> {
29+
constructor(props) {
30+
super(props)
31+
this.state = {
32+
selectedFeedback: null,
33+
}
34+
}
35+
36+
private handleThumbsUpClick = () => {
37+
event(`firstMile.${this.props.wizardEventName}.thumbsUp.clicked`)
38+
this.setState({selectedFeedback: feedbackValue.THUMBS_UP})
39+
}
40+
private handleThumbsDownClick = () => {
41+
event(`firstMile.${this.props.wizardEventName}.thumbsDown.clicked`)
42+
this.setState({selectedFeedback: feedbackValue.THUMBS_DOWN})
43+
}
44+
45+
render() {
46+
const {selectedFeedback} = this.state
47+
return (
48+
<FlexBox
49+
margin={ComponentSize.Large}
50+
justifyContent={JustifyContent.SpaceBetween}
51+
className="feedback-bar"
52+
>
53+
<p>What did you think about the set up process?</p>
54+
<FlexBox margin={ComponentSize.Large}>
55+
<button
56+
onClick={this.handleThumbsUpClick}
57+
style={{
58+
fill:
59+
selectedFeedback === feedbackValue.THUMBS_UP
60+
? InfluxColors.Rainforest
61+
: InfluxColors.White,
62+
}}
63+
>
64+
{ThumbsUp}
65+
</button>
66+
<button
67+
onClick={this.handleThumbsDownClick}
68+
style={{
69+
fill:
70+
selectedFeedback === feedbackValue.THUMBS_DOWN
71+
? InfluxColors.Fire
72+
: InfluxColors.White,
73+
}}
74+
>
75+
{ThumbsDown}
76+
</button>
77+
</FlexBox>
78+
</FlexBox>
79+
)
80+
}
81+
}

src/homepageExperience/components/HomepageExperience.scss

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ h1#first-mile--header {
4343
font-size: $cf-text-base-1;
4444
}
4545

46-
&.overviewSection {
46+
&.verticallyCentered {
4747
margin-top: auto;
4848
}
4949
}
@@ -100,3 +100,14 @@ h1#first-mile--header {
100100
margin: 0;
101101
}
102102
}
103+
104+
.feedback-bar {
105+
background: linear-gradient(
106+
256.11deg,
107+
rgba(147, 148, 255, 0.2) 0%,
108+
rgba(81, 60, 198, 0.2) 100%
109+
);
110+
padding-left: 16px;
111+
padding-right: 16px;
112+
max-width: 493px;
113+
}

src/homepageExperience/components/HomepageIcons.tsx

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ export const GoIcon = (
267267
</svg>
268268
)
269269

270-
export const InfluxDBUniversityIcon = (
270+
export const BookIcon = (
271271
<svg
272272
width="18"
273273
height="20"
@@ -295,7 +295,7 @@ export const InfluxDBUniversityIcon = (
295295
</svg>
296296
)
297297

298-
export const VSCodePluginIcon = (
298+
export const CodeTerminalIcon = (
299299
<svg
300300
width="21"
301301
height="18"
@@ -457,3 +457,25 @@ export const TelegrafIcon = (
457457
</defs>
458458
</svg>
459459
)
460+
461+
export const ThumbsUp = (
462+
<svg
463+
width="22"
464+
height="20"
465+
viewBox="0 0 22 20"
466+
xmlns="http://www.w3.org/2000/svg"
467+
>
468+
<path d="M1 8.00011H4V20.0001H1C0.734784 20.0001 0.48043 19.8948 0.292893 19.7072C0.105357 19.5197 0 19.2653 0 19.0001V9.00011C0 8.73489 0.105357 8.48054 0.292893 8.293C0.48043 8.10547 0.734784 8.00011 1 8.00011ZM6.293 6.70711L12.693 0.307111C12.7781 0.221805 12.8911 0.170078 13.0112 0.161443C13.1314 0.152808 13.2506 0.187845 13.347 0.260111L14.2 0.900111C14.4369 1.07796 14.6158 1.32196 14.7143 1.60137C14.8127 1.88077 14.8262 2.18306 14.753 2.47011L13.6 7.00011H20C20.5304 7.00011 21.0391 7.21083 21.4142 7.5859C21.7893 7.96097 22 8.46968 22 9.00011V11.1041C22.0003 11.3655 21.9493 11.6244 21.85 11.8661L18.755 19.3811C18.6795 19.5643 18.5513 19.721 18.3866 19.8312C18.2219 19.9414 18.0282 20.0002 17.83 20.0001H7C6.73478 20.0001 6.48043 19.8948 6.29289 19.7072C6.10536 19.5197 6 19.2653 6 19.0001V7.41411C6.00006 7.14892 6.10545 6.8946 6.293 6.70711Z" />
469+
</svg>
470+
)
471+
472+
export const ThumbsDown = (
473+
<svg
474+
width="22"
475+
height="20"
476+
viewBox="0 0 22 20"
477+
xmlns="http://www.w3.org/2000/svg"
478+
>
479+
<path d="M21 12H18V0H21C21.2652 0 21.5196 0.105357 21.7071 0.292893C21.8946 0.48043 22 0.734784 22 1V11C22 11.2652 21.8946 11.5196 21.7071 11.7071C21.5196 11.8946 21.2652 12 21 12ZM15.707 13.293L9.307 19.693C9.22194 19.7783 9.10894 19.83 8.98878 19.8387C8.86862 19.8473 8.74939 19.8123 8.653 19.74L7.8 19.1C7.5631 18.9222 7.38416 18.6781 7.28575 18.3987C7.18733 18.1193 7.17385 17.8171 7.247 17.53L8.4 13H2C1.46957 13 0.96086 12.7893 0.585788 12.4142C0.210715 12.0391 1.0643e-06 11.5304 1.0643e-06 11V8.896C-0.000268556 8.63464 0.050692 8.37576 0.150001 8.134L3.246 0.62C3.32128 0.436753 3.4493 0.279995 3.6138 0.169612C3.77831 0.0592292 3.97189 0.00019547 4.17 0H15C15.2652 0 15.5196 0.105357 15.7071 0.292893C15.8946 0.48043 16 0.734784 16 1V12.586C15.9999 12.8512 15.8946 13.1055 15.707 13.293Z" />
480+
</svg>
481+
)

src/homepageExperience/components/steps/Finish.tsx

Lines changed: 72 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3,71 +3,110 @@ import {
33
AlignItems,
44
ComponentSize,
55
FlexBox,
6-
Icon,
7-
IconFont,
86
ResourceCard,
97
} from '@influxdata/clockface'
108

9+
import confetti from 'canvas-confetti'
10+
1111
import {
12-
InfluxDBUniversityIcon,
13-
VSCodePluginIcon,
12+
BookIcon,
13+
CodeTerminalIcon,
1414
} from 'src/homepageExperience/components/HomepageIcons'
1515
import {SafeBlankLink} from 'src/utils/SafeBlankLink'
1616

1717
import {event} from 'src/cloud/utils/reporting'
18+
import FeedbackBar from 'src/homepageExperience/components/FeedbackBar'
1819

1920
type OwnProps = {
2021
wizardEventName: string
22+
markStepAsCompleted: () => void
23+
finishStepCompleted: boolean
24+
}
25+
26+
const fireConfetti = () => {
27+
const count = 200
28+
const defaults = {
29+
origin: {y: 0.7},
30+
}
31+
32+
const fire = (particleRatio, options) => {
33+
confetti({
34+
...defaults,
35+
...options,
36+
particleCount: Math.floor(count * particleRatio),
37+
})
38+
}
39+
40+
fire(0.25, {
41+
spread: 26,
42+
startVelocity: 55,
43+
})
44+
fire(0.2, {
45+
spread: 60,
46+
})
47+
fire(0.35, {
48+
spread: 100,
49+
decay: 0.91,
50+
scalar: 0.8,
51+
})
52+
fire(0.1, {
53+
spread: 120,
54+
startVelocity: 25,
55+
decay: 0.92,
56+
scalar: 1.2,
57+
})
58+
fire(0.1, {
59+
spread: 120,
60+
startVelocity: 45,
61+
})
2162
}
2263

2364
export const Finish = (props: OwnProps) => {
2465
useEffect(() => {
25-
event(`firstMile.${props.wizardEventName}.finished`)
66+
// if the finish step was opened during the session,
67+
// this check prevents from multiple logging of finish events
68+
// in case user navigates back and forth
69+
if (!props.finishStepCompleted) {
70+
event(`firstMile.${props.wizardEventName}.finished`)
71+
props.markStepAsCompleted()
72+
fireConfetti()
73+
}
2674
}, [])
75+
2776
return (
2877
<>
2978
<h1>Congrats!</h1>
3079
<p>You completed setting up, writing, and querying data.</p>
31-
<p>Curious to learn more? Try these next steps!</p>
80+
<FeedbackBar wizardEventName={props.wizardEventName} />
81+
<p style={{marginTop: '80px'}}>
82+
Curious to learn more? Try these next steps!
83+
</p>
3284
<FlexBox margin={ComponentSize.Medium} alignItems={AlignItems.Stretch}>
3385
<ResourceCard className="homepage-wizard-next-steps">
34-
<SafeBlankLink href="https://influxdbu.com/">
35-
<h4>{InfluxDBUniversityIcon}InfluxDB University</h4>
86+
<SafeBlankLink href="https://github.com/InfluxCommunity/sample-flask/blob/main/app.py">
87+
<h4>{CodeTerminalIcon}Sample App</h4>
3688
</SafeBlankLink>
3789
<p>
38-
Our free hands-on courses teach you the technical skills and best
39-
practices to get the most out of your real-time data with InfluxDB."
90+
Play around with our template code of sample app to streamline your
91+
own data into InfluxData.
4092
</p>
4193
</ResourceCard>
4294
<ResourceCard className="homepage-wizard-next-steps">
43-
<SafeBlankLink href="https://docs.influxdata.com/influxdb/cloud/tools/flux-vscode">
44-
<h4>{VSCodePluginIcon}Install VSCode Plugin</h4>
95+
<SafeBlankLink href="https://docs.influxdata.com">
96+
<h4>{BookIcon}Key Concepts</h4>
4597
</SafeBlankLink>
46-
<p>Streamline your workflow even further with our VSCode plugin!</p>
98+
<p>Learn about important concepts for writing time-series data.</p>
4799
</ResourceCard>
48100
<ResourceCard className="homepage-wizard-next-steps">
49-
<div
50-
style={{
51-
display: 'flex',
52-
justifyContent: 'center',
53-
height: '100%',
54-
textTransform: 'uppercase',
55-
}}
56-
>
57-
<h5>
58-
More Options{' '}
59-
<Icon
60-
glyph={IconFont.ArrowRight_New}
61-
style={{marginLeft: '9px'}}
62-
/>
63-
</h5>
64-
</div>
101+
<SafeBlankLink href="https://influxdbu.com/">
102+
<h4>{CodeTerminalIcon}InfluxDB University</h4>
103+
</SafeBlankLink>
104+
<p>
105+
Our free hands-on courses teach you the technical skills and best
106+
practices to get the most out of your real-time data with InfluxDB.
107+
</p>
65108
</ResourceCard>
66109
</FlexBox>
67-
68-
<p style={{marginTop: '150px'}}>
69-
What did you think about the set up process? Give us feedback to improve
70-
</p>
71110
</>
72111
)
73112
}

src/homepageExperience/containers/GoWizard.tsx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,24 @@ import {event} from 'src/cloud/utils/reporting'
2828
interface State {
2929
currentStep: number
3030
selectedBucket: string
31+
finishStepCompleted: boolean
3132
}
3233

3334
export class GoWizard extends PureComponent<null, State> {
3435
state = {
3536
currentStep: 1,
3637
selectedBucket: 'my-bucket',
38+
finishStepCompleted: false,
3739
}
3840

3941
private handleSelectBucket = (bucketName: string) => {
4042
this.setState({selectedBucket: bucketName})
4143
}
4244

45+
private handleMarkStepAsCompleted = () => {
46+
this.setState({finishStepCompleted: true})
47+
}
48+
4349
handleNextClick = () => {
4450
this.setState(
4551
{
@@ -91,7 +97,13 @@ export class GoWizard extends PureComponent<null, State> {
9197
return <ExecuteAggregateQuery bucket={this.state.selectedBucket} />
9298
}
9399
case 8: {
94-
return <Finish wizardEventName="goWizard" />
100+
return (
101+
<Finish
102+
wizardEventName="goWizard"
103+
markStepAsCompleted={this.handleMarkStepAsCompleted}
104+
finishStepCompleted={this.state.finishStepCompleted}
105+
/>
106+
)
95107
}
96108
default: {
97109
return <Overview />
@@ -117,7 +129,9 @@ export class GoWizard extends PureComponent<null, State> {
117129
<div className="homepage-wizard-container--main">
118130
<div
119131
className={classnames('homepage-wizard-container--main-wrapper', {
120-
overviewSection: this.state.currentStep === 1,
132+
verticallyCentered:
133+
this.state.currentStep === 1 ||
134+
this.state.currentStep === HOMEPAGE_NAVIGATION_STEPS.length,
121135
})}
122136
>
123137
{this.renderStep()}

0 commit comments

Comments
 (0)