added progress spinner to feed and search

master
Max 5 years ago
parent cef2e80cf5
commit a1e7416845

@ -46,6 +46,7 @@ import {MatSlideToggleModule} from '@angular/material/slide-toggle';
import {MatMenuModule} from '@angular/material/menu'; import {MatMenuModule} from '@angular/material/menu';
import {MatRippleModule} from '@angular/material/core'; import {MatRippleModule} from '@angular/material/core';
import {MatBadgeModule} from '@angular/material/badge'; import {MatBadgeModule} from '@angular/material/badge';
import {MatProgressSpinnerModule} from '@angular/material/progress-spinner';
import { FlexLayoutModule } from '@angular/flex-layout'; import { FlexLayoutModule } from '@angular/flex-layout';
import { MainNavigationComponent } from './components/main-navigation/main-navigation.component'; import { MainNavigationComponent } from './components/main-navigation/main-navigation.component';
@ -124,7 +125,8 @@ const appRoutes: Routes = [
MatRippleModule, MatRippleModule,
MatTableModule, MatTableModule,
MatSortModule, MatSortModule,
MatBadgeModule MatBadgeModule,
MatProgressSpinnerModule
], ],
providers: [], providers: [],
bootstrap: [AppComponent] bootstrap: [AppComponent]

@ -1,8 +1,3 @@
<!--<div id="postinput">
<textarea #content id='input' placeholder="Post something ..." rows='3' wrap="soft"></textarea>
<button id="attach" type='submit'><span><i class="fa fa-paperclip fa-2x" aria-hidden="true"></i></span></button>
<button id="submit" type='submit' (click)=createPost(content)><span><i class="fa fa-send-o fa-2x" aria-hidden="true"></i></span></button>
</div>-->
<div id="home"> <div id="home">
<mat-card > <mat-card >
<mat-card-content> <mat-card-content>
@ -36,10 +31,6 @@
</mat-button-toggle-group> </mat-button-toggle-group>
</div> </div>
<div id="complete-feed"> <div id="complete-feed">
<!--<div id='feedchooser'>
<button id="new" (click)="showNew()">New</button>
<button id='mostliked' (click)="showMostLiked()">Most Liked</button>
</div>-->
<div id="feedlist"> <div id="feedlist">
<div *ngIf = "viewNew"> <div *ngIf = "viewNew">
<feed-postlist (voteEvent)="refresh($event)" [childPostList]="parentSelectedPostList"></feed-postlist> <feed-postlist (voteEvent)="refresh($event)" [childPostList]="parentSelectedPostList"></feed-postlist>
@ -47,6 +38,7 @@
<div *ngIf = "viewMostLiked"> <div *ngIf = "viewMostLiked">
<feed-postlist (voteEvent)="refresh($event)" [childPostList]="parentSelectedPostList"></feed-postlist> <feed-postlist (voteEvent)="refresh($event)" [childPostList]="parentSelectedPostList"></feed-postlist>
</div> </div>
<mat-spinner *ngIf="loading" style="margin:0 auto; margin-top: 5em;" diameter="50"></mat-spinner>
</div> </div>
</div> </div>
</div> </div>

@ -11,6 +11,7 @@ import { User } from 'src/app/models/user';
styleUrls: ['./feed.component.sass'] styleUrls: ['./feed.component.sass']
}) })
export class FeedComponent implements OnInit { export class FeedComponent implements OnInit {
loading = true;
checked: boolean; // if the "I protected the environment."-box is checked checked: boolean; // if the "I protected the environment."-box is checked
empty: boolean; empty: boolean;
// points value of the green action // points value of the green action
@ -38,6 +39,7 @@ export class FeedComponent implements OnInit {
if (this.loggedIn) { if (this.loggedIn) {
this.userId = user.userID; this.userId = user.userID;
this.feedService.getAllPostsRawByUserId(this.userId).subscribe(response => { this.feedService.getAllPostsRawByUserId(this.userId).subscribe(response => {
this.loading = false;
this.feedNew = this.feedService.renderAllPosts(response.json()); this.feedNew = this.feedService.renderAllPosts(response.json());
this.parentSelectedPostList = this.feedNew; this.parentSelectedPostList = this.feedNew;
this.feedMostLiked = this.feedNew; this.feedMostLiked = this.feedNew;
@ -45,6 +47,7 @@ export class FeedComponent implements OnInit {
}); });
} else { } else {
this.feedService.getAllPostsRaw().subscribe(response => { this.feedService.getAllPostsRaw().subscribe(response => {
this.loading = false;
this.feedNew = this.feedService.renderAllPosts(response.json()); this.feedNew = this.feedService.renderAllPosts(response.json());
this.parentSelectedPostList = this.feedNew; this.parentSelectedPostList = this.feedNew;
this.feedMostLiked = this.feedNew; this.feedMostLiked = this.feedNew;

@ -36,5 +36,7 @@
</div> </div>
</mat-card-header> </mat-card-header>
</mat-card> </mat-card>
<mat-spinner *ngIf="loading" style="margin:0 auto; margin-top: 5em;" diameter="50"></mat-spinner>
</div> </div>
</div> </div>

@ -37,4 +37,4 @@
.icon-box .icon-box
text-align: right text-align: right
width: 100% width: 100%

@ -13,6 +13,7 @@ import { DatasharingService } from '../../services/datasharing.service';
styleUrls: ['./search.component.sass'] styleUrls: ['./search.component.sass']
}) })
export class SearchComponent implements OnInit { export class SearchComponent implements OnInit {
loading = false;
searchValue = ' '; searchValue = ' ';
category = 'user'; category = 'user';
user: User; user: User;
@ -40,6 +41,7 @@ export class SearchComponent implements OnInit {
this.searchValue = searchWord; this.searchValue = searchWord;
if (searchWord) { // if not null or empty if (searchWord) { // if not null or empty
if (this.category === 'user') { if (this.category === 'user') {
this.loading = true;
this.findUser(searchWord); this.findUser(searchWord);
} else if (this.category === 'groupe') { } else if (this.category === 'groupe') {
// this.findUserByHandle(searchWord); // this.findUserByHandle(searchWord);
@ -74,6 +76,7 @@ export class SearchComponent implements OnInit {
} }
} }
} }
this.loading = false;
}); });
} }

Loading…
Cancel
Save