Skip to content
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

Idea: alternative way to define steps #264

Open
knownasilya opened this issue Oct 17, 2018 · 2 comments
Open

Idea: alternative way to define steps #264

knownasilya opened this issue Oct 17, 2018 · 2 comments

Comments

@knownasilya
Copy link

knownasilya commented Oct 17, 2018

Currently steps are very brittle, because they are dependent on the template but defined outside of it and with duplicated logic. This shows it's ugly head when you start filtering steps based by state in your app and the filtered steps don't necessarily match the UI because you missed something that might have filtered out the step in the UI. The UI should be the source of the steps, since they are describing the UI.

I'd love to see a template based solution for defining steps, something like:

{{#if this.sessionService.isAuthenticated}}
  <TourStep
	@id='user-menu'
	@text='Menu for setting user settings or logging out'
	@next='somethingelse'
  >
    <UserAvatarMenu />
  </TourStep>
{{else}}
  <TourStep
	@id='login'
	@text='Click here to log into the .... application'
	@next='somethotherthing'
  >
    {{#link-to 'login'}}Login{{/link-to}}
  </TourStep>
{{/if}}

<TourStep @id='somethingelse' @text='..'>
  Something here..
</TourStep>

The issue is what order to present the steps and where to start. The order can be defined by using @next='nextid'. The start step could be a special component or a flag on the TourStep component, like @initialStep={{true}}.

@RobbieTheWagner
Copy link
Owner

@knownasilya couldn't you use the same things you use for your if on the JS side to determine the steps? I'm not opposed to also supporting some sort of template based setup for steps, but I think it's much easier in JS because you can do complex logic to really customize everything.

@knownasilya
Copy link
Author

You can, but the issue arises when the location you setup your tour, most likely in the application route, doesn't have access to all of the local data necessary to determine the state. So you start pulling out data into services just for the tour and it's messy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants