fix: fix nav animation for notifications/mentions (#1515)
This commit is contained in:
parent
8648bb0ad2
commit
3490f98208
|
@ -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)) {
|
||||
|
|
Loading…
Reference in New Issue