-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Axon 72 new onboarding auth UI (#116)
* Checkpoint * UX works, but Auth not set up yet * callbacks for signin * call back working correctly * Cloud auth * server auth * AXON-72: updated auth flow styles * AXON-72: fix linting errors * AXON-72: add logo and use vscode native components * AXON-72: logo files * AXON-72: fixed stepping bug and handle back bug * AXON-72: added error logging when invalid sign in flow * AXON-72: remove console logs * AXON-72: clean up for readability + use constant values --------- Co-authored-by: Bryan Wieger <[email protected]>
- Loading branch information
1 parent
e592f09
commit 8b7878e
Showing
20 changed files
with
788 additions
and
102 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
import React, { useCallback } from 'react'; | ||
import { Container, Typography, Box, Card, CardActionArea, CardContent } from '@material-ui/core'; | ||
import { Product } from './types'; | ||
import { VSCodeRadio, VSCodeButton } from '@vscode/webview-ui-toolkit/react'; | ||
import { BitbucketOnboardingLogo } from '../icons/BitbucketOnboardingLogo'; | ||
import { JiraOnboardingLogo } from '../icons/JiraOnboardingLogo'; | ||
|
||
type Props = { | ||
product: Product; | ||
handleOptionChange: (value: string) => void; | ||
executeSetup: () => void; | ||
handleBack?: () => void; | ||
signInText: string; | ||
valueSet: { | ||
cloud: string; | ||
server: string; | ||
none: string; | ||
}; | ||
}; | ||
const OnboardingRadio = ({ | ||
checked, | ||
handleValueChange, | ||
value, | ||
title, | ||
description, | ||
}: { | ||
checked: string; | ||
handleValueChange: (v: string) => void; | ||
value: string; | ||
title: string; | ||
description?: string; | ||
}) => { | ||
return ( | ||
<Card variant="outlined" style={{ width: '100%' }}> | ||
<CardActionArea | ||
onClick={() => { | ||
handleValueChange(value); | ||
}} | ||
> | ||
<CardContent style={formControlStyles}> | ||
<VSCodeRadio checked={checked === value} /> | ||
<Box flexDirection={'column'}> | ||
<Typography style={{ fontWeight: 'bold' }}>{title}</Typography> | ||
{description && <Typography>{description}</Typography>} | ||
</Box> | ||
</CardContent> | ||
</CardActionArea> | ||
</Card> | ||
); | ||
}; | ||
|
||
export const JiraBitbucketOnboarding: React.FC<Props> = ({ | ||
product, | ||
handleOptionChange, | ||
executeSetup, | ||
handleBack, | ||
signInText, | ||
valueSet, | ||
}) => { | ||
const [checked, setChecked] = React.useState(valueSet.cloud); | ||
|
||
const handleValueChange = useCallback( | ||
(value: string) => { | ||
setChecked(value); | ||
handleOptionChange(value); | ||
}, | ||
[handleOptionChange], | ||
); | ||
|
||
return ( | ||
<Container style={{ justifyContent: 'center' }} maxWidth="xs"> | ||
<Box style={wrapperStyles} flexDirection="column"> | ||
{product === 'Jira' ? <JiraOnboardingLogo /> : <BitbucketOnboardingLogo />} | ||
<Typography variant="h2">What version of {product} do you use?</Typography> | ||
<Box flexDirection="column" style={radioGroupStyles}> | ||
<OnboardingRadio | ||
checked={checked} | ||
handleValueChange={handleValueChange} | ||
value={valueSet.cloud} | ||
title="Cloud" | ||
description="For most of our users. The URL for accessing your site will typically be in the format mysite.atlassian.net" | ||
/> | ||
<OnboardingRadio | ||
checked={checked} | ||
handleValueChange={handleValueChange} | ||
value={valueSet.server} | ||
title="Server" | ||
description="For users with a custom site. The URL is usually a custom domain or IP address set up by your organization" | ||
/> | ||
<OnboardingRadio | ||
checked={checked} | ||
handleValueChange={handleValueChange} | ||
value={valueSet.none} | ||
title={product === 'Jira' ? "I don't have Jira" : "I don't have Bitbucket"} | ||
/> | ||
</Box> | ||
<Box | ||
style={{ | ||
display: 'flex', | ||
justifyContent: 'space-between', | ||
alignItems: 'flex-start', | ||
alignSelf: 'stretch', | ||
}} | ||
> | ||
<VSCodeButton | ||
disabled={!handleBack} | ||
onClick={() => { | ||
handleBack && handleBack(); | ||
}} | ||
appearance="secondary" | ||
> | ||
Back | ||
</VSCodeButton> | ||
<VSCodeButton | ||
onClick={() => { | ||
executeSetup(); | ||
}} | ||
> | ||
{signInText} | ||
</VSCodeButton> | ||
</Box> | ||
</Box> | ||
</Container> | ||
); | ||
}; | ||
|
||
const wrapperStyles = { | ||
display: 'flex', | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
gap: '24px', | ||
}; | ||
|
||
const formControlStyles = { | ||
display: 'flex', | ||
padding: '12px', | ||
alignItems: 'flex-start', | ||
gap: '8px', | ||
alignSelf: 'stretch', | ||
borderRadius: '4px', | ||
}; | ||
|
||
const radioGroupStyles = { | ||
display: 'flex', | ||
gap: '8px', | ||
alignItems: 'flex-start', | ||
alignSelf: 'stretch', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export type Product = 'Jira' | 'Bitbucket'; |
Oops, something went wrong.