Repository navigation
[Onboarding] Tutorial entry point #8244
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
635a13e
9d9c78f
97597f4
854ab78
2b0b5fb
4df67ed
053592d
e5c332f
dae189e
09af0af
d59b9c5
c4e1f44
a79528d
5aed05a
e05428f
e9981c1
1b1afb8
7d868c4
0438a86
8c1bd2f
7564bfb
f9a5b62
aaa5846
3c47411
d6b95e3
531511d
9ca6b44
c1fbf69
2e1dea9
acfea1e
909ea74
76948f1
5a706c5
75ddb0a
3573513
6053031
a843bdd
c17933a
64867bd
4128d9c
258bbd6
a899e61
5a61f0e
e58bbdc
c81eda2
5337b2e
9645eae
d6d0c8d
6546349
66e75fc
12f3f07
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 |
|---|---|---|
|
|
@@ -17,7 +17,7 @@ import { updateStore, UpdateStatus } from './lib/update-store' | |
| import { RetryAction } from '../models/retry-actions' | ||
| import { shouldRenderApplicationMenu } from './lib/features' | ||
| import { matchExistingRepository } from '../lib/repository-matching' | ||
| import { getDotComAPIEndpoint } from '../lib/api' | ||
| import { getDotComAPIEndpoint, IAPIRepository } from '../lib/api' | ||
| import { ILaunchStats, SamplesURL } from '../lib/stats' | ||
| import { getVersion, getName } from './lib/app-proxy' | ||
| import { getOS } from '../lib/get-os' | ||
|
|
@@ -103,6 +103,8 @@ import { BannerType } from '../models/banner' | |
| import { StashAndSwitchBranch } from './stash-changes/stash-and-switch-branch-dialog' | ||
| import { OverwriteStash } from './stash-changes/overwrite-stashed-changes-dialog' | ||
| import { ConfirmDiscardStashDialog } from './stashing/confirm-discard-stash' | ||
| import { CreateTutorialRepositoryDialog } from './blank-slate/create-tutorial-repository-dialog' | ||
| import { enableTutorial } from '../lib/feature-flag' | ||
|
|
||
| const MinuteInMilliseconds = 1000 * 60 | ||
| const HourInMilliseconds = MinuteInMilliseconds * 60 | ||
|
|
@@ -679,6 +681,23 @@ export class App extends React.Component<IAppProps, IAppState> { | |
| }) | ||
| } | ||
|
|
||
| private onCreateTutorialRepository = () => { | ||
| if (!enableTutorial()) { | ||
| return | ||
| } | ||
|
|
||
| const account = this.getDotComAccount() || this.getEnterpriseAccount() | ||
|
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. What extra considerations are there for supporting enterprise accounts? #8148 (comment)
Member
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. I attempted to answer this in the referenced issue #8148 (comment) |
||
|
|
||
| if (account === null) { | ||
| return | ||
| } | ||
|
|
||
| this.props.dispatcher.showPopup({ | ||
| type: PopupType.CreateTutorialRepository, | ||
| account, | ||
| }) | ||
|
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 noticed that we don't provide feedback to the users in the cases where we return early from this method. Which could mean we leave the user hanging in an confusing/awkward way. It looks like for now we'll never return early from this (because However, I'm wondering if it's still worth providing some feedback because there's always the chance that the code changes such that we hit these cases (ex: we add a keyboard shortcut). It could be worthwhile to display a message or something (ex: letting them know that they need to set up a dotcom or enterprise account) just for good measure.
Member
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.
Correct
Yeah, this is always a balance that can be argued either way. In this case I'm happy with the risk as-is but if we end up adding a menu item or keyboard shortcut which itself is still enabled when the user isn't signed in I agree that we should add such a message. Staying hypothetical here, if I were do to something to future-proof this it would be leveraging the type system to ensure that we don't call this method unless we do have an account. I'd do this by making a non-nullable |
||
| } | ||
|
|
||
| private showAbout() { | ||
| this.props.dispatcher.showPopup({ type: PopupType.About }) | ||
| } | ||
|
|
@@ -1781,11 +1800,39 @@ export class App extends React.Component<IAppProps, IAppState> { | |
| /> | ||
| ) | ||
| } | ||
| case PopupType.CreateTutorialRepository: { | ||
| return ( | ||
| <CreateTutorialRepositoryDialog | ||
| key="create-tutorial-repository-dialog" | ||
| account={popup.account} | ||
| onDismissed={this.onPopupDismissed} | ||
| onTutorialRepositoryCreated={this.onTutorialRepositoryCreated} | ||
| onError={this.onTutorialRepositoryError} | ||
| /> | ||
| ) | ||
| } | ||
| default: | ||
| return assertNever(popup, `Unknown popup type: ${popup}`) | ||
| } | ||
| } | ||
|
|
||
| private onTutorialRepositoryError = (error: Error) => { | ||
| this.props.dispatcher.closePopup(PopupType.CreateTutorialRepository) | ||
| this.props.dispatcher.postError(error) | ||
| } | ||
|
|
||
| private onTutorialRepositoryCreated = ( | ||
| path: string, | ||
| account: Account, | ||
| apiRepository: IAPIRepository | ||
| ) => { | ||
| this.props.dispatcher.addTutorialRepository( | ||
| path, | ||
| account.endpoint, | ||
| apiRepository | ||
| ) | ||
| } | ||
|
|
||
| private onShowRebaseConflictsBanner = ( | ||
| repository: Repository, | ||
| targetBranch: string | ||
|
|
@@ -2291,6 +2338,7 @@ export class App extends React.Component<IAppProps, IAppState> { | |
| onCreate={this.showCreateRepository} | ||
| onClone={this.showCloneRepo} | ||
| onAdd={this.showAddLocalRepo} | ||
| onCreateTutorialRepository={this.onCreateTutorialRepository} | ||
| apiRepositories={this.state.apiRepositories} | ||
| onRefreshRepositories={this.onRefreshRepositories} | ||
| /> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it true that we could be in a no-repositories blank slate (ex: Desktop just installed) but the user could still have a repo with the tutorial name convention in their home folder...?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sorry, what I meant was that it shouldn't be possible for another repository with the same path to exist in the repositories table given that the no-repositories blank slate is only ever shown when that table is empty. I'll clarify in the documentation.