Giter Site home page Giter Site logo

andrewjbateman / ionic-angular-world-data Goto Github PK

View Code? Open in Web Editor NEW
16.0 2.0 3.0 30.35 MB

:clipboard: Ionic-Angular app that displays information about world countries and oceans using JSON data fetched from a REST API. Includes a user search of countries/capitals. Page popovers used to provide links to external websites or activate functions such as delete item from favourites.

Home Page: https://ionic-world-info.web.app

License: MIT License

JavaScript 2.30% TypeScript 52.93% HTML 27.74% Roff 0.25% SCSS 16.77%
ionic5 api-rest countries favourites oceans popover ionic rest-countries storage json-data

ionic-angular-world-data's Introduction

⚑ Ionic Country Data

  • Ionic app that displays data about countries and oceans from the Rest Countries API, Leaflet maps and a local JSON file. Note: to open web links in a new window use: ctrl+click on link

GitHub repo size GitHub pull requests GitHub Repo stars GitHub last commit

πŸ“„ Table of contents

πŸ“š General info

  • The Rest Countries API v3 has a number of endpoints that can be used to search for info. I have used the endpoints: All?fields=name,capital,region,flags, Name & Region. The API Response Example was useful to create my http interface class.
  • Leaflet maps displays a map of the chosen country that the user can zoom in and out of.
  • Angular KeyValuePipe used to extract values from key-value pairs
  • Latest Angular flow control template syntax used - @for and @if.

πŸ“· Screenshots

Ionic page Ionic page Ionic page
Country-List Page Country-List Page - Dark Country-List - Detail
Ionic page Ionic page Ionic page
Map View Page Side Menu Side Menu - Dark
Ionic page Ionic page Ionic page
Oceans-List Page Oceans Page - Dark Oceans Page + Popover
Ionic page Ionic page Ionic page
Favourites Page Favourites Page + Popover Favourites Page - Dark
Ionic page Ionic page Ionic page
About Page About Page + Popover About Page - Dark

πŸ“Ά Technologies

πŸ’Ύ Setup

  • Run npm i to install dependencies
  • ionic serve to start the server on _localhost://8100_
  • To create a build file suitable for Firebase deployment: ionic build --release
  • To deploy to Firebase: firebase deploy

πŸ’» Code Examples

  • service function to fetch API country details, from rest-api.service.ts using the take(1) method so unsubscribing from the observable is not necessary.
fetchCountryDetailData(country: string): Observable<CountryDetail[]> {
  return this.httpClient
    .get<CountryDetail[]>(`${apiUrl}/name/${country}?fullText=true`)
    .pipe(
      take(1),
      catchError((error) => {
      return throwError('Country not found', error);
    })
  );
}

πŸ†’ Features

  • integrated Leaflet Maps API to show country map. Free.
  • Typescript interface used to define the expected structures of the json objects returned from the API.
  • Separate services page with API http fetch functions.
  • RxJS Observables used to extract data asynchronously.
  • Dark mode switch on menu.
  • Offline Storage (future) of favourite countries/oceans using Ionic Storage.
  • ion-grid with fixed column size used so country content data will display ok even on a PC.
  • search function to search for country name with regex to only allow letters in search text.

πŸ“‹ General/Navigation/Pages

  • Nav side-bar: countries, oceans, favorites, about, dark theme toggle.

  • Countries page: Displays mat-card list of countries, displaying country flag, title, capital and region, for 'all' and 5 region sub-categories. Clicking on a country list item will show the country detail (no routing required - all done using @if in the html content :-)). Country searchbar to search by country name. Fab icon link to map of country.

  • Oceans page Displays a mat-card for each ocean using data from a local json file and an *ngFor loop. Menu popover with links to further info for each ocean. It was decided not to add 'favourites functionality' as there are only 5 oceans and they are easy to find.

  • Maps page Displays Leaflet map of country and surrounding area with Capital in an offset tooltip

  • Favourites Displays user favourites and popover allows them to be deleted. Shows an image with text below if there are no favourites

  • About Displays image with author credit and short info about the app with links to APIs used. Header includes popover with working links to Author Website, Github Repo & author website contact page

πŸ“‹ Status & To-do list

  • Status: Working

πŸ“‹ To-do

  1. Add delete from favourites from individual country card - show heart red or hollow
  2. Progress bar - check it is working
  3. Add eslinting - currently will not install due to rxjs version
  4. Splash screen
  5. SqLite - use as default database?
  6. Lighthouse score?
  7. Run on simulator

πŸ‘ Inspiration

πŸ“ License

  • This project is licensed under the terms of the MIT license.

βœ‰οΈ Contact

ionic-angular-world-data's People

Contributors

andrewjbateman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.