-
Notifications
You must be signed in to change notification settings - Fork 13
components: generic linking for all centers and pages #818
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
base: main
Are you sure you want to change the base?
components: generic linking for all centers and pages #818
Conversation
| if (initialUrl) { | ||
| // this url contains the whole url, like so: https://nwac.us/observations/#/observations/fb5bb19a-2b89-4c9c-91d2-eb673c5ab877 | ||
| const url = new URL(initialUrl); | ||
| return getStateFromPath(path + '?share=true&share_url=' + url.origin + '/', opts); |
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.
the back button navigation depends on these two params - so if you are going to fully take this out, that logic will need to change or it will be broken
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.
Oh yeah I am hoping we don't go that route ... 🤞
| }; | ||
|
|
||
| // centers use the widgets, and the widgets manage state after some prefix in the URL; not ever center has the same prefix for every widget | ||
| const prefixesForCenter = (avalancheCenter: AvalancheCenterID): prefixes => { |
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 think it would make sense for this to live in a separate file vs with all this linking
This commit adds a function to map between any avalanche center's URL and the correct set of (nested) screens on the app. Lots of testing to do. Signed-off-by: Steve Kuznetsov <stekuznetsov@microsoft.com>
99429a4 to
3ac4dac
Compare
|
Fixes #812 |
| import {TabNavigatorParamList} from 'routes'; | ||
| import {AvalancheCenterID, AvalancheCenterWebsites, reverseLookup} from 'types/nationalAvalancheCenter'; | ||
|
|
||
| export const getStateFromUrl = (logger: Logger, rawUrl: string): undefined | PartialState<NavigationState<TabNavigatorParamList>> => { |
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.
TODO: on unknown, fall back to a new webview in the root stack that just shows the website, since there's no way to programatically reject some parts of the domain if we're registered for the whole thing
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.
and/or use the filter config for linking
This commit adds a function to map between any avalanche center's URL and the correct set of (nested) screens on the app. Lots of testing to do.