Merge branch 'julius-dev' of Software_Engineering_I/greenvironment-frontend into master

master
Trivernis 5 years ago committed by Gitea
commit 9d9d2dfbea

@ -1,4 +1,4 @@
import { TestBed, async } from '@angular/core/testing'; import {async, TestBed} from '@angular/core/testing';
import {AppComponent} from './app.component'; import {AppComponent} from './app.component';
describe('AppComponent', () => { describe('AppComponent', () => {

@ -1,5 +1,4 @@
import {Component, OnInit} from '@angular/core'; import {Component, OnInit} from '@angular/core';
import { User } from './models/user';
import {DatasharingService} from './services/datasharing.service'; import {DatasharingService} from './services/datasharing.service';
import {SelfService} from './services/selfservice/self.service'; import {SelfService} from './services/selfservice/self.service';
@ -10,12 +9,13 @@ import { SelfService } from './services/selfservice/self.service';
}) })
export class AppComponent implements OnInit { export class AppComponent implements OnInit {
constructor(private data: DatasharingService, private selfservice: SelfService) { } constructor(private data: DatasharingService, private selfservice: SelfService) {
}
ngOnInit() { ngOnInit() {
this.data.currentUserInfo.subscribe(user => { this.data.currentUserInfo.subscribe(user => {
if (user.loggedIn !== true) { if (user.loggedIn !== true) {
this.selfservice.checkIfLoggedIn(); this.selfservice.checkIfLoggedIn().subscribe();
} }
}); });
} }

@ -1,8 +1,8 @@
import { BrowserModule } from '@angular/platform-browser'; import {BrowserModule, DomSanitizer} from '@angular/platform-browser';
import {NgModule} from '@angular/core'; import {NgModule} from '@angular/core';
import { FormsModule } from '@angular/forms'; import {FormsModule, ReactiveFormsModule} from '@angular/forms';
import {RouterModule, Routes} from '@angular/router'; import {RouterModule, Routes} from '@angular/router';
import { SocketIoModule, SocketIoConfig } from 'ngx-socket-io'; import {SocketIoConfig, SocketIoModule} from 'ngx-socket-io';
import {HttpModule} from '@angular/http'; import {HttpModule} from '@angular/http';
import {AppComponent} from './app.component'; import {AppComponent} from './app.component';
@ -15,16 +15,14 @@ import { FriendsComponent } from './components/social/friends/friends.component'
import {FeedComponent} from './components/feed/feed.component'; import {FeedComponent} from './components/feed/feed.component';
import {HomeComponent} from './components/home/home.component'; import {HomeComponent} from './components/home/home.component';
import {SocialComponent} from './components/social/social.component'; import {SocialComponent} from './components/social/social.component';
import { GroupsComponent } from './components/social/groups/groups.component'; import {DialogCreateGroupComponent, GroupsComponent} from './components/social/groups/groups.component';
import { DialogCreateGroupComponent } from './components/social/groups/groups.component'; import {DialogCreateEventComponent, GroupComponent} from './components/group/group.component';
import { DialogCreateEventComponent } from './components/group/group.component';
import {ChatmanagerComponent} from './components/chatmanager/chatmanager.component'; import {ChatmanagerComponent} from './components/chatmanager/chatmanager.component';
import {ChatlistComponent} from './components/chatlist/chatlist.component'; import {ChatlistComponent} from './components/chatlist/chatlist.component';
import {PostlistComponent} from './components/feed/postlist/postlist.component'; import {PostlistComponent} from './components/feed/postlist/postlist.component';
import {GraphQLModule} from './graphql.module'; import {GraphQLModule} from './graphql.module';
import {HttpClientModule} from '@angular/common/http'; import {HttpClientModule} from '@angular/common/http';
import {ProfileComponent} from './components/profile/profile.component'; import {ProfileComponent} from './components/profile/profile.component';
import { GroupComponent } from './components/group/group.component';
import {ImprintComponent} from './components/imprint/imprint.component'; import {ImprintComponent} from './components/imprint/imprint.component';
import {AboutComponent} from './components/about/about.component'; import {AboutComponent} from './components/about/about.component';
import {ChatcontactsComponent} from './components/chatmanager/chatcontacts/chatcontacts.component'; import {ChatcontactsComponent} from './components/chatmanager/chatcontacts/chatcontacts.component';
@ -36,8 +34,7 @@ import {UserlistComponent} from './components/userlist/userlist.component';
import {MatSliderModule} from '@angular/material/slider'; import {MatSliderModule} from '@angular/material/slider';
import {MatFormFieldModule} from '@angular/material/form-field'; import {MatFormFieldModule} from '@angular/material/form-field';
import {MatInputModule} from '@angular/material/input'; import {MatInputModule} from '@angular/material/input';
import { ReactiveFormsModule} from '@angular/forms'; import {MatIconModule, MatIconRegistry} from '@angular/material/icon';
import {MatIconModule} from '@angular/material/icon';
import {MatToolbarModule} from '@angular/material/toolbar'; import {MatToolbarModule} from '@angular/material/toolbar';
import {MatSidenavModule} from '@angular/material/sidenav'; import {MatSidenavModule} from '@angular/material/sidenav';
import {MatTabsModule} from '@angular/material/tabs'; import {MatTabsModule} from '@angular/material/tabs';
@ -59,14 +56,13 @@ import { MatButtonModule } from '@angular/material/button';
import {MatListModule} from '@angular/material/list'; import {MatListModule} from '@angular/material/list';
import {MatSortModule} from '@angular/material/sort'; import {MatSortModule} from '@angular/material/sort';
import {SearchComponent} from './components/search/search.component'; import {SearchComponent} from './components/search/search.component';
import {DomSanitizer} from '@angular/platform-browser';
import {MatIconRegistry} from '@angular/material/icon';
import {MatDialogModule} from '@angular/material/dialog'; import {MatDialogModule} from '@angular/material/dialog';
import {MatTooltipModule} from '@angular/material/tooltip'; import {MatTooltipModule} from '@angular/material/tooltip';
import {MatExpansionModule} from '@angular/material/expansion'; import {MatExpansionModule} from '@angular/material/expansion';
import {MatDatepickerModule} from '@angular/material/datepicker'; import {MatDatepickerModule} from '@angular/material/datepicker';
import {MatNativeDateModule} from '@angular/material/'; import {MatNativeDateModule, MatProgressBarModule} from '@angular/material/';
import {MatSnackBarModule} from '@angular/material/snack-bar'; import {MatSnackBarModule} from '@angular/material/snack-bar';
import {DialogFileUploadComponent} from './components/profile/fileUpload/fileUpload.component';
const config: SocketIoConfig = {url: 'http://localhost:4444', options: {}}; const config: SocketIoConfig = {url: 'http://localhost:4444', options: {}};
@ -107,6 +103,7 @@ const appRoutes: Routes = [
GroupComponent, GroupComponent,
DialogCreateEventComponent, DialogCreateEventComponent,
UserlistComponent, UserlistComponent,
DialogFileUploadComponent,
], ],
imports: [ imports: [
BrowserModule, BrowserModule,
@ -151,8 +148,13 @@ const appRoutes: Routes = [
MatExpansionModule, MatExpansionModule,
MatDatepickerModule, MatDatepickerModule,
MatSnackBarModule, MatSnackBarModule,
MatProgressBarModule,
],
entryComponents: [
DialogCreateGroupComponent,
DialogCreateEventComponent,
DialogFileUploadComponent
], ],
entryComponents: [ DialogCreateGroupComponent, DialogCreateEventComponent ],
providers: [], providers: [],
bootstrap: [AppComponent] bootstrap: [AppComponent]
}) })

@ -10,7 +10,8 @@
</div> </div>
<div id="text1" style="text-align: center;"> <div id="text1" style="text-align: center;">
<h1>What's Greenvironment?</h1> <h1>What's Greenvironment?</h1>
<p>We, the greenviroment team want to create a network for environmentalists who care for our nature and our planet as much as we do.</p> <p>We, the greenviroment team want to create a network for environmentalists who care for our nature and our planet
as much as we do.</p>
<br> <br>
<h1>What does the level mean?</h1> <h1>What does the level mean?</h1>
<p>There are different levels you can reach through green behaviour. <p>There are different levels you can reach through green behaviour.
@ -63,7 +64,8 @@
</table> </table>
</div> </div>
<div id="text2" style="text-align: center;"> <div id="text2" style="text-align: center;">
<p class="mat-display-1">We believe, that together we can do amazing things to protect our environment and keep it clean and green.</p> <p class="mat-display-1">We believe, that together we can do amazing things to protect our environment and keep it
clean and green.</p>
<p class="mat-display-1">You aren't part of greenvironment yet? - join us now!</p> <p class="mat-display-1">You aren't part of greenvironment yet? - join us now!</p>
<a mat-stroked-button color="primary" class="link-button" routerLink="/register">Register</a> <a mat-stroked-button color="primary" class="link-button" routerLink="/register">Register</a>
<br> <br>

@ -31,5 +31,6 @@
max-width: 690px max-width: 690px
margin: 0 auto margin: 0 auto
text-align: left text-align: left
.mat-header-cell .mat-header-cell
padding-right: 0.5em padding-right: 0.5em

