Cleanup code

master
trivernis 5 years ago
parent d99310c9b6
commit 5a19cc0dc4

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

@ -1,7 +1,6 @@
import { Component, OnInit } from '@angular/core';
import { User } from './models/user';
import { DatasharingService } from './services/datasharing.service';
import { SelfService } from './services/selfservice/self.service';
import {Component, OnInit} from '@angular/core';
import {DatasharingService} from './services/datasharing.service';
import {SelfService} from './services/selfservice/self.service';
@Component({
selector: 'app-root',
@ -10,7 +9,8 @@ import { SelfService } from './services/selfservice/self.service';
})
export class AppComponent implements OnInit {
constructor(private data: DatasharingService, private selfservice: SelfService) { }
constructor(private data: DatasharingService, private selfservice: SelfService) {
}
ngOnInit() {
this.data.currentUserInfo.subscribe(user => {

@ -1,43 +1,40 @@
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { RouterModule, Routes } from '@angular/router';
import { SocketIoModule, SocketIoConfig } from 'ngx-socket-io';
import { HttpModule } from '@angular/http';
import {BrowserModule, DomSanitizer} from '@angular/platform-browser';
import {NgModule} from '@angular/core';
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
import {RouterModule, Routes} from '@angular/router';
import {SocketIoConfig, SocketIoModule} from 'ngx-socket-io';
import {HttpModule} from '@angular/http';
import { AppComponent } from './app.component';
import { DocumentListComponent } from './components/document-list/document-list.component';
import { DocumentComponent } from './components/document/document.component';
import { RegisterComponent } from './components/register/register.component';
import { LoginComponent } from './components/login/login.component';
import { ChatComponent } from './components/chat/chat.component';
import { FriendsComponent } from './components/social/friends/friends.component';
import { FeedComponent } from './components/feed/feed.component';
import { HomeComponent } from './components/home/home.component';
import { SocialComponent } from './components/social/social.component';
import { GroupsComponent } from './components/social/groups/groups.component';
import { DialogCreateGroupComponent } from './components/social/groups/groups.component';
import { DialogCreateEventComponent } from './components/group/group.component';
import { ChatmanagerComponent } from './components/chatmanager/chatmanager.component';
import { ChatlistComponent } from './components/chatlist/chatlist.component';
import { PostlistComponent } from './components/feed/postlist/postlist.component';
import { GraphQLModule } from './graphql.module';
import { HttpClientModule } from '@angular/common/http';
import { ProfileComponent } from './components/profile/profile.component';
import { GroupComponent } from './components/group/group.component';
import { ImprintComponent } from './components/imprint/imprint.component';
import { AboutComponent } from './components/about/about.component';
import { ChatcontactsComponent } from './components/chatmanager/chatcontacts/chatcontacts.component';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import {AppComponent} from './app.component';
import {DocumentListComponent} from './components/document-list/document-list.component';
import {DocumentComponent} from './components/document/document.component';
import {RegisterComponent} from './components/register/register.component';
import {LoginComponent} from './components/login/login.component';
import {ChatComponent} from './components/chat/chat.component';
import {FriendsComponent} from './components/social/friends/friends.component';
import {FeedComponent} from './components/feed/feed.component';
import {HomeComponent} from './components/home/home.component';
import {SocialComponent} from './components/social/social.component';
import {DialogCreateGroupComponent, GroupsComponent} from './components/social/groups/groups.component';
import {DialogCreateEventComponent, GroupComponent} from './components/group/group.component';
import {ChatmanagerComponent} from './components/chatmanager/chatmanager.component';
import {ChatlistComponent} from './components/chatlist/chatlist.component';
import {PostlistComponent} from './components/feed/postlist/postlist.component';
import {GraphQLModule} from './graphql.module';
import {HttpClientModule} from '@angular/common/http';
import {ProfileComponent} from './components/profile/profile.component';
import {ImprintComponent} from './components/imprint/imprint.component';
import {AboutComponent} from './components/about/about.component';
import {ChatcontactsComponent} from './components/chatmanager/chatcontacts/chatcontacts.component';
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
import {MatTableModule} from '@angular/material/table';
import { InfiniteScrollModule } from 'ngx-infinite-scroll';
import {InfiniteScrollModule} from 'ngx-infinite-scroll';
import {UserlistComponent} from './components/userlist/userlist.component';
import { MatSliderModule } from '@angular/material/slider';
import { MatFormFieldModule } from '@angular/material/form-field';
import {MatSliderModule} from '@angular/material/slider';
import {MatFormFieldModule} from '@angular/material/form-field';
import {MatInputModule} from '@angular/material/input';
import { ReactiveFormsModule} from '@angular/forms';
import {MatIconModule} from '@angular/material/icon';
import {MatIconModule, MatIconRegistry} from '@angular/material/icon';
import {MatToolbarModule} from '@angular/material/toolbar';
import {MatSidenavModule} from '@angular/material/sidenav';
import {MatTabsModule} from '@angular/material/tabs';
@ -45,22 +42,20 @@ import {MatCardModule} from '@angular/material/card';
import {MatButtonToggleModule} from '@angular/material/button-toggle';
import {MatSelectModule} from '@angular/material/select';
import {MatCheckboxModule} from '@angular/material/checkbox';
import { OverlayModule} from '@angular/cdk/overlay';
import {OverlayModule} from '@angular/cdk/overlay';
import {MatSlideToggleModule} from '@angular/material/slide-toggle';
import {MatMenuModule} from '@angular/material/menu';
import {MatRippleModule} from '@angular/material/core';
import {MatBadgeModule} from '@angular/material/badge';
import {MatProgressSpinnerModule} from '@angular/material/progress-spinner';
import { FlexLayoutModule } from '@angular/flex-layout';
import { MainNavigationComponent } from './components/main-navigation/main-navigation.component';
import { LayoutModule } from '@angular/cdk/layout';
import { MatButtonModule } from '@angular/material/button';
import { MatListModule } from '@angular/material/list';
import {FlexLayoutModule} from '@angular/flex-layout';
import {MainNavigationComponent} from './components/main-navigation/main-navigation.component';
import {LayoutModule} from '@angular/cdk/layout';
import {MatButtonModule} from '@angular/material/button';
import {MatListModule} from '@angular/material/list';
import {MatSortModule} from '@angular/material/sort';
import { SearchComponent } from './components/search/search.component';
import {DomSanitizer} from '@angular/platform-browser';
import {MatIconRegistry} from '@angular/material/icon';
import {SearchComponent} from './components/search/search.component';
import {MatDialogModule} from '@angular/material/dialog';
import {MatTooltipModule} from '@angular/material/tooltip';
import {MatExpansionModule} from '@angular/material/expansion';
@ -70,16 +65,16 @@ 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: {}};
const appRoutes: Routes = [
{ path: '', component: HomeComponent },
{ path: 'profile/:id', component: ProfileComponent },
{ path: 'group/:id', component: GroupComponent },
{ path: 'login', component: LoginComponent },
{ path: 'register', component: RegisterComponent },
{ path: 'about', component: AboutComponent },
{ path: 'imprint', component: ImprintComponent },
{path: '', component: HomeComponent},
{path: 'profile/:id', component: ProfileComponent},
{path: 'group/:id', component: GroupComponent},
{path: 'login', component: LoginComponent},
{path: 'register', component: RegisterComponent},
{path: 'about', component: AboutComponent},
{path: 'imprint', component: ImprintComponent},
];
@NgModule({
@ -170,4 +165,4 @@ export class AppModule {
iconRegistry.addSvgIcon(
'logo_green', sanitizer.bypassSecurityTrustResourceUrl('assets/images/gv-logo-flat.svg'));
}
}
}

@ -1,5 +1,5 @@
<div id="about">
<div id="text0" style="text-align: center;">
<div id="text0" style="text-align: center;">
<h1>Greenvironment</h1>
<br> <br> <br> <br> <br>
@ -7,10 +7,11 @@
<button mat-icon-button>
<mat-icon class="big-icon" color="primary">keyboard_arrow_down</mat-icon>
</button>
</div>
<div id="text1" style="text-align: center;">
</div>
<div id="text1" style="text-align: center;">
<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>
<h1>What does the level mean?</h1>
<p>There are different levels you can reach through green behaviour.
@ -18,11 +19,11 @@
</p>
<table mat-table [dataSource]="levelSource" class="mat-elevation-z8">
<ng-container matColumnDef="level">
<th mat-header-cell *matHeaderCellDef> level </th>
<th mat-header-cell *matHeaderCellDef> level</th>
<td mat-cell *matCellDef="let level"> {{level.level}} </td>
</ng-container>
<ng-container matColumnDef="name">
<th mat-header-cell *matHeaderCellDef> level name </th>
<th mat-header-cell *matHeaderCellDef> level name</th>
<td mat-cell *matCellDef="let level"> {{level.name}} </td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedLevelColumns"></tr>
@ -42,31 +43,32 @@
<!-- Position Column -->
<ng-container matColumnDef="points">
<th mat-header-cell *matHeaderCellDef mat-sort-header> points </th>
<th mat-header-cell *matHeaderCellDef mat-sort-header> points</th>
<td mat-cell *matCellDef="let action"> {{action.points}} </td>
</ng-container>
<!-- Name Column -->
<ng-container matColumnDef="name">
<th mat-header-cell *matHeaderCellDef mat-sort-header> action </th>
<th mat-header-cell *matHeaderCellDef mat-sort-header> action</th>
<td mat-cell *matCellDef="let action"> {{action.name}} </td>
</ng-container>
<!-- decriotion Column -->
<ng-container matColumnDef="description">
<th mat-header-cell *matHeaderCellDef mat-sort-header> description </th>
<th mat-header-cell *matHeaderCellDef mat-sort-header> description</th>
<td mat-cell *matCellDef="let action"> {{action.description}} </td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
</table>
</div>
<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>
</div>
<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">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>
<a mat-stroked-button color="primary" class="link-button" routerLink="/login">Login</a>
</div>
</div>
</div>

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

@ -1,6 +1,6 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
import { AboutComponent } from './about.component';
import {AboutComponent} from './about.component';
describe('AboutComponent', () => {
let component: AboutComponent;
@ -8,7 +8,7 @@ describe('AboutComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ AboutComponent ]
declarations: [AboutComponent]
})
.compileComponents();
}));

@ -1,9 +1,9 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { Activitylist } from 'src/app/models/activity';
import { Levellist } from 'src/app/models/levellist';
import {Component, OnInit, ViewChild} from '@angular/core';
import {Activitylist} from 'src/app/models/activity';
import {Levellist} from 'src/app/models/levellist';
import {MatSort} from '@angular/material/sort';
import {MatTableDataSource} from '@angular/material/table';
import { ActivityService } from 'src/app/services/activity/activity.service';
import {ActivityService} from 'src/app/services/activity/activity.service';
@Component({
selector: 'app-about',
@ -19,9 +19,11 @@ export class AboutComponent implements OnInit {
displayedLevelColumns = ['level', 'name'];
levelSource = this.levellist.levels;
constructor(private activityService: ActivityService) { }
constructor(private activityService: ActivityService) {
}
@ViewChild(MatSort, {static: true}) sort: MatSort;
ngOnInit() {
this.activityService.getActivities();
this.activityService.activitylist.subscribe(response => {

@ -1,6 +1,6 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
import { ChatComponent } from './chat.component';
import {ChatComponent} from './chat.component';
describe('ChatComponent', () => {
let component: ChatComponent;
@ -8,7 +8,7 @@ describe('ChatComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ChatComponent ]
declarations: [ChatComponent]
})
.compileComponents();
}));

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

@ -9,7 +9,7 @@
[class.selected]="chat === selectedChat" (click)="showChat(chat)">
<div class="picture">Pic</div>
<div class="name"><span>{{chat.memberName}}</span></div>
<div class="date"> <a>Date of last message</a></div>
<div class="date"><a>Date of last message</a></div>
</div>
</div>
</div>

@ -1,6 +1,6 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
import { ChatlistComponent } from './chatlist.component';
import {ChatlistComponent} from './chatlist.component';
describe('ChatlistComponent', () => {
let component: ChatlistComponent;
@ -8,7 +8,7 @@ describe('ChatlistComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ChatlistComponent ]
declarations: [ChatlistComponent]
})
.compileComponents();
}));

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

@ -1,6 +1,7 @@
<div id="contacts">
<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>
</div>
<div class="search-container">

@ -1,6 +1,6 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
import { ChatcontactsComponent } from './chatcontacts.component';
import {ChatcontactsComponent} from './chatcontacts.component';
describe('ChatcontactsComponent', () => {
let component: ChatcontactsComponent;
@ -8,7 +8,7 @@ describe('ChatcontactsComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ChatcontactsComponent ]
declarations: [ChatcontactsComponent]
})
.compileComponents();
}));

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

@ -1,6 +1,6 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
import { ChatmanagerComponent } from './chatmanager.component';
import {ChatmanagerComponent} from './chatmanager.component';
describe('ChatmanagerComponent', () => {
let component: ChatmanagerComponent;
@ -8,7 +8,7 @@ describe('ChatmanagerComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ChatmanagerComponent ]
declarations: [ChatmanagerComponent]
})
.compileComponents();
}));

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

