Ability to toggle categories on / off on timeline

This commit is contained in:
efarooqui
2020-10-12 16:33:19 -07:00
parent cde94262be
commit b8b7c712de
2 changed files with 6 additions and 7 deletions

View File

@@ -342,7 +342,7 @@ class Timeline extends React.Component {
onDragStart={() => { this.onDragStart() }}
onDrag={() => { this.onDrag() }}
onDragEnd={() => { this.onDragEnd() }}
categories={this.props.domain.categories}
categories={this.props.app.activeCategories}
features={this.props.features}
/>
<Handles

View File

@@ -26,11 +26,10 @@ class TimelineCategories extends React.Component {
renderCategory (cat, idx) {
const { features, dims } = this.props
const { id } = cat
const strokeWidth = 1 // dims.trackHeight / (this.props.categories.length + 1)
if (features.GRAPH_NONLOCATED &&
features.GRAPH_NONLOCATED.categories &&
features.GRAPH_NONLOCATED.categories.includes(id)) {
features.GRAPH_NONLOCATED.categories.includes(cat)) {
return null
}
@@ -40,12 +39,12 @@ class TimelineCategories extends React.Component {
class='tick'
style={{ strokeWidth }}
opacity='0.5'
transform={`translate(0,${this.props.getCategoryY(id)})`}
transform={`translate(0,${this.props.getCategoryY(cat)})`}
>
<line x1={dims.marginLeft} x2={dims.width - dims.width_controls} />
</g>
<g class='tick' opacity='1' transform={`translate(0,${this.props.getCategoryY(id)})`}>
<text x={dims.marginLeft - 5} dy='0.32em'>{id}</text>
<g class='tick' opacity='1' transform={`translate(0,${this.props.getCategoryY(cat)})`}>
<text x={dims.marginLeft - 5} dy='0.32em'>{cat}</text>
</g>
</React.Fragment>
)
@@ -53,7 +52,7 @@ class TimelineCategories extends React.Component {
render () {
const { dims, categories } = this.props
const categoriesExist = categories && categories.length > 0
const categoriesExist = categories && categories.length > 0
const renderedCategories = categoriesExist
? this.props.categories.map((cat, idx) => this.renderCategory(cat, idx))
: this.renderCategory('Events', 0)