mirror of
https://github.com/bellingcat/ukraine-timemap.git
synced 2026-06-11 21:08:36 +03:00
Ability to toggle categories on / off on timeline
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user