NationalBankBelgium / stark

Modern client-side Web application framework based on Angular, Angular Material / Material Design, TypeScript, Redux, RxJS, ...
https://stark.nbb.be
Other
55 stars 23 forks source link

ui: breadcrumb - enable navigation history based breadcrumbs #1320

Open dsebastien opened 5 years ago

dsebastien commented 5 years ago

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[X] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/NationalBankBelgium/stark/blob/master/CONTRIBUTING.md#got-a-question-or-problem

Current behavior

Currently, the breadcrumb component shows a hierarchical view based on the route tree.

Expected behavior

It would be nice for user experience if it supported a history based mode.

In that mode , the breadcrumb would get a new entry each time the user navigates. So it would show links to easily go back to a previous screen where the user was.

I'll post an example to clarify the idea.

Scenario 1:

Of course the length must be limited, but this breadcrumb mode is very useful for scenarios where users go from seach/master to detail, then into other entities/concepts/pages, the moves somewhere else, but wants to keep a trail and be able to go back to where he was before (ideally with the same state, but that's another problem).

Ideally, a service could also be provided to let developers manipulate the contents of the "stack" used by the breadcrumbs.

Environment


Stark version: 10.0.0-beta.8

christophercr commented 5 years ago

Good idea @dsebastien!

In fact I think this should be really easy to implement since we already implemented the navigateToPrevious() method which does basically that and keeping the state of each transition. 😉

We just need to adapt the Breadcrumb component to "enable" such functionality and expose the navigation history of the StarkRoutingService so the Breadcrumb component can use it.

One remark though, I don't think it is necessary to provide a service to let developers manipulate the contents of the stack cause it may be too much overkill. I suggest to provide an output that will emit whenever the Breadcrumb component re-generates the breadcrumbs so the developer can react on it and adapt the breadcrumbs if needed.

@carlo-nomes @SuperITMan What do you think?