-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Setup Wizard: add new setup steps UI #47384
Changes from all commits
123852b
120c986
f8b3376
95efd97
3763721
de5c826
703f4f5
88f10fc
dac4e81
e34f766
c0fe380
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,32 +1,62 @@ | ||
| import { FC, useState } from 'react' | ||
| import { FC } from 'react' | ||
|
|
||
| import { H1, H2 } from '@sourcegraph/wildcard' | ||
| import { useTemporarySetting } from '@sourcegraph/shared/src/settings/temporary' | ||
| import { Container, H1, H2 } from '@sourcegraph/wildcard' | ||
|
|
||
| import { BrandLogo } from '../components/branding/BrandLogo' | ||
|
|
||
| import { SetupTabs, SetupList, SetupTab } from './components/SetupTabs' | ||
| import { SetupStepsRoot, CustomNextButton, StepConfiguration } from './components/setup-steps' | ||
|
|
||
| import styles from './Setup.module.scss' | ||
|
|
||
| const SETUP_STEPS: StepConfiguration[] = [ | ||
| { | ||
| id: '001', | ||
| name: 'Add local repositories', | ||
| path: '/setup/local-repositories', | ||
| render: () => <H2>Hello local repositories step</H2>, | ||
| }, | ||
| { | ||
| id: '002', | ||
| name: 'Add remote repositories', | ||
| path: '/setup/remote-repositories', | ||
| render: () => ( | ||
| <Container> | ||
| <H2>Hello remote repositories step</H2> | ||
| <CustomNextButton label="Custom next step label" disabled={true} /> | ||
| </Container> | ||
| ), | ||
| }, | ||
| { | ||
| id: '003', | ||
| name: 'Sync repositories', | ||
| path: '/setup/sync-repositories', | ||
| render: () => <H2>Hello sync repositories step</H2>, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can revise my work easily, just adding that component I was working on here. I can set my branch to merge into yours or wait for yours to merge |
||
| }, | ||
| ] | ||
|
|
||
| export const SetupWizard: FC = props => { | ||
| const [step, setStep] = useState(0) | ||
| const [activeStepId, setStepId, status] = useTemporarySetting('setup.activeStepId') | ||
|
st0nebreaker marked this conversation as resolved.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, I think we should add in logic about the last completed step to be the initial step. Imagine there's 5 steps, user is on step 3, goes back to view step 1, they exit, when they re-visit we should direct them to their latest complete step right? This is also a data point we want to have saved to log for metrics, so could be good to have on hand. What do you think?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ideally yes, agree it would be best UX here, unfortunately I found a few problems with this and how we should work with browser history. At the moment I implemented it in the way where we store the last visited step. It should be enough for the first implementation because steps on consumer level will be in charge of the Next button availability and this is how we prevent users from skipping required steps. In the next PRs when we will have steps implementation I think we should add more logic and implement it as you described
But imagine if user go back to the first step and did something that made this 1 step invalid. In this case we should redirect user to this 1 step next time when they hit root URL route "/setup"
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That makes sense, if a past step is re-visited and error'd we need to account for that. I'm just thinking how we can store furthest step visited, because at Merge we've been talking about logging at what point a user drops off the form if they don't complete for data collection. We can just store this separate from the routing logic too, though |
||
|
|
||
| if (status !== 'loaded') { | ||
| return null | ||
| } | ||
|
|
||
| const handleStepChange = (step: StepConfiguration): void => { | ||
| setStepId(step.id) | ||
| } | ||
|
|
||
| return ( | ||
| <div className={styles.root}> | ||
| <header className={styles.header}> | ||
| <BrandLogo variant="logo" isLightTheme={false} className={styles.logo} /> | ||
|
|
||
| <H2 as={H1} className="font-weight-normal text-white mt-3 mb-4"> | ||
| Welcome to Sourcegraph! Let's get your instance ready. | ||
| Welcome to Sourcegraph! Let's get started. | ||
| </H2> | ||
| </header> | ||
|
|
||
| <SetupTabs activeTabIndex={step} defaultActiveIndex={0} onTabChange={setStep}> | ||
| <SetupList wrapperClassName="border-bottom-0"> | ||
| <SetupTab index={0}>Add code hosts</SetupTab> | ||
| <SetupTab index={1}>Sync repositories</SetupTab> | ||
| </SetupList> | ||
| </SetupTabs> | ||
| <SetupStepsRoot initialStepId={activeStepId} steps={SETUP_STEPS} onStepChange={handleStepChange} /> | ||
| </div> | ||
| ) | ||
| } | ||
This file was deleted.
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.