fix: fix nav animation for notifications/mentions (#1515)

kaios-2
Nolan Lawson 2019-09-22 16:20:26 -07:00 zatwierdzone przez GitHub
rodzic 8648bb0ad2
commit 3490f98208
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 9 dodań i 1 usunięć

Wyświetl plik

@ -3,10 +3,18 @@ import { emit } from '../../_utils/eventBus'
export function navObservers (store) {
function pageIsInNav (store, page) {
const { navPages } = store.get()
return !!navPages.find(_ => _.name === page)
return navPages.find(_ => _.name === page)
}
function normalizePageName (page) {
// notifications/mentions are a special case; they show as selected in the nav
return page === 'notifications/mentions' ? 'notifications' : page
}
store.observe('currentPage', (currentPage, previousPage) => {
currentPage = normalizePageName(currentPage)
previousPage = normalizePageName(previousPage)
if (currentPage && previousPage &&
pageIsInNav(store, currentPage) &&
pageIsInNav(store, previousPage)) {