#118 Addition of a loader component for the app.
Opened 2 years ago by nishantparhi. Modified 2 years ago
nishantparhi/Fedora-app master  into  master

file modified
+2

@@ -24,6 +24,7 @@ 

  import { NoMeetingsComponent } from '../components/no-meetings/no-meetings';

  import { NoResultsComponent } from '../components/no-results/no-results';

  import { NoInternetComponent } from '../components/no-internet/no-internet';

+ import { LoaderComponent } from '../components/loadingdots/loadingdots';

  

  import { Browser } from '../providers/browser/browser';

  

@@ -49,6 +50,7 @@ 

      NoMeetingsComponent,

      NoResultsComponent,

      NoInternetComponent,

+     LoaderComponent,

      FedoraPodcast,

      PodcastPlayer

    ],

@@ -0,0 +1,29 @@ 

+ <div class="spinner"></div>

+ <style>.spinner {

+   width: 40px;

+   height: 40px;

+   background-color: #333;

+ 

+   margin: 100px auto;

+   -webkit-animation: sk-rotateplane 1.2s infinite ease-in-out;

+   animation: sk-rotateplane 1.2s infinite ease-in-out;

+ }

+ 

+ @-webkit-keyframes sk-rotateplane {

+   0% { -webkit-transform: perspective(120px) }

+   50% { -webkit-transform: perspective(120px) rotateY(180deg) }

+   100% { -webkit-transform: perspective(120px) rotateY(180deg)  rotateX(180deg) }

+ }

+ 

+ @keyframes sk-rotateplane {

+   0% { 

+     transform: perspective(120px) rotateX(0deg) rotateY(0deg);

+     -webkit-transform: perspective(120px) rotateX(0deg) rotateY(0deg) 

+   } 50% { 

+     transform: perspective(120px) rotateX(-180.1deg) rotateY(0deg);

+     -webkit-transform: perspective(120px) rotateX(-180.1deg) rotateY(0deg) 

+   } 100% { 

+     transform: perspective(120px) rotateX(-180deg) rotateY(-179.9deg);

+     -webkit-transform: perspective(120px) rotateX(-180deg) rotateY(-179.9deg);

+   }

+ }</style>

@@ -0,0 +1,12 @@ 

+  import { Component } from '@angular/core';

+  

+  @Component({

+    selector: 'loadingdots',

+    templateUrl: 'loadingdots.html'

+  })

+  export class LoaderComponent {

+  

+    constructor() {

+    }

+  

+  }

file modified
+1

@@ -22,6 +22,7 @@ 

          Popular

        </ion-segment-button>

      </ion-segment>

+     <loader *ngIf="dotsloading"></loader>

      <ion-list>

        <ion-list *ngIf="questions.length !== 0">

          <ion-card *ngFor="let question of questions" tappable (click)="openQuestion(question)">

file modified
+4

@@ -22,6 +22,8 @@ 

     * Stores list of displayed questions

     */

    private questions: Question[];

+   

+   private dotsloading;

  

    constructor(private browser: Browser,

      private askFedora: AskFedoraService) {

@@ -36,10 +38,12 @@ 

     * Fetch a list of latest questions using Ask Fedora API.

     */

    updateQuestions(type: string): void {

+   	this.dotsloading = true;

      this.askFedora

        .getQuestions(type)

        .subscribe(questions => {

          this.questions = questions || [];

+         this.dotsloading = false;

        });

    }

  

@@ -27,6 +27,7 @@ 

        Past Events

      </ion-segment-button>

    </ion-segment>

+   <loader *ngIf="dotsloading"></loader>

    <ion-list>

      <div *ngIf="meetings.length !== 0">

        <ion-card *ngFor="let meeting of meetings">

@@ -32,6 +32,8 @@ 

     * List of calendars in FedoCal

     */

    public calendars: CalendarType[];

+   

+   private dotsloading;

  

    /**

     * List of meetings in the selected calendar

@@ -81,10 +83,12 @@ 

     * @param type type of meetings to fetch, upcoming or past

     */

    updateMeetings(type: string): void {

+   this.dotsloading = true;

      this.fedoCal

        .getMeetings(this.selectedCalendar, type)

        .subscribe(meetings => {

          this.meetings = meetings;

+         this.dotsloading = false;

        });

    }

  

@@ -17,6 +17,7 @@ 

        <img src='./assets/img/sort.svg'>

      </button>

    </ion-label>

+   <loader *ngIf="dotsloading"></loader>

    <ion-list>

      <ion-card *ngFor="let post of posts let i = index">

        <ion-row>

@@ -18,6 +18,8 @@ 

     * List of posts from Fedora Magazine

     */

    private posts: Post[];

+   

+   private dotsloading;

  

    /**

     * Number of posts

@@ -50,9 +52,11 @@ 

     * Fetch latest posts from Fedor Magazine API

     */

    updatePosts(postCount): void {

+    	this.dotsloading = true;

      this.fedoraMag.getPosts(postCount)

        .subscribe(posts => {

          this.posts = posts;

+         this.dotsloading = false;

        });

    }