noi-techpark / webcomp-mobility-echarging-map

Web Component to show a map of E-Charging Stations in South Tyrol
https://webcomponents.opendatahub.com/webcomponent/98013c75-f27c-414e-aff9-c58ed760e791
GNU Affero General Public License v3.0
0 stars 3 forks source link
opendata opendatahub opendatahub-webcomponent webcomponents

webcomp-mobility-echarging-map

This project contains the map web component for the Green Mobility South Tyrol project.

REUSE Compliance CI/CD

Green Mobility South Tyrol wants to split the existing functionalities of the website into reusable and independent components. Using these webcomponents, a developer can easily integrate the functionality of the single components into any website. The data source for the components is the Open Data Hub project.

Table of Contents

Usage

Include the Javascript file dist/map_widget.min.js in your HTML and define the web component like this:

<e-mobility-map-widget></e-mobility-map-widget>

Options

Translations

Add language as attribute, if you want to translate the web component.

<e-mobility-dashboard-widget language="en"></e-mobility-dashboard-widget>

Possible values are currently en, de, it, nl, cs, pl, fr, ru (see /src/translations.js).

Logo

URL of an icon, that will be shown in the lower left corner.

<e-mobility-map-widget logo="https://www.example.com/your-logo.png"></e-mobility-map-widget>

Marker

To configure desired starting location with marker, add current_location attribute. lat and lng will be the Latitude and Longitude coordinates of your desired location, respectively.

<e-mobility-map-widget current_location='{ "lat": 46.5, "lng": 11.33 }'></e-mobility-map-widget>

Font

To configure desired font, add fontFamily attribute. Default font is "Suedtirol".

<e-mobility-map-widget fontFamily="Arial"></e-mobility-map-widget>

Styling

This web component has only one style variable, namely --e-mobility-widget-map-height, which sets the height of the widget.

For example:

<style>
  e-mobility-map-widget.YOUR_CLASS_NAME {
    --e-mobility-widget-map-height: 200px;
  }
</style>

<e-mobility-map-widget 
  class="YOUR_CLASS_NAME" 
  logo="logo.png" 
  language="it"
  current_location='{ "lat": 46.5, "lng": 11.33 }'
  fontFamily="Arial"
></e-mobility-map-widget>

The width of this component reacts on regular css rules. Configure the display property accordingly, for instance, as display: block, if you want to hardcode the dimensions.

Getting started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

To build the project, the following prerequisites must be met:

For a ready to use Docker environment with all prerequisites already installed and prepared, you can check out the Docker environment section.

Source code

Get a copy of the repository:

git clone https://github.com/noi-techpark/webcomp-mobility-echarging-map.git

Change directory:

cd webcomp-mobility-echarging-map/

Dependencies

Download all dependencies:

npm install

Build

Build and start the project:

npm run start

The application will be served and can be accessed at http://localhost:8000.

Deployment

To create the distributable files, execute the following command:

npm run build

Docker environment

For the project a Docker environment is already prepared and ready to use with all necessary prerequisites.

These Docker containers are the same as used by the continuous integration servers.

Installation

Install Docker (with Docker Compose) locally on your machine.

Dependenices

First, install all dependencies:

docker-compose run --rm app /bin/bash -c "npm install"

Start and stop the containers

Before start working you have to start the Docker containers:

docker-compose up --build --detach

After finished working you can stop the Docker containers:

docker-compose stop

Running commands inside the container

When the containers are running, you can execute any command inside the environment. Just replace the dots ... in the following example with the command you wish to execute:

docker-compose run --rm app /bin/bash -c "..."

Some examples are:

docker-compose run --rm app /bin/bash -c "npm run build"

Information

Support

ToDo: For support, please contact help@opendatahub.com.

Contributing

If you'd like to contribute, please follow the following instructions:

A more detailed description can be found here: https://github.com/noi-techpark/documentation/blob/master/contributors.md.

Documentation

More documentation can be found at https://opendatahub.readthedocs.io/en/latest/index.html.

Boilerplate

The project uses this boilerplate: https://github.com/noi-techpark/webcomp-boilerplate.

License

The code in this project is licensed under the GNU AFFERO GENERAL PUBLIC LICENSE Version 3 license. See the LICENSE.md file for more information.

REUSE

This project is REUSE compliant, more information about the usage of REUSE in NOI Techpark repositories can be found here.

Since the CI for this project checks for REUSE compliance you might find it useful to use a pre-commit hook checking for REUSE compliance locally. The pre-commit-config file in the repository root is already configured to check for REUSE compliance with help of the pre-commit tool.

Install the tool by running:

pip install pre-commit

Then install the pre-commit hook via the config file by running:

pre-commit install