diff --git a/web/types/nav-types.js b/web/types/nav-types.js --- a/web/types/nav-types.js +++ b/web/types/nav-types.js @@ -5,9 +5,10 @@ export type NavInfo = { ...$Exact, - +tab: 'calendar' | 'chat', + +tab: 'calendar' | 'chat' | 'settings', +activeChatThreadID: ?string, +pendingThread?: ThreadInfo, + +settingsSection?: 'account', }; export const updateNavInfoActionType = 'UPDATE_NAV_INFO'; diff --git a/web/url-utils.js b/web/url-utils.js --- a/web/url-utils.js +++ b/web/url-utils.js @@ -58,6 +58,10 @@ if (activeChatThreadID) { newURL += `thread/${activeChatThreadID}/`; } + } else if (navInfo.tab === 'settings') { + if (navInfo.settingsSection) { + newURL += `${navInfo.settingsSection}/`; + } } } @@ -97,12 +101,28 @@ activeChatThreadID = navInfo.activeChatThreadID; } - return { - tab: urlInfo.chat ? 'chat' : 'calendar', + let tab = 'chat'; + if (urlInfo.calendar) { + tab = 'calendar'; + } else if (urlInfo.settings) { + tab = 'settings'; + } + + const newNavInfo = { + tab, startDate: startDateForYearAndMonth(year, month), endDate: endDateForYearAndMonth(year, month), activeChatThreadID, }; + + if (!urlInfo.settings) { + return newNavInfo; + } + + return { + ...newNavInfo, + settingsSection: urlInfo.settings, + }; } export { canonicalURLFromReduxState, navInfoFromURL };