Merge branch 'max_dev' of Software_Engineering_I/greenvironment-frontend into master

master
Trivernis 5 years ago committed by Gitea
commit 534d025790

@ -39,6 +39,7 @@ export class FeedComponent implements OnInit {
} }
ngOnInit() { ngOnInit() {
console.log('init feedcomponent');
this.data.currentUserInfo.subscribe(user => { this.data.currentUserInfo.subscribe(user => {
this.user = user; this.user = user;
this.loggedIn = user.loggedIn; this.loggedIn = user.loggedIn;
@ -55,7 +56,6 @@ export class FeedComponent implements OnInit {
this.loadingNew = response; this.loadingNew = response;
}); });
this.feedService.topPostsAvailable.subscribe(response => { this.feedService.topPostsAvailable.subscribe(response => {
console.log(response);
this.loadingMostLiked = response; this.loadingMostLiked = response;
}); });
} }
@ -83,7 +83,6 @@ export class FeedComponent implements OnInit {
} }
onScroll() { onScroll() {
console.log('scrolled');
this.feedService.getNextPosts(); this.feedService.getNextPosts();
} }

@ -1,4 +1,5 @@
<div id="content" fxShow="true" fxHide.lt-md="true"> <!--on big screen-->
<div id="content" *ngIf="media.isActive('md') || media.isActive('lg')">
<div id="chat"> <div id="chat">
<home-chatmanager [hidden]="!loggedIn"></home-chatmanager> <home-chatmanager [hidden]="!loggedIn"></home-chatmanager>
</div> </div>
@ -12,14 +13,9 @@
<home-search></home-search> <home-search></home-search>
</div> </div>
</div> </div>
<!--
<mat-tab-group headerPosition="below" position="0" id="bottom-menu" fxShow="true" fxHide.gt-sm="true"> <!--on small screen-->
<mat-tab label="First"> <home-chatmanager ></home-chatmanager></mat-tab> <div class="bottom-menu" *ngIf="media.isActive('sm') || media.isActive('xs')">
<mat-tab label="Second"><home-feed id="feed"></home-feed></mat-tab>
<mat-tab label="Third"> <home-social ></home-social></mat-tab>
</mat-tab-group>
-->
<div class="bottom-menu" fxShow="true" fxHide.gt-sm="true">
<mat-tab-group id="tab-group" selectedIndex="1" mat-stretch-tabs headerPosition="below"> <mat-tab-group id="tab-group" selectedIndex="1" mat-stretch-tabs headerPosition="below">
<mat-tab disabled> <mat-tab disabled>
<ng-template mat-tab-label> <ng-template mat-tab-label>

@ -1,6 +1,6 @@
import {Component, OnInit} from '@angular/core'; import {Component, OnInit} from '@angular/core';
import {DatasharingService} from 'src/app/services/datasharing.service'; import {DatasharingService} from 'src/app/services/datasharing.service';
import {FeedService} from 'src/app/services/feed/feed.service'; import { MediaObserver } from '@angular/flex-layout';
@Component({ @Component({
selector: 'app-home', selector: 'app-home',
@ -11,7 +11,7 @@ export class HomeComponent implements OnInit {
loggedIn: boolean; loggedIn: boolean;
constructor(private data: DatasharingService, private feedService: FeedService) { constructor(private data: DatasharingService, public media: MediaObserver) {
} }
ngOnInit() { ngOnInit() {

@ -3,6 +3,12 @@
.dialogFormField .dialogFormField
width: 100% width: 100%
#error
margin-top: 1em
#progress-bar
margin-top: 1em
.confirmationButton .confirmationButton
background-color: $primary-color background-color: $primary-color

@ -1,5 +1,5 @@
<div id="file-upload-dialog"> <div id="file-upload-dialog">
<h1 mat-dialog-title align="center">Upload a new Profile Picture!</h1> <h1 mat-dialog-title align="center">Upload a new profile picture!</h1>
<div class="uploadDialogContent" mat-dialog-content> <div class="uploadDialogContent" mat-dialog-content>
<input style="display: none" id="input-file" type="file" accept="image/*" (change)="onFileInputChange($event)" #name> <input style="display: none" id="input-file" type="file" accept="image/*" (change)="onFileInputChange($event)" #name>
<label for="input-file" class="mat-button mat-raised-button mat-primary">Choose File</label> <label for="input-file" class="mat-button mat-raised-button mat-primary">Choose File</label>
@ -7,9 +7,9 @@
<h2 *ngIf="localFileUrl">Preview:</h2> <h2 *ngIf="localFileUrl">Preview:</h2>
<img *ngIf="localFileUrl" id="inputPreview" [src]="localFileUrl"/> <img *ngIf="localFileUrl" id="inputPreview" [src]="localFileUrl"/>
</div> </div>
<mat-progress-bar *ngIf="uploading" mode="indeterminate"></mat-progress-bar> <mat-progress-bar id="progress-bar" *ngIf="uploading" mode="indeterminate"></mat-progress-bar>
</div> </div>
<mat-error *ngIf="errorOccurred">{{getErrorMessage()}}</mat-error> <mat-error id="error" *ngIf="errorOccurred">{{getErrorMessage()}}</mat-error>
<div mat-dialog-actions align="end"> <div mat-dialog-actions align="end">
<button mat-button (click)="onCancelClicked()">Cancel</button> <button mat-button (click)="onCancelClicked()">Cancel</button>
<button class="confirmationButton" mat-raised-button cdkFocusInitial (click)="onOkClicked()">Upload</button> <button class="confirmationButton" mat-raised-button cdkFocusInitial (click)="onOkClicked()">Upload</button>

@ -41,10 +41,12 @@ export class User {
this.joinedAt = userDataResponse.joinedAt; this.joinedAt = userDataResponse.joinedAt;
this.friendCount = userDataResponse.friendCount; this.friendCount = userDataResponse.friendCount;
this.groupCount = userDataResponse.groupCount; this.groupCount = userDataResponse.groupCount;
try { if (userDataResponse.settings) {
this.darkmode = !!JSON.parse(userDataResponse.settings).darkmode; try {
} catch (err) { this.darkmode = !!JSON.parse(userDataResponse.settings).darkmode;
console.error(err); } catch (err) {
console.error(err);
}
} }
if (userDataResponse.friends) { if (userDataResponse.friends) {
this.friends = userDataResponse.friends this.friends = userDataResponse.friends

@ -151,6 +151,7 @@ export class FeedService {
} }
public getPosts(sort: string) { public getPosts(sort: string) {
console.log('feedservice: getPosts()');
if ((sort === 'NEW' && this.newPosts.getValue().length === 0) || if ((sort === 'NEW' && this.newPosts.getValue().length === 0) ||
(sort === 'TOP' && this.mostLikedPosts.getValue().length === 0)) { (sort === 'TOP' && this.mostLikedPosts.getValue().length === 0)) {
const headers = new Headers(); const headers = new Headers();

Loading…
Cancel
Save