@ -19,9 +19,11 @@ export class AboutComponent implements OnInit {
displayedLevelColumns = ['level', 'name']; displayedLevelColumns = ['level', 'name'];
levelSource = this.levellist.levels; levelSource = this.levellist.levels;
constructor(private activityService: ActivityService) { } constructor(private activityService: ActivityService) {
}
@ViewChild(MatSort, {static: true}) sort: MatSort; @ViewChild(MatSort, {static: true}) sort: MatSort;
ngOnInit() { ngOnInit() {
this.activityService.getActivities(); this.activityService.getActivities();
this.activityService.activitylist.subscribe(response => { this.activityService.activitylist.subscribe(response => {

@ -1,6 +1,5 @@
import { Component, OnInit, EventEmitter, Output, Input } from '@angular/core'; import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
import {Chatmessage} from 'src/app/models/chatmessage'; import {Chatmessage} from 'src/app/models/chatmessage';
import { Chatinfo } from 'src/app/models/chatinfo';
import {ChatService} from 'src/app/services/chat/chat.service'; import {ChatService} from 'src/app/services/chat/chat.service';
import {Chat} from 'src/app/models/chat'; import {Chat} from 'src/app/models/chat';
@ -16,7 +15,8 @@ export class ChatComponent implements OnInit {
@Output() goBackEvent = new EventEmitter<boolean>(); @Output() goBackEvent = new EventEmitter<boolean>();
@Input() childChat: Chat; @Input() childChat: Chat;
constructor(private chatService: ChatService) { } constructor(private chatService: ChatService) {
}
ngOnInit() { ngOnInit() {
this.refresh(); this.refresh();

@ -1,5 +1,4 @@
import { Component, OnInit, Output, EventEmitter, Input } from '@angular/core'; import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
import { Chatinfo } from 'src/app/models/chatinfo';
import {Chat} from 'src/app/models/chat'; import {Chat} from 'src/app/models/chat';
import {ChatService} from 'src/app/services/chat/chat.service'; import {ChatService} from 'src/app/services/chat/chat.service';
@ -15,7 +14,8 @@ export class ChatlistComponent implements OnInit {
@Output() showCreateChatEvent = new EventEmitter<boolean>(); @Output() showCreateChatEvent = new EventEmitter<boolean>();
selectedChat: Chat; selectedChat: Chat;
constructor(private chatService: ChatService) { } constructor(private chatService: ChatService) {
}
ngOnInit() { ngOnInit() {

@ -1,6 +1,7 @@
<div id="contacts"> <div id="contacts">
<div id='header'> <div id='header'>
<button id="goback" (click)="goBack()"><span><i class="fa fa-arrow-left fa-3x" aria-hidden="true"></i></span></button> <button id="goback" (click)="goBack()"><span><i class="fa fa-arrow-left fa-3x" aria-hidden="true"></i></span>
</button>
<span class='title'>Contacts</span> <span class='title'>Contacts</span>
</div> </div>
<div class="search-container"> <div class="search-container">

@ -1,4 +1,4 @@
import { Component, OnInit, Output, EventEmitter } from '@angular/core'; import {Component, EventEmitter, OnInit, Output} from '@angular/core';
import {FriendInfo} from 'src/app/models/friendinfo'; import {FriendInfo} from 'src/app/models/friendinfo';
import {ChatService} from 'src/app/services/chat/chat.service'; import {ChatService} from 'src/app/services/chat/chat.service';
@ -12,7 +12,8 @@ export class ChatcontactsComponent implements OnInit {
@Output() goBackEvent = new EventEmitter<boolean>(); @Output() goBackEvent = new EventEmitter<boolean>();
selectedContact: FriendInfo; selectedContact: FriendInfo;
constructor(private chatService: ChatService) { } constructor(private chatService: ChatService) {
}
ngOnInit() { ngOnInit() {
} }

@ -1,7 +1,5 @@
import { Component, OnInit, ViewChild } from '@angular/core'; import {Component, OnInit} from '@angular/core';
import {ChatService} from '../../services/chat/chat.service'; import {ChatService} from '../../services/chat/chat.service';
import { ChatComponent } from '../chat/chat.component';
import { Chatinfo } from 'src/app/models/chatinfo';
import {DatasharingService} from 'src/app/services/datasharing.service'; import {DatasharingService} from 'src/app/services/datasharing.service';
import {Chat} from 'src/app/models/chat'; import {Chat} from 'src/app/models/chat';
@ -19,7 +17,8 @@ export class ChatmanagerComponent implements OnInit {
parentSelectedChat: Chat; parentSelectedChat: Chat;
parentChats: Array<Chat>; parentChats: Array<Chat>;
constructor(private data: DatasharingService, private chatService: ChatService) { } constructor(private data: DatasharingService, private chatService: ChatService) {
}
ngOnInit() { ngOnInit() {
/*this.data.currentChatIDs.subscribe(chatIDs => { /*this.data.currentChatIDs.subscribe(chatIDs => {

@ -1,4 +1,5 @@
<div class='sidenav'> <div class='sidenav'>
<span (click)='newDoc()'>New Document</span> <span (click)='newDoc()'>New Document</span>
<span [class.selected]='docId === currentDoc' (click)='loadDoc(docId)' *ngFor='let docId of documents | async'>{{ docId }}</span> <span [class.selected]='docId === currentDoc' (click)='loadDoc(docId)'
*ngFor='let docId of documents | async'>{{ docId }}</span>
</div> </div>

@ -15,9 +15,13 @@
font-family: 'Roboto', Tahoma, Geneva, Verdana, sans-serif; font-family: 'Roboto', Tahoma, Geneva, Verdana, sans-serif;
color: #818181; color: #818181;
display: block; display: block;
}.selected { }
.selected {
color: #e1e1e1; color: #e1e1e1;
}:hover { }
:hover {
color: #f1f1f1; color: #f1f1f1;
cursor: pointer; cursor: pointer;
} }

@ -1,4 +1,4 @@
import { Component, OnInit, OnDestroy } from '@angular/core'; import {Component, OnDestroy, OnInit} from '@angular/core';
import {Observable, Subscription} from 'rxjs'; import {Observable, Subscription} from 'rxjs';
import {DocumentService} from 'src/app/services/document.service'; import {DocumentService} from 'src/app/services/document.service';
@ -13,7 +13,8 @@ export class DocumentListComponent implements OnInit, OnDestroy {
currentDoc: string; currentDoc: string;
private _docSub: Subscription; private _docSub: Subscription;
constructor(private documentService: DocumentService) { } constructor(private documentService: DocumentService) {
}
ngOnInit() { ngOnInit() {
this.documents = this.documentService.documents; this.documents = this.documentService.documents;

@ -1,4 +1,4 @@
import { Component, OnInit, OnDestroy } from '@angular/core'; import {Component, OnDestroy, OnInit} from '@angular/core';
import {DocumentService} from 'src/app/services/document.service'; import {DocumentService} from 'src/app/services/document.service';
import {Subscription} from 'rxjs'; import {Subscription} from 'rxjs';
import {Document} from 'src/app/models/document'; import {Document} from 'src/app/models/document';
@ -12,7 +12,9 @@ import { startWith } from 'rxjs/operators';
export class DocumentComponent implements OnInit, OnDestroy { export class DocumentComponent implements OnInit, OnDestroy {
document: Document; document: Document;
private _docSub: Subscription; private _docSub: Subscription;
constructor(private documentService: DocumentService) { }
constructor(private documentService: DocumentService) {
}
ngOnInit() { ngOnInit() {
this._docSub = this.documentService.currentDocument.pipe( this._docSub = this.documentService.currentDocument.pipe(

@ -7,25 +7,29 @@ infinite-scroll
<mat-card> <mat-card>
<mat-card-content> <mat-card-content>
<mat-form-field id="input"> <mat-form-field id="input">
<textarea matInput #content type="text" [(ngModel)]="textInputValue" mat-autosize="true" matAutosizeMaxRows="3" placeholder="post something"></textarea> <textarea matInput #content type="text" (input)="onTextInputChange()" [(ngModel)]="textInputValue"
mat-autosize="true" matAutosizeMaxRows="3" placeholder="post something"></textarea>
<button mat-button matSuffix mat-icon-button> <button mat-button matSuffix mat-icon-button>
<mat-icon>add</mat-icon> <mat-icon>add</mat-icon>
</button> </button>
</mat-form-field> </mat-form-field>
<p id="check"> <p id="check">
<mat-checkbox color="primary" [(ngModel)]="checked" checked="checked">I protected the environment.</mat-checkbox> <mat-checkbox color="primary" [(ngModel)]="checked" checked="checked">I protected the environment.
</mat-checkbox>
</p> </p>
<mat-form-field id="action-chooser" *ngIf="checked"> <mat-form-field id="action-chooser" *ngIf="checked">
<mat-label>What did you do?</mat-label> <mat-label>What did you do?</mat-label>
<mat-select [(ngModel)]="activityId" name="action"> <mat-select [(ngModel)]="activityId" name="action">
<mat-option>nothing ;)</mat-option> <mat-option>nothing ;)</mat-option>
<mat-option *ngFor="let action of actionlist.Actions" [value]="action.id" [matTooltip]="action.description" matTooltipShowDelay="200"> <mat-option *ngFor="let action of actionlist.Actions" [value]="action.id" [matTooltip]="action.description"
matTooltipShowDelay="200">
{{action.name}} ({{action.description}}) {{action.name}} ({{action.description}})
</mat-option> </mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-error *ngIf="errorOccurred && textInputValue">{{getErrorMessage()}}</mat-error> <mat-error *ngIf="errorOccurred && textInputValue">{{getErrorMessage()}}</mat-error>
<button mat-raised-button *ngIf="textInputValue" color="primary" id="post-button" (click)=createPost(content,activityId)> <button mat-raised-button *ngIf="textInputValue" color="primary" id="post-button"
(click)=createPost(content,activityId)>
POST POST
</button> </button>
</mat-card-content> </mat-card-content>
@ -50,7 +54,8 @@ infinite-scroll
<div id="complete-feed"> <div id="complete-feed">
<div id="feedlist"> <div id="feedlist">
<feed-postlist [childPostList]="parentSelectedPostList"></feed-postlist> <feed-postlist [childPostList]="parentSelectedPostList"></feed-postlist>
<div style="height: 60px;" [hidden]='(!loadingNew && view === "new") || (!loadingMostLiked && view === "mostliked") '> <div style="height: 60px;"
[hidden]='(!loadingNew && view === "new") || (!loadingMostLiked && view === "mostliked") '>
<!--<mat-spinner *ngIf='loadingNew && view === "mostLiked"' style="margin:0 auto; margin-top: 2em;" diameter="50"></mat-spinner>--> <!--<mat-spinner *ngIf='loadingNew && view === "mostLiked"' style="margin:0 auto; margin-top: 2em;" diameter="50"></mat-spinner>-->
<mat-spinner style="margin:0 auto; margin-top: 2em;" diameter="50"></mat-spinner> <mat-spinner style="margin:0 auto; margin-top: 2em;" diameter="50"></mat-spinner>
</div> </div>

@ -15,6 +15,7 @@
display: flex display: flex
width: 100% width: 100%
padding: 0.5em padding: 0.5em
#info #info
::ng-deep .mat-card-header-text ::ng-deep .mat-card-header-text
margin: 0px margin: 0px

@ -49,9 +49,6 @@ export class FeedComponent implements OnInit {
}); });
this.feedService.getPosts('NEW'); this.feedService.getPosts('NEW');
this.feedService.posts.subscribe(response => { this.feedService.posts.subscribe(response => {
if (response.length > 0) {
// this.loading = false;
}
this.parentSelectedPostList = response; this.parentSelectedPostList = response;
}); });
this.feedService.newPostsAvailable.subscribe(response => { this.feedService.newPostsAvailable.subscribe(response => {
@ -104,4 +101,14 @@ export class FeedComponent implements OnInit {
getErrorMessage() { getErrorMessage() {
return this.errorMessage; return this.errorMessage;
} }
/**
* Executed when the text in the input field changes.
*/
onTextInputChange() {
if (this.errorOccurred) {
this.errorOccurred = false;
this.errorMessage = '';
}
}
} }

@ -8,26 +8,34 @@ $mat-card-header-size: 40px !default
margin-top: 0.5em margin-top: 0.5em
outline: none outline: none
user-select: none user-select: none
::ng-deep .mat-card-header-text ::ng-deep .mat-card-header-text
margin-top: 10px margin-top: 10px
.mat-card-subtitle .mat-card-subtitle
display: contents display: contents
.mat-card-content .mat-card-content
overflow: auto overflow: auto
a:hover a:hover
cursor: pointer cursor: pointer
#button-box #button-box
text-align: right text-align: right
margin-left: auto margin-left: auto
::ng-deep img ::ng-deep img
max-width: 100% max-width: 100%
height: auto height: auto
border-radius: 4px border-radius: 4px
.mat-button .mat-button
min-width: 32px !important min-width: 32px !important
padding: 0 padding: 0
margin: 0 margin: 0
margin-left: 8px margin-left: 8px
.profile-picture .profile-picture
border-radius: 50% border-radius: 50%
width: $mat-card-header-size width: $mat-card-header-size
@ -35,6 +43,7 @@ $mat-card-header-size: 40px !default
.activity-info .activity-info
display: contents display: contents
.span .span
margin-left: 32px margin-left: 32px

@ -1,4 +1,4 @@
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
import {Post} from 'src/app/models/post'; import {Post} from 'src/app/models/post';
import {FeedService} from 'src/app/services/feed/feed.service'; import {FeedService} from 'src/app/services/feed/feed.service';
import {Router} from '@angular/router'; import {Router} from '@angular/router';
@ -14,7 +14,8 @@ export class PostlistComponent implements OnInit {
@Output() voteEvent = new EventEmitter<boolean>(); @Output() voteEvent = new EventEmitter<boolean>();
selectedPost: Post; selectedPost: Post;
constructor(private feedService: FeedService, private router: Router) { } constructor(private feedService: FeedService, private router: Router) {
}
ngOnInit() { ngOnInit() {
} }

@ -24,7 +24,9 @@
</mat-toolbar-row> </mat-toolbar-row>
<mat-toolbar-row> <mat-toolbar-row>
<div class="info-box"> <div class="info-box">
<span id="handle" class="pointer" (click)="showUserProfile(groupProfile.creator)">created by {{groupProfile.creator.username}} @{{groupProfile.creator.handle}}</span> <span id="handle" class="pointer"
(click)="showUserProfile(groupProfile.creator)">created by {{groupProfile.creator.username}}
@{{groupProfile.creator.handle}}</span>
</div> </div>
</mat-toolbar-row> </mat-toolbar-row>
<mat-toolbar-row> <mat-toolbar-row>
@ -38,7 +40,9 @@
<mat-toolbar-row> <mat-toolbar-row>
<div class="profile-picture"></div> <div class="profile-picture"></div>
<span id="username">{{groupProfile.name}}</span> <span id="username">{{groupProfile.name}}</span>
<span id="handle" class="pointer" (click)="showUserProfile(groupProfile.creator)">created by {{groupProfile.creator.username}} @{{groupProfile.creator.handle}}</span> <span id="handle" class="pointer"
(click)="showUserProfile(groupProfile.creator)">created by {{groupProfile.creator.username}}
@{{groupProfile.creator.handle}}</span>
<div class="button-box"> <div class="button-box">
<button mat-icon-button <button mat-icon-button
class="request-button" class="request-button"
@ -115,4 +119,3 @@
<mat-spinner *ngIf="loading" style="margin:0 auto; margin-top: 10em;" diameter="100"></mat-spinner> <mat-spinner *ngIf="loading" style="margin:0 auto; margin-top: 10em;" diameter="100"></mat-spinner>
</div> </div>

@ -26,22 +26,30 @@ $mat-card-header-size: 100px !default
.button-box .button-box
text-align: right text-align: right
margin-left: auto margin-left: auto
.request-button .request-button
margin: auto 0 margin: auto 0
#toolbar #toolbar
margin-top: 32px margin-top: 32px
.mat-toolbar-row .mat-toolbar-row
max-height: 40px max-height: 40px
.info-box .info-box
font-size: 14px font-size: 14px
margin-left: calc(100px + 0.5em) margin-left: calc(100px + 0.5em)
.info .info
margin-right: 3em margin-right: 3em
#username #username
margin: 0 0.5em margin: 0 0.5em
overflow: auto overflow: auto
#handle #handle
font-size: 14px font-size: 14px
.profile-picture .profile-picture
background-image: url(https://material.angular.io/assets/img/examples/shiba1.jpg) background-image: url(https://material.angular.io/assets/img/examples/shiba1.jpg)
height: $mat-card-header-size height: $mat-card-header-size
@ -49,6 +57,7 @@ $mat-card-header-size: 100px !default
border-radius: 50% border-radius: 50%
flex-shrink: 0 flex-shrink: 0
background-size: cover background-size: cover
&:hover &:hover
height: 200 height: 200
// Makes `<img>` tags behave like `background-size: cover`. Not supported // Makes `<img>` tags behave like `background-size: cover`. Not supported
@ -61,27 +70,35 @@ $mat-card-header-size: 100px !default
margin-top: 0.5em margin-top: 0.5em
outline: none outline: none
user-select: none user-select: none
::ng-deep .mat-card-header-text ::ng-deep .mat-card-header-text
margin: 0 margin: 0
margin-left: 16px margin-left: 16px
.mat-card-subtitle .mat-card-subtitle
margin: 0 margin: 0
word-break: break-all word-break: break-all
.mat-card-title .mat-card-title
margin: 0 margin: 0
word-break: break-all word-break: break-all
.request-button .request-button
margin-top: 0.5em margin-top: 0.5em
margin-bottom: 0.5em margin-bottom: 0.5em
.profile-picture .profile-picture
background-image: url(https://material.angular.io/assets/img/examples/shiba1.jpg) background-image: url(https://material.angular.io/assets/img/examples/shiba1.jpg)
background-size: cover background-size: cover
.profile-picture:hover .profile-picture:hover
cursor: pointer cursor: pointer
.pointer .pointer
cursor: pointer cursor: pointer
::ng-deep .mat-expansion-panel ::ng-deep .mat-expansion-panel
background: #e6e6e6 background: #e6e6e6
::ng-deep.dark-theme .mat-expansion-panel ::ng-deep.dark-theme .mat-expansion-panel
background: #121212 background: #121212

@ -1,5 +1,5 @@
import {Component, OnInit, ViewChild} from '@angular/core'; import {Component, OnInit, ViewChild} from '@angular/core';
import {Router, NavigationEnd} from '@angular/router'; import {NavigationEnd, Router} from '@angular/router';
import {User} from 'src/app/models/user'; import {User} from 'src/app/models/user';
import {MatSort} from '@angular/material/sort'; import {MatSort} from '@angular/material/sort';
import {RequestService} from 'src/app/services/request/request.service'; import {RequestService} from 'src/app/services/request/request.service';
@ -77,6 +77,7 @@ export class GroupComponent implements OnInit {
} }
@ViewChild(MatSort, {static: true}) sort: MatSort; @ViewChild(MatSort, {static: true}) sort: MatSort;
ngOnInit() { ngOnInit() {
this.loading = true; this.loading = true;
this.id = this.router.url.substr(this.router.url.lastIndexOf('/') + 1); this.id = this.router.url.substr(this.router.url.lastIndexOf('/') + 1);
@ -98,7 +99,9 @@ export class GroupComponent implements OnInit {
for (const member of this.groupProfile.members) { for (const member of this.groupProfile.members) {
member.allowedToSendRequest = this.requestService.isAllowedToSendRequest(member.userID, this.self); member.allowedToSendRequest = this.requestService.isAllowedToSendRequest(member.userID, this.self);
} }
} else { this.groupNotFound = true; } } else {
this.groupNotFound = true;
}
this.loading = false; this.loading = false;
}); });
} }

@ -1,8 +1,16 @@
<div id="content" fxShow="true" fxHide.lt-md="true"> <div id="content" fxShow="true" fxHide.lt-md="true">
<div id="chat"><home-chatmanager [hidden]="!loggedIn"></home-chatmanager></div> <div id="chat">
<div id="feed"><home-feed></home-feed></div> <home-chatmanager [hidden]="!loggedIn"></home-chatmanager>
<div class="social" [hidden]="!loggedIn"><home-social></home-social></div> </div>
<div class="social" [hidden]="loggedIn"><home-search></home-search></div> <div id="feed">
<home-feed></home-feed>
</div>
<div class="social" [hidden]="!loggedIn">
<home-social></home-social>
</div>
<div class="social" [hidden]="loggedIn">
<home-search></home-search>
</div>
</div> </div>
<!-- <!--
<mat-tab-group headerPosition="below" position="0" id="bottom-menu" fxShow="true" fxHide.gt-sm="true"> <mat-tab-group headerPosition="below" position="0" id="bottom-menu" fxShow="true" fxHide.gt-sm="true">

@ -11,7 +11,8 @@ export class HomeComponent implements OnInit {
loggedIn: boolean; loggedIn: boolean;
constructor(private data: DatasharingService, private feedService: FeedService) { } constructor(private data: DatasharingService, private feedService: FeedService) {
}
ngOnInit() { ngOnInit() {
this.data.currentUserInfo.subscribe(user => { this.data.currentUserInfo.subscribe(user => {

@ -7,7 +7,8 @@ import { Component, OnInit } from '@angular/core';
}) })
export class ImprintComponent implements OnInit { export class ImprintComponent implements OnInit {
constructor() { } constructor() {
}
ngOnInit() { ngOnInit() {
} }

@ -11,7 +11,8 @@
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<input matInput placeholder="Enter your password" [type]="hide ? 'password' : 'text'" #password> <input matInput placeholder="Enter your password" [type]="hide ? 'password' : 'text'" #password>
<button mat-icon-button matSuffix (click)="hide = !hide" [attr.aria-label]="'Hide password'" [attr.aria-pressed]="hide"> <button mat-icon-button matSuffix (click)="hide = !hide" [attr.aria-label]="'Hide password'"
[attr.aria-pressed]="hide">
<mat-icon>{{hide ? 'visibility_off' : 'visibility'}}</mat-icon> <mat-icon>{{hide ? 'visibility_off' : 'visibility'}}</mat-icon>
</button> </button>
</mat-form-field> </mat-form-field>

@ -16,6 +16,7 @@ export class LoginComponent implements OnInit {
constructor(private loginService: LoginService, private router: Router) { constructor(private loginService: LoginService, private router: Router) {
this.login = {passwordHash: null, email: null}; this.login = {passwordHash: null, email: null};
} }
login: Login; login: Login;
hide = true; hide = true;
errorOccurred = false; errorOccurred = false;
@ -55,6 +56,7 @@ export class LoginComponent implements OnInit {
}); });
} }
ngOnInit() {} ngOnInit() {
}
} }

@ -1,5 +1,7 @@
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet"> <!-- getting the google material fonts --> <link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500"
<meta name="viewport" content="width=device-width,height=device-height,user-scalable=no,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0"> <!-- diables zoom --> rel="stylesheet"> <!-- getting the google material fonts -->
<meta name="viewport"
content="width=device-width,height=device-height,user-scalable=no,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0"> <!-- diables zoom -->
<mat-sidenav-container class="mat-typography"> <mat-sidenav-container class="mat-typography">
<!-- SIDENAV --> <!-- SIDENAV -->
@ -24,8 +26,10 @@
<mat-divider></mat-divider> <mat-divider></mat-divider>
<div id="link-box"> <div id="link-box">
<a mat-stroked-button *ngIf="!loggedIn" class="link-button" routerLink="/register" (click)="drawer.close()">Register</a> <a mat-stroked-button *ngIf="!loggedIn" class="link-button" routerLink="/register" (click)="drawer.close()">Register</a>
<a mat-stroked-button *ngIf="!loggedIn" class="link-button" routerLink="/login" (click)="drawer.toggle()">Login</a> <a mat-stroked-button *ngIf="!loggedIn" class="link-button" routerLink="/login"
<a mat-stroked-button *ngIf="loggedIn" class="link-button" (click)="logout()" (click)="drawer.toggle()">log out</a> (click)="drawer.toggle()">Login</a>
<a mat-stroked-button *ngIf="loggedIn" class="link-button" (click)="logout()" (click)="drawer.toggle()">log
out</a>
</div> </div>
</mat-nav-list> </mat-nav-list>
</mat-sidenav> </mat-sidenav>
@ -46,7 +50,8 @@
<mat-icon *ngIf="lighttheme" svgIcon="logo" style="min-width: 35px;" routerLink="" class="link"></mat-icon> <mat-icon *ngIf="lighttheme" svgIcon="logo" style="min-width: 35px;" routerLink="" class="link"></mat-icon>
<mat-icon *ngIf="!lighttheme" svgIcon="logo_green" style="min-width: 35px;" routerLink="" class="link"></mat-icon> <mat-icon *ngIf="!lighttheme" svgIcon="logo_green" style="min-width: 35px;" routerLink="" class="link"></mat-icon>
<span routerLink="" class="link">Greenvironment</span> <span routerLink="" class="link">Greenvironment</span>
<nav mat-tab-nav-bar backgroundColor="accent" color="accent" fxShow="true" fxHide.lt-md="true" routerLinkActive #rla=""> <nav mat-tab-nav-bar backgroundColor="accent" color="accent" fxShow="true" fxHide.lt-md="true" routerLinkActive
#rla="">
<div *ngIf="loggedIn"> <div *ngIf="loggedIn">
<a mat-tab-link class="link" <a mat-tab-link class="link"
*ngFor="let link of navLinksLoggedIn" *ngFor="let link of navLinksLoggedIn"
@ -73,10 +78,13 @@
<!--content on BIG SCREEN--> <!--content on BIG SCREEN-->
<div id="menu-button-box"> <div id="menu-button-box">
<span class="mat-button" *ngIf="loggedIn" fxShow="true" fxHide.lt-md="true" routerLink={{profileUrl}}>Hello, {{user.username}}</span> <span class="mat-button" *ngIf="loggedIn" fxShow="true" fxHide.lt-md="true"
routerLink={{profileUrl}}>Hello, {{user.username}}</span>
<span class="mat-button" *ngIf="!loggedIn" fxShow="true" fxHide.lt-md="true" routerLink="/login"><span>Hello, Sign in</span></span> <span class="mat-button" *ngIf="!loggedIn" fxShow="true" fxHide.lt-md="true" routerLink="/login"><span>Hello, Sign in</span></span>
<button mat-icon-button [matMenuTriggerFor]="requestMenu" [disabled]="!loggedIn" id="menu-button"> <button mat-icon-button [matMenuTriggerFor]="requestMenu" [disabled]="!loggedIn" id="menu-button">
<mat-icon [matBadge]="user.receivedRequests.length" [matBadgeHidden]="!(user.receivedRequests.length > 0)" matBadgeColor="accent">notifications</mat-icon> <mat-icon [matBadge]="user.receivedRequests.length" [matBadgeHidden]="!(user.receivedRequests.length > 0)"
matBadgeColor="accent">notifications
</mat-icon>
</button> </button>
<button mat-icon-button [matMenuTriggerFor]="menu" id="menu-button"> <button mat-icon-button [matMenuTriggerFor]="menu" id="menu-button">
@ -86,7 +94,8 @@
<mat-menu #requestMenu="matMenu"> <mat-menu #requestMenu="matMenu">
<span mat-menu-item disableRipple="true" disabled="true">friend requests:</span> <span mat-menu-item disableRipple="true" disabled="true">friend requests:</span>
<button mat-menu-item *ngFor = "let request of user.receivedRequests" [class.selected]="request === selectedRequest" (click)="$event.stopPropagation();" disableRipple="true"> <button mat-menu-item *ngFor="let request of user.receivedRequests"
[class.selected]="request === selectedRequest" (click)="$event.stopPropagation();" disableRipple="true">
<button mat-icon-button (click)=acceptRequest(request.senderUserID) (click)="$event.stopPropagation();"> <button mat-icon-button (click)=acceptRequest(request.senderUserID) (click)="$event.stopPropagation();">
<mat-icon>check</mat-icon> <mat-icon>check</mat-icon>
</button> </button>

@ -6,15 +6,19 @@
.menu-bar .menu-bar
position: inherit !important position: inherit !important
.mat-card-avatar .mat-card-avatar
display: contents display: contents
.profile-picture .profile-picture
width: 52px width: 52px
height: 52px height: 52px
border-radius: 50% border-radius: 50%
flex-shrink: 0 flex-shrink: 0
.hello-text-box .hello-text-box
margin-left: 8px margin-left: 8px
.hello-text .hello-text
white-space: normal white-space: normal
font-size: initial font-size: initial
@ -34,10 +38,13 @@
//position: sticky //position: sticky
top: 0 top: 0
z-index: 999 z-index: 999
.mat-tab-nav-bar .mat-tab-nav-bar
height: 56px height: 56px
.mat-tab-links .mat-tab-links
height: 56px height: 56px
.mat-tab-link .mat-tab-link
height: 56px height: 56px

@ -1,5 +1,5 @@
import { Component, OnInit, HostBinding } from '@angular/core'; import {Component, HostBinding, OnInit} from '@angular/core';
import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout'; import {BreakpointObserver} from '@angular/cdk/layout';
import {DatasharingService} from '../../services/datasharing.service'; import {DatasharingService} from '../../services/datasharing.service';
import {RequestService} from '../../services/request/request.service'; import {RequestService} from '../../services/request/request.service';
import {SettingsService} from '../../services/settings/settings.service'; import {SettingsService} from '../../services/settings/settings.service';
@ -27,6 +27,7 @@ export class MainNavigationComponent implements OnInit {
) { ) {
this.overlay = overlayContainer.getContainerElement(); this.overlay = overlayContainer.getContainerElement();
} }
loggedIn = false; loggedIn = false;
userId: number; userId: number;
username: string; username: string;
@ -53,6 +54,7 @@ export class MainNavigationComponent implements OnInit {
]; ];
@HostBinding('class') componentCssClass; @HostBinding('class') componentCssClass;
ngOnInit() { ngOnInit() {
this.data.currentUserInfo.subscribe(user => { this.data.currentUserInfo.subscribe(user => {
this.user = user; this.user = user;
@ -102,20 +104,25 @@ export class MainNavigationComponent implements OnInit {
{path: '/imprint', label: 'Imprint'}, {path: '/imprint', label: 'Imprint'},
]; ];
} }
onSetTheme(theme) { onSetTheme(theme) {
this.overlayContainer.getContainerElement().classList.add(theme); this.overlayContainer.getContainerElement().classList.add(theme);
this.componentCssClass = theme; this.componentCssClass = theme;
} }
logout() { logout() {
const url = environment.graphQLUrl; const url = environment.graphQLUrl;
const headers = new Headers(); const headers = new Headers();
headers.set('Content-Type', 'application/json'); headers.set('Content-Type', 'application/json');
const body = {query: `mutation { const body = {
query: `mutation {
logout logout
}`}; }`
};
this.http.post(url, body).subscribe(response => { this.http.post(url, body).subscribe(response => {
console.log(response.text()); }); console.log(response.text());
});
this.loggedIn = false; this.loggedIn = false;
const user = new User(); const user = new User();
user.loggedIn = false; user.loggedIn = false;

@ -0,0 +1,23 @@
@import '../../../../styles/greenvironment-material-theme'
.dialogFormField
width: 100%
.confirmationButton
background-color: $primary-color
.uploadDialogContent
overflow: hidden
text-align: center
#inputPreview
max-width: 75%
max-height: 100%
width: auto
clip-path: circle()
mask-mode: luminance
#inputPreviewWrapper
margin: auto
text-align: center
max-height: 512px

@ -0,0 +1,79 @@
import {Component} from '@angular/core';
import {MatDialogRef} from '@angular/material/dialog';
import {SelfService} from '../../../services/selfservice/self.service';
import {environment} from '../../../../environments/environment';
import {BehaviorSubject} from 'rxjs';
@Component({
selector: 'file-upload-dialog',
templateUrl: 'fileUploadDialog.component.html',
styleUrls: ['./fileUpload.component.sass'],
})
export class DialogFileUploadComponent {
public errorOccurred = false;
public uploading = false;
private errorMessage: string;
public profilePictureUrl: BehaviorSubject<string | null>;
private file;
public localFileUrl;
constructor(public dialogRef: MatDialogRef<DialogFileUploadComponent>, private selfService: SelfService) {
this.profilePictureUrl = new BehaviorSubject<string | null>(null);
}
/**
* Getter for the error message
*/
getErrorMessage() {
return this.errorMessage;
}
/**
* Fired when the cancel button of the dialog is pressed
*/
onCancelClicked() {
this.dialogRef.close();
}
/**
* Fired when the ok button was pressed
*/
onOkClicked() {
this.errorOccurred = false;
this.uploading = true;
this.selfService.changeProfilePicture(this.file).subscribe((response) => {
this.uploading = false;
if (response.success) {
this.profilePictureUrl.next(environment.greenvironmentUrl + response.fileName);
this.dialogRef.close();
} else {
this.errorMessage = response.error;
this.errorOccurred = true;
}
}, (error) => {
this.uploading = false;
this.errorOccurred = true;
console.log(error);
if (error.error) {
this.errorMessage = error.error.error;
} else {
this.errorMessage = 'Failed to upload the profile picture.';
}
});
}
/**
* Fired when the input of the file select changes.
* @param event
*/
onFileInputChange(event) {
this.errorOccurred = false;
this.errorMessage = '';
this.file = event.target.files[0];
const reader = new FileReader();
reader.onload = (e: any) => {
this.localFileUrl = e.target.result;
};
reader.readAsDataURL(this.file);
}
}

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

@ -3,10 +3,9 @@
<!--on small screen--> <!--on small screen-->
<mat-toolbar id="toolbar" fxShow="true" fxHide.gt-sm="true"> <mat-toolbar id="toolbar" fxShow="true" fxHide.gt-sm="true">
<mat-toolbar-row> <mat-toolbar-row>
<div class="hover-box" matTooltip="upload new picture" *ngIf="ownProfile" (click)="fileInput.click()"> <div class="hover-box" matTooltip="upload new picture" *ngIf="ownProfile" (click)="openFileUploadDialog()">
<img class="profile-picture" [src]="userProfile.profilePicture"/> <img class="profile-picture" [src]="userProfile.profilePicture"/>
<mat-icon id="icon">camera_alt</mat-icon> <mat-icon id="icon">camera_alt</mat-icon>
<input #fileInput type="file" accept="image/*" (change)="onFileInput($event)" style="display:none;" />
</div> </div>
<div *ngIf="!ownProfile"> <div *ngIf="!ownProfile">
<img class="profile-picture" [src]="userProfile.profilePicture"/> <img class="profile-picture" [src]="userProfile.profilePicture"/>
@ -45,10 +44,9 @@
<!--on big screen--> <!--on big screen-->
<mat-toolbar id="toolbar" fxShow="true" fxHide.lt-md="true"> <mat-toolbar id="toolbar" fxShow="true" fxHide.lt-md="true">
<mat-toolbar-row> <mat-toolbar-row>
<div class="hover-box" matTooltip="upload new picture" *ngIf="ownProfile" (click)="fileInput.click()"> <div class="hover-box" matTooltip="upload new picture" *ngIf="ownProfile" (click)="openFileUploadDialog()">
<img class="profile-picture" [src]="userProfile.profilePicture"/> <img class="profile-picture" [src]="userProfile.profilePicture"/>
<mat-icon id="icon">camera_alt</mat-icon> <mat-icon id="icon">camera_alt</mat-icon>
<input #fileInput type="file" accept="image/*" (change)="onFileInput($event)" style="display:none;" />
</div> </div>
<div *ngIf="!ownProfile"> <div *ngIf="!ownProfile">
<img class="profile-picture" [src]="userProfile.profilePicture"/> <img class="profile-picture" [src]="userProfile.profilePicture"/>
@ -75,17 +73,6 @@
<feed-postlist [childPostList]="this.userProfile.posts"></feed-postlist> <feed-postlist [childPostList]="this.userProfile.posts"></feed-postlist>
</div> </div>
<div id="profile"> <div id="profile">
<!--<table style="width:100%">
<tr>
<th>points </th>
<th>action</th>
</tr>
<tr *ngFor= "let action of actionlist.actions">
<td>{{action.points}}</td>
<td>{{action.name}}</td>
</tr>
</table>-->
</div> </div>
</div> </div>
<div id="profilecontainer" *ngIf="profileNotFound"> <div id="profilecontainer" *ngIf="profileNotFound">
@ -94,4 +81,3 @@
<mat-spinner *ngIf="loading" style="margin:0 auto; margin-top: 10em;" diameter="100"></mat-spinner> <mat-spinner *ngIf="loading" style="margin:0 auto; margin-top: 10em;" diameter="100"></mat-spinner>
</div> </div>

@ -17,25 +17,33 @@
margin: 0 auto margin: 0 auto
width: 100% width: 100%
max-width: 690px max-width: 690px
.icon-box .icon-box
text-align: right text-align: right
width: 100% width: 100%
.request-button .request-button
margin-top: 0.5em margin-top: 0.5em
margin-bottom: 0.5em margin-bottom: 0.5em
margin-left: auto margin-left: auto
#toolbar #toolbar
margin-top: 32px margin-top: 32px
.mat-toolbar-row .mat-toolbar-row
max-height: 40px max-height: 40px
.info-box .info-box
font-size: 14px font-size: 14px
margin-left: calc(100px + 0.5em) margin-left: calc(100px + 0.5em)
.info .info
margin-right: 1em margin-right: 1em
font-size: 14px font-size: 14px
#username #username
margin: 0 0.5em margin: 0 0.5em
#handle #handle
font-size: 14px font-size: 14px
@ -52,9 +60,11 @@ $mat-card-header-size: 100px !default
display: flex display: flex
justify-content: center justify-content: center
align-items: center align-items: center
&:hover &:hover
.profile-picture .profile-picture
filter: brightness(70%) filter: brightness(70%)
#icon #icon
display: block display: block
filter: none filter: none
@ -71,8 +81,6 @@ $mat-card-header-size: 100px !default
z-index: 10 z-index: 10
object-fit: cover object-fit: cover
#postlist #postlist
margin: 0.5em auto margin: 0.5em auto
padding: 0 padding: 0

@ -1,21 +1,21 @@
import {Component, OnInit} from '@angular/core'; import {Component, OnInit} from '@angular/core';
import {Router, NavigationEnd} from '@angular/router'; import {NavigationEnd, Router} from '@angular/router';
import {User} from 'src/app/models/user'; import {User} from 'src/app/models/user';
import {Levellist} from 'src/app/models/levellist'; import {Levellist} from 'src/app/models/levellist';
import {RequestService} from 'src/app/services/request/request.service'; import {RequestService} from 'src/app/services/request/request.service';
import {DatasharingService} from '../../services/datasharing.service'; import {DatasharingService} from '../../services/datasharing.service';
import {ProfileService} from 'src/app/services/profile/profile.service'; import {ProfileService} from 'src/app/services/profile/profile.service';
import {HttpClient} from '@angular/common/http'; import {HttpClient} from '@angular/common/http';
import { environment } from 'src/environments/environment';
import {MatSnackBar} from '@angular/material/snack-bar'; import {MatSnackBar} from '@angular/material/snack-bar';
import { reduce } from 'rxjs/operators'; import {SelfService} from '../../services/selfservice/self.service';
import {MatDialog} from '@angular/material';
import {DialogFileUploadComponent} from './fileUpload/fileUpload.component';
@Component({ @Component({
selector: 'app-profile', selector: 'app-profile',
templateUrl: './profile.component.html', templateUrl: './profile.component.html',
styleUrls: ['./profile.component.sass'] styleUrls: ['./profile.component.sass']
}) })
export class ProfileComponent implements OnInit { export class ProfileComponent implements OnInit {
levellist: Levellist = new Levellist(); levellist: Levellist = new Levellist();
ownProfile = false; ownProfile = false;
@ -33,7 +33,9 @@ export class ProfileComponent implements OnInit {
private router: Router, private router: Router,
private requestService: RequestService, private requestService: RequestService,
private data: DatasharingService, private data: DatasharingService,
private profileService: ProfileService) { private profileService: ProfileService,
private selfService: SelfService,
public dialog: MatDialog) {
router.events.forEach((event) => { router.events.forEach((event) => {
// check if the user is on the profile page (of userY) and routes to the page of userY (e.g. his own page) // check if the user is on the profile page (of userY) and routes to the page of userY (e.g. his own page)
if (event instanceof NavigationEnd) { if (event instanceof NavigationEnd) {
@ -58,11 +60,11 @@ export class ProfileComponent implements OnInit {
this.userProfile = response; this.userProfile = response;
// tslint:disable-next-line:max-line-length // tslint:disable-next-line:max-line-length
this.userProfile.allowedToSendRequest = this.requestService.isAllowedToSendRequest(this.userProfile.userID, this.self); this.userProfile.allowedToSendRequest = this.requestService.isAllowedToSendRequest(this.userProfile.userID, this.self);
if (this.userProfile.userID === this.self.userID) { this.ownProfile = this.userProfile.userID === this.self.userID;
this.ownProfile = true;
} else {this.ownProfile = false; }
this.rankname = this.levellist.getLevelName(this.userProfile.level); this.rankname = this.levellist.getLevelName(this.userProfile.level);
} else { this.profileNotFound = true; } } else {
this.profileNotFound = true;
}
this.loading = false; this.loading = false;
}); });
} }
@ -71,19 +73,18 @@ export class ProfileComponent implements OnInit {
user.allowedToSendRequest = false; user.allowedToSendRequest = false;
this.requestService.sendFriendRequest(user); this.requestService.sendFriendRequest(user);
} }
onFileInput(event) {
console.log(event.target.files[0]);
const formData: any = new FormData();
formData.append('profilePicture', event.target.files[0]);
this.http.post(environment.greenvironmentUrl + '/upload', formData).subscribe( /**
(response: any) => { * Opens the file upload dialog
this.userProfile.profilePicture = environment.greenvironmentUrl + response.fileName; */
}, openFileUploadDialog() {
(error) => { const dialogRef = this.dialog.open(DialogFileUploadComponent, {
this._snackBar.open('failed to upload picture', 'okay', { width: '400px'
duration: 3000
}); });
dialogRef.componentInstance.profilePictureUrl.subscribe((profilePictureUrl) => {
if (profilePictureUrl) {
this.userProfile.profilePicture = profilePictureUrl;
}
}); });
} }
} }

@ -4,7 +4,8 @@
Register Register
</mat-card-title> </mat-card-title>
<mat-card-content> <mat-card-content>
<div class="example-container" (keyup.enter)="onClickSubmit(username.value,email.value,password.value, repeatpassword.value)"> <div class="example-container"
(keyup.enter)="onClickSubmit(username.value,email.value,password.value, repeatpassword.value)">
<mat-error *ngIf="errorOccurred">{{errorMessage}}</mat-error> <mat-error *ngIf="errorOccurred">{{errorMessage}}</mat-error>
<mat-form-field> <mat-form-field>
<input matInput placeholder="Enter your email" #email> <input matInput placeholder="Enter your email" #email>
@ -14,18 +15,22 @@
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<input matInput placeholder="Enter your password" [type]="hide1 ? 'password' : 'text'" #password> <input matInput placeholder="Enter your password" [type]="hide1 ? 'password' : 'text'" #password>
<button mat-icon-button matSuffix (click)="hide1 = !hide1" [attr.aria-label]="'Hide password'" [attr.aria-pressed]="hide1"> <button mat-icon-button matSuffix (click)="hide1 = !hide1" [attr.aria-label]="'Hide password'"
[attr.aria-pressed]="hide1">
<mat-icon>{{hide1 ? 'visibility_off' : 'visibility'}}</mat-icon> <mat-icon>{{hide1 ? 'visibility_off' : 'visibility'}}</mat-icon>
</button> </button>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<input matInput placeholder="Repeat your password" [type]="hide2 ? 'password' : 'text'" #repeatpassword> <input matInput placeholder="Repeat your password" [type]="hide2 ? 'password' : 'text'" #repeatpassword>
<button mat-icon-button matSuffix (click)="hide2 = !hide2" [attr.aria-label]="'Hide password'" [attr.aria-pressed]="hide2"> <button mat-icon-button matSuffix (click)="hide2 = !hide2" [attr.aria-label]="'Hide password'"
[attr.aria-pressed]="hide2">
<mat-icon>{{hide2 ? 'visibility_off' : 'visibility'}}</mat-icon> <mat-icon>{{hide2 ? 'visibility_off' : 'visibility'}}</mat-icon>
</button> </button>
</mat-form-field> </mat-form-field>
</div> </div>
<button mat-raised-button color="primary" (click)="onClickSubmit(username.value,email.value,password.value, repeatpassword.value)">Register</button> <button mat-raised-button color="primary"
(click)="onClickSubmit(username.value,email.value,password.value, repeatpassword.value)">Register
</button>
<p>You are already part of greenvironment?</p> <p>You are already part of greenvironment?</p>
<a mat-stroked-button color="primary" routerLink="/login">Login</a> <a mat-stroked-button color="primary" routerLink="/login">Login</a>
</mat-card-content> </mat-card-content>

@ -1,9 +1,6 @@
import {Component, OnInit} from '@angular/core'; import {Component, OnInit} from '@angular/core';
import {RegisterService} from '../../services/register/register.service'; import {RegisterService} from '../../services/register/register.service';
import {Registration} from '../../models/registration'; import {Registration} from '../../models/registration';
import {Router} from '@angular/router';
import {Md5} from 'ts-md5/dist/md5';
import { parseWebDriverCommand } from 'blocking-proxy/built/lib/webdriver_commands';
import * as sha512 from 'js-sha512'; import * as sha512 from 'js-sha512';
@Component({ @Component({
@ -50,7 +47,8 @@ export class RegisterComponent implements OnInit {
} }
} }
ngOnInit() {} ngOnInit() {
}
} }

@ -34,7 +34,10 @@
<div mat-card-avatar class="profile-picture" (click)="showGroupProfile(group)"></div> <div mat-card-avatar class="profile-picture" (click)="showGroupProfile(group)"></div>
<mat-card-title class="pointer" (click)="showGroupProfile(group)">{{group.name}}</mat-card-title> <mat-card-title class="pointer" (click)="showGroupProfile(group)">{{group.name}}</mat-card-title>
<div class="icon-box"> <div class="icon-box">
<button mat-icon-button class="request-button" (click)="joinGroup(group)" [disabled]="!group.allowedToJoinGroup"><mat-icon>group_add</mat-icon></button> <button mat-icon-button class="request-button" (click)="joinGroup(group)"
[disabled]="!group.allowedToJoinGroup">
<mat-icon>group_add</mat-icon>
</button>
</div> </div>
</mat-card-header> </mat-card-header>
</mat-card> </mat-card>

@ -22,16 +22,20 @@
margin-top: 0.5em margin-top: 0.5em
outline: none outline: none
user-select: none user-select: none
::ng-deep .mat-card-header-text ::ng-deep .mat-card-header-text
width: 1000% width: 1000%
margin: 0 margin: 0
margin-left: 16px margin-left: 16px
.mat-card-subtitle .mat-card-subtitle
margin: 0 margin: 0
word-break: break-all word-break: break-all
.mat-card-title .mat-card-title
margin: 0 margin: 0
word-break: break-all word-break: break-all
.request-button .request-button
margin-top: 0.5em margin-top: 0.5em
margin-bottom: 0.5em margin-bottom: 0.5em
@ -39,6 +43,7 @@
.profile-picture .profile-picture
background-image: url(https://material.angular.io/assets/img/examples/shiba1.jpg) background-image: url(https://material.angular.io/assets/img/examples/shiba1.jpg)
background-size: cover background-size: cover
.profile-picture:hover .profile-picture:hover
cursor: pointer cursor: pointer
@ -51,6 +56,7 @@
::ng-deep .mat-expansion-panel ::ng-deep .mat-expansion-panel
background: #e6e6e6 background: #e6e6e6
::ng-deep.dark-theme .mat-expansion-panel ::ng-deep.dark-theme .mat-expansion-panel
background: #121212 background: #121212

@ -1,9 +1,7 @@
import {Component, OnInit} from '@angular/core'; import {Component, OnInit} from '@angular/core';
import {SearchService} from 'src/app/services/search/search.service'; import {SearchService} from 'src/app/services/search/search.service';
import {RequestService} from 'src/app/services/request/request.service'; import {RequestService} from 'src/app/services/request/request.service';
import {Headers, Http} from '@angular/http';
import {User} from 'src/app/models/user'; import {User} from 'src/app/models/user';
import {environment} from 'src/environments/environment';
import {Router} from '@angular/router'; import {Router} from '@angular/router';
import {DatasharingService} from '../../services/datasharing.service'; import {DatasharingService} from '../../services/datasharing.service';
import {GroupInfo} from 'src/app/models/groupinfo'; import {GroupInfo} from 'src/app/models/groupinfo';
@ -25,7 +23,9 @@ export class SearchComponent implements OnInit {
private searchService: SearchService, private searchService: SearchService,
private requestService: RequestService, private requestService: RequestService,
private router: Router, private router: Router,
private data: DatasharingService) { } private data: DatasharingService) {
}
ngOnInit() { ngOnInit() {
this.data.currentUserInfo.subscribe(user => { this.data.currentUserInfo.subscribe(user => {
this.user = user; this.user = user;

@ -10,8 +10,10 @@
width: 100% width: 100%
margin-top: 0.5em margin-top: 0.5em
cursor: pointer cursor: pointer
::ng-deep .mat-card-header-text ::ng-deep .mat-card-header-text
margin: 0 24px margin: 0 24px
.mat-card-subtitle .mat-card-subtitle
margin: 0 margin: 0

@ -11,11 +11,14 @@ import { User } from 'src/app/models/user';
}) })
export class FriendsComponent implements OnInit { export class FriendsComponent implements OnInit {
user: User; user: User;
constructor(private data: DatasharingService, private router: Router) { }
constructor(private data: DatasharingService, private router: Router) {
}
ngOnInit() { ngOnInit() {
this.data.currentUserInfo.subscribe(user => { this.data.currentUserInfo.subscribe(user => {
this.user = user; }); this.user = user;
});
} }
public showFriendProfile(pFriend: FriendInfo) { public showFriendProfile(pFriend: FriendInfo) {

@ -1,7 +1,10 @@
<mat-toolbar> <mat-toolbar>
<span>Groups</span> <span>Groups</span>
<div id="button-box"> <div id="button-box">
<button mat-icon-button (click)="openDialog()" matTooltip="create group" matTooltipPosition="left" matTooltipShowDelay="500"><mat-icon>group_add</mat-icon></button> <button mat-icon-button (click)="openDialog()" matTooltip="create group" matTooltipPosition="left"
matTooltipShowDelay="500">
<mat-icon>group_add</mat-icon>
</button>
</div> </div>
</mat-toolbar> </mat-toolbar>

@ -10,6 +10,7 @@
width: 100% width: 100%
margin-top: 0.5em margin-top: 0.5em
cursor: pointer cursor: pointer
.mat-card-subtitle .mat-card-subtitle
margin: 0 margin: 0

@ -5,8 +5,6 @@ import {SocialService} from 'src/app/services/social/social.service';
import {User} from 'src/app/models/user'; import {User} from 'src/app/models/user';
import {DatasharingService} from 'src/app/services/datasharing.service'; import {DatasharingService} from 'src/app/services/datasharing.service';
import {Router} from '@angular/router'; import {Router} from '@angular/router';
import {GraphQLError} from 'graphql';
import {IGraphqlError} from '../../../models/interfaces/IGraphqlError';
import {IErrorResponse} from '../../../models/interfaces/IErrorResponse'; import {IErrorResponse} from '../../../models/interfaces/IErrorResponse';
// DIALOG COMPONENT to create groups // DIALOG COMPONENT to create groups

@ -7,7 +7,8 @@ import { Component, OnInit } from '@angular/core';
}) })
export class SocialComponent implements OnInit { export class SocialComponent implements OnInit {
constructor() { } constructor() {
}
ngOnInit() { ngOnInit() {
} }

@ -6,7 +6,10 @@
<mat-card-title class="pointer" (click)="showUserProfile(user)">{{user.username}}</mat-card-title> <mat-card-title class="pointer" (click)="showUserProfile(user)">{{user.username}}</mat-card-title>
<mat-card-subtitle class="pointer" (click)="showUserProfile(user)">{{user.handle}}</mat-card-subtitle> <mat-card-subtitle class="pointer" (click)="showUserProfile(user)">{{user.handle}}</mat-card-subtitle>
<div class="icon-box"> <div class="icon-box">
<button mat-icon-button class="request-button" (click)="sendFriendRequest(user)" [disabled]="!user.allowedToSendRequest"><mat-icon>person_add</mat-icon></button> <button mat-icon-button class="request-button" (click)="sendFriendRequest(user)"
[disabled]="!user.allowedToSendRequest">
<mat-icon>person_add</mat-icon>
</button>
</div> </div>
</mat-card-header> </mat-card-header>
</mat-card> </mat-card>

@ -7,15 +7,19 @@
margin-top: 0.5em margin-top: 0.5em
outline: none outline: none
user-select: none user-select: none
::ng-deep .mat-card-header-text ::ng-deep .mat-card-header-text
width: 1000% width: 1000%
margin: auto 0 auto 24px margin: auto 0 auto 24px
.mat-card-subtitle .mat-card-subtitle
margin: 0 margin: 0
word-break: break-all word-break: break-all
.mat-card-title .mat-card-title
margin: 0 margin: 0
word-break: break-all word-break: break-all
.request-button .request-button
margin-top: 0.5em margin-top: 0.5em
margin-bottom: 0.5em margin-bottom: 0.5em

@ -1,4 +1,4 @@
import { Component, OnInit, Input } from '@angular/core'; import {Component, Input, OnInit} from '@angular/core';
import {User} from 'src/app/models/user'; import {User} from 'src/app/models/user';
import {RequestService} from 'src/app/services/request/request.service'; import {RequestService} from 'src/app/services/request/request.service';
import {Router} from '@angular/router'; import {Router} from '@angular/router';
@ -13,7 +13,8 @@ export class UserlistComponent implements OnInit {
@Input() userList: Array<User>; @Input() userList: Array<User>;
selectedUser: User; selectedUser: User;
constructor(private requestService: RequestService, private router: Router) { } constructor(private requestService: RequestService, private router: Router) {
}
ngOnInit() { ngOnInit() {
} }

@ -1,9 +1,10 @@
import {NgModule} from '@angular/core'; import {NgModule} from '@angular/core';
import {ApolloModule, APOLLO_OPTIONS} from 'apollo-angular'; import {APOLLO_OPTIONS, ApolloModule} from 'apollo-angular';
import {HttpLinkModule, HttpLink} from 'apollo-angular-link-http'; import {HttpLink, HttpLinkModule} from 'apollo-angular-link-http';
import {InMemoryCache} from 'apollo-cache-inmemory'; import {InMemoryCache} from 'apollo-cache-inmemory';
const uri = 'https://o5x5jzoo7z.sse.codesandbox.io/graphql'; const uri = 'https://o5x5jzoo7z.sse.codesandbox.io/graphql';
// 'https://greenvironment.net/graphql:443'; // <-- add the URL of the GraphQL server here // 'https://greenvironment.net/graphql:443'; // <-- add the URL of the GraphQL server here
export function createApollo(httpLink: HttpLink) { export function createApollo(httpLink: HttpLink) {
return { return {
@ -22,4 +23,5 @@ export function createApollo(httpLink: HttpLink) {
}, },
], ],
}) })
export class GraphQLModule {} export class GraphQLModule {
}

@ -1,4 +1,3 @@
export class Activity { export class Activity {
id: number; id: number;
name: string; name: string;
@ -14,5 +13,5 @@ export class Activity {
} }
export class Activitylist { export class Activitylist {
Actions: Activity[] = new Array(); Actions: Activity[] = [];
} }

@ -1,5 +1,3 @@
import { User } from 'src/app/models/user';
export class FriendRequest { export class FriendRequest {
id: number; id: number;
senderUserID: number; senderUserID: number;

@ -6,9 +6,9 @@ export class Group {
name: string; name: string;
handle: string; handle: string;
creator: User = new User(); creator: User = new User();
members: User[] = new Array(); members: User[] = [];
admins: User[] = new Array(); admins: User[] = [];
events: Event[] = new Array(); events: Event[] = [];
joined: boolean; joined: boolean;
allowedToJoinGroup = false; allowedToJoinGroup = false;
} }

@ -0,0 +1,5 @@
export interface IFileUploadResult {
success: boolean;
fileName?: string;
error?: string;
}

@ -1,5 +1,4 @@
import {IGroup} from './IGroup'; import {IGroup} from './IGroup';
import {ISettings} from './ISettings';
import {IChat} from './IChat'; import {IChat} from './IChat';
import {IRequest} from './IRequest'; import {IRequest} from './IRequest';

@ -1,5 +1,3 @@
import { Hash } from 'crypto';
export interface Login { export interface Login {
email: string; email: string;
passwordHash: string; passwordHash: string;

@ -46,20 +46,30 @@ export class User {
} catch (err) { } catch (err) {
console.error(err); console.error(err);
} }
if (userDataResponse.friends) {
this.friends = userDataResponse.friends this.friends = userDataResponse.friends
.map(friend => new FriendInfo( .map(friend => new FriendInfo(
friend.id, friend.name, friend.id, friend.name,
friend.level, friend.level,
this.buildProfilePictureUrl(friend.profilePicture) this.buildProfilePictureUrl(friend.profilePicture)
)); ));
}
if (userDataResponse.groups) {
this.groups = userDataResponse.groups this.groups = userDataResponse.groups
.map(group => new GroupInfo(group.id, group.name)); .map(group => new GroupInfo(group.id, group.name));
}
if (userDataResponse.chats) {
this.chatIDs = userDataResponse.chats.map(chat => chat.id); this.chatIDs = userDataResponse.chats.map(chat => chat.id);
}
if (userDataResponse.sentRequests) {
this.sentRequestUserIDs = userDataResponse.sentRequests this.sentRequestUserIDs = userDataResponse.sentRequests
.map(request => request.receiver.id); .map(request => request.receiver.id);
}
if (userDataResponse.receivedRequests) {
this.receivedRequests = userDataResponse.receivedRequests this.receivedRequests = userDataResponse.receivedRequests
.map(request => new FriendRequest(request.id, request.sender.id, request.sender.handle, request.sender.name)); .map(request => new FriendRequest(request.id, request.sender.id, request.sender.handle, request.sender.name));
} }
}
buildProfilePictureUrl(path: string): string { buildProfilePictureUrl(path: string): string {
if (path) { if (path) {

@ -1,6 +1,6 @@
import {Injectable} from '@angular/core'; import {Injectable} from '@angular/core';
import {BehaviorSubject} from 'rxjs'; import {BehaviorSubject} from 'rxjs';
import { Activitylist, Activity } from 'src/app/models/activity'; import {Activity, Activitylist} from 'src/app/models/activity';
import {environment} from 'src/environments/environment'; import {environment} from 'src/environments/environment';
import {Http} from '@angular/http'; import {Http} from '@angular/http';
@ -12,7 +12,8 @@ export class ActivityService {
public activitylist = new BehaviorSubject<Activitylist>(new Activitylist()); public activitylist = new BehaviorSubject<Activitylist>(new Activitylist());
constructor(private http: Http) { } constructor(private http: Http) {
}
changeUserInfo(pActivitylist: Activitylist) { changeUserInfo(pActivitylist: Activitylist) {
this.activitylist.next(pActivitylist); this.activitylist.next(pActivitylist);
@ -30,11 +31,11 @@ export class ActivityService {
} }
public buildJson(): any { public buildJson(): any {
const body = {query: `query{getActivities{ const body = {
query: `query{getActivities{
id name description points id name description points
}}`, variables: { }}`, variables: {}
};
}};
return body; return body;
} }

@ -1,5 +1,5 @@
import {Injectable} from '@angular/core'; import {Injectable} from '@angular/core';
import {Http, URLSearchParams, Headers} from '@angular/http'; import {Headers, Http} from '@angular/http';
import {Chat} from 'src/app/models/chat'; import {Chat} from 'src/app/models/chat';
import {Chatmessage} from 'src/app/models/chatmessage'; import {Chatmessage} from 'src/app/models/chatmessage';
import {FriendInfo} from 'src/app/models/friendinfo'; import {FriendInfo} from 'src/app/models/friendinfo';
@ -17,7 +17,8 @@ export class ChatService {
constructor(private http: Http, private data: DatasharingService) { constructor(private http: Http, private data: DatasharingService) {
this.data.currentUserInfo.subscribe(user => { this.data.currentUserInfo.subscribe(user => {
this.ownID = user.userID; }); this.ownID = user.userID;
});
} }
public getAllChats(): Array<Chat> { public getAllChats(): Array<Chat> {
@ -210,17 +211,20 @@ export class ChatService {
getBodyForNewChat(pUserID: number) { getBodyForNewChat(pUserID: number) {
this.arr = [pUserID]; this.arr = [pUserID];
const body = {query: `mutation($userID: number[]) { const body = {
query: `mutation($userID: number[]) {
createChat(members: $userID) {id} createChat(members: $userID) {id}
}`, variables: { }`, variables: {
members: this.arr members: this.arr
}}; }
};
return body; return body;
} }
getBodyForRequestOfAllChatPartners() { getBodyForRequestOfAllChatPartners() {
const body = {query: `query { const body = {
query: `query {
getSelf { getSelf {
chats(first: 1000, offset: 0) {members{name, id, level}} chats(first: 1000, offset: 0) {members{name, id, level}}
}}` }}`
@ -230,18 +234,21 @@ export class ChatService {
} }
getBodyForSendMessage(pchatID: number, pContent: string) { getBodyForSendMessage(pchatID: number, pContent: string) {
const body = {query: `mutation($chatId: ID!, $content: String!) { const body = {
query: `mutation($chatId: ID!, $content: String!) {
sendMessage(chatId: $chatId, content: $content) {id} sendMessage(chatId: $chatId, content: $content) {id}
}`, variables: { }`, variables: {
chatId: pchatID, chatId: pchatID,
content: pContent content: pContent
}}; }
};
return body; return body;
} }
getBodyForGetAllChats() { getBodyForGetAllChats() {
const body = {query: `query { const body = {
query: `query {
getSelf { getSelf {
chats(first: 10, offset: 0) { chats(first: 10, offset: 0) {
id, members{name, id, level}, id, members{name, id, level},
@ -256,24 +263,28 @@ export class ChatService {
} }
getBodyForGetChatsByID(pChatID: number) { getBodyForGetChatsByID(pChatID: number) {
const body = {query: `query($chatID: ID!) { const body = {
query: `query($chatID: ID!) {
getChat(chatId: $chatID) {id, members{name, id, level}, getChat(chatId: $chatID) {id, members{name, id, level},
messages(first: 1000, offset: 0) {author {id}, createdAt, content}} messages(first: 1000, offset: 0) {author {id}, createdAt, content}}
} }
}`, variables: { }`, variables: {
chatId: pChatID chatId: pChatID
}}; }
};
return body; return body;
} }
getBodyForGetMessagesInChat(pChatID: number) { getBodyForGetMessagesInChat(pChatID: number) {
const body = {query: `query($chatId: ID!) { const body = {
query: `query($chatId: ID!) {
getChat(chatId: $chatId) { getChat(chatId: $chatId) {
messages(first: 1000, offset: 0) {author {id}, createdAt, content} messages(first: 1000, offset: 0) {author {id}, createdAt, content}
} }
}`, variables: { }`, variables: {
chatId: pChatID chatId: pChatID
}}; }
};
return body; return body;
} }
} }

@ -12,7 +12,8 @@ export class DatasharingService {
currentUserInfo = this.userInfoSource.asObservable(); currentUserInfo = this.userInfoSource.asObservable();
currentChatIDs = this.chatIDsSource.asObservable(); currentChatIDs = this.chatIDsSource.asObservable();
constructor() { } constructor() {
}
changeUserInfo(pUserInfo: User) { changeUserInfo(pUserInfo: User) {
this.userInfoSource.next(pUserInfo); this.userInfoSource.next(pUserInfo);

@ -11,7 +11,8 @@ export class DocumentService {
currentDocument = this.socket.fromEvent<Document>('document'); currentDocument = this.socket.fromEvent<Document>('document');
documents = this.socket.fromEvent<string[]>('documents'); documents = this.socket.fromEvent<string[]>('documents');
constructor(private socket: Socket) { } constructor(private socket: Socket) {
}
getDocument(id: string) { getDocument(id: string) {
this.socket.emit('getDoc', id); this.socket.emit('getDoc', id);

@ -21,13 +21,15 @@ export class FeedService {
private mostLikedOffset = 0; private mostLikedOffset = 0;
private newOffset = 0; private newOffset = 0;
constructor(private http: HttpClient) { } constructor(private http: HttpClient) {
}
public createPost(pContent: String) { public createPost(pContent: String) {
const headers = new Headers(); const headers = new Headers();
headers.set('Content-Type', 'application/json'); headers.set('Content-Type', 'application/json');
const body = {query: `mutation($content: String!) { const body = {
query: `mutation($content: String!) {
createPost(content: $content) { createPost(content: $content) {
id, id,
content, content,
@ -50,7 +52,8 @@ export class FeedService {
createdAt} createdAt}
}`, variables: { }`, variables: {
content: pContent content: pContent
}}; }
};
return this.http.post(environment.graphQLUrl, body).pipe(tap(response => { return this.http.post(environment.graphQLUrl, body).pipe(tap(response => {
const updatedposts = this.newPosts.getValue(); const updatedposts = this.newPosts.getValue();
updatedposts.unshift(this.renderPost(response)); updatedposts.unshift(this.renderPost(response));
@ -63,7 +66,8 @@ export class FeedService {
const headers = new Headers(); const headers = new Headers();
headers.set('Content-Type', 'application/json'); headers.set('Content-Type', 'application/json');
const body = {query: `mutation($content: String!, $id: ID) { const body = {
query: `mutation($content: String!, $id: ID) {
createPost(content: $content activityId: $id) { createPost(content: $content activityId: $id) {
id, id,
content, content,
@ -87,7 +91,8 @@ export class FeedService {
}`, variables: { }`, variables: {
content: pContent, content: pContent,
id: activityId id: activityId
}}; }
};
return this.http.post(environment.graphQLUrl, body).pipe(tap(response => { return this.http.post(environment.graphQLUrl, body).pipe(tap(response => {
const updatedposts = this.newPosts.getValue(); const updatedposts = this.newPosts.getValue();
updatedposts.unshift(this.renderPost(response)); updatedposts.unshift(this.renderPost(response));
@ -100,13 +105,15 @@ export class FeedService {
const headers = new Headers(); const headers = new Headers();
headers.set('Content-Type', 'application/json'); headers.set('Content-Type', 'application/json');
const body = {query: `mutation($postId: ID!) { const body = {
query: `mutation($postId: ID!) {
vote(postId: $postId, type: UPVOTE) { vote(postId: $postId, type: UPVOTE) {
post{userVote upvotes downvotes} post{userVote upvotes downvotes}
} }
}`, variables: { }`, variables: {
postId postId
}}; }
};
return this.http.post(environment.graphQLUrl, body); return this.http.post(environment.graphQLUrl, body);
} }
@ -115,13 +122,15 @@ export class FeedService {
const headers = new Headers(); const headers = new Headers();
headers.set('Content-Type', 'application/json'); headers.set('Content-Type', 'application/json');
const body = {query: `mutation($postId: ID!) { const body = {
query: `mutation($postId: ID!) {
vote(postId: $postId, type: DOWNVOTE) { vote(postId: $postId, type: DOWNVOTE) {
post{userVote upvotes downvotes} post{userVote upvotes downvotes}
} }
}`, variables: { }`, variables: {
postId: pPostID postId: pPostID
}}; }
};
return this.http.post(environment.graphQLUrl, body); return this.http.post(environment.graphQLUrl, body);
} }
@ -130,11 +139,13 @@ export class FeedService {
const headers = new Headers(); const headers = new Headers();
headers.set('Content-Type', 'application/json'); headers.set('Content-Type', 'application/json');
const body = {query: `mutation($postId: ID!) { const body = {
query: `mutation($postId: ID!) {
deletePost(postId: $postId) deletePost(postId: $postId)
}`, variables: { }`, variables: {
postId: pPostID postId: pPostID
}}; }
};
return this.http.post(environment.graphQLUrl, body); return this.http.post(environment.graphQLUrl, body);
} }
@ -153,7 +164,8 @@ export class FeedService {
} }
this.setPost(sort); this.setPost(sort);
}); });
} this.setPost(sort); }
this.setPost(sort);
} }
public getNextPosts() { public getNextPosts() {
@ -198,7 +210,8 @@ export class FeedService {
} }
buildJson(sort: string, offset: number) { buildJson(sort: string, offset: number) {
const body = {query: `query($offset: Int, $sort: SortType){ const body = {
query: `query($offset: Int, $sort: SortType){
getPosts (first: 10, offset: $offset, sort: $sort) { getPosts (first: 10, offset: $offset, sort: $sort) {
id, id,
content, content,
@ -222,7 +235,8 @@ export class FeedService {
}`, variables: { }`, variables: {
offset, offset,
sort sort
}}; }
};
return body; return body;
} }
@ -251,7 +265,9 @@ export class FeedService {
post.activity.name, post.activity.name,
post.activity.description, post.activity.description,
post.activity.points); post.activity.points);
} else { activity = null; } } else {
activity = null;
}
return new Post(id, content, htmlContent, upvotes, downvotes, userVote, deletable, date, author, activity); return new Post(id, content, htmlContent, upvotes, downvotes, userVote, deletable, date, author, activity);
} }
@ -283,7 +299,9 @@ export class FeedService {
post.activity.name, post.activity.name,
post.activity.description, post.activity.description,
post.activity.points); post.activity.points);
} else { activity = null; } } else {
activity = null;
}
posts.push(new Post(id, content, htmlContent, upvotes, downvotes, userVote, deletable, date, author, activity)); posts.push(new Post(id, content, htmlContent, upvotes, downvotes, userVote, deletable, date, author, activity));
} }
return posts; return posts;

@ -1,10 +1,9 @@
import {Injectable} from '@angular/core'; import {Injectable} from '@angular/core';
import {Http} from '@angular/http'; import {Http} from '@angular/http';
import { Author } from 'src/app/models/author';
import {environment} from 'src/environments/environment'; import {environment} from 'src/environments/environment';
import {User} from 'src/app/models/user'; import {User} from 'src/app/models/user';
import {Event} from 'src/app/models/event'; import {Event} from 'src/app/models/event';
import { Observable, BehaviorSubject } from 'rxjs'; import {BehaviorSubject} from 'rxjs';
import {Group} from 'src/app/models/group'; import {Group} from 'src/app/models/group';
@Injectable({ @Injectable({
@ -14,7 +13,8 @@ export class GroupService {
public group: BehaviorSubject<Group> = new BehaviorSubject(new Group()); public group: BehaviorSubject<Group> = new BehaviorSubject(new Group());
constructor(private http: Http) { } constructor(private http: Http) {
}
public getGroupData(groupId: string) { public getGroupData(groupId: string) {
const headers = new Headers(); const headers = new Headers();
@ -83,7 +83,8 @@ export class GroupService {
public createEvent(name: string, date: string, groupId: string) { public createEvent(name: string, date: string, groupId: string) {
const headers = new Headers(); const headers = new Headers();
headers.set('Content-Type', 'application/json'); headers.set('Content-Type', 'application/json');
const body = {query: `mutation($groupId: ID!, $name: String, $date: String) { const body = {
query: `mutation($groupId: ID!, $name: String, $date: String) {
createEvent(name: $name, dueDate: $date, groupId: $groupId) { createEvent(name: $name, dueDate: $date, groupId: $groupId) {
id id
name name
@ -94,7 +95,8 @@ export class GroupService {
name: name, name: name,
date: date, date: date,
groupId: groupId groupId: groupId
}}; }
};
this.http.post(environment.graphQLUrl, body).subscribe(response => { this.http.post(environment.graphQLUrl, body).subscribe(response => {
const event = response.json().data.createEvent; const event = response.json().data.createEvent;
@ -109,26 +111,30 @@ export class GroupService {
public joinEvent(eventId: string) { public joinEvent(eventId: string) {
const headers = new Headers(); const headers = new Headers();
headers.set('Content-Type', 'application/json'); headers.set('Content-Type', 'application/json');
const body = {query: `mutation($eventId: ID!) { const body = {
query: `mutation($eventId: ID!) {
joinEvent(eventId: $eventId) { joinEvent(eventId: $eventId) {
joined joined
} }
}`, variables: { }`, variables: {
eventId: eventId eventId: eventId
}}; }
};
return this.http.post(environment.graphQLUrl, body); return this.http.post(environment.graphQLUrl, body);
} }
public leaveEvent(eventId: string) { public leaveEvent(eventId: string) {
const headers = new Headers(); const headers = new Headers();
headers.set('Content-Type', 'application/json'); headers.set('Content-Type', 'application/json');
const body = {query: `mutation($eventId: ID!) { const body = {
query: `mutation($eventId: ID!) {
leaveEvent(eventId: $eventId) { leaveEvent(eventId: $eventId) {
joined joined
} }
}`, variables: { }`, variables: {
eventId: eventId eventId: eventId
}}; }
};
return this.http.post(environment.graphQLUrl, body); return this.http.post(environment.graphQLUrl, body);
} }

@ -1,34 +1,14 @@
import {Injectable} from '@angular/core'; import {Injectable} from '@angular/core';
import { Http } from '@angular/http'; import {HttpClient} from '@angular/common/http';
import {Post} from 'src/app/models/post'; import {Post} from 'src/app/models/post';
import {Author} from 'src/app/models/author'; import {Author} from 'src/app/models/author';
import {environment} from 'src/environments/environment'; import {environment} from 'src/environments/environment';
import {User} from 'src/app/models/user'; import {User} from 'src/app/models/user';
import { Observable, Subject } from 'rxjs'; import {Subject} from 'rxjs';
import {Activity} from 'src/app/models/activity'; import {Activity} from 'src/app/models/activity';
import {BaseService} from '../base.service';
@Injectable({ const graphqlGetProfileQuery = `query($userId: ID) {
providedIn: 'root'
})
export class ProfileService {
public proflile: Subject<any> = new Subject();
constructor(private http: Http) { }
public getUserData(userId: string) {
const headers = new Headers();
headers.set('Content-Type', 'application/json');
// return this.renderProfile(this.http.post(environment.graphQLUrl, this.buildGetProfileJson(userId)));
this.http.post(environment.graphQLUrl, this.buildGetProfileJson(userId)).subscribe(result => {
// push onto subject
this.proflile.next(this.renderProfile(result.json()));
return this.proflile;
});
}
public buildGetProfileJson(id: string): any {
const body = {query: `query($userId: ID) {
getUser(userId:$userId){ getUser(userId:$userId){
id id
handle handle
@ -64,29 +44,54 @@ export class ProfileService {
createdAt createdAt
} }
} }
}`, variables: { }`;
@Injectable({
providedIn: 'root'
})
export class ProfileService extends BaseService {
constructor(private http: HttpClient) {
super();
}
public proflile: Subject<any> = new Subject();
/**
* Builds the request body of a getProfile request
* @param id
*/
private static buildGetProfileBody(id: string): any {
return {
query: graphqlGetProfileQuery,
variables: {
userId: id, userId: id,
}}; }
return body; };
}
/**
* Returns the data for the specified user.
* @param userId
*/
public getUserData(userId: string) {
const headers = new Headers();
headers.set('Content-Type', 'application/json');
this.http.post(environment.graphQLUrl, ProfileService.buildGetProfileBody(userId)).subscribe(result => {
this.proflile.next(this.getProfileData(result));
return this.proflile;
});
} }
public renderProfile(response: any): User { /**
* Returns a userinstance filled with profile data
* @param response
*/
public getProfileData(response: any): User {
const posts = new Array<Post>(); const posts = new Array<Post>();
const profile = new User(); const profile = new User();
if (response.data.getUser != null) { if (response.data.getUser) {
profile.assignFromResponse(response.data.getUser);
profile.userID = response.data.getUser.id;
profile.username = response.data.getUser.name;
profile.handle = response.data.getUser.handle;
profile.points = response.data.getUser.points;
profile.level = response.data.getUser.level;
profile.friendCount = response.data.getUser.friendCount;
profile.groupCount = response.data.getUser.groupCount;
if (response.data.getUser.profilePicture) {
profile.profilePicture = environment.greenvironmentUrl + response.data.getUser.profilePicture;
} else {
profile.profilePicture = 'assets/images/default-profilepic.svg';
}
const temp = new Date(Number(response.data.getUser.joinedAt)); const temp = new Date(Number(response.data.getUser.joinedAt));
const date = temp.toLocaleString('en-GB'); const date = temp.toLocaleString('en-GB');
profile.joinedAt = date; profile.joinedAt = date;
@ -114,7 +119,9 @@ export class ProfileService {
post.activity.name, post.activity.name,
post.activity.description, post.activity.description,
post.activity.points); post.activity.points);
} else { activity = null; } } else {
activity = null;
}
// tslint:disable-next-line: max-line-length // tslint:disable-next-line: max-line-length
posts.push(new Post(id, content, htmlContent, upvotes, downvotes, userVote, deletable, pdate, author, activity)); posts.push(new Post(id, content, htmlContent, upvotes, downvotes, userVote, deletable, pdate, author, activity));

@ -1,5 +1,5 @@
import {Injectable} from '@angular/core'; import {Injectable} from '@angular/core';
import {Http, URLSearchParams, Headers} from '@angular/http'; import {Headers, Http} from '@angular/http';
import {Registration} from '../../models/registration'; import {Registration} from '../../models/registration';
import {Router} from '@angular/router'; import {Router} from '@angular/router';
import {DatasharingService} from '../datasharing.service'; import {DatasharingService} from '../datasharing.service';
@ -13,7 +13,8 @@ import { FriendInfo } from 'src/app/models/friendinfo';
}) })
export class RegisterService { export class RegisterService {
constructor(private http: Http, private data: DatasharingService, private router: Router) { } constructor(private http: Http, private data: DatasharingService, private router: Router) {
}
public register(registration: Registration, errorCb: any) { public register(registration: Registration, errorCb: any) {
@ -72,7 +73,8 @@ export class RegisterService {
} }
public buildJson(registration: Registration): any { public buildJson(registration: Registration): any {
const body = {query: `mutation($username: String, $email: String, $pwHash: String) { const body = {
query: `mutation($username: String, $email: String, $pwHash: String) {
register(username: $username, email: $email, passwordHash: $pwHash) { register(username: $username, email: $email, passwordHash: $pwHash) {
id, id,
name, name,
@ -95,7 +97,8 @@ export class RegisterService {
email: registration.email, email: registration.email,
pwHash: registration.passwordHash, pwHash: registration.passwordHash,
username: registration.username, username: registration.username,
}}; }
};
return body; return body;
} }
} }

@ -16,7 +16,9 @@ export class RequestService {
} }
public isAllowedToSendRequest(userID: number, self: User): boolean { public isAllowedToSendRequest(userID: number, self: User): boolean {
if (!self.loggedIn) { return false; } else { if (!self.loggedIn) {
return false;
} else {
for (const receiverID of self.sentRequestUserIDs) { for (const receiverID of self.sentRequestUserIDs) {
if (userID === receiverID || if (userID === receiverID ||
userID === self.userID) { userID === self.userID) {

@ -8,7 +8,6 @@ import {Observable} from 'rxjs';
import {ISearchResult} from '../../models/interfaces/ISearchResult'; import {ISearchResult} from '../../models/interfaces/ISearchResult';
import {environment} from '../../../environments/environment'; import {environment} from '../../../environments/environment';
import {BaseService} from '../base.service'; import {BaseService} from '../base.service';
import {tap} from 'rxjs/operators';
interface ISearchRequestResult { interface ISearchRequestResult {
data: { data: {

@ -1,71 +1,13 @@
import { Injectable, EventEmitter, Output } from '@angular/core'; import {Injectable} from '@angular/core';
import {Http, URLSearchParams, Headers} from '@angular/http';
import {User} from 'src/app/models/user'; import {User} from 'src/app/models/user';
import {DatasharingService} from '../datasharing.service'; import {DatasharingService} from '../datasharing.service';
import {Router} from '@angular/router';
import {environment} from 'src/environments/environment'; import {environment} from 'src/environments/environment';
import { FriendRequest } from 'src/app/models/friendRequest'; import {HttpClient} from '@angular/common/http';
import { FriendInfo } from 'src/app/models/friendinfo'; import {tap} from 'rxjs/operators';
import { GroupInfo } from 'src/app/models/groupinfo'; import {BaseService} from '../base.service';
import {IFileUploadResult} from '../../models/interfaces/IFileUploadResult';
@Injectable({ const getSelfGraphqlQuery = `{
providedIn: 'root'
})
export class SelfService {
constructor(private http: Http, private data: DatasharingService, private router: Router) { }
public checkIfLoggedIn() {
const url = environment.graphQLUrl;
const headers = new Headers();
headers.set('Content-Type', 'application/json');
return this.http.post(url, this.buildJson())
.subscribe(response => {
this.stillLoggedIn();
this.updateUserInfo(response.json());
}, error => {
this.notLoggedIn();
// this.fakeLogin();
}
);
}
public stillLoggedIn() {
}
public notLoggedIn() {
}
public updateUserInfo(response: any) {
const user = new User();
user.assignFromResponse(response.data.getSelf);
this.data.changeUserInfo(user);
}
public fakeLogin() {
const user: User = new User();
let friendRequest: FriendRequest = new FriendRequest();
user.loggedIn = true;
user.userID = 1;
user.username = 'Rapier';
user.handle = 'rapier123';
user.email = 'r@r.com';
user.points = 100;
user.level = 3;
user.friends.push(new FriendInfo(1, 'Freund77', 4, 'lalala'));
friendRequest = new FriendRequest();
friendRequest.id = 10;
friendRequest.senderUserID = 99;
friendRequest.senderUsername = 'Löwe';
friendRequest.senderHandle = 'loewe123';
user.receivedRequests.push(friendRequest);
this.data.changeUserInfo(user);
}
public buildJson(): any {
const body = {query: `{
getSelf{ getSelf{
id, id,
name, name,
@ -91,8 +33,57 @@ export class SelfService {
}, },
settings settings
} }
}`, variables: { }`;
}};
return body; @Injectable({
providedIn: 'root'
})
export class SelfService extends BaseService {
constructor(private http: HttpClient, private data: DatasharingService) {
super();
}
/**
* Builds the getself request body
*/
private static buildGetSelfBody(): any {
return {
query: getSelfGraphqlQuery, variables: {}
};
}
/**
* Checks if the user is still logged in
*/
public checkIfLoggedIn() {
const url = environment.graphQLUrl;
const headers = new Headers();
headers.set('Content-Type', 'application/json');
return this.http.post(url, SelfService.buildGetSelfBody(), {headers: this.headers})
.pipe(tap(response => {
this.updateUserInfo(response);
}));
}
/**
* Uploads a file as a profile picture
* @param file
*/
public changeProfilePicture(file: any) {
const formData: any = new FormData();
formData.append('profilePicture', file);
return this.http.post<IFileUploadResult>(environment.greenvironmentUrl + '/upload', formData);
}
/**
* Updates the info on a user
* @param response
*/
public updateUserInfo(response: any) {
const user = new User();
user.assignFromResponse(response.data.getSelf);
this.data.changeUserInfo(user);
} }
} }

@ -10,6 +10,7 @@ import {DatasharingService} from '../datasharing.service';
export class SettingsService { export class SettingsService {
users: Array<User>; users: Array<User>;
constructor(private http: Http, private data: DatasharingService) { constructor(private http: Http, private data: DatasharingService) {
} }
@ -20,7 +21,8 @@ export class SettingsService {
headers.set('Content-Type', 'application/json'); headers.set('Content-Type', 'application/json');
const body = this.buildJsonDarkMode('darkmode: ' + '\'' + active + '\''); const body = this.buildJsonDarkMode('darkmode: ' + '\'' + active + '\'');
this.http.post(url, body).subscribe(response => { this.http.post(url, body).subscribe(response => {
console.log(response.text()); }); console.log(response.text());
});
} }
public buildJsonDarkMode(setting_: string): any { public buildJsonDarkMode(setting_: string): any {

@ -5,7 +5,6 @@
xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#" xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

@ -5,7 +5,6 @@
xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#" xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

@ -5,7 +5,6 @@
xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#" xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

@ -59,7 +59,6 @@ $background: map_merge($background, (background: $background-color));
$light-theme: map_merge($light-theme, (background: $background)); $light-theme: map_merge($light-theme, (background: $background));
$dark-primary: mat-palette($mat-light-green); $dark-primary: mat-palette($mat-light-green);
$dark-accent: mat-palette($mat-black); $dark-accent: mat-palette($mat-black);
$dark-warn: mat-palette($mat-red); $dark-warn: mat-palette($mat-red);
@ -80,6 +79,7 @@ $dark-theme: map_merge($dark-theme, (background: $dark-background));
.light-theme { .light-theme {
@include angular-material-theme($light-theme) @include angular-material-theme($light-theme)
} }
// Include theme styles for core and each component used in your app. // Include theme styles for core and each component used in your app.
// Alternatively, you can import and @include the theme mixins for each component // Alternatively, you can import and @include the theme mixins for each component
// that you are using. // that you are using.

@ -2,10 +2,7 @@
import 'zone.js/dist/zone-testing'; import 'zone.js/dist/zone-testing';
import {getTestBed} from '@angular/core/testing'; import {getTestBed} from '@angular/core/testing';
import { import {BrowserDynamicTestingModule, platformBrowserDynamicTesting} from '@angular/platform-browser-dynamic/testing';
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
declare const require: any; declare const require: any;

1
src/typings.d.ts vendored

@ -1,4 +1,3 @@
declare module '*.svg' { declare module '*.svg' {
const svg: string; const svg: string;
export default svg; export default svg;

Loading…
Cancel
Save