import { AddIcon, CollectionIcon, ProcessIcon, ProjectIcon } from '~/components/icon/icon';
import { openProjectCreateDialog } from '~/store/projects/project-create-actions';
import { openCollectionCreateDialog } from '~/store/collections/collection-create-actions';
+import { matchProjectRoute } from '~/routes/routes';
type CssRules = 'button' | 'menuItem' | 'icon';
interface SidePanelDataProps {
currentItemId: string;
+ showButton: boolean;
}
interface SidePanelState {
type SidePanelProps = SidePanelDataProps & DispatchProp & WithStyles<CssRules>;
+const transformOrigin: PopoverOrigin = {
+ vertical: -50,
+ horizontal: 45
+};
+
+const checkButtonVisibility = ({ router }: RootState) => {
+ const pathname = router.location ? router.location.pathname : '';
+ const match = matchProjectRoute(pathname);
+ return match ? true : false;
+};
+
export const SidePanelButton = withStyles(styles)(
connect((state: RootState) => ({
- currentItemId: getProperty(PROJECT_PANEL_CURRENT_UUID)(state.properties)
+ currentItemId: getProperty(PROJECT_PANEL_CURRENT_UUID)(state.properties),
+ showButton: checkButtonVisibility(state)
}))(
class extends React.Component<SidePanelProps> {
anchorEl: undefined
};
- transformOrigin: PopoverOrigin = {
- vertical: -50,
- horizontal: 45
- };
-
render() {
- const { classes } = this.props;
+ const { classes, showButton } = this.props;
const { anchorEl } = this.state;
return <Toolbar>
- <Grid container>
+ {showButton && <Grid container>
<Grid container item xs alignItems="center" justify="center">
<Button variant="contained" color="primary" size="small" className={classes.button}
aria-owns={anchorEl ? 'aside-menu-list' : undefined}
open={Boolean(anchorEl)}
onClose={this.handleClose}
onClick={this.handleClose}
- transformOrigin={this.transformOrigin}>
+ transformOrigin={transformOrigin}>
<MenuItem className={classes.menuItem} onClick={this.handleNewCollectionClick}>
<CollectionIcon className={classes.icon} /> New collection
</MenuItem>
</MenuItem>
</Menu>
</Grid>
- </Grid>
+ </Grid> }
</Toolbar>;
}
import { getProcess } from '~/store/processes/process';
import { Dispatch } from 'redux';
import { openProcessContextMenu } from '~/store/context-menu/context-menu-actions';
-import { matchProcessLogRoute } from '~/routes/routes';
import { ProcessLogPanelRootDataProps, ProcessLogPanelRootActionProps, ProcessLogPanelRoot } from './process-log-panel-root';
import { getProcessPanelLogs } from '~/store/process-logs-panel/process-logs-panel';
import { setProcessLogsPanelFilter } from '~/store/process-logs-panel/process-logs-panel-actions';