mirror of
https://github.com/bellingcat/ukraine-timemap.git
synced 2026-06-08 03:18:36 +03:00
Time display on Card display precision
This commit is contained in:
@@ -88,11 +88,27 @@ class Card extends React.Component {
|
||||
|
||||
// NB: should be internaionalized.
|
||||
renderTimestamp () {
|
||||
let timelabel = this.makeTimelabel(this.props.event.timestamp)
|
||||
|
||||
let precision = this.props.event.time_display;
|
||||
if (precision === '_date_only') {
|
||||
precision = ''
|
||||
timelabel = timelabel.substring(0, 11)
|
||||
} else if (precision === '_approximate_date_only') {
|
||||
precision = ' (Approximate date)'
|
||||
timelabel = timelabel.substring(0, 11)
|
||||
} else if (precision === '_approximate_datetime') {
|
||||
precision = ' (Approximate datetime)'
|
||||
} else {
|
||||
timelabel = timelabel.substring(0, 11)
|
||||
}
|
||||
|
||||
return (
|
||||
<CardTimestamp
|
||||
makeTimelabel={(timestamp) => this.makeTimelabel(timestamp)}
|
||||
makeTimelabel={timelabel}
|
||||
language={this.props.language}
|
||||
timestamp={this.props.event.timestamp}
|
||||
timelabel={timelabel}
|
||||
precision={precision}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -3,18 +3,17 @@ import React from 'react'
|
||||
import copy from '../../../js/data/copy.json'
|
||||
import { isNotNullNorUndefined } from '../../../js/utilities'
|
||||
|
||||
const CardTimestamp = ({ makeTimelabel, language, timestamp }) => {
|
||||
const CardTimestamp = ({ timelabel, language, precision }) => {
|
||||
// const daytimeLang = copy[language].cardstack.timestamp
|
||||
// const estimatedLang = copy[language].cardstack.estimated
|
||||
const unknownLang = copy[language].cardstack.unknown_time
|
||||
|
||||
if (isNotNullNorUndefined(timestamp)) {
|
||||
const timelabel = makeTimelabel(timestamp)
|
||||
if (isNotNullNorUndefined(timelabel)) {
|
||||
return (
|
||||
<div className='card-cell timestamp'>
|
||||
<p>
|
||||
<i className='material-icons left'>today</i>
|
||||
{timelabel}
|
||||
{timelabel}{(precision !== '') ? ` - ${precision}` : ''}
|
||||
</p>
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -58,7 +58,6 @@ function MapEvents ({ getCategoryColor, categories, projectPoint, styleLocation,
|
||||
|
||||
return (
|
||||
<path
|
||||
onClick={() => { console.log('uo')}}
|
||||
class='location-event-marker'
|
||||
id={`arc_${idx}`}
|
||||
d={arc}
|
||||
|
||||
@@ -16,6 +16,7 @@ const eventSchema = Joi.object().keys({
|
||||
tags: Joi.array().allow(''),
|
||||
comments: Joi.string().allow(''),
|
||||
timestamp: Joi.string(),
|
||||
time_display: Joi.string().allow(''),
|
||||
|
||||
// nested
|
||||
narrative___stepStyles: Joi.array()
|
||||
|
||||
Reference in New Issue
Block a user