From e9c1497ee8679e4fe8c7bff693b451285d6fe9a9 Mon Sep 17 00:00:00 2001 From: Zac Ioannidis Date: Wed, 28 Oct 2020 23:41:14 +0000 Subject: [PATCH] Added new layout for cards --- src/components/CardStack.jsx | 50 ++++++++++++++++++++++++------------ 1 file changed, 33 insertions(+), 17 deletions(-) diff --git a/src/components/CardStack.jsx b/src/components/CardStack.jsx index 3c6997c..4629e75 100644 --- a/src/components/CardStack.jsx +++ b/src/components/CardStack.jsx @@ -1,9 +1,5 @@ import React from 'react' import { connect } from 'react-redux' -import { - // timeFormat - timeParse -} from 'd3' import * as selectors from '../selectors' import { // calculateColorPercentages, @@ -14,8 +10,6 @@ import { import { Card } from '@forensic-architecture/design-system/react' import copy from '../common/data/copy.json' -const parseTimeUS = timeParse('%-m/%-d/%Y') - class CardStack extends React.Component { constructor () { super() @@ -71,16 +65,44 @@ class CardStack extends React.Component { const thisRef = React.createRef() this.refs[idx] = thisRef + let precision + switch (event.location_precision) { + case `Generalised`: + precision = `No location data` + break + case `Estimated`: + precision = `Precise location estimated` + break + case `Self-reported`: + precision = `Location reported by witness` + break + case `Confirmed`: + default: + precision = null + break + } + return ( ({ text: `Source ${idx + 1}`, href })) : 'Source hidden to protect the privacy and dignity of civilians. Read more [here](https://staging.forensic-architecture.org/wp-content/uploads/2020/09/2020.14.09-FA-Bcat-Mission-Statement.pdf).' + value: event.hide_source === 'FALSE' ? event.links.map((href, idx) => ({ text: `Source ${idx + 1}`, href, color: null, onClick: () => window.open(href, '_blank') })) : 'Source hidden to protect the privacy and dignity of civilians. Read more [here](https://staging.forensic-architecture.org/wp-content/uploads/2020/09/2020.14.09-FA-Bcat-Mission-Statement.pdf).' } ] // [{ kind: "text", title: "Category", value: "Press attack" }],