File tree Expand file tree Collapse file tree 6 files changed +54
-8
lines changed Expand file tree Collapse file tree 6 files changed +54
-8
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,10 @@ import WriteDataDetailsContextProvider from 'src/writeData/components/WriteDataD
2626
2727// Utils
2828import { event } from 'src/cloud/utils/reporting'
29- import { HOMEPAGE_NAVIGATION_STEPS_ARDUINO } from 'src/homepageExperience/utils'
29+ import {
30+ scrollNextPageIntoView ,
31+ HOMEPAGE_NAVIGATION_STEPS_ARDUINO ,
32+ } from 'src/homepageExperience/utils'
3033import { normalizeEventName } from 'src/cloud/utils/reporting'
3134import RateLimitAlert from 'src/cloud/components/RateLimitAlert'
3235import { isFlagEnabled } from 'src/shared/utils/featureFlag'
@@ -85,6 +88,7 @@ export class ArduinoWizard extends PureComponent<{}, State> {
8588 ) ,
8689 }
8790 )
91+ scrollNextPageIntoView ( )
8892 }
8993 )
9094 }
@@ -105,6 +109,7 @@ export class ArduinoWizard extends PureComponent<{}, State> {
105109 ) ,
106110 }
107111 )
112+ scrollNextPageIntoView ( )
108113 }
109114 )
110115 }
@@ -120,6 +125,7 @@ export class ArduinoWizard extends PureComponent<{}, State> {
120125 ) ,
121126 }
122127 )
128+ scrollNextPageIntoView ( )
123129 }
124130
125131 renderStep = ( ) => {
Original file line number Diff line number Diff line change @@ -25,7 +25,10 @@ import WriteDataDetailsContextProvider from 'src/writeData/components/WriteDataD
2525
2626// Utils
2727import { event } from 'src/cloud/utils/reporting'
28- import { HOMEPAGE_NAVIGATION_STEPS_SHORT } from 'src/homepageExperience/utils'
28+ import {
29+ scrollNextPageIntoView ,
30+ HOMEPAGE_NAVIGATION_STEPS_SHORT ,
31+ } from 'src/homepageExperience/utils'
2932import { normalizeEventName } from 'src/cloud/utils/reporting'
3033import RateLimitAlert from 'src/cloud/components/RateLimitAlert'
3134import { isFlagEnabled } from 'src/shared/utils/featureFlag'
@@ -84,6 +87,8 @@ export class CliWizard extends PureComponent<{}, State> {
8487 ) ,
8588 }
8689 )
90+
91+ scrollNextPageIntoView ( )
8792 }
8893 )
8994 }
@@ -104,6 +109,8 @@ export class CliWizard extends PureComponent<{}, State> {
104109 ) ,
105110 }
106111 )
112+
113+ scrollNextPageIntoView ( )
107114 }
108115 )
109116 }
@@ -119,6 +126,7 @@ export class CliWizard extends PureComponent<{}, State> {
119126 ) ,
120127 }
121128 )
129+ scrollNextPageIntoView ( )
122130 }
123131
124132 renderStep = ( ) => {
Original file line number Diff line number Diff line change @@ -23,12 +23,14 @@ import {normalizeEventName} from 'src/cloud/utils/reporting'
2323
2424import { GoIcon } from 'src/homepageExperience/components/HomepageIcons'
2525
26- import { HOMEPAGE_NAVIGATION_STEPS } from 'src/homepageExperience/utils'
27-
2826// Utils
2927import { event } from 'src/cloud/utils/reporting'
3028import RateLimitAlert from 'src/cloud/components/RateLimitAlert'
3129import { isFlagEnabled } from 'src/shared/utils/featureFlag'
30+ import {
31+ scrollNextPageIntoView ,
32+ HOMEPAGE_NAVIGATION_STEPS ,
33+ } from 'src/homepageExperience/utils'
3234
3335interface State {
3436 currentStep : number
@@ -84,6 +86,7 @@ export class GoWizard extends PureComponent<null, State> {
8486 ) ,
8587 }
8688 )
89+ scrollNextPageIntoView ( )
8790 }
8891 )
8992 }
@@ -104,6 +107,7 @@ export class GoWizard extends PureComponent<null, State> {
104107 ) ,
105108 }
106109 )
110+ scrollNextPageIntoView ( )
107111 }
108112 )
109113 }
@@ -119,6 +123,7 @@ export class GoWizard extends PureComponent<null, State> {
119123 ) ,
120124 }
121125 )
126+ scrollNextPageIntoView ( )
122127 }
123128
124129 renderStep = ( ) => {
Original file line number Diff line number Diff line change @@ -23,12 +23,14 @@ import {normalizeEventName} from 'src/cloud/utils/reporting'
2323
2424import { NodejsIcon } from 'src/homepageExperience/components/HomepageIcons'
2525
26- import { HOMEPAGE_NAVIGATION_STEPS } from 'src/homepageExperience/utils'
27-
2826// Utils
2927import { event } from 'src/cloud/utils/reporting'
3028import RateLimitAlert from 'src/cloud/components/RateLimitAlert'
3129import { isFlagEnabled } from 'src/shared/utils/featureFlag'
30+ import {
31+ scrollNextPageIntoView ,
32+ HOMEPAGE_NAVIGATION_STEPS ,
33+ } from 'src/homepageExperience/utils'
3234
3335interface State {
3436 currentStep : number
@@ -84,6 +86,7 @@ export class NodejsWizard extends PureComponent<null, State> {
8486 ) ,
8587 }
8688 )
89+ scrollNextPageIntoView ( )
8790 }
8891 )
8992 }
@@ -104,6 +107,7 @@ export class NodejsWizard extends PureComponent<null, State> {
104107 ) ,
105108 }
106109 )
110+ scrollNextPageIntoView ( )
107111 }
108112 )
109113 }
@@ -119,6 +123,7 @@ export class NodejsWizard extends PureComponent<null, State> {
119123 ) ,
120124 }
121125 )
126+ scrollNextPageIntoView ( )
122127 }
123128
124129 renderStep = ( ) => {
Original file line number Diff line number Diff line change @@ -24,12 +24,14 @@ import {normalizeEventName} from 'src/cloud/utils/reporting'
2424
2525import { PythonIcon } from 'src/homepageExperience/components/HomepageIcons'
2626
27- import { HOMEPAGE_NAVIGATION_STEPS } from 'src/homepageExperience/utils'
28-
2927// Utils
3028import { event } from 'src/cloud/utils/reporting'
3129import RateLimitAlert from 'src/cloud/components/RateLimitAlert'
3230import { isFlagEnabled } from 'src/shared/utils/featureFlag'
31+ import {
32+ scrollNextPageIntoView ,
33+ HOMEPAGE_NAVIGATION_STEPS ,
34+ } from 'src/homepageExperience/utils'
3335
3436interface State {
3537 currentStep : number
@@ -85,6 +87,7 @@ export class PythonWizard extends PureComponent<null, State> {
8587 ) ,
8688 }
8789 )
90+ scrollNextPageIntoView ( )
8891 }
8992 )
9093 }
@@ -105,6 +108,7 @@ export class PythonWizard extends PureComponent<null, State> {
105108 ) ,
106109 }
107110 )
111+ scrollNextPageIntoView ( )
108112 }
109113 )
110114 }
@@ -120,6 +124,7 @@ export class PythonWizard extends PureComponent<null, State> {
120124 ) ,
121125 }
122126 )
127+ scrollNextPageIntoView ( )
123128 }
124129
125130 renderStep = ( ) => {
Original file line number Diff line number Diff line change 11import { IconFont } from '@influxdata/clockface'
22
3+ import { isFlagEnabled } from 'src/shared/utils/featureFlag'
4+
35export const HOMEPAGE_NAVIGATION_STEPS = [
46 {
57 name : 'Overview' ,
@@ -100,3 +102,18 @@ export const HOMEPAGE_NAVIGATION_STEPS_ARDUINO = [
100102 glyph : IconFont . StarSmile ,
101103 } ,
102104]
105+
106+ // Each onboarding page in the wizard has a single h1 at the top of it. Attempt to scroll it into view smoothly
107+ // Set a timeout of 0 so that this function call gets run after react has a had a chance to update state and
108+ // re-render on the main thread.
109+ export const scrollNextPageIntoView = ( ) => {
110+ if ( isFlagEnabled ( 'firstMileScrollTop' ) ) {
111+ setTimeout ( ( ) => {
112+ document . querySelector ( 'h1' ) . scrollIntoView ( {
113+ behavior : 'smooth' ,
114+ block : 'nearest' ,
115+ inline : 'nearest' ,
116+ } )
117+ } , 0 )
118+ }
119+ }
You can’t perform that action at this time.
0 commit comments