mirror of
https://github.com/bellingcat/ukraine-timemap.git
synced 2026-06-13 05:48:36 +03:00
lint it
This commit is contained in:
@@ -9,16 +9,16 @@ function MapEvents ({ getCategoryColor, categories, projectPoint, styleLocation,
|
||||
return [x, y]
|
||||
}
|
||||
|
||||
function renderBorder() {
|
||||
function renderBorder () {
|
||||
return (
|
||||
<React.Fragment>
|
||||
{<circle
|
||||
class='event-hover'
|
||||
cx="0"
|
||||
cy="0"
|
||||
r="10"
|
||||
cx='0'
|
||||
cy='0'
|
||||
r='10'
|
||||
stroke={colors.primaryHighlight}
|
||||
fill-opacity="0.0"
|
||||
fill-opacity='0.0'
|
||||
/>}
|
||||
</React.Fragment>
|
||||
)
|
||||
@@ -110,20 +110,20 @@ function MapEvents ({ getCategoryColor, categories, projectPoint, styleLocation,
|
||||
const customStyles = styleLocation ? styleLocation(location) : null
|
||||
const extraRender = (customStyles) ? customStyles[1] : null
|
||||
|
||||
const isSelected = selected.reduce( (acc, event) => {
|
||||
return acc || (event.latitude == location.latitude && event.longitude == location.longitude)
|
||||
const isSelected = selected.reduce((acc, event) => {
|
||||
return acc || (event.latitude === location.latitude && event.longitude === location.longitude)
|
||||
}, false)
|
||||
|
||||
return (
|
||||
<g
|
||||
className={`location-event ${narrative ? 'no-hover' : ''}`}
|
||||
transform={`translate(${x}, ${y})`}
|
||||
onClick={(!narrative) ? () => onSelect(location.events) : null}
|
||||
>
|
||||
{renderLocationSlicesByCategory(location)}
|
||||
{extraRender ? extraRender() : null}
|
||||
{isSelected ? null : renderBorder()}
|
||||
</g>
|
||||
<g
|
||||
className={`location-event ${narrative ? 'no-hover' : ''}`}
|
||||
transform={`translate(${x}, ${y})`}
|
||||
onClick={(!narrative) ? () => onSelect(location.events) : null}
|
||||
>
|
||||
{renderLocationSlicesByCategory(location)}
|
||||
{extraRender ? extraRender() : null}
|
||||
{isSelected ? null : renderBorder()}
|
||||
</g>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import React from 'react'
|
||||
|
||||
function zoomIsActive(duration, extent) {
|
||||
function zoomIsActive (duration, extent) {
|
||||
if (duration > 1570000 && extent > 1570000) {
|
||||
return true;
|
||||
return true
|
||||
}
|
||||
return duration === extent
|
||||
}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import React from 'react'
|
||||
import { connect } from "react-redux"
|
||||
import { connect } from 'react-redux'
|
||||
import MediaOverlay from '../../Overlay/Media'
|
||||
|
||||
const ReactMarkdown = require('react-markdown')
|
||||
|
||||
const MEDIA_HIDDEN = -2
|
||||
const MEDIA_HOWTO = -1
|
||||
|
||||
class TemplateCover extends React.Component {
|
||||
constructor (props) {
|
||||
@@ -15,10 +14,10 @@ class TemplateCover extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
getVideo(index, headerEndIndex) {
|
||||
if(index < headerEndIndex) {
|
||||
getVideo (index, headerEndIndex) {
|
||||
if (index < headerEndIndex) {
|
||||
return this.props.cover.headerVideos[index]
|
||||
} else if(index >= 0) {
|
||||
} else if (index >= 0) {
|
||||
return this.props.cover.videos[index]
|
||||
} else {
|
||||
return null
|
||||
@@ -30,7 +29,7 @@ class TemplateCover extends React.Component {
|
||||
var video = this.getVideo(this.state.video, headerVideos.length || 0)
|
||||
return (
|
||||
<div className='default-cover-container'>
|
||||
<div className="cover-content">
|
||||
<div className='cover-content'>
|
||||
{
|
||||
this.props.cover.bgVideo ? (
|
||||
<div className={`fullscreen-bg ${!this.props.showing ? 'hidden' : ''}`}>
|
||||
@@ -41,7 +40,7 @@ class TemplateCover extends React.Component {
|
||||
preload='auto'
|
||||
className='fullscreen-bg__video'
|
||||
>
|
||||
<source src={this.props.cover.bgVideo} type='video/mp4' />
|
||||
<source src={this.props.cover.bgVideo} type='video/mp4' />
|
||||
</video>
|
||||
</div>
|
||||
) : null
|
||||
@@ -55,17 +54,17 @@ class TemplateCover extends React.Component {
|
||||
}
|
||||
<hr />
|
||||
<div className='hero thin'>
|
||||
{
|
||||
headerVideos ? (
|
||||
<div className='row'>
|
||||
{ headerVideos.slice(0,2).map( (media, index) => (
|
||||
<div className='cell plain' onClick={() => this.setState({ video: index })}>
|
||||
{media.buttonTitle}
|
||||
</div>
|
||||
) ) }
|
||||
</div>
|
||||
) : null
|
||||
}
|
||||
{
|
||||
headerVideos ? (
|
||||
<div className='row'>
|
||||
{ headerVideos.slice(0, 2).map((media, index) => (
|
||||
<div className='cell plain' onClick={() => this.setState({ video: index })}>
|
||||
{media.buttonTitle}
|
||||
</div>
|
||||
)) }
|
||||
</div>
|
||||
) : null
|
||||
}
|
||||
<div className='row'>
|
||||
<div className='cell yellow' onClick={this.props.showAppHandler}>
|
||||
EXPLORE
|
||||
@@ -80,8 +79,8 @@ class TemplateCover extends React.Component {
|
||||
<div className='hero'>
|
||||
<div className='row'>
|
||||
{/* NOTE: only take first four videos, drop any others for style reasons */}
|
||||
{ this.props.cover.videos.slice(0,4).map( (media, index) => (
|
||||
<div className='cell small' onClick={() => this.setState({ video: index + (headerVideos.length || 0)})} >
|
||||
{ this.props.cover.videos.slice(0, 4).map((media, index) => (
|
||||
<div className='cell small' onClick={() => this.setState({ video: index + (headerVideos.length || 0) })} >
|
||||
{media.buttonTitle}<br />{media.buttonSubtitle}
|
||||
</div>
|
||||
)) }
|
||||
@@ -92,29 +91,29 @@ class TemplateCover extends React.Component {
|
||||
</div>
|
||||
|
||||
{
|
||||
this.state.video != MEDIA_HIDDEN ? (
|
||||
<MediaOverlay
|
||||
opaque
|
||||
source={
|
||||
{
|
||||
title: video.title,
|
||||
desc: video.desc,
|
||||
paths: [video.file],
|
||||
poster: video.poster
|
||||
}}
|
||||
translations={video.translations}
|
||||
onCancel={() => this.setState({ video: MEDIA_HIDDEN })}
|
||||
/>
|
||||
) : null }
|
||||
this.state.video !== MEDIA_HIDDEN ? (
|
||||
<MediaOverlay
|
||||
opaque
|
||||
source={
|
||||
{
|
||||
title: video.title,
|
||||
desc: video.desc,
|
||||
paths: [video.file],
|
||||
poster: video.poster
|
||||
}}
|
||||
translations={video.translations}
|
||||
onCancel={() => this.setState({ video: MEDIA_HIDDEN })}
|
||||
/>
|
||||
) : null }
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
function mapStateToProps(state) {
|
||||
function mapStateToProps (state) {
|
||||
return {
|
||||
cover : state.app.cover
|
||||
cover: state.app.cover
|
||||
}
|
||||
}
|
||||
|
||||
export default connect(mapStateToProps) (TemplateCover);
|
||||
export default connect(mapStateToProps)(TemplateCover)
|
||||
|
||||
Reference in New Issue
Block a user