@ -1,4 +1,5 @@
<div class='sidenav'>
<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>

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

@ -1,6 +1,6 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
import { DocumentListComponent } from './document-list.component';
import {DocumentListComponent} from './document-list.component';
describe('DocumentListComponent', () => {
let component: DocumentListComponent;
@ -8,7 +8,7 @@ describe('DocumentListComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ DocumentListComponent ]
declarations: [DocumentListComponent]
})
.compileComponents();
}));

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

@ -1,6 +1,6 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
import { DocumentComponent } from './document.component';
import {DocumentComponent} from './document.component';
describe('DocumentComponent', () => {
let component: DocumentComponent;
@ -8,7 +8,7 @@ describe('DocumentComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ DocumentComponent ]
declarations: [DocumentComponent]
})
.compileComponents();
}));

@ -1,8 +1,8 @@
import { Component, OnInit, OnDestroy } from '@angular/core';
import { DocumentService } from 'src/app/services/document.service';
import { Subscription } from 'rxjs';
import { Document } from 'src/app/models/document';
import { startWith } from 'rxjs/operators';
import {Component, OnDestroy, OnInit} from '@angular/core';
import {DocumentService} from 'src/app/services/document.service';
import {Subscription} from 'rxjs';
import {Document} from 'src/app/models/document';
import {startWith} from 'rxjs/operators';
@Component({
selector: 'app-document',
@ -12,11 +12,13 @@ import { startWith } from 'rxjs/operators';
export class DocumentComponent implements OnInit, OnDestroy {
document: Document;
private _docSub: Subscription;
constructor(private documentService: DocumentService) { }
constructor(private documentService: DocumentService) {
}
ngOnInit() {
this._docSub = this.documentService.currentDocument.pipe(
startWith({ id: '', doc: 'Select an existing document or create a new one to get started'})
startWith({id: '', doc: 'Select an existing document or create a new one to get started'})
).subscribe(document => this.document = document);
}

@ -1,31 +1,35 @@
<div id="home"
infinite-scroll
[infiniteScrollDistance]="0.5"
[scrollWindow]="false"
(scrolled)="onScroll()">
infinite-scroll
[infiniteScrollDistance]="0.5"
[scrollWindow]="false"
(scrolled)="onScroll()">
<div [hidden]="!loggedIn">
<mat-card >
<mat-card>
<mat-card-content>
<mat-form-field id="input">
<textarea matInput #content type="text" (input)="onTextInputChange()" [(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>
<mat-icon>add</mat-icon>
</button>
</mat-form-field>
<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>
<mat-form-field id="action-chooser" *ngIf="checked">
<mat-label>What did you do?</mat-label>
<mat-select [(ngModel)]="activityId" name="action">
<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}})
</mat-option>
</mat-select>
</mat-form-field>
<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
</button>
</mat-card-content>
@ -34,26 +38,27 @@ infinite-scroll
<div [hidden]="loggedIn">
<mat-card id="info">
<mat-card-header>
<mat-card-title >
<mat-card-title>
You need to <a routerLink="/login" class="primary-color">login</a> to post something.
</mat-card-title>
</mat-card-header>
</mat-card>
</div>
<div id="chooser-div" style="text-align: center; margin-top: 1em;">
<div id="chooser-div" style="text-align: center; margin-top: 1em;">
<mat-button-toggle-group id="feedchooser" [(ngModel)]="view" value="view">
<mat-button-toggle (click)="showNew()" value="new">New</mat-button-toggle>
<mat-button-toggle (click)="showMostLiked()" value="mostliked">Most Liked</mat-button-toggle>
</mat-button-toggle-group>
</div>
<div id="complete-feed">
</div>
<div id="complete-feed">
<div id="feedlist">
<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 style="margin:0 auto; margin-top: 2em;" diameter="50"></mat-spinner>
</div>
</div>
</div>
</div>
</div>

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

