components: generic linking for all centers and pages#818
Open
stevekuznetsov wants to merge 2 commits intoNWACus:mainfrom
Open
components: generic linking for all centers and pages#818stevekuznetsov wants to merge 2 commits intoNWACus:mainfrom
stevekuznetsov wants to merge 2 commits intoNWACus:mainfrom
Conversation
yuliadub
reviewed
Oct 31, 2024
| 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); |
Collaborator
There was a problem hiding this comment.
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
Collaborator
Author
There was a problem hiding this comment.
Oh yeah I am hoping we don't go that route ... 🤞
yuliadub
reviewed
Oct 31, 2024
| }; | ||
|
|
||
| // 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 => { |
Collaborator
There was a problem hiding this comment.
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
Collaborator
Author
|
Fixes #812 |
stevekuznetsov
commented
Dec 16, 2024
| import {TabNavigatorParamList} from 'routes'; | ||
| import {AvalancheCenterID, AvalancheCenterWebsites, reverseLookup} from 'types/nationalAvalancheCenter'; | ||
|
|
||
| export const getStateFromUrl = (logger: Logger, rawUrl: string): undefined | PartialState<NavigationState<TabNavigatorParamList>> => { |
Collaborator
Author
There was a problem hiding this comment.
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
Collaborator
Author
There was a problem hiding this comment.
and/or use the filter config for linking
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.