mirror of
https://github.com/bellingcat/ukraine-timemap.git
synced 2026-06-12 21:38:35 +03:00
renamed js folder as common + moved hardcoded colors into global.js
This commit is contained in:
committed by
Lachlan Kermode
parent
c32dff1080
commit
7755a8fee2
@@ -1,5 +1,5 @@
|
||||
/* global fetch, alert */
|
||||
import { urlFromEnv } from '../js/utilities'
|
||||
import { urlFromEnv } from '../common/utilities'
|
||||
|
||||
// TODO: relegate these URLs entirely to environment variables
|
||||
const EVENT_DATA_URL = urlFromEnv('EVENT_EXT')
|
||||
|
||||
13
src/common/global.js
Normal file
13
src/common/global.js
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
const colors = {
|
||||
fa_red : '#eb443e',
|
||||
yellow : '#ffd800',
|
||||
black : '#000',
|
||||
white : '#fff'
|
||||
}
|
||||
|
||||
export default {
|
||||
darkBackground : colors.black,
|
||||
primaryHighlight : colors.yellow,
|
||||
secondaryHighlight : colors.white
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
import copy from '../js/data/copy.json'
|
||||
import copy from '../common/data/copy.json'
|
||||
import {
|
||||
parseDate,
|
||||
formatterWithYear
|
||||
} from '../js/utilities'
|
||||
} from '../common/utilities'
|
||||
import React from 'react'
|
||||
|
||||
import CardTimestamp from './presentational/Card/Timestamp'
|
||||
|
||||
@@ -3,7 +3,7 @@ import { connect } from 'react-redux'
|
||||
import * as selectors from '../selectors'
|
||||
|
||||
import Card from './Card.jsx'
|
||||
import copy from '../js/data/copy.json'
|
||||
import copy from '../common/data/copy.json'
|
||||
|
||||
class CardStack extends React.Component {
|
||||
constructor () {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react'
|
||||
import copy from '../js/data/copy.json'
|
||||
import copy from '../common/data/copy.json'
|
||||
|
||||
export default ({ ui, app, methods }) => {
|
||||
function renderIntro () {
|
||||
|
||||
@@ -16,7 +16,7 @@ import Notification from './Notification.jsx'
|
||||
import StaticPage from './StaticPage'
|
||||
import TemplateCover from './presentational/covers/TemplateCover'
|
||||
|
||||
import { parseDate } from '../js/utilities'
|
||||
import { parseDate } from '../common/utilities'
|
||||
import { isMobile } from 'react-device-detect'
|
||||
|
||||
class Dashboard extends React.Component {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react'
|
||||
import copy from '../../js/data/copy.json'
|
||||
import copy from '../../common/data/copy.json'
|
||||
|
||||
const LoadingOverlay = ({ isLoading, language }) => {
|
||||
let classes = 'loading-overlay'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React from 'react'
|
||||
import Content from './Content'
|
||||
import Controls from './Controls'
|
||||
import { selectTypeFromPathWithPoster } from '../../js/utilities'
|
||||
import { selectTypeFromPathWithPoster } from '../../common/utilities'
|
||||
|
||||
class SourceOverlay extends React.Component {
|
||||
constructor () {
|
||||
|
||||
@@ -4,8 +4,8 @@ import { connect } from 'react-redux'
|
||||
import * as selectors from '../selectors'
|
||||
import hash from 'object-hash'
|
||||
|
||||
import copy from '../js/data/copy.json'
|
||||
import { formatterWithYear, parseDate } from '../js/utilities'
|
||||
import copy from '../common/data/copy.json'
|
||||
import { formatterWithYear, parseDate } from '../common/utilities'
|
||||
import Header from './presentational/Timeline/Header'
|
||||
import Axis from './TimelineAxis.jsx'
|
||||
import Clip from './presentational/Timeline/Clip'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from 'react'
|
||||
import Checkbox from '../presentational/Checkbox'
|
||||
import copy from '../../js/data/copy.json'
|
||||
import copy from '../../common/data/copy.json'
|
||||
|
||||
export default ({
|
||||
categories,
|
||||
|
||||
@@ -9,8 +9,8 @@ import Search from './Search'
|
||||
import TagListPanel from './TagListPanel'
|
||||
import CategoriesListPanel from './CategoriesListPanel'
|
||||
import BottomActions from './BottomActions'
|
||||
import copy from '../../js/data/copy.json'
|
||||
import { trimAndEllipse } from '../../js/utilities.js'
|
||||
import copy from '../../common/data/copy.json'
|
||||
import { trimAndEllipse } from '../../common/utilities.js'
|
||||
|
||||
class Toolbar extends React.Component {
|
||||
constructor (props) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* global fetch */
|
||||
import React from 'react'
|
||||
import copy from '../../js/data/copy.json'
|
||||
import copy from '../../common/data/copy.json'
|
||||
import TagFilter from './TagFilter'
|
||||
|
||||
export default class Search extends React.Component {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from 'react'
|
||||
import Checkbox from '../presentational/Checkbox'
|
||||
import copy from '../../js/data/copy.json'
|
||||
import copy from '../../common/data/copy.json'
|
||||
|
||||
function TagListPanel ({
|
||||
tags,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from 'react'
|
||||
|
||||
import { capitalizeFirstLetter } from '../../../js/utilities.js'
|
||||
import { capitalizeFirstLetter } from '../../../common/utilities.js'
|
||||
|
||||
const CardCategory = ({ categoryTitle, categoryLabel, color }) => (
|
||||
<div className='card-row card-cell category'>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from 'react'
|
||||
|
||||
import copy from '../../../js/data/copy.json'
|
||||
import copy from '../../../common/data/copy.json'
|
||||
|
||||
const CardLocation = ({ language, location, isPrecise }) => {
|
||||
if (location !== '') {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from 'react'
|
||||
|
||||
import copy from '../../../js/data/copy.json'
|
||||
import copy from '../../../common/data/copy.json'
|
||||
|
||||
const CardSummary = ({ language, description, isHighlighted }) => {
|
||||
const summary = copy[language].cardstack.description
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from 'react'
|
||||
|
||||
import copy from '../../../js/data/copy.json'
|
||||
import copy from '../../../common/data/copy.json'
|
||||
|
||||
const CardTags = ({ tags, language }) => {
|
||||
const tagsLang = copy[language].cardstack.tags
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React from 'react'
|
||||
|
||||
import copy from '../../../js/data/copy.json'
|
||||
import { isNotNullNorUndefined } from '../../../js/utilities'
|
||||
import copy from '../../../common/data/copy.json'
|
||||
import { isNotNullNorUndefined } from '../../../common/utilities'
|
||||
|
||||
const CardTimestamp = ({ timelabel, language, precision }) => {
|
||||
// const daytimeLang = copy[language].cardstack.timestamp
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import React from 'react'
|
||||
import { Portal } from 'react-portal'
|
||||
import colors from '../../../common/global.js'
|
||||
|
||||
function MapEvents ({ getCategoryColor, categories, projectPoint, styleLocation, selected, narrative, onSelect, svg, locations }) {
|
||||
function getCoordinatesForPercent (radius, percent) {
|
||||
@@ -16,7 +17,7 @@ function MapEvents ({ getCategoryColor, categories, projectPoint, styleLocation,
|
||||
cx="0"
|
||||
cy="0"
|
||||
r="10"
|
||||
stroke="#ffd800"
|
||||
stroke={colors.primaryHighlight}
|
||||
fill-opacity="0.0"
|
||||
/>}
|
||||
</React.Fragment>
|
||||
@@ -30,7 +31,7 @@ function MapEvents ({ getCategoryColor, categories, projectPoint, styleLocation,
|
||||
|
||||
let styles = ({
|
||||
fill: getCategoryColor(locCategory),
|
||||
stroke: '#ffffff',
|
||||
stroke: colors.darkBackground,
|
||||
strokeWidth: 0,
|
||||
fillOpacity: 0.85,
|
||||
...extraStyles
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import React from 'react'
|
||||
import { Portal } from 'react-portal'
|
||||
import colors from '../../../common/global.js'
|
||||
|
||||
class MapSelectedEvents extends React.Component {
|
||||
renderMarker (event) {
|
||||
@@ -13,7 +14,7 @@ class MapSelectedEvents extends React.Component {
|
||||
>
|
||||
<path
|
||||
className='leaflet-interactive'
|
||||
stroke={styles ? styles.stroke : '#ffd800'}
|
||||
stroke={styles ? styles.stroke : colors.primaryHighlight}
|
||||
stroke-opacity='1'
|
||||
stroke-width={styles ? styles['stroke-width'] : 2}
|
||||
stroke-linecap=''
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import React from 'react'
|
||||
import colors from '../../../common/global.js'
|
||||
|
||||
const TimelineMarkers = ({ styles, getEventX, getCategoryY, transitionDuration, selected }) => {
|
||||
function renderMarker (event) {
|
||||
@@ -7,7 +8,7 @@ const TimelineMarkers = ({ styles, getEventX, getCategoryY, transitionDuration,
|
||||
className='timeline-marker'
|
||||
cx={0}
|
||||
cy={0}
|
||||
stroke={styles ? styles.stroke : '#ffffff'}
|
||||
stroke={styles ? styles.stroke : colors.secondaryHighlight}
|
||||
stroke-opacity='1'
|
||||
stroke-width={styles ? styles['stroke-width'] : 2}
|
||||
stroke-linecap=''
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import initial from '../store/initial.js'
|
||||
import { parseDate, toggleFlagAC } from '../js/utilities'
|
||||
import { parseDate, toggleFlagAC } from '../common/utilities'
|
||||
|
||||
import {
|
||||
UPDATE_HIGHLIGHTED,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { parseTimestamp } from '../js/utilities'
|
||||
import { parseTimestamp } from '../common/utilities'
|
||||
/**
|
||||
* Some handy helpers
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createSelector } from 'reselect'
|
||||
import { compareTimestamp, insetSourceFrom } from '../js/utilities'
|
||||
import { compareTimestamp, insetSourceFrom } from '../common/utilities'
|
||||
import { isTimeRangedIn } from './helpers'
|
||||
|
||||
// Input selectors
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { mergeDeepLeft } from 'ramda'
|
||||
|
||||
const FA_RED = '#eb443e';
|
||||
import colors from '../common/global.js'
|
||||
|
||||
const initial = {
|
||||
/*
|
||||
@@ -107,12 +106,12 @@ const initial = {
|
||||
tiles: 'openstreetmap', // ['openstreetmap', 'streets', 'satellite']
|
||||
style: {
|
||||
categories: {
|
||||
default: FA_RED
|
||||
default: colors.fa_red
|
||||
},
|
||||
narratives: {
|
||||
default: {
|
||||
opacity: 0.9,
|
||||
stroke: FA_RED,
|
||||
stroke: colors.fa_red,
|
||||
strokeWidth: 3
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user