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

Implement a basic dynamic help mechanism #283

Merged
merged 7 commits into from
Nov 11, 2015

Conversation

chrismayer
Copy link
Contributor

This adds a dynamic help system to highlight 'help-augmented' elements
by a badge and show the corresponding help text by clicking the badge. The highlighting can be activated / deactivated by a button in the toolbar.

To show the mechanism the ZoomToMaxExtentButton is extended by such a "help-badge"

Fixes #155

@simboss simboss added the ready label Nov 5, 2015
@mbarto
Copy link
Contributor

mbarto commented Nov 6, 2015

Looks good. I was wondering if we can extend existing tools with help badge functionality using an Higher Order Component that wraps existing ones, instead of adding help functionality to every component one by one.
Something like:

<Help text="..."><ZoomToMaxExtent/></Help>

@chrismayer
Copy link
Contributor Author

Thanks for you review @mbarto. I agree that a high-level wrapper would be good. I also discovered that it is not that good to extend every component and already tried some things to solve that, but no good approach so far. I will have a deeper look on that.

@chrismayer
Copy link
Contributor Author

I did some more investigation and added an approach for a high level component, which can be wrapped around an existing element in order to show a help badge.
The positioning is a bit tricky because the HelpBadge is no more a direct child of the component itself. I solved it with a dynamic ID and appropriate CSS.
Any thoughts welcome.

return (
<div style={{position: "absolute"}}>
<HelpBadge
id={"helpbadge-" + this.props.children.key}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add some check that one single child exist and has a key,

@mbarto
Copy link
Contributor

mbarto commented Nov 6, 2015

Looks good to me, please proceed with other components.

@offtherailz
Copy link
Member

Hi, It would be nice if the help text appears on mouse hover (on the ?) .
The interaction should be: the Help div appears on first hover event. The text changes on the next hover events, the help div disappear when the user disable the help.
If would be cool if the help div was draggable, maybe this can be a future enhancement, what do you think @mbarto ?

@chrismayer
Copy link
Contributor Author

I added some more help badges to the app's components. To add them to the MapToolbar's buttons seems to be a bit more complicated since they are created dynamically and the <HelpWrapper>-tag doesn't seem to be the right component, which is expected for in the MapToolbar class. Any hints welcome how to solve this in an elegant way.

The hovering behaviour described by @offtherailz shouldn't be that hard to implement once a decision has been made.

@offtherailz
Copy link
Member

I think we can do it passing some property helpMessage to each children and the other properties to the map toolbar directly. When the toolbar creates the buttons, it can wrap the component ( if the helpMessage property is present). This should solve the problem.

@mbarto
Copy link
Contributor

mbarto commented Nov 9, 2015

Yes, I think it's a good idea. I also think hover is the way to go.

@chrismayer
Copy link
Contributor Author

I implemented the hover mechanism (f72225c) as described by @offtherailz:

The interaction should be: the Help div appears on first hover event. The text changes on the next hover events, the help div disappear when the user disable the help.

This adds a dynamic help system to highlight 'help-augmented' elements
by a badge and show the corresponding help text by clicking the badge.
Hereby the basic mechanism is introduced:

  - Badge class as symbol for 'help-augmented' elements
  - Panel to display help texts
  - State object for help (incl. actions and reducers for manipulation)
  - Toggle-button to activate/deactivate the help mechanism
  - Exemplary help implementation for ZoomToMaxExtentButton
  - Adapt existing unit tests for ZoomToMaxExtentButton
This introduces a high-level wrapper to add a HelpBadge element to a
component without modifying the component itself.
This adds HelpBadge the following components:
  - SearchBar
  - ScaleBox
This ensures that the window with the helptexts appears on the
first mouseover-event on a 'HelpBadge' (not on help modus activation).
To hide the helptext window the help modus has to be disabled.
@mbarto
Copy link
Contributor

mbarto commented Nov 11, 2015

Hi Christian. Do you think you have still time to add the help badge also to the MapToolbar tools?
Can you also rebase your work on master, so that we don't have conflicts?
Thanks

@chrismayer
Copy link
Contributor Author

Hi Mauro,
I already started, will provide it asap (no later than end of the day).

To add help badges to the MapToolbar its button creation is adapted.
By passing a property 'helpText' to a child component of the MapToolbar,
it is wrapped and extended by a HelpBadge component.
@chrismayer
Copy link
Contributor Author

Do you think you have still time to add the help badge also to the MapToolbar tools?
Can you also rebase your work on master, so that we don't have conflicts?

Done...

mbarto added a commit that referenced this pull request Nov 11, 2015
Implement a basic dynamic help mechanism
@mbarto mbarto merged commit 7528833 into geosolutions-it:master Nov 11, 2015
@mbarto mbarto removed the ready label Nov 11, 2015
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

Successfully merging this pull request may close these issues.

4 participants