https://github.com/undp-data/dv-electricity-access-map
https://github.com/undp-data/dv-electricity-access-map
Last synced: over 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/undp-data/dv-electricity-access-map
- Owner: UNDP-Data
- Created: 2023-03-02T17:56:59.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-11-06T16:04:47.000Z (over 2 years ago)
- Last Synced: 2025-01-16T04:43:35.900Z (over 1 year ago)
- Language: TypeScript
- Size: 313 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Electricity Access from Space
#### Electricity access from space [Click here to see the interface](https://witty-tree-055fdd510.4.azurestaticapps.net).
## Table of Contents
* [Link for the visualization](#section-01)
* [Deployment](#deployment)
* [Steps to integrate the vis in static page](#section-02)
* [Pages on DFP where This Viz is Used](#section-03)
* [Related Repos](#section-04)
* [Global CSS Files and Repo](#section-05)
* [Build With](#section-06)
* [Installation](#section-07)
* [Local Deployment](#section-08)
* [Available Scripts](#section-09)
* [Tooling Setup](#section-10)
## Link for the visualization
[https://witty-tree-055fdd510.4.azurestaticapps.net](https://witty-tree-055fdd510.4.azurestaticapps.net)
## Deployment
The Production site deployed using Azure Static Web App and work flow can be found [here](https://github.com/UNDP-Data/dv-electricity-access-map/blob/master/.github/workflows/azure-static-web-apps-witty-tree-055fdd510.yml)
## Steps to Integrating the Visualization in the Data Future Platform or Any Other Page
Add the following div in the page
```
```
Apart from the mentioned `div` above the following `script` and `link` needs to be added to the `head` or in the embed code
```
```
## Pages on DFP Where the Visualization is Used
[Electricity access today and future](https://data.undp.org/insights/electricity-access-today-and-future)
## Related Repos
* [__stylesheet-for-viz__](https://github.com/UNDP-Data/stylesheets-for-viz): Repo which defines the css settings for the project
## Global CSS for UI and Graphs
__Git Repo__: https://github.com/UNDP-Data/stylesheets-for-viz
__Link for stylesheets__
* https://undp-data.github.io/stylesheets-for-viz/style/mainStyleSheet.css
* https://undp-data.github.io/stylesheets-for-viz/style/StyleForGraphingInterface.css
* https://undp-data.github.io/stylesheets-for-viz/style/StyleForGraph.css
## Build with
* __React__: Used as MVC framework.
* __styled-components__: Utilizes tagged template literals and the power of CSS, allows to write actual CSS code to style the components in JS/TS.
* __Various D3 Libraries__: Used for visualizations, adding interaction and reading the csv data file.
* __MapLibre__: This is package for creating sub-national maps.
* __AntD__: For UI elements like dropdown, buttons, checkbox, and slider.
* __lodash__: Used for manipulating and iterating arrays and objects.
* __undp-viz-colors__: This is package for defining the visualization color palette.
## Installation
This project uses `npm`. For installation you will need to install `node` and `npm`, if you don't already have it. `node` and `npm` can be installed from [here](https://nodejs.org/en/download/).
To install the project, simply clone the the repo and them run `npm install` in the project folder. You can use terminal on Mac and Command Prompt on Windows.
This project is bootstrapped with [`Vite`](https://vitejs.dev/) and was created using `npm create vite@latest` command.
Run the terminal or command prompt and then run the following
```
git clone https://github.com/UNDP-Data/dv-electricity-access-map.git
cd dv-electricity-access-map
npm install
```
## Local Development
To start the project locally, you can run `npm run dev` in the project folder in terminal or command prompt.
This is run the app in development mode. Open [http://localhost:5173/](http://localhost:5173/) to view it in the browser.
The page will reload if you make edits. You will also see any lint errors in the console.
## Available Scripts
* `npm run dev`: Executes `vite` and start the local server for local deployment.
* `npm run build`: Executes `tsc && vite build` and builds the app for production and deployment.
## Tooling Setup
This project uses ESLint integrated with prettier, which verifies and formats your code so you don't have to do it manually. You should have your editor set up to display lint errors and automatically fix those which it is possible to fix. See [http://eslint.org/docs/user-guide/integrations](http://eslint.org/docs/user-guide/integrations).
This project is build in Visual Studio Code, therefore the project is already set up to work with. Install it from [here](https://code.visualstudio.com/) and then install this [eslint plugin](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and you should be good to go.