17426: Add plugin ability to override app bar.
[arvados-workbench2.git] / src / common / plugintypes.ts
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import * as React from 'react';
6 import { Dispatch } from 'redux';
7 import { RootStore, RootState } from '~/store/store';
8
9 export type RouteListReducer = (startingList: React.ReactElement[]) => React.ReactElement[];
10 export type CategoriesListReducer = (startingList: string[]) => string[];
11 export type NavigateMatcher = (dispatch: Dispatch, getState: () => RootState, uuid: string) => boolean;
12 export type LocationChangeMatcher = (store: RootStore, pathname: string) => boolean;
13
14 export interface PluginConfig {
15     // Customize the list of possible center panels by adding or removing Route components.
16     centerPanelList: RouteListReducer[];
17
18     // Customize the list of side panel categories
19     sidePanelCategories: CategoriesListReducer[];
20
21     // Add to the list of possible dialogs by adding dialog components.
22     dialogs: React.ReactElement[];
23
24     // Add navigation actions for identifiers
25     navigateToHandlers: NavigateMatcher[];
26
27     // Add handlers for navigation actions
28     locationChangeHandlers: LocationChangeMatcher[];
29
30     appBarLeft?: React.ReactElement;
31
32     appBarMiddle?: React.ReactElement;
33
34     appBarRight?: React.ReactElement;
35 }