Skip to content

Commit

Permalink
Use typescript, update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
rosslh committed Aug 5, 2024
1 parent fccd6ab commit e54af23
Show file tree
Hide file tree
Showing 28 changed files with 1,376 additions and 16,362 deletions.
30 changes: 26 additions & 4 deletions ReadMe.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,33 @@
# MetaProjection.ca

[![Netlify Status](https://api.netlify.com/api/v1/badges/3dd4e416-74a7-49b1-847a-ad95a0b44607/deploy-status)](https://app.netlify.com/sites/metaprojection/deploys)
[![Uptime Robot status](https://img.shields.io/uptimerobot/status/m792388124-b7e4417815ddd9388914883d)](https://www.metaprojection.ca/)
[MetaProjection.ca](https://www.metaprojection.ca/) is a web application designed to provide Canadian voters with up-to-date electoral projections. By aggregating data from multiple trusted sources, it offers a clear and comprehensive overview of how the election is shaping up, both at the federal level and within individual electoral districts.

[MetaProjection.ca](https://www.metaprojection.ca/) is a web application that aggregates Canadian electoral projections from multiple sources and provides an overview of how the election is playing out, both federally and by district.
![Netlify](https://img.shields.io/netlify/3dd4e416-74a7-49b1-847a-ad95a0b44607?style=flat-square&label=Netlify)
![Uptime Robot status](https://img.shields.io/uptimerobot/status/m792388124-b7e4417815ddd9388914883d?up_message=online&style=flat-square&label=Status)
![Uptime Robot ratio (30 days)](<https://img.shields.io/uptimerobot/ratio/m792388124-b7e4417815ddd9388914883d?style=flat-square&label=Uptime%20(1mo)>)

A map is displayed at the top of the page which indicates how each electoral district is likely to vote. The application uses the user’s geolocation to find their district and display its likely winner.
## Features

### Interactive Electoral Map

The centerpiece of the application is an interactive map displayed prominently at the top of the page. This map provides a visual representation of how each electoral district across Canada is likely to vote. The color-coded districts allow users to quickly grasp the projected political landscape at a glance.

### Personalized District Information

MetaProjection.ca takes user experience a step further by utilizing geolocation technology. Upon granting permission, the application can identify the user's current electoral district and highlight it on the map. This feature allows voters to immediately see the projected outcome for their local area, fostering a more engaged and informed electorate.

### Comprehensive Data Aggregation

By compiling projections from various reputable sources, MetaProjection.ca offers a balanced and nuanced view of the electoral landscape. This approach helps mitigate potential biases and provides users with a more accurate overall picture of the upcoming election.

## How It Works

1. Visit [MetaProjection.ca](https://www.metaprojection.ca/)
2. Allow geolocation access for personalized district information (optional)
3. Explore the interactive map to view projections for different regions
4. Dive deeper into specific districts or overall federal projections as needed

MetaProjection.ca aims to be an essential tool for Canadian voters, political analysts, and anyone interested in staying informed about the country's electoral dynamics.

## Technologies used

Expand Down
167 changes: 84 additions & 83 deletions client/gatsby-config.js
Original file line number Diff line number Diff line change
@@ -1,86 +1,87 @@
"use strict";
module.exports = {
siteMetadata: {
title: `MetaProjection`,
description: `MetaProjection aggregates multiple Canadian electoral projections to provide an overview of how the election is playing out`,
author: `Ross Hill`,
// no trailing slash
url: `https://www.metaprojection.ca`,
publishTimestamp: new Date().getTime(),
},
plugins: [
`gatsby-plugin-react-leaflet`,
{
resolve: `gatsby-plugin-typography`,
options: {
pathToConfigModule: `src/utils/typography`,
},
siteMetadata: {
title: `MetaProjection`,
description: `MetaProjection aggregates multiple Canadian electoral projections to provide an overview of how the election is playing out`,
author: `Ross Hill`,
// no trailing slash
url: `https://www.metaprojection.ca`,
publishTimestamp: new Date().getTime(),
},
`gatsby-transformer-json`,
// {
// resolve: `gatsby-source-filesystem`,
// options: {
// name: `ByDistrict2021`,
// path: `${__dirname}/src/data/2021/byDistrict`,
// },
// },
// {
// resolve: `gatsby-source-filesystem`,
// options: {
// name: `Federal2021`,
// path: `${__dirname}/src/data/2021/federal/${new Date()
// .toISOString()
// .slice(0, 10)}.json`,
// },
// },
// {
// resolve: `gatsby-source-filesystem`,
// options: {
// name: `ByDistrict2019`,
// path: `${__dirname}/src/data/2019/byDistrict`,
// },
// },
// {
// resolve: `gatsby-source-filesystem`,
// options: {
// name: `Federal2019`,
// path: `${__dirname}/src/data/2019/federal/${new Date()
// .toISOString()
// .slice(0, 10)}.json`,
// },
// },
`gatsby-plugin-react-helmet`,
{
resolve: `gatsby-source-filesystem`,
options: {
name: `images`,
path: `${__dirname}/src/images`,
},
},
`gatsby-transformer-sharp`,
`gatsby-plugin-sharp`,
{
resolve: `gatsby-plugin-manifest`,
options: {
name: `MetaProjection`,
short_name: `MetaProjection`,
start_url: `/`,
background_color: `#950451`,
theme_color: `#950451`,
display: `minimal-ui`,
icon: `${__dirname}/src/images/icon.png`,
},
},
// this (optional) plugin enables Progressive Web App + Offline functionality. To learn more, visit: https://gatsby.dev/offline
// `gatsby-plugin-offline`,
`gatsby-plugin-emotion`,
{
resolve: "gatsby-plugin-sentry",
options: {
dsn: "https://[email protected]/1778220",
// Optional settings, see https://docs.sentry.io/clients/node/config/#optional-settings
environment: process.env.NODE_ENV,
enabled: true,
},
},
],
plugins: [
`gatsby-plugin-react-leaflet`,
{
resolve: `gatsby-plugin-typography`,
options: {
pathToConfigModule: `src/utils/typography`,
},
},
`gatsby-transformer-json`,
// {
// resolve: `gatsby-source-filesystem`,
// options: {
// name: `ByDistrict2021`,
// path: `${__dirname}/src/data/2021/byDistrict`,
// },
// },
// {
// resolve: `gatsby-source-filesystem`,
// options: {
// name: `Federal2021`,
// path: `${__dirname}/src/data/2021/federal/${new Date()
// .toISOString()
// .slice(0, 10)}.json`,
// },
// },
// {
// resolve: `gatsby-source-filesystem`,
// options: {
// name: `ByDistrict2019`,
// path: `${__dirname}/src/data/2019/byDistrict`,
// },
// },
// {
// resolve: `gatsby-source-filesystem`,
// options: {
// name: `Federal2019`,
// path: `${__dirname}/src/data/2019/federal/${new Date()
// .toISOString()
// .slice(0, 10)}.json`,
// },
// },
`gatsby-plugin-react-helmet`,
{
resolve: `gatsby-source-filesystem`,
options: {
name: `images`,
path: `${__dirname}/src/images`,
},
},
`gatsby-transformer-sharp`,
`gatsby-plugin-sharp`,
{
resolve: `gatsby-plugin-manifest`,
options: {
name: `MetaProjection`,
short_name: `MetaProjection`,
start_url: `/`,
background_color: `#950451`,
theme_color: `#950451`,
display: `minimal-ui`,
icon: `${__dirname}/src/images/icon.png`,
},
},
// this (optional) plugin enables Progressive Web App + Offline functionality. To learn more, visit: https://gatsby.dev/offline
// `gatsby-plugin-offline`,
`gatsby-plugin-emotion`,
{
resolve: "gatsby-plugin-sentry",
options: {
dsn: "https://[email protected]/1778220",
// Optional settings, see https://docs.sentry.io/clients/node/config/#optional-settings
environment: process.env.NODE_ENV,
enabled: true,
},
},
],
};
86 changes: 86 additions & 0 deletions client/gatsby-config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
module.exports = {
siteMetadata: {
title: `MetaProjection`,
description: `MetaProjection aggregates multiple Canadian electoral projections to provide an overview of how the election is playing out`,
author: `Ross Hill`,
// no trailing slash
url: `https://www.metaprojection.ca`,
publishTimestamp: new Date().getTime(),
},
plugins: [
`gatsby-plugin-react-leaflet`,
{
resolve: `gatsby-plugin-typography`,
options: {
pathToConfigModule: `src/utils/typography`,
},
},
`gatsby-transformer-json`,
// {
// resolve: `gatsby-source-filesystem`,
// options: {
// name: `ByDistrict2021`,
// path: `${__dirname}/src/data/2021/byDistrict`,
// },
// },
// {
// resolve: `gatsby-source-filesystem`,
// options: {
// name: `Federal2021`,
// path: `${__dirname}/src/data/2021/federal/${new Date()
// .toISOString()
// .slice(0, 10)}.json`,
// },
// },
// {
// resolve: `gatsby-source-filesystem`,
// options: {
// name: `ByDistrict2019`,
// path: `${__dirname}/src/data/2019/byDistrict`,
// },
// },
// {
// resolve: `gatsby-source-filesystem`,
// options: {
// name: `Federal2019`,
// path: `${__dirname}/src/data/2019/federal/${new Date()
// .toISOString()
// .slice(0, 10)}.json`,
// },
// },
`gatsby-plugin-react-helmet`,
{
resolve: `gatsby-source-filesystem`,
options: {
name: `images`,
path: `${__dirname}/src/images`,
},
},
`gatsby-transformer-sharp`,
`gatsby-plugin-sharp`,
{
resolve: `gatsby-plugin-manifest`,
options: {
name: `MetaProjection`,
short_name: `MetaProjection`,
start_url: `/`,
background_color: `#950451`,
theme_color: `#950451`,
display: `minimal-ui`,
icon: `${__dirname}/src/images/icon.png`,
},
},
// this (optional) plugin enables Progressive Web App + Offline functionality. To learn more, visit: https://gatsby.dev/offline
// `gatsby-plugin-offline`,
`gatsby-plugin-emotion`,
{
resolve: "gatsby-plugin-sentry",
options: {
dsn: "https://[email protected]/1778220",
// Optional settings, see https://docs.sentry.io/clients/node/config/#optional-settings
environment: process.env.NODE_ENV,
enabled: true,
},
},
],
};
54 changes: 27 additions & 27 deletions client/gatsby-node.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
"use strict";
// const path = require("path");
// const data = require("./src/data/districts.json");
// const slugify = require("slugify");

exports.createPages = (/* { boundActionCreators, actions } */) => {
// const { createPage } = boundActionCreators;
// const { createRedirect } = actions;
// // Your component that should be rendered for every item in JSON.
// const template = path.resolve(`src/templates/district.js`);
// // Create pages for each JSON entry.
// data.forEach(({ number, name }) => {
// const path = `/riding/${slugify(name)}`;
// const redirectPath = `/district/${number}`;
// createPage({
// path,
// component: template,
// // Send additional data to page from JSON (or query inside template)
// context: {
// relativePath: path,
// number,
// name,
// },
// });
// createRedirect({
// fromPath: redirectPath,
// toPath: path,
// isPermanent: true,
// redirectInBrowser: true, // still need this for findDistrict programmatic routing
// });
// });
exports.createPages = ( /* { boundActionCreators, actions } */) => {
// const { createPage } = boundActionCreators;
// const { createRedirect } = actions;
// // Your component that should be rendered for every item in JSON.
// const template = path.resolve(`src/templates/district.js`);
// // Create pages for each JSON entry.
// data.forEach(({ number, name }) => {
// const path = `/riding/${slugify(name)}`;
// const redirectPath = `/district/${number}`;
// createPage({
// path,
// component: template,
// // Send additional data to page from JSON (or query inside template)
// context: {
// relativePath: path,
// number,
// name,
// },
// });
// createRedirect({
// fromPath: redirectPath,
// toPath: path,
// isPermanent: true,
// redirectInBrowser: true, // still need this for findDistrict programmatic routing
// });
// });
};
31 changes: 31 additions & 0 deletions client/gatsby-node.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// const path = require("path");
// const data = require("./src/data/districts.json");
// const slugify = require("slugify");

exports.createPages = (/* { boundActionCreators, actions } */) => {
// const { createPage } = boundActionCreators;
// const { createRedirect } = actions;
// // Your component that should be rendered for every item in JSON.
// const template = path.resolve(`src/templates/district.js`);
// // Create pages for each JSON entry.
// data.forEach(({ number, name }) => {
// const path = `/riding/${slugify(name)}`;
// const redirectPath = `/district/${number}`;
// createPage({
// path,
// component: template,
// // Send additional data to page from JSON (or query inside template)
// context: {
// relativePath: path,
// number,
// name,
// },
// });
// createRedirect({
// fromPath: redirectPath,
// toPath: path,
// isPermanent: true,
// redirectInBrowser: true, // still need this for findDistrict programmatic routing
// });
// });
};
9 changes: 9 additions & 0 deletions client/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
declare module "*.png" {
const content: string;
export default content;
}

declare module "*.jpg" {
const content: string;
export default content;
}
Loading

0 comments on commit e54af23

Please sign in to comment.