Skip to content

Commit

Permalink
fixes multiple broken story pages
Browse files Browse the repository at this point in the history
  • Loading branch information
davelandry committed Jan 14, 2019
1 parent 733f501 commit 1a686ac
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 6 deletions.
1 change: 1 addition & 0 deletions api/storyRoute.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ module.exports = function(app) {
if (!topic.selectors) topic.selectors = [];
if (!topic.stats) topic.stats = [];
if (!topic.descriptions) topic.descriptions = [];
if (!(topic.descriptions instanceof Array)) topic.descriptions = [topic.descriptions];
topic.descriptions = topic.descriptions.map(description => {
const text = description
.replace(/\<\<foot note=([0-9]+)\>\>/g, (match, g1) =>
Expand Down
2 changes: 1 addition & 1 deletion app/components/Viz/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class Viz extends Component {
data={ vizProps.config.cart || vizProps.config.data }
dataFormat={ vizProps.dataFormat }
slug={ slug }
title={ formatters.stripHTML(title) }
title={ formatters.stripHTML(title || "Data USA Visualization") }
topic={ topic } /> : null }
<Visualization
ref={ comp => this.viz = comp }
Expand Down
14 changes: 13 additions & 1 deletion app/pages/Story/Story.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
background-color: #E9E9E9;
color: white;
margin: 0 auto;
padding: 60px 50px 25px;
padding: 25px 50px;
width: 100%;
&.dark {
background-color: var(--dark);
Expand Down Expand Up @@ -83,5 +83,17 @@
color: rgba(51, 51, 51, .93);
padding: 60px 50px 25px;
width: 100%;
& .topic-description {
margin-bottom: 15px;
}
& .topic-content {
margin: 0 auto;
max-width: 700px;
}
& .visualization {
margin: 0 auto;
max-width: 700px;
min-height: 400px;
}
}
}
4 changes: 2 additions & 2 deletions app/pages/Story/Story.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ class Story extends Component {
</div>
</div>
{ topics.map((t, i) => <TextViz contents={t} key={i} />) }
<div className="meta-info">
{ footnotes && <div className="meta-info">
<ol className="footnotes">
{ footnotes.map((footnote, i) => <li className="footnote" id={`footnote${i}`} key={i} dangerouslySetInnerHTML={{__html: footnote}}></li>) }
</ol>
</div>
</div> }
<div className="meta-info dark">
{ authors.map((a, i) =>
<div key={i} id={slugify(a.name)} className="author">
Expand Down
4 changes: 2 additions & 2 deletions app/stories/06-12-2017_hardest-working.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ topics:
year: "2014"
id: "geo"
type: "Geomap"
description:
descriptions:
- "Many believe Americans have a deserved reputation for being among the hardest-working and most productive people on the planet. But where in the United States do people work the longest hours? High-energy New Yorkers would love to claim that title as their own, but residents of other large urban areas, such as Washington, D.C., may disagree. And in fact, D.C. denizens do work the longest hours when aggregated to the state level. But this high-level view obscures some interesting insights—for instance, none of the Public Use Micro Areas (PUMAs) that comprise the nation’s capital make the top ten individually. In fact, the top three places nationally may surprise you. The three PUMAs reporting the longest weekly hours are:"
- "<ol>
<li><a href='/profile/geo/79500US2901400/'>Pulaski, Camden, Miller, and Morgan counties, Missouri</a>: 48.7 hours</li>
Expand All @@ -29,7 +29,7 @@ topics:
- "This is an eclectic mix of the fabled American heartland,<<foot note=1>> the majestic and partially uncharted extreme Northwest, and the electric Northeast. Each of these places is radically different from the others in its history, industry, and character. Many likely would have expected the upscale Manhattan neighborhoods to appear on this list, considering New Yorkers’ reputation for being awake (and at work) at all hours. But the cluster of Missouri counties won’t immediately spring to most minds when this question is asked—save possibly for those who live there. However, the data tells us that their inclusion is entirely on merit. Finally, there’s Subsistence Alaska, which conjures up images of grand vistas and survivalist serenity. This collection of rural Alaskan boroughs has an above-average concentration of native hunting and fishing—as well as resource extraction—and features a lifestyle fundamentally different to almost anywhere in the United States."
- "Let’s take a closer look at the types of people we might find in each of these places. On the surface, the three geographies could not be more different, but if we dig a little deeper, we may find some similarities."
- title: "Median Household Income"
description: "A good place to start is with median household income, and as we’ll see, longer hours do not necessarily mean higher wages. The New York neighborhoods lead the way with $118,108, more than double the $53,482 US average. Subsistence Alaska, at $56,736, is more or less in line with the national average. The Missourian suburbs come a distant third, with a median household income of $42,812. This seems to make sense: Wages appear to align much more closely to cost of living rather than hours worked, and, as anyone who has visited can attest, Manhattan is quite expensive."
descriptions: "A good place to start is with median household income, and as we’ll see, longer hours do not necessarily mean higher wages. The New York neighborhoods lead the way with $118,108, more than double the $53,482 US average. Subsistence Alaska, at $56,736, is more or less in line with the national average. The Missourian suburbs come a distant third, with a median household income of $42,812. This seems to make sense: Wages appear to align much more closely to cost of living rather than hours worked, and, as anyone who has visited can attest, Manhattan is quite expensive."
viz:
attrs: "geo"
data:
Expand Down

0 comments on commit 1a686ac

Please sign in to comment.