1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import * as React from 'react';
6 import { RouteComponentProps } from 'react-router';
7 import { ProjectState } from '../../store/project/project-reducer';
8 import { RootState } from '../../store/store';
9 import { connect, DispatchProp } from 'react-redux';
10 import { CollectionState } from "../../store/collection/collection-reducer";
11 import { ItemMode, setProjectItem } from "../../store/navigation/navigation-action";
12 import ProjectExplorer from "../../views-components/project-explorer/project-explorer";
13 import { projectExplorerItems } from "./project-panel-selectors";
14 import { ProjectExplorerItem } from "../../views-components/project-explorer/project-explorer-item";
15 import { Button, StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core';
17 interface ProjectPanelDataProps {
18 projects: ProjectState;
19 collections: CollectionState;
22 type ProjectPanelProps = ProjectPanelDataProps & RouteComponentProps<{ name: string }> & DispatchProp;
24 class ProjectPanel extends React.Component<ProjectPanelProps & WithStyles<CssRules>> {
26 const items = projectExplorerItems(
27 this.props.projects.items,
28 this.props.projects.currentItemId,
29 this.props.collections
33 <div className={this.props.classes.toolbar}>
34 <Button color="primary" variant="raised" className={this.props.classes.button}>
37 <Button color="primary" variant="raised" className={this.props.classes.button}>
40 <Button color="primary" variant="raised" className={this.props.classes.button}>
46 onRowClick={this.goToItem}
52 goToItem = (item: ProjectExplorerItem) => {
53 this.props.dispatch<any>(setProjectItem(this.props.projects.items, item.uuid, item.kind, ItemMode.BOTH));
57 type CssRules = "toolbar" | "button";
59 const styles: StyleRulesCallback<CssRules> = theme => ({
61 marginBottom: theme.spacing.unit * 3,
63 justifyContent: "flex-end"
66 marginLeft: theme.spacing.unit
70 export default withStyles(styles)(
72 (state: RootState) => ({
73 projects: state.projects,
74 collections: state.collections