special URLs for all top-level navigation routes #78
1 changed files with 21 additions and 16 deletions
|
@ -6,26 +6,31 @@ import Constants, { DrawerRoutes, InnerDrawerRoutes } from 'constants'; // eslin
|
||||||
|
|
||||||
const tagNameLength = 10;
|
const tagNameLength = 10;
|
||||||
|
|
||||||
|
const specialRouteMap = {
|
||||||
|
about: Constants.DRAWER_ROUTE_ABOUT,
|
||||||
|
allContent: Constants.DRAWER_ROUTE_TRENDING,
|
||||||
|
channels: Constants.DRAWER_ROUTE_CHANNEL_CREATOR,
|
||||||
|
library: Constants.DRAWER_ROUTE_MY_LBRY,
|
||||||
|
publish: Constants.DRAWER_ROUTE_PUBLISH,
|
||||||
|
publishes: Constants.DRAWER_ROUTE_PUBLISHES,
|
||||||
|
rewards: Constants.DRAWER_ROUTE_REWARDS,
|
||||||
|
settings: Constants.DRAWER_ROUTE_SETTINGS,
|
||||||
|
subscriptions: Constants.DRAWER_ROUTE_SUBSCRIPTIONS,
|
||||||
|
wallet: Constants.FULL_ROUTE_NAME_WALLET,
|
||||||
|
discover: Constants.FULL_ROUTE_NAME_DISCOVER,
|
||||||
|
};
|
||||||
|
|
||||||
function getRouteForSpecialUri(uri) {
|
function getRouteForSpecialUri(uri) {
|
||||||
let targetRoute;
|
let targetRoute;
|
||||||
const page = uri.substring(8).trim(); // 'lbry://?'.length == 8
|
const page = uri.substring(8).trim(); // 'lbry://?'.length == 8
|
||||||
|
|
||||||
switch (page) {
|
if (specialRouteMap[page]) {
|
||||||
case Constants.PAGE_REWARDS:
|
targetRoute = specialRouteMap[page];
|
||||||
targetRoute = Constants.DRAWER_ROUTE_REWARDS;
|
}
|
||||||
break;
|
|
||||||
case Constants.PAGE_SETTINGS:
|
if (!targetRoute) {
|
||||||
targetRoute = Constants.DRAWER_ROUTE_SETTINGS;
|
// default to the home page if there is no match for the page
|
||||||
break;
|
|
||||||
case Constants.PAGE_TRENDING:
|
|
||||||
targetRoute = Constants.DRAWER_ROUTE_TRENDING;
|
|
||||||
break;
|
|
||||||
case Constants.PAGE_WALLET:
|
|
||||||
targetRoute = Constants.FULL_ROUTE_NAME_WALLET;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
targetRoute = Constants.FULL_ROUTE_NAME_DISCOVER;
|
targetRoute = Constants.FULL_ROUTE_NAME_DISCOVER;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return targetRoute;
|
return targetRoute;
|
||||||
|
|
Loading…
Reference in a new issue