[examples/538][m] - little fixes and renaming (#870)

This commit is contained in:
Luccas Mateus 2023-05-11 13:15:18 -03:00 committed by GitHub
parent 336ff819dc
commit 1cfc4db528
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 304 additions and 84 deletions

View File

@ -1,46 +1,11 @@
[
{
"url": "https://github.com/fivethirtyeight/data/tree/master/nba-forecasts",
"name": "nba-forecasts",
"displayName": "nba-<span class=\"lastword\">forecasts</span>",
"articles": [
{
"date": "2023-05-08T22:33:43.000Z",
"title": "2022-23 NBA Predictions",
"url": "https://projects.fivethirtyeight.com/2023-nba-predictions/"
}
],
"files": [
"https://projects.fivethirtyeight.com/nba-model/nba_elo.csv",
"https://projects.fivethirtyeight.com/nba-model/nba_elo_latest.csv"
]
},
{
"url": "https://github.com/fivethirtyeight/data/tree/master/soccer-spi",
"name": "soccer-spi",
"displayName": "soccer-<span class=\"lastword\">spi</span>",
"articles": [
{
"date": "2023-05-08T22:17:18.000Z",
"title": "Club Soccer Predictions",
"url": "https://projects.fivethirtyeight.com/soccer-predictions/"
}
],
"files": [
"https://projects.fivethirtyeight.com/soccer-api/club/spi_matches.csv",
"https://projects.fivethirtyeight.com/soccer-api/club/spi_matches_latest.csv",
"https://projects.fivethirtyeight.com/soccer-api/club/spi_global_rankings.csv",
"https://projects.fivethirtyeight.com/soccer-api/international/spi_matches_intl.csv",
"https://projects.fivethirtyeight.com/soccer-api/international/spi_global_rankings_intl.csv"
]
},
{
"url": "https://github.com/fivethirtyeight/data/tree/master/polls",
"name": "polls",
"displayName": "<span class=\"lastword\">polls</span>",
"articles": [
{
"date": "2023-05-08T20:36:59.000Z",
"date": "2023-05-11T14:35:40.000Z",
"title": "Latest Polls",
"url": "https://projects.fivethirtyeight.com/polls/"
}
@ -63,13 +28,45 @@
"https://projects.fivethirtyeight.com/2020-general-data/presidential_poll_averages_2020.csv"
]
},
{
"url": "https://github.com/fivethirtyeight/data/tree/master/congress-generic-ballot",
"name": "congress-generic-ballot",
"displayName": "congress-generic-<span class=\"lastword\">ballot</span>",
"articles": [
{
"date": "2023-05-11T14:35:40.000Z",
"title": "Do Voters Want Democrats Or Republicans In Congress?",
"url": "https://projects.fivethirtyeight.com/congress-generic-ballot-polls/"
}
],
"files": [
"https://projects.fivethirtyeight.com/generic-ballot-data/generic_polllist.csv",
"https://projects.fivethirtyeight.com/polls/data/generic_ballot_averages.csv"
]
},
{
"url": "https://github.com/fivethirtyeight/data/tree/master/nba-forecasts",
"name": "nba-forecasts",
"displayName": "nba-<span class=\"lastword\">forecasts</span>",
"articles": [
{
"date": "2023-05-11T11:15:46.000Z",
"title": "2022-23 NBA Predictions",
"url": "https://projects.fivethirtyeight.com/2023-nba-predictions/"
}
],
"files": [
"https://projects.fivethirtyeight.com/nba-model/nba_elo.csv",
"https://projects.fivethirtyeight.com/nba-model/nba_elo_latest.csv"
]
},
{
"url": "https://github.com/fivethirtyeight/data/tree/master/nba-raptor",
"name": "nba-raptor",
"displayName": "nba-<span class=\"lastword\">raptor</span>",
"articles": [
{
"date": "2023-05-08T11:15:48.000Z",
"date": "2023-05-11T11:13:20.000Z",
"title": "The Best NBA Players, According To RAPTOR",
"rowspan": 3,
"url": "https://projects.fivethirtyeight.com/nba-player-ratings/"
@ -92,13 +89,32 @@
"https://projects.fivethirtyeight.com/nba-model/2023/latest_RAPTOR_by_player.csv"
]
},
{
"url": "https://github.com/fivethirtyeight/data/tree/master/soccer-spi",
"name": "soccer-spi",
"displayName": "soccer-<span class=\"lastword\">spi</span>",
"articles": [
{
"date": "2023-05-11T05:25:51.000Z",
"title": "Club Soccer Predictions",
"url": "https://projects.fivethirtyeight.com/soccer-predictions/"
}
],
"files": [
"https://projects.fivethirtyeight.com/soccer-api/club/spi_matches.csv",
"https://projects.fivethirtyeight.com/soccer-api/club/spi_matches_latest.csv",
"https://projects.fivethirtyeight.com/soccer-api/club/spi_global_rankings.csv",
"https://projects.fivethirtyeight.com/soccer-api/international/spi_matches_intl.csv",
"https://projects.fivethirtyeight.com/soccer-api/international/spi_global_rankings_intl.csv"
]
},
{
"url": "https://github.com/fivethirtyeight/data/tree/master/nhl-forecasts",
"name": "nhl-forecasts",
"displayName": "nhl-<span class=\"lastword\">forecasts</span>",
"articles": [
{
"date": "2023-05-08T04:18:20.000Z",
"date": "2023-05-11T04:53:22.000Z",
"title": "2022-23 NHL Predictions",
"url": "https://projects.fivethirtyeight.com/2023-nhl-predictions/"
}
@ -114,7 +130,7 @@
"displayName": "mlb-<span class=\"lastword\">elo</span>",
"articles": [
{
"date": "2023-05-08T02:25:55.000Z",
"date": "2023-05-11T02:35:49.000Z",
"title": "2023 MLB Predictions",
"url": "https://projects.fivethirtyeight.com/2023-mlb-predictions/"
}
@ -124,22 +140,6 @@
"https://projects.fivethirtyeight.com/mlb-api/mlb_elo_latest.csv"
]
},
{
"url": "https://github.com/fivethirtyeight/data/tree/master/congress-generic-ballot",
"name": "congress-generic-ballot",
"displayName": "congress-generic-<span class=\"lastword\">ballot</span>",
"articles": [
{
"date": "2023-05-02T13:48:41.000Z",
"title": "Do Voters Want Democrats Or Republicans In Congress?",
"url": "https://projects.fivethirtyeight.com/congress-generic-ballot-polls/"
}
],
"files": [
"https://projects.fivethirtyeight.com/generic-ballot-data/generic_polllist.csv",
"https://projects.fivethirtyeight.com/polls/data/generic_ballot_averages.csv"
]
},
{
"url": "https://github.com/fivethirtyeight/data/tree/master/congress-demographics",
"name": "congress-demographics",
@ -211,6 +211,18 @@
"https://projects.fivethirtyeight.com/nfl-api/nfl_elo_latest.csv"
]
},
{
"url": "https://github.com/fivethirtyeight/checking-our-work-data",
"name": "checking-our-work-data",
"displayName": "checking-our-work-<span class=\"lastword\">data</span>",
"articles": [
{
"date": "2023-02-02T16:30:00.000Z",
"title": "How Good Are FiveThirtyEight Forecasts?",
"url": "https://projects.fivethirtyeight.com/checking-our-work/"
}
]
},
{
"url": "https://github.com/fivethirtyeight/data/tree/master/world-cup-2022",
"name": "world-cup-2022",
@ -227,6 +239,18 @@
"https://projects.fivethirtyeight.com/soccer-api/international/2022/wc_forecasts.csv"
]
},
{
"url": "https://github.com/fivethirtyeight/covid-19-polls",
"name": "covid-19-polls",
"displayName": "covid-19-<span class=\"lastword\">polls</span>",
"articles": [
{
"date": "2022-11-29T20:20:08.000Z",
"title": "How Americans View Bidens Response To The Coronavirus Crisis",
"url": "https://projects.fivethirtyeight.com/coronavirus-polls/"
}
]
},
{
"url": "https://github.com/fivethirtyeight/data/tree/master/election-deniers",
"name": "election-deniers",
@ -347,6 +371,18 @@
}
]
},
{
"url": "https://github.com/fivethirtyeight/nfl-elo-game",
"name": "nfl-elo-game",
"displayName": "nfl-elo-<span class=\"lastword\">game</span>",
"articles": [
{
"date": "2022-02-14T03:03:26.000Z",
"title": "Can You Beat FiveThirtyEights NFL Forecasts?",
"url": "https://projects.fivethirtyeight.com/2021-nfl-forecasting-game/"
}
]
},
{
"url": "https://github.com/fivethirtyeight/data/tree/master/redlining",
"name": "redlining",
@ -371,6 +407,42 @@
}
]
},
{
"url": "https://github.com/fivethirtyeight/negro-leagues-player-ratings",
"name": "negro-leagues-player-ratings",
"displayName": "negro-leagues-player-<span class=\"lastword\">ratings</span>",
"articles": [
{
"date": "2021-02-25T11:00:00.000Z",
"title": "The Negro League Stars That MLB Kept Out — And Is Finally Recognizing",
"url": "https://projects.fivethirtyeight.com/negro-leagues-mlb/"
}
]
},
{
"url": "https://github.com/fivethirtyeight/police-settlements",
"name": "police-settlements",
"displayName": "police-<span class=\"lastword\">settlements</span>",
"articles": [
{
"date": "2021-02-22T11:00:49.000Z",
"title": "Cities Spend Millions On Police Misconduct Every Year. Heres Why Its So Difficult to Hold Departments Accountable.",
"url": "https://fivethirtyeight.com/features/police-misconduct-costs-cities-millions-every-year-but-thats-where-the-accountability-ends/"
}
]
},
{
"url": "https://github.com/fivethirtyeight/superbowl-ads",
"name": "superbowl-ads",
"displayName": "superbowl-<span class=\"lastword\">ads</span>",
"articles": [
{
"date": "2021-02-04T16:11:00.000Z",
"title": "According To Super Bowl Ads, Americans Love America, Animals And Sex",
"url": "https://projects.fivethirtyeight.com/super-bowl-ads/"
}
]
},
{
"url": "https://github.com/fivethirtyeight/data/tree/master/trump-approval-ratings",
"name": "trump-approval-ratings",
@ -403,6 +475,18 @@
"https://projects.fivethirtyeight.com/congress-tracker-data/csv/vote_predictions.csv"
]
},
{
"url": "https://github.com/fivethirtyeight/election-results",
"name": "election-results",
"displayName": "election-<span class=\"lastword\">results</span>",
"articles": [
{
"date": "2020-11-03T05:33:43.000Z",
"title": "2020 Election Forecast",
"url": "https://projects.fivethirtyeight.com/2020-election-forecast/"
}
]
},
{
"url": "https://github.com/fivethirtyeight/data/tree/master/election-forecasts-2020",
"name": "election-forecasts-2020",
@ -473,6 +557,18 @@
}
]
},
{
"url": "https://github.com/fivethirtyeight/WNBA-stats",
"name": "WNBA-stats",
"displayName": "WNBA-<span class=\"lastword\">stats</span>",
"articles": [
{
"date": "2020-05-27T19:06:43.000Z",
"title": "Its Time To Give Basketballs Other GOAT Her Due",
"url": "https://fivethirtyeight.com/features/its-time-to-give-basketballs-other-goat-her-due/"
}
]
},
{
"url": "https://github.com/fivethirtyeight/data/tree/master/covid-geography",
"name": "covid-geography",
@ -512,6 +608,18 @@
"https://projects.fivethirtyeight.com/endorsements-2020-data/endorsements-2020.csv"
]
},
{
"url": "https://github.com/fivethirtyeight/nba-player-advanced-metrics",
"name": "nba-player-advanced-metrics",
"displayName": "nba-player-advanced-<span class=\"lastword\">metrics</span>",
"articles": [
{
"date": "2020-03-09T15:27:37.000Z",
"title": "Luka Dončić And The Mavs Are Pushing The Limits Of Offensive Efficiency",
"url": "https://fivethirtyeight.com/features/luka-doncic-and-the-mavs-are-pushing-the-limits-of-offensive-efficiency/"
}
]
},
{
"url": "https://github.com/fivethirtyeight/data/tree/master/impeachment-polls",
"name": "impeachment-polls",
@ -603,6 +711,18 @@
}
]
},
{
"url": "https://github.com/fivethirtyeight/candidate-emails",
"name": "candidate-emails",
"displayName": "candidate-<span class=\"lastword\">emails</span>",
"articles": [
{
"date": "2019-07-11T15:33:15.000Z",
"title": "What Our Inbox Tells Us About How Democrats Are Tackling Trump",
"url": "https://fivethirtyeight.com/features/which-democrats-are-campaigning-on-trump/"
}
]
},
{
"url": "https://github.com/fivethirtyeight/data/tree/master/nba-draymond",
"name": "nba-draymond",
@ -643,6 +763,18 @@
}
]
},
{
"url": "https://github.com/fivethirtyeight/twitter-overlap",
"name": "twitter-overlap",
"displayName": "twitter-<span class=\"lastword\">overlap</span>",
"articles": [
{
"date": "2019-06-12T15:24:07.000Z",
"title": "Which 2020 Candidates Have The Most In Common … On Twitter?",
"url": "https://fivethirtyeight.com/features/which-2020-candidates-have-the-most-in-common-on-twitter/"
}
]
},
{
"url": "https://github.com/fivethirtyeight/data/tree/master/trump-lawsuits",
"name": "trump-lawsuits",
@ -825,6 +957,18 @@
"https://projects.fivethirtyeight.com/congress-model-2018/governor_state_forecast.csv"
]
},
{
"url": "https://github.com/fivethirtyeight/actblue-analysis",
"name": "actblue-analysis",
"displayName": "actblue-<span class=\"lastword\">analysis</span>",
"articles": [
{
"date": "2018-10-25T17:31:42.000Z",
"title": "How ActBlue Is Trying To Turn Small Donations Into A Blue Wave",
"url": "https://fivethirtyeight.com/features/how-actblue-is-trying-to-turn-small-donations-into-a-blue-wave"
}
]
},
{
"url": "https://github.com/fivethirtyeight/data/tree/master/primary-candidates-2018",
"name": "primary-candidates-2018",
@ -1035,6 +1179,18 @@
}
]
},
{
"url": "https://github.com/fivethirtyeight/redistricting-atlas-data",
"name": "redistricting-atlas-data",
"displayName": "redistricting-atlas-<span class=\"lastword\">data</span>",
"articles": [
{
"date": "2018-01-25T11:00:00.000Z",
"title": "The Atlas Of Redistricting",
"url": "https://projects.fivethirtyeight.com/redistricting-maps/"
}
]
},
{
"url": "https://github.com/fivethirtyeight/data/tree/master/next-bechdel",
"name": "next-bechdel",
@ -1464,6 +1620,37 @@
}
]
},
{
"url": "https://github.com/fivethirtyeight/uber-tlc-foil-response",
"name": "uber-tlc-foil-response",
"displayName": "uber-tlc-foil-<span class=\"lastword\">response</span>",
"articles": [
{
"date": "2015-12-09T16:19:40.000Z",
"title": "Is Uber Making NYC Rush-Hour Traffic Worse?",
"rowspan": 4,
"url": "https://fivethirtyeight.com/features/is-uber-making-nyc-rush-hour-traffic-worse/"
},
{
"date": "2015-10-13T20:44:12.000Z",
"title": "Uber Is Taking Millions Of Manhattan Rides Away From Taxis",
"rowspan": 0,
"url": "https://fivethirtyeight.com/features/uber-is-taking-millions-of-manhattan-rides-away-from-taxis/"
},
{
"date": "2015-08-28T10:30:36.000Z",
"title": "Public Transit Should Be Ubers New Best Friend",
"rowspan": 0,
"url": "https://fivethirtyeight.com/features/public-transit-should-be-ubers-new-best-friend/"
},
{
"date": "2015-08-10T18:06:17.000Z",
"title": "Uber Is Serving New Yorks Outer Boroughs More Than Taxis Are",
"rowspan": 0,
"url": "https://fivethirtyeight.com/features/uber-is-serving-new-yorks-outer-boroughs-more-than-taxis-are/"
}
]
},
{
"url": "https://github.com/fivethirtyeight/data/tree/master/tarantino",
"name": "tarantino",
@ -1982,6 +2169,18 @@
}
]
},
{
"url": "https://github.com/fivethirtyeight/data/tree/master/comma-survey-data",
"name": "comma-survey-data",
"displayName": "comma-survey-<span class=\"lastword\">data</span>",
"articles": [
{
"date": "2014-06-17T16:28:55.000Z",
"title": "Elitist, Superfluous, Or Popular? We Polled Americans on the Oxford Comma",
"url": "http://fivethirtyeight.com/features/elitist-superfluous-or-popular-we-polled-americans-on-the-oxford-comma/"
}
]
},
{
"url": "https://github.com/fivethirtyeight/data/tree/master/world-cup-predictions",
"name": "world-cup-predictions",

View File

@ -16,6 +16,7 @@
"autoprefixer": "10.4.14",
"eslint": "8.40.0",
"eslint-config-next": "13.4.1",
"flexsearch": "^0.7.31",
"next": "13.4.1",
"next-mdx-remote": "^4.4.1",
"next-seo": "^6.0.0",
@ -2610,6 +2611,11 @@
"resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz",
"integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ=="
},
"node_modules/flexsearch": {
"version": "0.7.31",
"resolved": "https://registry.npmjs.org/flexsearch/-/flexsearch-0.7.31.tgz",
"integrity": "sha512-XGozTsMPYkm+6b5QL3Z9wQcJjNYxp0CYn3U1gO7dwD6PAqU1SVWZxI9CCg3z+ml3YfqdPnrBehaBrnH2AGKbNA=="
},
"node_modules/for-each": {
"version": "0.3.3",
"resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz",

View File

@ -17,6 +17,7 @@
"autoprefixer": "10.4.14",
"eslint": "8.40.0",
"eslint-config-next": "13.4.1",
"flexsearch": "^0.7.31",
"next": "13.4.1",
"next-mdx-remote": "^4.4.1",
"next-seo": "^6.0.0",

View File

@ -29,6 +29,16 @@ export default function Document() {
</a>
</h1>
</div>
<div className="mx-2 py-1.5 text-[14px] text-[#3c3c3c]">
<ul className='flex gap-x-4'>
<li>
<a className='hover:opacity-75 transition' href="https://portaljs.org">PortalJS</a>
</li>
<li>
<a className='hover:opacity-75 transition' href="https://github.com/datopian/portaljs/tree/main/examples/fivethirtyeight">View on Github</a>
</li>
</ul>
</div>
</header>
<Main />
<NextScript />

View File

@ -20,28 +20,34 @@ export interface Dataset {
files?: string[];
}
// Request a weekday along with a long date
const options = {
year: 'numeric',
month: 'long',
day: 'numeric',
} as const;
export function MobileItem({ dataset }: { dataset: Dataset }) {
return (
<div className="flex gap-x-2 pb-2 py-4 items-center justify-between border-b border-zinc-600">
<div className="flex flex-col">
<span className="font-light">{dataset.name}</span>
<span className="font-mono font-light">
<a className="underline" href={dataset.url} target="_blank">
{dataset.name}
</a>
</span>
{dataset.articles.map((article) => (
<div key={article.title} className="py-1 flex flex-col">
<span className="font-bold hover:underline">{article.title}</span>
<span className="font-light text-base">
{format(article.date)}
{format(article.date).includes('years')
? new Date(article.date).toLocaleString('en-US', options)
: format(article.date)}
</span>{' '}
</div>
))}
</div>
<div className="flex flex-col justify-start">
<a
className="border border-zinc-900 font-light px-4 py-1 text-sm transition hover:bg-zinc-900 hover:text-white"
href={dataset.url}
target="_blank"
>
info
</a>
<a
className="ml-2 border border-zinc-900 font-light px-4 py-1 text-sm transition hover:bg-zinc-900 hover:text-white"
href={`/datasets/${dataset.name}`}
@ -78,25 +84,23 @@ export function DesktopItem({ dataset }: { dataset: Dataset }) {
index === dataset.articles.length - 1 ? 'border-b' : ''
} border-zinc-400`}
>
<td className="py-8 font-light">{index === 0 ? dataset.name : ''}</td>
<td className="py-8 font-light font-mono text-[14px] text-zinc-700">
<a className="underline" href={dataset.url} target="_blank">
{index === 0 ? dataset.name : ''}
</a>
</td>
<td>
<a className="py-8 font-bold hover:underline" href={article.url}>
<a
className="py-8 font-bold hover:underline pr-2"
href={article.url}
>
{article.title}
</a>
</td>
<td className="py-8 font-light text-base min-w-[120px]">
{format(article.date)}
</td>
<td className="py-8">
{index === 0 && (
<a
className="border border-zinc-900 font-light px-[25px] py-2.5 text-sm transition hover:bg-zinc-900 hover:text-white"
href={dataset.url}
target="_blank"
>
info
</a>
)}
<td className="py-8 font-light text-[14px] min-w-[138px] font-mono text-[#999]">
{format(article.date).includes('years')
? new Date(article.date).toLocaleString('en-US', options)
: format(article.date)}
</td>
<td className="py-8">
{index === 0 && (
@ -150,7 +154,7 @@ export default function Home({ datasets }: { datasets: Dataset[] }) {
<h1 className="text-[40px] font-bold text-zinc-800 text-center">
Our Data
</h1>
<p className="max-w-2xl text-lg text-center text-zinc-700">
<p className="max-w-[600px] text-[17px] text-center text-[#6d6f71]">
Were sharing the data and code behind some of our articles and
graphics. We hope youll use it to check our work and to create
stories and visualizations of&nbsp;your&nbsp;own.
@ -164,13 +168,13 @@ export default function Home({ datasets }: { datasets: Dataset[] }) {
<table className="w-full mt-10 mb-4 hidden md:table">
<thead className="border-b-4 pb-2 border-zinc-900">
<tr>
<th className="uppercase text-left font-light text-xs pb-3">
<th className="uppercase text-left font-normal text-xs pb-3">
data set
</th>
<th className="uppercase text-left font-light text-xs pb-3">
<th className="uppercase text-left font-normal text-xs pb-3">
related content
</th>
<th className="uppercase text-left font-light text-xs pb-3">
<th className="uppercase text-left font-normal text-xs pb-3">
last updated
</th>
</tr>

View File

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 629 B

After

Width:  |  Height:  |  Size: 629 B