// Copyright (C) The Arvados Authors. All rights reserved. // // SPDX-License-Identifier: AGPL-3.0 import * as React from 'react'; import { StyleRulesCallback, WithStyles, withStyles, Card, CardHeader, IconButton, CardContent, Grid, MenuItem, Menu, ListItemIcon, ListItemText, Typography } from '@material-ui/core'; import { connect } from 'react-redux'; import { RouteComponentProps } from 'react-router'; import { ArvadosTheme } from '../../common/custom-theme'; import { RootState } from '../../store/store'; import { MoreOptionsIcon, CollectionIcon, ShareIcon, RenameIcon, AddFavoriteIcon, MoveToIcon, CopyIcon, ProvenanceGraphIcon, DetailsIcon, AdvancedIcon, RemoveIcon } from '../../components/icon/icon'; import { DetailsAttribute } from '../../components/details-attribute/details-attribute'; import { CollectionResource } from '../../models/collection'; type CssRules = 'card' | 'iconHeader'; const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ card: { marginBottom: '20px' }, iconHeader: { fontSize: '1.875rem', color: theme.customs.colors.yellow700 } }); const MENU_OPTIONS = [ { title: 'Edit collection', icon: RenameIcon }, { title: 'Share', icon: ShareIcon }, { title: 'Move to', icon: MoveToIcon }, { title: 'Add to favorites', icon: AddFavoriteIcon }, { title: 'Copy to project', icon: CopyIcon }, { title: 'View details', icon: DetailsIcon }, { title: 'Provenance graph', icon: ProvenanceGraphIcon }, { title: 'Advanced', icon: AdvancedIcon }, { title: 'Remove', icon: RemoveIcon } ]; interface CollectionPanelDataProps { item: CollectionResource; } interface CollectionPanelActionProps { onItemRouteChange: (collectionId: string) => void; } type CollectionPanelProps = CollectionPanelDataProps & CollectionPanelActionProps & WithStyles & RouteComponentProps<{ id: string }>; export const CollectionPanel = withStyles(styles)( connect((state: RootState) => ({ item: state.collectionPanel.item }))( class extends React.Component { state = { anchorEl: undefined, open: false }; showMenu = (event: any) => { this.setState({ anchorEl: event.currentTarget, open: true }); } closeMenu = () => { this.setState({ anchorEl: undefined, open: false }); } displayMenuAction = () => { return ; } render() { const { anchorEl, open } = this.state; const { classes, item } = this.props; return
} action={ } title={item && item.name } /> {MENU_OPTIONS.map((option) => ( {option.title} }/> ))} Tags Tags
; } componentWillReceiveProps({ match, item, onItemRouteChange }: CollectionPanelProps) { if (!item || match.params.id !== item.uuid) { onItemRouteChange(match.params.id); } } } ) );