diff --git a/backend/app/views.py b/backend/app/views.py index 029b082..6742358 100644 --- a/backend/app/views.py +++ b/backend/app/views.py @@ -41,23 +41,6 @@ def index(request): return render(request, 'index.html', context) -def example(request, example_id=None): - """ - Example page - """ - - context = { - 'page_metadata': { - 'title': 'Example ID page' - }, - 'component_props': { - 'id': example_id - }, - 'component_name': 'ExampleId', - } - return render(request, 'index.html', context) - - def competitiveness(request): """ Competitiveness Map Page @@ -73,7 +56,7 @@ def competitiveness(request): return render(request, 'index.html', context) -def PieChart(request, example_id=None): +def PieChart(request): """ Displays PieChart for data from election campaign finance """ @@ -87,7 +70,7 @@ def PieChart(request, example_id=None): return render(request, 'index.html', context) -def BarChart(request, example_id=None): +def BarChart(request): """ Displays Bar Chart for data from election campaign finance """ @@ -101,7 +84,7 @@ def BarChart(request, example_id=None): return render(request, 'index.html', context) -def FinanceSankey(request, example_id=None): +def FinanceSankey(request): """ Displays FinanceSankey for data from election campaign finance """ diff --git a/backend/config/urls.py b/backend/config/urls.py index b044489..1a597f4 100644 --- a/backend/config/urls.py +++ b/backend/config/urls.py @@ -27,16 +27,12 @@ # View Pages ################################################################################ path('', views.index), - path('example/', views.example), - path('example/', views.example), path('competitiveness', views.competitiveness), path('campaign-finance/top-10-donors-piechart/', views.PieChart), path('campaign-finance/top-10-donors-barchart/', views.BarChart), path('campaign-finance/donor-party-sankey/', views.FinanceSankey), - - ################################################################################ # API endpoints ################################################################################ diff --git a/frontend/components/ExampleId.js b/frontend/components/ExampleId.js deleted file mode 100644 index e6fe07d..0000000 --- a/frontend/components/ExampleId.js +++ /dev/null @@ -1,85 +0,0 @@ -import React, {useState, useEffect} from "react"; -import * as PropTypes from "prop-types"; -import MapBase from "../components/global/MapBase"; -import {GeoJSON, Polygon} from "react-leaflet"; -export const DEFAULT_MAP_CENTER_LAT = 20.5937; -export const DEFAULT_MAP_CENTER_LNG = 78.9629; - -const multiPolygon = [ - [ - [20.5536, 78.9681], - [20.5530, 78.9681], - [20.5530, 78.9695] - ] -]; -const fillBlueOptions = {fillColor: "blue"}; - -function geojsonLayer(geojson) { - return geojson !== null ? ( - geojson["features"].map((feature) => { - return ( - - ); - }) - ) : <>; -} - -const ExampleId = ({id}) => { - - const [tracker, setTracker] = useState(0); - - const onButtonClick = () => { - setTracker(previousState => previousState + 1); - }; - - const [mapData, setMapData] = useState(null); - - useEffect(() => { - async function getGeojson() { - const mapResponse = await fetch("/api/SDE_DATA_IN_F7DSTRBND_1991/10"); - const result = await mapResponse.json(); - if (!ignore) { - setMapData(result); - } - } - - let ignore = false; - getGeojson(); - return () => { - ignore = true; - }; - }); - - return ( -
-

This is the Example ID page.

-

- This page demonstrates passing view parameters from Django to React - and very simple state management. -

-

View params:

-
    -
  • ID: {id}
  • -
-

Example state: {tracker}

- - , - SDE_DATA_IN_F7DSTRBND_1991: geojsonLayer(mapData) - }}/> -
- ); -}; - -ExampleId.propTypes = { - id: PropTypes.number -}; - -export default ExampleId; diff --git a/frontend/components/ExampleId.module.scss b/frontend/components/ExampleId.module.scss deleted file mode 100644 index e69de29..0000000 diff --git a/frontend/components/global/Nav.js b/frontend/components/global/Nav.js index db35dd4..ebe2bd2 100644 --- a/frontend/components/global/Nav.js +++ b/frontend/components/global/Nav.js @@ -2,18 +2,23 @@ import React from "react"; import DH_LOGO from "../../images/dh_logo.svg"; const Nav = () => { - return ( ); diff --git a/frontend/index.js b/frontend/index.js index cabaf5b..28997fc 100644 --- a/frontend/index.js +++ b/frontend/index.js @@ -4,7 +4,6 @@ import "./scss/index.scss"; import "bootstrap/dist/css/bootstrap.min.css"; import Base from "./components/global/Base"; import ErrorNotFoundComponent from "./components/ErrorNotFoundComponent"; -import ExampleId from "./components/ExampleId"; import Home from "./components/Home"; import CompetitivenessMap from "./components/CompetitivenessMap"; import PieChart from "./components/PieChart"; @@ -17,12 +16,11 @@ const COMPONENT_NAME = JSON.parse(COMPONENT_NAME_RAW); const COMPONENTS = { ErrorNotFoundComponent, - ExampleId, - CompetitivenessMap, Home, PieChart, BarChart, - FinanceSankey + FinanceSankey, + CompetitivenessMap }; const PreselectedComponent = COMPONENTS[COMPONENT_NAME || "ErrorNotFoundComponent"]; diff --git a/frontend/scss/example.scss b/frontend/scss/competitivenessMap.scss similarity index 77% rename from frontend/scss/example.scss rename to frontend/scss/competitivenessMap.scss index c332d3f..c5421cb 100644 --- a/frontend/scss/example.scss +++ b/frontend/scss/competitivenessMap.scss @@ -1,52 +1,45 @@ -.example { - .list { - list-style: none; - padding: 0.5rem; - } +.map-display { display: flex; - } -.dataDisplay{ + +.data-display { display: flex; text-align: left; font-size: large; - background-color: 'red'; + background-color: "red"; width: 30%; align-items: center; justify-content: left; font-size: larger; padding-left: 2%; margin-top: 5%; - } -.dataDisplay div { +.data-display div { margin-top: 5px; - } -.slider{ +.slider { width: 25%; position: absolute; - right:0; + right: 0; display: flex; justify-content: left; flex-direction: column; - } -.mapTitle{ +.map-title { font-weight: bold; font-size: xx-large; margin: 0.5rem; text-align: center; } -.mapSubtitle{ +.map-subtitle { font-weight: bold; font-size: larger; - } + #map-container { z-index: 1; height: calc(100vh); diff --git a/frontend/scss/index.scss b/frontend/scss/index.scss index a218186..9b8e70e 100644 --- a/frontend/scss/index.scss +++ b/frontend/scss/index.scss @@ -1,5 +1,5 @@ -@import '~normalize.css'; -@import './global.scss'; -@import './nav.scss'; -@import './example.scss'; -@import '~bootstrap/scss/bootstrap'; +@import "~normalize.css"; +@import "./global.scss"; +@import "./nav.scss"; +@import "./competitivenessMap.scss"; +@import "~bootstrap/scss/bootstrap";