Skip to content

Commit

Permalink
Merge branch 'popup'
Browse files Browse the repository at this point in the history
  • Loading branch information
LaChope committed Oct 6, 2022
2 parents ada88ce + a5fb8e9 commit 9e0112a
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 41 deletions.
33 changes: 7 additions & 26 deletions src/assets/PlanningTool.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,6 @@
width: calc(100% - 30rem);
}

.task_card {
background: #0000aa;
}

.scheduled_wo {
background: #00aa00;
}

.maintenance_wo {
background: #aa0000;
}

.rct-sidebar {
position: relative;
padding-right: 0.25rem;
Expand Down Expand Up @@ -58,26 +46,19 @@
margin-bottom: 1.25rem;
}

.explanatory-notes .note .color {
display: inline-block;
.explanatory-notes .note {
display: flex;
align-items: center;
padding-top: .5rem;
}

.explanatory-notes .note .legend-color {
background-color: #000;
width: 1.5rem;
height: 0.8rem;
margin-right: 1.3rem;
}

.explanatory-notes .note .color.scheduled-wo {
background-color: #aa0000;
}

.explanatory-notes .note .color.task-card {
background-color: #00aa00;
}

.explanatory-notes .note .color.maintenance-wo {
background-color: #0000aa;
}

.static-item:after {
content: '';
display: block;
Expand Down
38 changes: 38 additions & 0 deletions src/components/Legend.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import React from "react";
import Constants from "../constants/Constants";

const Legend = ({ title, legendItems }) => {
let defaultItems = Constants.DEFAULT_LEGEND_ITEMS;

return (
<div className="explanatory-notes">
<h3>{title}</h3>
<React.Fragment>
{legendItems.map((item, index) => {
return (
<div key={index} className="note">
<div
className="legend-color"
style={{ background: `${item.color}` }}
/>
<div className="legend-item">{item.name}</div>
</div>
);
})}
{defaultItems.map((item, index) => {
return (
<div key={index} className="note">
<div
className="legend-color"
style={{ background: `${item.color}` }}
/>
<div className="legend-item">{item.name}</div>
</div>
);
})}
</React.Fragment>
</div>
);
};

export default Legend;
35 changes: 20 additions & 15 deletions src/components/PlanningTool.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import Popup from './Popup'
import Modal from './Modal'
import EditItemModal from './EditItemModal'
import Constants from '../constants/Constants'
import Legend from "./Legend";

const keys = {
groupIdKey: "id",
Expand Down Expand Up @@ -1627,21 +1628,7 @@ class PlanningTool extends Component {
}
</Timeline>
<div className="explanatory-notes-container">
<div className="explanatory-notes">
<h3>Task types</h3>
<div className="note">
<span className="color scheduled-wo"/>
Scheduled_wo
</div>
<div className="note">
<span className="color task-card"/>
Task_card
</div>
<div className="note">
<span className="color maintenance-wo"/>
Maintenance_wo
</div>
</div>
<Legend legendItems={this.props.legendItems} title="Legend" />
{this.renderPopup(popup)}
{/*undo redo*/}
<div className="action-buttons">
Expand Down Expand Up @@ -1710,6 +1697,10 @@ PlanningTool
date: PropTypes.instanceOf(moment).isRequired,
label: PropTypes.string,
color: PropTypes.string,
})),
legendItems: PropTypes.arrayOf(PropTypes.shape({
name: PropTypes.string,
color: PropTypes.string
}))
}

Expand All @@ -1734,5 +1725,19 @@ PlanningTool
],
groups: [],
popup: Popup,
legendItems: [
{
name: "scheduled_wo",
color: "red"
},
{
name: "maintenance_wo",
color: "green"
},
{
name: "task group",
color: "blue"
}
]
}
export default PlanningTool
11 changes: 11 additions & 0 deletions src/constants/Constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,15 @@ export default class Constants{
static RESOURCE_REORDER = 'resource-reorder'
static MILESTONE_ADD = 'milestone-add'
static MILESTONE_EDIT = 'milestone-edit'
static DEFAULT_LEGEND_ITEMS = [
{
name: "Current selection & parents/children",
color: "#FFC107",
},
{
name: "Non-movable item",
color:
"repeating-linear-gradient( -45deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0) 2px, #465298 2px, #465298 4px )",
},
];
}

0 comments on commit 9e0112a

Please sign in to comment.