@ -1,6 +1,6 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
import { FeedComponent } from './feed.component';
import {FeedComponent} from './feed.component';
describe('FeedComponent', () => {
let component: FeedComponent;
@ -8,7 +8,7 @@ describe('FeedComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ FeedComponent ]
declarations: [FeedComponent]
})
.compileComponents();
}));

@ -19,7 +19,7 @@
</div>
</div>-->
<mat-card class="post" *ngFor = "let post of childPostList" [class.selected]="post === selectedPost" tabindex="0">
<mat-card class="post" *ngFor="let post of childPostList" [class.selected]="post === selectedPost" tabindex="0">
<mat-card-header>
<div mat-card-avatar>
<img class="profile-picture" [src]="post.author.profilePicture"/>

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

@ -1,6 +1,6 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
import { PostlistComponent } from './postlist.component';
import {PostlistComponent} from './postlist.component';
describe('PostlistComponent', () => {
let component: PostlistComponent;
@ -8,7 +8,7 @@ describe('PostlistComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ PostlistComponent ]
declarations: [PostlistComponent]
})
.compileComponents();
}));

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

@ -24,7 +24,9 @@
</mat-toolbar-row>
<mat-toolbar-row>
<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>
</mat-toolbar-row>
<mat-toolbar-row>
@ -38,7 +40,9 @@
<mat-toolbar-row>
<div class="profile-picture"></div>
<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">
<button mat-icon-button
class="request-button"
@ -76,7 +80,7 @@
tabindex="0">
<mat-card-header>
<mat-card-title>{{event.name}}</mat-card-title>
<mat-card-subtitle >{{event.date}}</mat-card-subtitle>
<mat-card-subtitle>{{event.date}}</mat-card-subtitle>
<div class="button-box">
<button mat-icon-button class="request-button"
matTooltip="join event" matTooltipShowDelay="500"
@ -115,4 +119,3 @@
<mat-spinner *ngIf="loading" style="margin:0 auto; margin-top: 10em;" diameter="100"></mat-spinner>
</div>

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

@ -1,6 +1,6 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
import { GroupComponent } from './group.component';
import {GroupComponent} from './group.component';
describe('GroupComponent', () => {
let component: GroupComponent;
@ -8,7 +8,7 @@ describe('GroupComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ GroupComponent ]
declarations: [GroupComponent]
})
.compileComponents();
}));

@ -1,12 +1,12 @@
import { Component, OnInit, ViewChild} from '@angular/core';
import {Router, NavigationEnd} from '@angular/router';
import { User } from 'src/app/models/user';
import {Component, OnInit, ViewChild} from '@angular/core';
import {NavigationEnd, Router} from '@angular/router';
import {User} from 'src/app/models/user';
import {MatSort} from '@angular/material/sort';
import { RequestService } from 'src/app/services/request/request.service';
import { DatasharingService } from '../../services/datasharing.service';
import { GroupService } from 'src/app/services/group/group.service';
import { Group } from 'src/app/models/group';
import { Event } from 'src/app/models/event';
import {RequestService} from 'src/app/services/request/request.service';
import {DatasharingService} from '../../services/datasharing.service';
import {GroupService} from 'src/app/services/group/group.service';
import {Group} from 'src/app/models/group';
import {Event} from 'src/app/models/event';
import {MatDialog, MatDialogRef} from '@angular/material/dialog';
// DIALOG COMPONENT to create events
@ -77,6 +77,7 @@ export class GroupComponent implements OnInit {
}
@ViewChild(MatSort, {static: true}) sort: MatSort;
ngOnInit() {
this.loading = true;
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) {
member.allowedToSendRequest = this.requestService.isAllowedToSendRequest(member.userID, this.self);
}
} else { this.groupNotFound = true; }
} else {
this.groupNotFound = true;
}
this.loading = false;
});
}

