Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update agency intro text #1037

Merged
merged 1 commit into from
Jun 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/components/ExplorerIntro.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ const ExplorerIntro = ({ agency, crime, place, ucr, until }) => {
if (agency) {
return (
<ExplorerIntroAgency
name={agency.agency_name}
county={agency.primary_county}
crime={crime}
hasNibrs={agency.nibrs_months_reported === 12}
name={agency.agency_name}
state={oriToState(place)}
type={agency.agency_type_name}
hasNibrs={agency.nibrs_months_reported === 12}
/>
)
}
Expand Down
26 changes: 23 additions & 3 deletions src/components/ExplorerIntroAgency.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,42 @@
import lowerCase from 'lodash.lowercase'
import startCase from 'lodash.startcase'
import upperFirst from 'lodash.upperfirst'
import PropTypes from 'prop-types'
import React from 'react'

import Term from './Term'
import { nibrsTerm, srsTerm } from './Terms'
import mapCrimeToGlossaryTerm from '../util/glossary'

const ExplorerIntroAgency = ({ county, name, state, type, hasNibrs }) => {
const ExplorerIntroAgency = ({
county,
crime,
hasNibrs,
name,
state,
type,
}) => {
const showCounty =
(county && type === 'City') || type === 'University or College'
const crimeTerm = (
<Term id={mapCrimeToGlossaryTerm(crime)} size="sm">
{upperFirst(lowerCase(crime))}
</Term>
)

return (
<p className="serif">
The {startCase(name)} law enforcement agency is located in
{' '}
{showCounty && `${county} County, `}
{startCase(state)}. This agency reports
{startCase(state)}.
{' '}
{crimeTerm} totals for this agency are voluntarily submitted to the
FBI using
{' '}
{hasNibrs ? nibrsTerm : srsTerm}
{' '}
data to the FBI.
reports.
</p>
)
}
Expand Down