Skip to content

Commit

Permalink
#44 fix use single source of constants
Browse files Browse the repository at this point in the history
  • Loading branch information
emekauja committed Nov 15, 2022
1 parent 083277f commit c01c197
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
17 changes: 9 additions & 8 deletions src/components/common/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import vars from '../../assets/styles/variables';
import { CustomBreadcrumbsWithMenu } from './Breadcrumbs';
import Dialog from '@mui/material/Dialog';
import UndoIcon from '@mui/icons-material/Undo';
import { COMPOSITION } from '../views/sidebar/TreeView/InstanceTreeView';
import { PNLClasses } from '../../constants';


const {
textWhite,
Expand Down Expand Up @@ -106,20 +107,20 @@ const breadcrumbs = [
];

const listItems = [
{ label: 'Build', soon: false },
{ label: 'Test', soon: true },
{ label: 'Composition', soon: false },
{ label: 'Build', value: 'build', soon: false },
{ label: 'Test', value: 'test', soon: true },
{ label: 'Composition', value: 'composition', soon: false },
];

const Header = () => {
const classes = useStyles();
const [anchorEl, setAnchorEl] = React.useState(null);
const [selected, setSelected] = React.useState('Build');
const [selected, setSelected] = React.useState('build');
const open = Boolean(anchorEl);

const handleClick = (event, value) => {
if (event) {
if (value.toLowerCase() === COMPOSITION) {
if (value === PNLClasses.COMPOSITION) {
setAnchorEl(event.currentTarget);
}
}
Expand Down Expand Up @@ -168,10 +169,10 @@ const Header = () => {
{listItems.map((item) => {
return (
<ListItemButton
selected={item.label === selected}
selected={item.value === selected}
disableRipple
disabled={item.soon}
onClick={(e) => handleClick(e, item.label)}
onClick={(e) => handleClick(e, item.value)}
>
<Typography>{item.label}</Typography>
{item.soon && <Chip label="SOON" />}
Expand Down
7 changes: 2 additions & 5 deletions src/components/views/sidebar/TreeView/InstanceTreeView.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,11 @@ import vars from '../../../../assets/styles/variables';
import { makeStyles } from '@mui/styles';
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
import { COMPOSITION_DTO } from '../Sidebar';
import { PNLClasses } from '../../../../constants';

export const GRAPH_SOURCE = 'GRAPH';
export const TREE_SOURCE = 'TREE';
export const COMPOSITION = 'composition';
export const MECHANISM = 'mechanism';
export const PROJECTION = 'projection';


const { COMPOSITION, MECHANISM, PROJECTION } = PNLClasses;
const {
popperBG,
listSelectedTextColor,
Expand Down

0 comments on commit c01c197

Please sign in to comment.