1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import * as React from 'react';
6 import { values, memoize, pipe, pick } from 'lodash/fp';
7 import { HomeTreePicker } from '~/views-components/projects-tree-picker/home-tree-picker';
8 import { SharedTreePicker } from '~/views-components/projects-tree-picker/shared-tree-picker';
9 import { FavoritesTreePicker } from '~/views-components/projects-tree-picker/favorites-tree-picker';
10 import { getProjectsTreePickerIds, SHARED_PROJECT_ID, FAVORITES_PROJECT_ID } from '~/store/tree-picker/tree-picker-actions';
11 import { TreeItem } from '~/components/tree/tree';
12 import { ProjectsTreePickerItem } from './generic-projects-tree-picker';
14 export interface ProjectsTreePickerProps {
16 includeCollections?: boolean;
17 includeFiles?: boolean;
18 showSelection?: boolean;
19 toggleItemActive?: (event: React.MouseEvent<HTMLElement>, item: TreeItem<ProjectsTreePickerItem>, pickerId: string) => void;
20 toggleItemSelection?: (event: React.MouseEvent<HTMLElement>, item: TreeItem<ProjectsTreePickerItem>, pickerId: string) => void;
23 export const ProjectsTreePicker = ({ pickerId, ...props }: ProjectsTreePickerProps) => {
24 const { home, shared, favorites } = getProjectsTreePickerIds(pickerId);
25 const relatedTreePickers = getRelatedTreePickers(pickerId);
32 <HomeTreePicker pickerId={home} {...p} />
33 <SharedTreePicker pickerId={shared} {...p} />
34 <FavoritesTreePicker pickerId={favorites} {...p} />
38 const getRelatedTreePickers = memoize(pipe(getProjectsTreePickerIds, values));
39 const disableActivation = [SHARED_PROJECT_ID, FAVORITES_PROJECT_ID];