1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import { Dispatch } from 'redux';
6 import { isSidePanelTreeCategory, SidePanelTreeCategory } from '~/store/side-panel-tree/side-panel-tree-actions';
7 import { navigateToFavorites, navigateTo } from '../navigation/navigation-action';
8 import { snackbarActions } from '~/store/snackbar/snackbar-actions';
10 export const navigateFromSidePanel = (id: string) =>
11 (dispatch: Dispatch) => {
12 if (isSidePanelTreeCategory(id)) {
13 dispatch<any>(getSidePanelTreeCategoryAction(id));
15 dispatch<any>(navigateTo(id));
19 const getSidePanelTreeCategoryAction = (id: string) => {
21 case SidePanelTreeCategory.FAVORITES:
22 return navigateToFavorites;
24 return sidePanelTreeCategoryNotAvailable(id);
28 const sidePanelTreeCategoryNotAvailable = (id: string) =>
29 snackbarActions.OPEN_SNACKBAR({
30 message: `${id} not available`,