@ -1,8 +1,16 @@
<div id="content" fxShow="true" fxHide.lt-md="true">
<div id="chat"><home-chatmanager [hidden]="!loggedIn"></home-chatmanager></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 id="chat">
<home-chatmanager [hidden]="!loggedIn"></home-chatmanager>
</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>
<!--
<mat-tab-group headerPosition="below" position="0" id="bottom-menu" fxShow="true" fxHide.gt-sm="true">
@ -31,7 +39,7 @@
</ng-template>
<home-social class="tab-content"></home-social>
</mat-tab>
<mat-tab >
<mat-tab>
<ng-template mat-tab-label>
<mat-icon>search</mat-icon>
</ng-template>

@ -1,6 +1,6 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
import { HomeComponent } from './home.component';
import {HomeComponent} from './home.component';
describe('HomeComponent', () => {
let component: HomeComponent;
@ -8,7 +8,7 @@ describe('HomeComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ HomeComponent ]
declarations: [HomeComponent]
})
.compileComponents();
}));

@ -1,6 +1,6 @@
import { Component, OnInit } from '@angular/core';
import { DatasharingService } from 'src/app/services/datasharing.service';
import { FeedService } from 'src/app/services/feed/feed.service';
import {Component, OnInit} from '@angular/core';
import {DatasharingService} from 'src/app/services/datasharing.service';
import {FeedService} from 'src/app/services/feed/feed.service';
@Component({
selector: 'app-home',
@ -11,7 +11,8 @@ export class HomeComponent implements OnInit {
loggedIn: boolean;
constructor(private data: DatasharingService, private feedService: FeedService) { }
constructor(private data: DatasharingService, private feedService: FeedService) {
}
ngOnInit() {
this.data.currentUserInfo.subscribe(user => {

@ -1,6 +1,6 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
import { ImprintComponent } from './imprint.component';
import {ImprintComponent} from './imprint.component';
describe('ImprintComponent', () => {
let component: ImprintComponent;
@ -8,7 +8,7 @@ describe('ImprintComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ImprintComponent ]
declarations: [ImprintComponent]
})
.compileComponents();
}));

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

@ -1,5 +1,5 @@
<div id="login">
<mat-card style="text-align: center;" >
<mat-card style="text-align: center;">
<mat-card-title>
Login
</mat-card-title>
@ -7,11 +7,12 @@
<div class="example-container" (keyup.enter)="onClickSubmit(email.value,password.value)">
<mat-error *ngIf="errorOccurred">{{getErrorMessage()}}</mat-error>
<mat-form-field>
<input matInput placeholder="Enter your email" #email >
<input matInput placeholder="Enter your email" #email>
</mat-form-field>
<mat-form-field>
<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>
</button>
</mat-form-field>
@ -20,5 +21,5 @@
<p>You aren't part of greenvironment yet?</p>
<a mat-stroked-button color="primary" routerLink="/register">Register</a>
</mat-card-content>
</mat-card>
</mat-card>
</div>

@ -1,6 +1,6 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
import { LoginComponent } from './login.component';
import {LoginComponent} from './login.component';
describe('LoginComponent', () => {
let component: LoginComponent;
@ -8,7 +8,7 @@ describe('LoginComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ LoginComponent ]
declarations: [LoginComponent]
})
.compileComponents();
}));

@ -1,7 +1,7 @@
import { Component, OnInit } from '@angular/core';
import {Component, OnInit} from '@angular/core';
import {FormControl, Validators} from '@angular/forms';
import { Login } from 'src/app/models/login';
import { LoginService } from 'src/app/services/login/login.service';
import {Login} from 'src/app/models/login';
import {LoginService} from 'src/app/services/login/login.service';
import {Router} from '@angular/router';
import * as sha512 from 'js-sha512';
import {IErrorResponse} from '../../models/interfaces/IErrorResponse';
@ -16,6 +16,7 @@ export class LoginComponent implements OnInit {
constructor(private loginService: LoginService, private router: Router) {
this.login = {passwordHash: null, email: null};
}
login: Login;
hide = true;
errorOccurred = false;
@ -43,7 +44,7 @@ export class LoginComponent implements OnInit {
this.errorMessage = ' ';
this.login.email = pEmail.trim().toLowerCase();
this.login.passwordHash = sha512.sha512(pPasswordHash);
this.loginService.login(this.login).subscribe( () => {
this.loginService.login(this.login).subscribe(() => {
this.router.navigateByUrl('').catch((error) => {
this.errorMessage = error.message;
this.errorOccurred = true;
@ -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 -->
<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 -->
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500"
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">
<!-- SIDENAV -->
@ -24,8 +26,10 @@
<mat-divider></mat-divider>
<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="/login" (click)="drawer.toggle()">Login</a>
<a mat-stroked-button *ngIf="loggedIn" class="link-button" (click)="logout()" (click)="drawer.toggle()">log out</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" (click)="logout()" (click)="drawer.toggle()">log
out</a>
</div>
</mat-nav-list>
</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_green" style="min-width: 35px;" routerLink="" class="link"></mat-icon>
<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">
<a mat-tab-link class="link"
*ngFor="let link of navLinksLoggedIn"
@ -73,10 +78,13 @@
<!--content on BIG SCREEN-->
<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>
<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 mat-icon-button [matMenuTriggerFor]="menu" id="menu-button">
@ -86,7 +94,8 @@
<mat-menu #requestMenu="matMenu">
<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();">
<mat-icon>check</mat-icon>
</button>
@ -108,7 +117,7 @@
</mat-slide-toggle>
</button>
<div [hidden]="!loggedIn">
<button mat-menu-item (click)="logout()" >
<button mat-menu-item (click)="logout()">
<mat-icon>exit_to_app</mat-icon>
<span>log out</span>
</button>

@ -6,15 +6,19 @@
.menu-bar
position: inherit !important
.mat-card-avatar
display: contents
.profile-picture
width: 52px
height: 52px
border-radius: 50%
flex-shrink: 0
.hello-text-box
margin-left: 8px
.hello-text
white-space: normal
font-size: initial
@ -26,7 +30,7 @@
.sidenav .mat-toolbar
//background: inherit
//background: inherit
.mat-toolbar
height: 56px
@ -34,10 +38,13 @@
//position: sticky
top: 0
z-index: 999
.mat-tab-nav-bar
height: 56px
.mat-tab-links
height: 56px
.mat-tab-link
height: 56px
@ -53,7 +60,7 @@
margin-bottom: 0.5em
::ng-deep .mat-tab-link
min-width: 5em!important
min-width: 5em !important
#menu-button-box
text-align: right

@ -1,13 +1,13 @@
import { LayoutModule } from '@angular/cdk/layout';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { MatButtonModule } from '@angular/material/button';
import { MatIconModule } from '@angular/material/icon';
import { MatListModule } from '@angular/material/list';
import { MatSidenavModule } from '@angular/material/sidenav';
import { MatToolbarModule } from '@angular/material/toolbar';
import {LayoutModule} from '@angular/cdk/layout';
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
import {NoopAnimationsModule} from '@angular/platform-browser/animations';
import {MatButtonModule} from '@angular/material/button';
import {MatIconModule} from '@angular/material/icon';
import {MatListModule} from '@angular/material/list';
import {MatSidenavModule} from '@angular/material/sidenav';
import {MatToolbarModule} from '@angular/material/toolbar';
import { MainNavigationComponent } from './main-navigation.component';
import {MainNavigationComponent} from './main-navigation.component';
describe('MainNavigationComponent', () => {
let component: MainNavigationComponent;

@ -1,14 +1,14 @@
import { Component, OnInit, HostBinding } from '@angular/core';
import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
import { DatasharingService } from '../../services/datasharing.service';
import { RequestService } from '../../services/request/request.service';
import { SettingsService } from '../../services/settings/settings.service';
import { environment } from 'src/environments/environment';
import { Levellist } from 'src/app/models/levellist';
import { Http } from '@angular/http';
import { Router } from '@angular/router';
import { User } from 'src/app/models/user';
import { OverlayContainer} from '@angular/cdk/overlay';
import {Component, HostBinding, OnInit} from '@angular/core';
import {BreakpointObserver} from '@angular/cdk/layout';
import {DatasharingService} from '../../services/datasharing.service';
import {RequestService} from '../../services/request/request.service';
import {SettingsService} from '../../services/settings/settings.service';
import {environment} from 'src/environments/environment';
import {Levellist} from 'src/app/models/levellist';
import {Http} from '@angular/http';
import {Router} from '@angular/router';
import {User} from 'src/app/models/user';
import {OverlayContainer} from '@angular/cdk/overlay';
@Component({
selector: 'app-main-navigation',
@ -27,6 +27,7 @@ export class MainNavigationComponent implements OnInit {
) {
this.overlay = overlayContainer.getContainerElement();
}
loggedIn = false;
userId: number;
username: string;
@ -41,18 +42,19 @@ export class MainNavigationComponent implements OnInit {
overlay;
navLinksLoggedIn = [
{ path: '', label: 'Home' },
{ path: this.profileUrl, label: 'Profile' },
{ path: '/about', label: 'About' },
{ path: '/imprint', label: 'Imprint' },
{path: '', label: 'Home'},
{path: this.profileUrl, label: 'Profile'},
{path: '/about', label: 'About'},
{path: '/imprint', label: 'Imprint'},
];
navLinks = [
{ path: '', label: 'Home' },
{ path: '/about', label: 'About' },
{ path: '/imprint', label: 'Imprint' },
{path: '', label: 'Home'},
{path: '/about', label: 'About'},
{path: '/imprint', label: 'Imprint'},
];
@HostBinding('class') componentCssClass;
ngOnInit() {
this.data.currentUserInfo.subscribe(user => {
this.user = user;
@ -96,26 +98,31 @@ export class MainNavigationComponent implements OnInit {
updateLinks() {
this.navLinksLoggedIn = [
{ path: '', label: 'Home' },
{ path: this.profileUrl, label: 'Profile' },
{ path: '/about', label: 'About' },
{ path: '/imprint', label: 'Imprint' },
{path: '', label: 'Home'},
{path: this.profileUrl, label: 'Profile'},
{path: '/about', label: 'About'},
{path: '/imprint', label: 'Imprint'},
];
}
onSetTheme(theme) {
this.overlayContainer.getContainerElement().classList.add(theme);
this.componentCssClass = theme;
}
logout() {
const url = environment.graphQLUrl;
const headers = new Headers();
headers.set('Content-Type', 'application/json');
const body = {query: `mutation {
const body = {
query: `mutation {
logout
}`};
}`
};
this.http.post(url, body).subscribe(response => {
console.log(response.text()); });
console.log(response.text());
});
this.loggedIn = false;
const user = new User();
user.loggedIn = false;

@ -1,4 +1,4 @@
import {Component, EventEmitter} from '@angular/core';
import {Component} from '@angular/core';
import {MatDialogRef} from '@angular/material/dialog';
import {SelfService} from '../../../services/selfservice/self.service';
import {environment} from '../../../../environments/environment';
@ -13,12 +13,12 @@ export class DialogFileUploadComponent {
public errorOccurred = false;
public uploading = false;
private errorMessage: string;
public profilePictureUrl: BehaviorSubject<string|null>;
public profilePictureUrl: BehaviorSubject<string | null>;
private file;
public localFileUrl;
constructor(public dialogRef: MatDialogRef<DialogFileUploadComponent>, private selfService: SelfService) {
this.profilePictureUrl = new BehaviorSubject<string|null>(null);
this.profilePictureUrl = new BehaviorSubject<string | null>(null);
}
/**

@ -17,25 +17,33 @@
margin: 0 auto
width: 100%
max-width: 690px
.icon-box
text-align: right
width: 100%
.request-button
margin-top: 0.5em
margin-bottom: 0.5em
margin-left: auto
#toolbar
margin-top: 32px
.mat-toolbar-row
max-height: 40px
.info-box
font-size: 14px
margin-left: calc(100px + 0.5em)
.info
margin-right: 1em
font-size: 14px
#username
margin: 0 0.5em
#handle
font-size: 14px
@ -52,14 +60,16 @@ $mat-card-header-size: 100px !default
display: flex
justify-content: center
align-items: center
&:hover
.profile-picture
filter: brightness(70%)
#icon
display: block
filter: none
// Makes `<img>` tags behave like `background-size: cover`. Not supported
// in IE, but we're using it as a progressive enhancement.
// Makes `<img>` tags behave like `background-size: cover`. Not supported
// in IE, but we're using it as a progressive enhancement.
.profile-picture
height: $mat-card-header-size

@ -1,6 +1,6 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
import { ProfileComponent } from './profile.component';
import {ProfileComponent} from './profile.component';
describe('ProfileComponent', () => {
let component: ProfileComponent;
@ -8,7 +8,7 @@ describe('ProfileComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ProfileComponent ]
declarations: [ProfileComponent]
})
.compileComponents();
}));

@ -1,12 +1,11 @@
import { Component, OnInit} from '@angular/core';
import {Router, NavigationEnd} from '@angular/router';
import { User } from 'src/app/models/user';
import { Levellist } from 'src/app/models/levellist';
import { RequestService } from 'src/app/services/request/request.service';
import { DatasharingService } from '../../services/datasharing.service';
import { ProfileService } from 'src/app/services/profile/profile.service';
import { HttpClient } from '@angular/common/http';
import { environment } from 'src/environments/environment';
import {Component, OnInit} from '@angular/core';
import {NavigationEnd, Router} from '@angular/router';
import {User} from 'src/app/models/user';
import {Levellist} from 'src/app/models/levellist';
import {RequestService} from 'src/app/services/request/request.service';
import {DatasharingService} from '../../services/datasharing.service';
import {ProfileService} from 'src/app/services/profile/profile.service';
import {HttpClient} from '@angular/common/http';
import {MatSnackBar} from '@angular/material/snack-bar';
import {SelfService} from '../../services/selfservice/self.service';
import {MatDialog} from '@angular/material';
@ -63,7 +62,9 @@ export class ProfileComponent implements OnInit {
this.userProfile.allowedToSendRequest = this.requestService.isAllowedToSendRequest(this.userProfile.userID, this.self);
this.ownProfile = this.userProfile.userID === this.self.userID;
this.rankname = this.levellist.getLevelName(this.userProfile.level);
} else { this.profileNotFound = true; }
} else {
this.profileNotFound = true;
}
this.loading = false;
});
}

@ -1,33 +1,38 @@
<div id="register">
<mat-card style="text-align: center;" >
<mat-card style="text-align: center;">
<mat-card-title>
Register
</mat-card-title>
<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-form-field>
<input matInput placeholder="Enter your email" #email >
<input matInput placeholder="Enter your email" #email>
</mat-form-field>
<mat-form-field>
<input matInput placeholder="Enter your username" #username >
<input matInput placeholder="Enter your username" #username>
</mat-form-field>
<mat-form-field>
<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>
</button>
</mat-form-field>
<mat-form-field>
<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>
</button>
</mat-form-field>
</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>
<a mat-stroked-button color="primary" routerLink="/login">Login</a>
</mat-card-content>
</mat-card>
</div>
</div>

@ -1,6 +1,6 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
import { RegisterComponent } from './register.component';
import {RegisterComponent} from './register.component';
describe('RegisterComponent', () => {
let component: RegisterComponent;
@ -8,7 +8,7 @@ describe('RegisterComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ RegisterComponent ]
declarations: [RegisterComponent]
})
.compileComponents();
}));

@ -1,9 +1,6 @@
import { Component, OnInit } from '@angular/core';
import {Component, OnInit} from '@angular/core';
import {RegisterService} from '../../services/register/register.service';
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';
@Component({
@ -28,7 +25,7 @@ export class RegisterComponent implements OnInit {
this.errorMessage = error.errors[0].message;
}
onClickSubmit(pUsername: string, pEmail: string, pPasswordHash: string, pPasswordHashRepeat: string ) {
onClickSubmit(pUsername: string, pEmail: string, pPasswordHash: string, pPasswordHashRepeat: string) {
this.errorOccurred = false;
this.errorMessage = ' ';
if (this.passwordSame(pPasswordHash, pPasswordHashRepeat)) {
@ -50,7 +47,8 @@ export class RegisterComponent implements OnInit {
}
}
ngOnInit() {}
ngOnInit() {
}
}

@ -1,13 +1,13 @@
<div id="search">
<mat-toolbar>
<mat-form-field id="input"
floatLabel="never" >
floatLabel="never">
<input matInput #searchWord
placeholder="search"
[ngModel]="searchWord.value"
(ngModelChange)="search(searchWord.value)">
<button mat-button matSuffix mat-icon-button>
<mat-icon>search </mat-icon>
<mat-icon>search</mat-icon>
</button>
</mat-form-field>
</mat-toolbar>
@ -34,7 +34,10 @@
<div mat-card-avatar class="profile-picture" (click)="showGroupProfile(group)"></div>
<mat-card-title class="pointer" (click)="showGroupProfile(group)">{{group.name}}</mat-card-title>
<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>
</mat-card-header>
</mat-card>

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

@ -1,5 +1,5 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { SearchComponent } from './search.component';
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
import {SearchComponent} from './search.component';
describe('ChatComponent', () => {
let component: SearchComponent;
@ -7,7 +7,7 @@ describe('ChatComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ SearchComponent ]
declarations: [SearchComponent]
})
.compileComponents();
}));

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

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

@ -1,6 +1,6 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
import { FriendsComponent } from './friends.component';
import {FriendsComponent} from './friends.component';
describe('FriendsComponent', () => {
let component: FriendsComponent;
@ -8,7 +8,7 @@ describe('FriendsComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ FriendsComponent ]
declarations: [FriendsComponent]
})
.compileComponents();
}));

@ -1,8 +1,8 @@
import { Component, OnInit } from '@angular/core';
import { DatasharingService } from 'src/app/services/datasharing.service';
import { FriendInfo } from 'src/app/models/friendinfo';
import { Router } from '@angular/router';
import { User } from 'src/app/models/user';
import {Component, OnInit} from '@angular/core';
import {DatasharingService} from 'src/app/services/datasharing.service';
import {FriendInfo} from 'src/app/models/friendinfo';
import {Router} from '@angular/router';
import {User} from 'src/app/models/user';
@Component({
selector: 'social-friends',
@ -11,11 +11,14 @@ import { User } from 'src/app/models/user';
})
export class FriendsComponent implements OnInit {
user: User;
constructor(private data: DatasharingService, private router: Router) { }
constructor(private data: DatasharingService, private router: Router) {
}
ngOnInit() {
this.data.currentUserInfo.subscribe(user => {
this.user = user; });
this.user = user;
});
}
public showFriendProfile(pFriend: FriendInfo) {

@ -1,7 +1,10 @@
<mat-toolbar>
<span>Groups</span>
<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>
</mat-toolbar>

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

@ -1,6 +1,6 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
import { GroupsComponent } from './groups.component';
import {GroupsComponent} from './groups.component';
describe('GroupsComponent', () => {
let component: GroupsComponent;
@ -8,7 +8,7 @@ describe('GroupsComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ GroupsComponent ]
declarations: [GroupsComponent]
})
.compileComponents();
}));

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

@ -1,6 +1,6 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
import { SocialComponent } from './social.component';
import {SocialComponent} from './social.component';
describe('SocialComponent', () => {
let component: SocialComponent;
@ -8,7 +8,7 @@ describe('SocialComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ SocialComponent ]
declarations: [SocialComponent]
})
.compileComponents();
}));

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

@ -1,4 +1,4 @@
<mat-card class="card" *ngFor = "let user of userList" [class.selected]="user === selectedUser" tabindex="0">
<mat-card class="card" *ngFor="let user of userList" [class.selected]="user === selectedUser" tabindex="0">
<mat-card-header>
<div mat-card-avatar>
<img class="profile-picture" [src]="user.profilePicture"/>
@ -6,7 +6,10 @@
<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>
<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>
</mat-card-header>
</mat-card>
</mat-card>

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

@ -1,6 +1,6 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
import { UserlistComponent } from './userlist.component';
import {UserlistComponent} from './userlist.component';
describe('UserlistComponent', () => {
let component: UserlistComponent;
@ -8,7 +8,7 @@ describe('UserlistComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ UserlistComponent ]
declarations: [UserlistComponent]
})
.compileComponents();
}));

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

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

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

@ -1,4 +1,4 @@
import { Chatmessage } from './chatmessage';
import {Chatmessage} from './chatmessage';
export class Chat {
id: number;

@ -1,5 +1,3 @@
import { User } from 'src/app/models/user';
export class FriendRequest {
id: number;
senderUserID: number;
@ -12,4 +10,4 @@ export class FriendRequest {
this.senderHandle = senderHandle;
this.senderUsername = senderName;
}
}
}

@ -1,4 +1,4 @@
import { Levellist } from 'src/app/models/levellist';
import {Levellist} from 'src/app/models/levellist';
export class FriendInfo {
levellist: Levellist = new Levellist();

@ -1,14 +1,14 @@
import { User } from 'src/app/models/user';
import { Event } from 'src/app/models/event';
import {User} from 'src/app/models/user';
import {Event} from 'src/app/models/event';
export class Group {
id: number;
name: string;
handle: string;
creator: User = new User();
members: User[] = new Array();
admins: User[] = new Array();
events: Event[] = new Array();
members: User[] = [];
admins: User[] = [];
events: Event[] = [];
joined: boolean;
allowedToJoinGroup = false;
}

@ -4,5 +4,5 @@ export interface IGraphqlError {
path: string[];
location: {line: number; column: number}[];
location: { line: number; column: number }[];
}

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

@ -1,12 +1,12 @@
export class Levellist {
levels: {level: number, name: string, points: number}[] = [
levels: { level: number, name: string, points: number }[] = [
{level: 0, name: 'Green Horn', points: 0},
{level: 1, name: 'Good Willed', points: 100 },
{level: 2, name: 'Helper', points: 200 },
{level: 3, name: 'World Saver', points: 300 },
{level: 4, name: 'Hero of the Green Country', points: 400 },
{level: 5, name: 'Champion of the Earth', points: 500 },
{level: 6, name: 'Intergallactic Superhero', points: 600 },
{level: 1, name: 'Good Willed', points: 100},
{level: 2, name: 'Helper', points: 200},
{level: 3, name: 'World Saver', points: 300},
{level: 4, name: 'Hero of the Green Country', points: 400},
{level: 5, name: 'Champion of the Earth', points: 500},
{level: 6, name: 'Intergallactic Superhero', points: 600},
];
getLevelName(level: number): any {

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

@ -1,5 +1,5 @@
import { Author } from './author';
import { Activity } from './activity';
import {Author} from './author';
import {Activity} from './activity';
export class Post {
id: number;

@ -2,4 +2,4 @@ export interface Registration {
username: string;
email: string;
passwordHash: string;
}
}

@ -1,9 +1,9 @@
import { FriendRequest } from 'src/app/models/friendRequest';
import { FriendInfo } from 'src/app/models/friendinfo';
import { GroupInfo } from 'src/app/models/groupinfo';
import { Post } from 'src/app/models/post';
import {FriendRequest} from 'src/app/models/friendRequest';
import {FriendInfo} from 'src/app/models/friendinfo';
import {GroupInfo} from 'src/app/models/groupinfo';
import {Post} from 'src/app/models/post';
import {IUser} from './interfaces/IUser';
import { environment } from 'src/environments/environment';
import {environment} from 'src/environments/environment';
export class User {
loggedIn = false;

@ -1,6 +1,6 @@
import { TestBed } from '@angular/core/testing';
import {TestBed} from '@angular/core/testing';
import { ActivityService } from './activity.service';
import {ActivityService} from './activity.service';
describe('ActivityService', () => {
beforeEach(() => TestBed.configureTestingModule({}));

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

@ -1,6 +1,6 @@
import { TestBed } from '@angular/core/testing';
import {TestBed} from '@angular/core/testing';
import { ChatService } from './chat.service';
import {ChatService} from './chat.service';
describe('ChatService', () => {
beforeEach(() => TestBed.configureTestingModule({}));

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

@ -1,6 +1,6 @@
import { TestBed } from '@angular/core/testing';
import {TestBed} from '@angular/core/testing';
import { DatasharingService } from './datasharing.service';
import {DatasharingService} from './datasharing.service';
describe('DatasharingService', () => {
beforeEach(() => TestBed.configureTestingModule({}));

@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';
import { BehaviorSubject } from 'rxjs';
import { User } from '../models/user';
import {Injectable} from '@angular/core';
import {BehaviorSubject} from 'rxjs';
import {User} from '../models/user';
@Injectable({
providedIn: 'root'
@ -12,7 +12,8 @@ export class DatasharingService {
currentUserInfo = this.userInfoSource.asObservable();
currentChatIDs = this.chatIDsSource.asObservable();
constructor() { }
constructor() {
}
changeUserInfo(pUserInfo: User) {
this.userInfoSource.next(pUserInfo);

@ -1,6 +1,6 @@
import { TestBed } from '@angular/core/testing';
import {TestBed} from '@angular/core/testing';
import { DocumentService } from './document.service';
import {DocumentService} from './document.service';
describe('DocumentService', () => {
beforeEach(() => TestBed.configureTestingModule({}));

@ -1,8 +1,8 @@
import { Injectable } from '@angular/core';
import {Injectable} from '@angular/core';
import { Socket } from 'ngx-socket-io';
import {Socket} from 'ngx-socket-io';
import { Document } from '../models/document';
import {Document} from '../models/document';
@Injectable({
providedIn: 'root'
@ -11,14 +11,15 @@ export class DocumentService {
currentDocument = this.socket.fromEvent<Document>('document');
documents = this.socket.fromEvent<string[]>('documents');
constructor(private socket: Socket) { }
constructor(private socket: Socket) {
}
getDocument(id: string) {
this.socket.emit('getDoc', id);
}
newDocument() {
this.socket.emit('addDoc', { id: this.docId(), doc: '' });
this.socket.emit('addDoc', {id: this.docId(), doc: ''});
}
editDocument(document: Document) {

@ -1,6 +1,6 @@
import { TestBed } from '@angular/core/testing';
import {TestBed} from '@angular/core/testing';
import { FeedService } from './feed.service';
import {FeedService} from './feed.service';
describe('FeedService', () => {
beforeEach(() => TestBed.configureTestingModule({}));

@ -1,10 +1,10 @@
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Post } from 'src/app/models/post';
import { Author } from 'src/app/models/author';
import { environment } from 'src/environments/environment';
import { Activity } from 'src/app/models/activity';
import { BehaviorSubject } from 'rxjs';
import {Injectable} from '@angular/core';
import {HttpClient} from '@angular/common/http';
import {Post} from 'src/app/models/post';
import {Author} from 'src/app/models/author';
import {environment} from 'src/environments/environment';
import {Activity} from 'src/app/models/activity';
import {BehaviorSubject} from 'rxjs';
import {tap} from 'rxjs/operators';
@Injectable({
@ -21,13 +21,15 @@ export class FeedService {
private mostLikedOffset = 0;
private newOffset = 0;
constructor(private http: HttpClient) { }
constructor(private http: HttpClient) {
}
public createPost(pContent: String) {
const headers = new Headers();
headers.set('Content-Type', 'application/json');
const body = {query: `mutation($content: String!) {
const body = {
query: `mutation($content: String!) {
createPost(content: $content) {
id,
content,
@ -50,7 +52,8 @@ export class FeedService {
createdAt}
}`, variables: {
content: pContent
}};
}
};
return this.http.post(environment.graphQLUrl, body).pipe(tap(response => {
const updatedposts = this.newPosts.getValue();
updatedposts.unshift(this.renderPost(response));
@ -63,7 +66,8 @@ export class FeedService {
const headers = new Headers();
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) {
id,
content,
@ -87,7 +91,8 @@ export class FeedService {
}`, variables: {
content: pContent,
id: activityId
}};
}
};
return this.http.post(environment.graphQLUrl, body).pipe(tap(response => {
const updatedposts = this.newPosts.getValue();
updatedposts.unshift(this.renderPost(response));
@ -100,13 +105,15 @@ export class FeedService {
const headers = new Headers();
headers.set('Content-Type', 'application/json');
const body = {query: `mutation($postId: ID!) {
const body = {
query: `mutation($postId: ID!) {
vote(postId: $postId, type: UPVOTE) {
post{userVote upvotes downvotes}
}
}`, variables: {
postId
}};
}
};
return this.http.post(environment.graphQLUrl, body);
}
@ -115,13 +122,15 @@ export class FeedService {
const headers = new Headers();
headers.set('Content-Type', 'application/json');
const body = {query: `mutation($postId: ID!) {
const body = {
query: `mutation($postId: ID!) {
vote(postId: $postId, type: DOWNVOTE) {
post{userVote upvotes downvotes}
}
}`, variables: {
postId: pPostID
}};
}
};
return this.http.post(environment.graphQLUrl, body);
}
@ -130,11 +139,13 @@ export class FeedService {
const headers = new Headers();
headers.set('Content-Type', 'application/json');
const body = {query: `mutation($postId: ID!) {
const body = {
query: `mutation($postId: ID!) {
deletePost(postId: $postId)
}`, variables: {
postId: pPostID
}};
}
};
return this.http.post(environment.graphQLUrl, body);
}
@ -153,7 +164,8 @@ export class FeedService {
}
this.setPost(sort);
});
} this.setPost(sort);
}
this.setPost(sort);
}
public getNextPosts() {
@ -198,7 +210,8 @@ export class FeedService {
}
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) {
id,
content,
@ -222,7 +235,8 @@ export class FeedService {
}`, variables: {
offset,
sort
}};
}
};
return body;
}
@ -251,7 +265,9 @@ export class FeedService {
post.activity.name,
post.activity.description,
post.activity.points);
} else { activity = null; }
} else {
activity = null;
}
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.description,
post.activity.points);
} else { activity = null; }
} else {
activity = null;
}
posts.push(new Post(id, content, htmlContent, upvotes, downvotes, userVote, deletable, date, author, activity));
}
return posts;

@ -1,6 +1,6 @@
import { TestBed } from '@angular/core/testing';
import {TestBed} from '@angular/core/testing';
import { GroupService } from './group.service';
import {GroupService} from './group.service';
describe('GroupService', () => {
beforeEach(() => TestBed.configureTestingModule({}));

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

@ -1,6 +1,6 @@
import { TestBed } from '@angular/core/testing';
import {TestBed} from '@angular/core/testing';
import { LoginService } from './login.service';
import {LoginService} from './login.service';
describe('LoginService', () => {
beforeEach(() => TestBed.configureTestingModule({}));

@ -1,6 +1,6 @@
import { TestBed } from '@angular/core/testing';
import {TestBed} from '@angular/core/testing';
import { ProfileService } from './profile.service';
import {ProfileService} from './profile.service';
describe('ProfileService', () => {
beforeEach(() => TestBed.configureTestingModule({}));

@ -119,7 +119,9 @@ export class ProfileService extends BaseService {
post.activity.name,
post.activity.description,
post.activity.points);
} else { activity = null; }
} else {
activity = null;
}
// tslint:disable-next-line: max-line-length
posts.push(new Post(id, content, htmlContent, upvotes, downvotes, userVote, deletable, pdate, author, activity));

@ -1,6 +1,6 @@
import { TestBed } from '@angular/core/testing';
import {TestBed} from '@angular/core/testing';
import { RegisterService } from './register.service';
import {RegisterService} from './register.service';
describe('RegisterService', () => {
beforeEach(() => TestBed.configureTestingModule({}));

@ -1,19 +1,20 @@
import { Injectable } from '@angular/core';
import {Http, URLSearchParams, Headers} from '@angular/http';
import { Registration } from '../../models/registration';
import {Injectable} from '@angular/core';
import {Headers, Http} from '@angular/http';
import {Registration} from '../../models/registration';
import {Router} from '@angular/router';
import { DatasharingService } from '../datasharing.service';
import { User } from 'src/app/models/user';
import { environment } from 'src/environments/environment';
import { FriendRequest } from 'src/app/models/friendRequest';
import { FriendInfo } from 'src/app/models/friendinfo';
import {DatasharingService} from '../datasharing.service';
import {User} from 'src/app/models/user';
import {environment} from 'src/environments/environment';
import {FriendRequest} from 'src/app/models/friendRequest';
import {FriendInfo} from 'src/app/models/friendinfo';
@Injectable({
providedIn: 'root'
})
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) {
@ -72,7 +73,8 @@ export class RegisterService {
}
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) {
id,
name,
@ -95,7 +97,8 @@ export class RegisterService {
email: registration.email,
pwHash: registration.passwordHash,
username: registration.username,
}};
}
};
return body;
}
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save