Merged Niklas and Max into Master
parent
9ce7a7596b
commit
ad1ab6ecd2
@ -0,0 +1 @@
|
||||
<router-outlet></router-outlet>
|
@ -0,0 +1,36 @@
|
||||
@import '../styles/mixins.sass'
|
||||
@import '../styles/vars.sass'
|
||||
/*
|
||||
#content
|
||||
grid-template: 7.5% 92.5% / 25% 50% 25%
|
||||
display: grid
|
||||
min-height: 100vh
|
||||
max-height: 100vh*/
|
||||
|
||||
#imprint
|
||||
background-color: $cSecondaryBackground
|
||||
grid-template: 15% 70% 15% / 15% 70% 15%
|
||||
display: grid
|
||||
min-height: 100vh
|
||||
max-height: 100vh
|
||||
|
||||
#about
|
||||
background-color: $cSecondaryBackground
|
||||
grid-template: 15% 70% 15% / 15% 70% 15%
|
||||
display: grid
|
||||
min-height: 100vh
|
||||
max-height: 100vh
|
||||
|
||||
#login
|
||||
background-color: $cSecondaryBackground
|
||||
grid-template: 15% 70% 15% / 15% 70% 15%
|
||||
display: grid
|
||||
min-height: 100vh
|
||||
max-height: 100vh
|
||||
|
||||
#register
|
||||
background-color: $cSecondaryBackground
|
||||
grid-template: 15% 70% 15% / 15% 70% 15%
|
||||
display: grid
|
||||
min-height: 100vh
|
||||
max-height: 100vh
|
@ -0,0 +1,31 @@
|
||||
import { TestBed, async } from '@angular/core/testing';
|
||||
import { AppComponent } from './app.component';
|
||||
|
||||
describe('AppComponent', () => {
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [
|
||||
AppComponent
|
||||
],
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
it('should create the app', () => {
|
||||
const fixture = TestBed.createComponent(AppComponent);
|
||||
const app = fixture.debugElement.componentInstance;
|
||||
expect(app).toBeTruthy();
|
||||
});
|
||||
|
||||
it(`should have as title 'socket-app'`, () => {
|
||||
const fixture = TestBed.createComponent(AppComponent);
|
||||
const app = fixture.debugElement.componentInstance;
|
||||
expect(app.title).toEqual('socket-app');
|
||||
});
|
||||
|
||||
it('should render title in a h1 tag', () => {
|
||||
const fixture = TestBed.createComponent(AppComponent);
|
||||
fixture.detectChanges();
|
||||
const compiled = fixture.debugElement.nativeElement;
|
||||
expect(compiled.querySelector('h1').textContent).toContain('Welcome to socket-app!');
|
||||
});
|
||||
});
|
@ -0,0 +1,12 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
templateUrl: './app.component.html',
|
||||
styleUrls: ['./app.component.sass']
|
||||
})
|
||||
export class AppComponent implements OnInit {
|
||||
constructor() { }
|
||||
|
||||
ngOnInit() { }
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
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 { 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 { AppScaffoldComponent } from './components/app-scaffold/app-scaffold.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 { 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';
|
||||
|
||||
const config: SocketIoConfig = { url: 'http://localhost:4444', options: {} };
|
||||
|
||||
const appRoutes: Routes = [
|
||||
{ path: '', component: HomeComponent },
|
||||
{ path: 'profile/:id', component: ProfileComponent },
|
||||
{ path: 'login', component: LoginComponent },
|
||||
{ path: 'register', component: RegisterComponent },
|
||||
{ path: 'about', component: AboutComponent },
|
||||
{ path: 'imprint', component: ImprintComponent },
|
||||
]
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
AppComponent,
|
||||
DocumentListComponent,
|
||||
DocumentComponent,
|
||||
RegisterComponent,
|
||||
LoginComponent,
|
||||
AppScaffoldComponent,
|
||||
ChatComponent,
|
||||
FriendsComponent,
|
||||
FeedComponent,
|
||||
HomeComponent,
|
||||
SocialComponent,
|
||||
GroupsComponent,
|
||||
ChatmanagerComponent,
|
||||
ChatlistComponent,
|
||||
PostlistComponent,
|
||||
ImprintComponent,
|
||||
AboutComponent,
|
||||
ProfileComponent
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
FormsModule,
|
||||
HttpModule,
|
||||
SocketIoModule.forRoot(config),
|
||||
GraphQLModule,
|
||||
HttpClientModule,
|
||||
RouterModule.forRoot(
|
||||
appRoutes
|
||||
)
|
||||
],
|
||||
providers: [],
|
||||
bootstrap: [AppComponent]
|
||||
})
|
||||
export class AppModule { }
|
@ -0,0 +1,17 @@
|
||||
@import '../../../styles/mixins.sass'
|
||||
@import '../../../styles/vars.sass'
|
||||
|
||||
#about
|
||||
background-color: $cSecondaryBackground
|
||||
grid-template: 15% 70% 15% / 15% 70% 15%
|
||||
display: grid
|
||||
min-height: 100vh
|
||||
max-height: 100vh
|
||||
|
||||
#aboutcontainer
|
||||
@include gridPosition(2, 2,2,2)
|
||||
background-color: $cPrimaryBackground
|
||||
input
|
||||
margin: 0.25em
|
||||
#header
|
||||
@include gridPosition(1, 2, 1, 2)
|
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { AboutComponent } from './about.component';
|
||||
|
||||
describe('AboutComponent', () => {
|
||||
let component: AboutComponent;
|
||||
let fixture: ComponentFixture<AboutComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ AboutComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(AboutComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
@ -0,0 +1,15 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-about',
|
||||
templateUrl: './about.component.html',
|
||||
styleUrls: ['./about.component.sass']
|
||||
})
|
||||
export class AboutComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
<h1>Greenvironment</h1>
|
||||
<button id="tab-home" routerLink="">Home</button>
|
||||
<button id="tab-profile" routerLink="/profile">Profile</button>
|
||||
<button id="tab-rank">Rank</button>
|
||||
<button id="tab-about" routerLink="/about">About</button>
|
||||
<button id="tab-imprint" routerLink="/imprint">Imprint</button>
|
||||
<div id="dropdown">
|
||||
<div>
|
||||
<span><i class="fa fa-caret-down" aria-hidden="true"></i></span>
|
||||
<span> Niklas Lampe</span>
|
||||
</div>
|
||||
<div id="dropdown-content">
|
||||
Hallo
|
||||
</div>
|
||||
</div>
|
||||
<button id="logoutbutton"><span><i class="fa fa-sign-out-alt fa-2x" aria-hidden="true"></i></span></button>
|
@ -0,0 +1,64 @@
|
||||
@import '../../../styles/mixins.sass'
|
||||
@import '../../../styles/vars.sass'
|
||||
|
||||
button
|
||||
border: 2px solid $cHeadPrimaryBackground
|
||||
margin-top: 0.125em
|
||||
padding: 0.125em
|
||||
background-color: $cHeadPrimaryBackground
|
||||
color: $cHeadFontColor
|
||||
font-weight: bold
|
||||
transition-duration: 0.25s
|
||||
|
||||
button:hover
|
||||
background-color: lighten($cHeadPrimaryBackground, 10%)
|
||||
cursor: pointer
|
||||
|
||||
button:active
|
||||
background-color: darken($cHeadPrimaryBackground, 5%)
|
||||
box-shadow: inset 0.25em 0.25em 0.1em rgba(0, 0, 0, 0.25)
|
||||
|
||||
h1
|
||||
@include gridPosition(1, 2, 1, 2)
|
||||
line-height: 100%
|
||||
margin-left: 0.5em
|
||||
margin-top: 0.25em
|
||||
|
||||
#tab-home
|
||||
@include gridPosition(1, 2, 2, 3)
|
||||
|
||||
#tab-profile
|
||||
@include gridPosition(1, 2, 3, 4)
|
||||
|
||||
#tab-rank
|
||||
@include gridPosition(1, 2, 4, 5)
|
||||
|
||||
#tab-about
|
||||
@include gridPosition(1, 2, 5, 6)
|
||||
|
||||
#tab-about
|
||||
@include gridPosition(1, 2, 6, 7)
|
||||
|
||||
#dropdown
|
||||
@include gridPosition(1, 2, 7, 8)
|
||||
display: flex
|
||||
align-items: center
|
||||
margin-left: 2em
|
||||
span
|
||||
margin-left: 1em
|
||||
#dropdown-content
|
||||
display: none
|
||||
position: absolute
|
||||
background-color: #f9f9f9
|
||||
min-width: 160px
|
||||
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2)
|
||||
padding: 12px 16px
|
||||
z-index: 1
|
||||
div:hover
|
||||
background-color: lighten($cHeadPrimaryBackground, 10%)
|
||||
cursor: pointer
|
||||
div:hover #dropdown-content
|
||||
display: block
|
||||
|
||||
#logoutbutton
|
||||
@include gridPosition(1, 2, 8, 9)
|
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { AppScaffoldComponent } from './app-scaffold.component';
|
||||
|
||||
describe('AppScaffoldComponent', () => {
|
||||
let component: AppScaffoldComponent;
|
||||
let fixture: ComponentFixture<AppScaffoldComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ AppScaffoldComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(AppScaffoldComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
@ -0,0 +1,15 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-scaffold',
|
||||
templateUrl: './app-scaffold.component.html',
|
||||
styleUrls: ['./app-scaffold.component.sass']
|
||||
})
|
||||
export class AppScaffoldComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
<div id="chat">
|
||||
<div id='header'>
|
||||
<button id="goback" (click)="goBack()"><span><i class="fa fa-arrow-left fa-3x" aria-hidden="true"></i></span></button>
|
||||
<span class='title'>{{childChat.id}}</span>
|
||||
</div>
|
||||
<div id='messagecontainer'>
|
||||
<div class="chatmessage" *ngFor="let message of messages">
|
||||
<div *ngIf="message.myself == true" id='ownmessage'><span>{{message.content}}</span></div>
|
||||
<div *ngIf="message.myself == false" id='foreignmessage'><span>{{message.content}}</span></div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="newmessage">
|
||||
<textarea id='input' placeholder="Write message here ..." rows='3' wrap="soft"></textarea>
|
||||
<button id="send" type='submit'><span><i class="fa fa-send-o fa-2x" aria-hidden="true"></i></span></button>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,83 @@
|
||||
@import '../../../styles/mixins.sass'
|
||||
@import '../../../styles/vars.sass'
|
||||
|
||||
#chat
|
||||
display: grid
|
||||
grid-template: 7.5% 82.5% 10%/100%
|
||||
width: 100%
|
||||
height: 100%
|
||||
|
||||
#header
|
||||
@include gridPosition(1, 2, 1, 2)
|
||||
background-color: $cBoxHeaderBackground
|
||||
display: grid
|
||||
grid-template: 100% /20% 80%
|
||||
|
||||
span
|
||||
color: $cFontWhite
|
||||
span.title
|
||||
@include gridPosition(1, 2, 2, 3)
|
||||
margin-top: 0.25em
|
||||
margin-left: 0.25em
|
||||
line-height: 100%
|
||||
font-size: 2em
|
||||
|
||||
button
|
||||
background-color: $cBoxHeaderBackground
|
||||
border: none
|
||||
|
||||
button:hover
|
||||
background-color: lighten($cBoxHeaderBackground, 10%)
|
||||
cursor: pointer
|
||||
|
||||
button:active
|
||||
background-color: darken($cBoxHeaderBackground, 5%)
|
||||
|
||||
#goback
|
||||
@include gridPosition(1, 2, 1, 2)
|
||||
|
||||
#chatheader
|
||||
@include gridPosition(1, 2, 1, 2)
|
||||
display: grid
|
||||
grid-template: 100% /10% 90%
|
||||
#goback
|
||||
@include gridPosition(1, 2, 1, 2)
|
||||
#name
|
||||
@include gridPosition(1, 2, 2, 3)
|
||||
|
||||
#messagecontainer
|
||||
@include gridPosition(2, 3, 1, 2)
|
||||
overflow: auto
|
||||
.chatmessage
|
||||
width: 100%
|
||||
#ownmessage
|
||||
text-align: right
|
||||
margin: 0.5em
|
||||
span
|
||||
background-color: $cMessageOwn
|
||||
border: solid
|
||||
border-color: $cMessageOwn
|
||||
border-radius: 0.25em
|
||||
#foreignmessage
|
||||
text-align: left
|
||||
margin: 0.5em
|
||||
span
|
||||
background-color: $cMessageForeign
|
||||
border: solid
|
||||
border-color: $cMessageForeign
|
||||
border-radius: 0.25em
|
||||
|
||||
|
||||
#newmessage
|
||||
@include gridPosition(3, 4, 1, 2)
|
||||
margin: 0.5em
|
||||
display: grid
|
||||
grid-template: 100% /80% 20%
|
||||
#input
|
||||
@include gridPosition(1, 2, 1, 2)
|
||||
border-radius: 0.25em
|
||||
border: 1px solid $cFeedInputBorder
|
||||
padding: 0.125em
|
||||
resize: none
|
||||
#send
|
||||
@include gridPosition(1, 2, 2, 3)
|
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ChatComponent } from './chat.component';
|
||||
|
||||
describe('ChatComponent', () => {
|
||||
let component: ChatComponent;
|
||||
let fixture: ComponentFixture<ChatComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ChatComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ChatComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
@ -0,0 +1,28 @@
|
||||
import { Component, OnInit, EventEmitter, Output, Input } from '@angular/core';
|
||||
import { Chatmessage } from 'src/app/models/chatmessage';
|
||||
import { Chatinfo } from 'src/app/models/chatinfo';
|
||||
|
||||
@Component({
|
||||
selector: 'chatmanager-chat',
|
||||
templateUrl: './chat.component.html',
|
||||
styleUrls: ['./chat.component.sass']
|
||||
})
|
||||
export class ChatComponent implements OnInit {
|
||||
|
||||
messages:Array<Chatmessage> = [new Chatmessage("Hallo",true), new Chatmessage("Hallo",false),
|
||||
new Chatmessage("Hallo",true), new Chatmessage("Hallo",false), new Chatmessage("Hallo",true),
|
||||
new Chatmessage("Hallo",false)]
|
||||
|
||||
@Output() goBackEvent = new EventEmitter<boolean>();
|
||||
@Input() childChat: Chatinfo;
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
goBack() {
|
||||
this.goBackEvent.emit(true)
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
<div id='chatlist'>
|
||||
<div id="header">
|
||||
<span class="title">Chats</span>
|
||||
<button id="newchat" (click)="newChat()"><span><i class="fa fa-plus fa-3x" aria-hidden="true"></i></span></button>
|
||||
</div>
|
||||
<div id="chats">
|
||||
<div class="chatitem" *ngFor="let chat of chats"
|
||||
[class.selected]="chat === selectedChat" (click)="showChat(chat)">
|
||||
<div class="picture">Pic</div>
|
||||
<div class="name"><span>{{chat.id}}</span></div>
|
||||
<div class="date"> <a>{{chat.date}}</a></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,72 @@
|
||||
@import '../../../styles/mixins.sass'
|
||||
@import '../../../styles/vars.sass'
|
||||
|
||||
#chatlist
|
||||
display: grid
|
||||
grid-template: 7.5% 92.5%/100%
|
||||
width: 100%
|
||||
height: 100%
|
||||
|
||||
#header
|
||||
@include gridPosition(1, 2, 1, 2)
|
||||
background-color: $cBoxHeaderBackground
|
||||
display: grid
|
||||
grid-template: 100% /80% 20%
|
||||
|
||||
span
|
||||
color: $cFontWhite
|
||||
span.title
|
||||
@include gridPosition(1, 2, 1, 2)
|
||||
margin-top: 0.25em
|
||||
margin-left: 0.25em
|
||||
line-height: 100%
|
||||
font-size: 2em
|
||||
|
||||
button
|
||||
background-color: $cBoxHeaderBackground
|
||||
border: none
|
||||
|
||||
button:hover
|
||||
background-color: lighten($cBoxHeaderBackground, 10%)
|
||||
cursor: pointer
|
||||
|
||||
button:active
|
||||
background-color: darken($cBoxHeaderBackground, 5%)
|
||||
|
||||
#newchat
|
||||
@include gridPosition(1, 2, 2, 3)
|
||||
|
||||
#chats
|
||||
overflow: auto
|
||||
@include gridPosition(2, 3, 1, 2)
|
||||
|
||||
div:hover
|
||||
background-color: darken($cPrimaryBackground, 10%)
|
||||
cursor: pointer
|
||||
.chatitem
|
||||
background-color: $cPrimaryBackground
|
||||
height: 3em
|
||||
margin: 0.2em
|
||||
padding: 0.25em
|
||||
border-radius: 0.25em
|
||||
border: solid
|
||||
display: grid
|
||||
grid-template: 100% / 20% 60% 20%
|
||||
.picture
|
||||
@include gridPosition(1, 2, 1, 2)
|
||||
border: solid
|
||||
.name, .date
|
||||
margin-top: auto
|
||||
margin-bottom: auto
|
||||
.name
|
||||
@include gridPosition(1, 2, 2, 3)
|
||||
font-weight: bold
|
||||
text-align: left
|
||||
padding-left: 0.5em
|
||||
span
|
||||
font-size: 125%
|
||||
.date
|
||||
@include gridPosition(1, 2, 3, 4)
|
||||
color: $cInactiveText
|
||||
text-align: right
|
||||
padding-right: 0.5em
|
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ChatlistComponent } from './chatlist.component';
|
||||
|
||||
describe('ChatlistComponent', () => {
|
||||
let component: ChatlistComponent;
|
||||
let fixture: ComponentFixture<ChatlistComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ChatlistComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ChatlistComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
@ -0,0 +1,32 @@
|
||||
import { Component, OnInit, Output, EventEmitter } from '@angular/core';
|
||||
import { Chatinfo } from 'src/app/models/chatinfo';
|
||||
import { ChatService } from 'src/app/services/chat/chat.service';
|
||||
|
||||
@Component({
|
||||
selector: 'chatmanager-chatlist',
|
||||
templateUrl: './chatlist.component.html',
|
||||
styleUrls: ['./chatlist.component.sass']
|
||||
})
|
||||
export class ChatlistComponent implements OnInit {
|
||||
|
||||
chats:Array<Chatinfo> = [new Chatinfo("Max", "23.06.19 12:50"), new Chatinfo("Julius", "17.04.19 16:50"),
|
||||
new Chatinfo("David", "23.06.19 12:50"), new Chatinfo("Bruno", "23.06.19 12:50")]
|
||||
|
||||
@Output() showChatEvent = new EventEmitter<Chatinfo>();
|
||||
selectedChat: Chatinfo;
|
||||
|
||||
constructor(private chatService: ChatService) { }
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
newChat() {
|
||||
this.chatService.getSelfName()
|
||||
}
|
||||
|
||||
showChat(pChat: Chatinfo) {
|
||||
this.selectedChat = pChat
|
||||
this.showChatEvent.emit(this.selectedChat)
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
<div *ngIf="showChatlist">
|
||||
<chatmanager-chatlist (showChatEvent)="showSpecialChat($event)"></chatmanager-chatlist>
|
||||
</div>
|
||||
<div *ngIf="showChat">
|
||||
<chatmanager-chat (goBackEvent)="goBackToChatlist($event)" [childChat]="parentSelectedChat"></chatmanager-chat>
|
||||
</div>
|
@ -0,0 +1,6 @@
|
||||
@import '../../../styles/mixins.sass'
|
||||
@import '../../../styles/vars.sass'
|
||||
|
||||
div
|
||||
width: 100%
|
||||
height: 100%
|
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ChatmanagerComponent } from './chatmanager.component';
|
||||
|
||||
describe('ChatmanagerComponent', () => {
|
||||
let component: ChatmanagerComponent;
|
||||
let fixture: ComponentFixture<ChatmanagerComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ChatmanagerComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ChatmanagerComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
@ -0,0 +1,33 @@
|
||||
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';
|
||||
|
||||
@Component({
|
||||
selector: 'home-chatmanager',
|
||||
templateUrl: './chatmanager.component.html',
|
||||
styleUrls: ['./chatmanager.component.sass']
|
||||
})
|
||||
export class ChatmanagerComponent implements OnInit {
|
||||
|
||||
showChatlist: boolean = true
|
||||
showChat: boolean = false
|
||||
parentSelectedChat: Chatinfo
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
goBackToChatlist($event) {
|
||||
this.showChatlist = $event
|
||||
this.showChat = false
|
||||
}
|
||||
|
||||
showSpecialChat($event) {
|
||||
this.parentSelectedChat = $event
|
||||
this.showChatlist = false
|
||||
this.showChat = true
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
<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>
|
||||
</div>
|
@ -0,0 +1,24 @@
|
||||
.sidenav {
|
||||
position: fixed;
|
||||
height: 100%;
|
||||
width: 220px;
|
||||
top: 0;
|
||||
left: 0;
|
||||
background-color: #111111;
|
||||
overflow-x: hidden;
|
||||
padding-top: 20px;
|
||||
|
||||
span {
|
||||
padding: 6px 8px 6px 16px;
|
||||
text-decoration: none;
|
||||
font-size: 25px;
|
||||
font-family: 'Roboto', Tahoma, Geneva, Verdana, sans-serif;
|
||||
color: #818181;
|
||||
display: block;
|
||||
}.selected {
|
||||
color: #e1e1e1;
|
||||
}:hover {
|
||||
color: #f1f1f1;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { DocumentListComponent } from './document-list.component';
|
||||
|
||||
describe('DocumentListComponent', () => {
|
||||
let component: DocumentListComponent;
|
||||
let fixture: ComponentFixture<DocumentListComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ DocumentListComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(DocumentListComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
@ -0,0 +1,35 @@
|
||||
import { Component, OnInit, OnDestroy } from '@angular/core';
|
||||
import { Observable, Subscription } from 'rxjs';
|
||||
|
||||
import { DocumentService } from 'src/app/services/document.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-document-list',
|
||||
templateUrl: './document-list.component.html',
|
||||
styleUrls: ['./document-list.component.scss']
|
||||
})
|
||||
export class DocumentListComponent implements OnInit, OnDestroy {
|
||||
documents: Observable<string[]>;
|
||||
currentDoc: string;
|
||||
private _docSub: Subscription;
|
||||
|
||||
constructor(private documentService: DocumentService) { }
|
||||
|
||||
ngOnInit() {
|
||||
this.documents = this.documentService.documents;
|
||||
this._docSub = this.documentService.currentDocument.subscribe(doc => this.currentDoc = doc.id);
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this._docSub.unsubscribe();
|
||||
}
|
||||
|
||||
loadDoc(id: string) {
|
||||
this.documentService.getDocument(id);
|
||||
}
|
||||
|
||||
newDoc() {
|
||||
this.documentService.newDocument();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1 @@
|
||||
<textarea [(ngModel)]='document.doc' (keyup)='editDoc()' placeholder='Start typing...'></textarea>
|
@ -0,0 +1,12 @@
|
||||
textarea {
|
||||
position: fixed;
|
||||
width: calc(100% - 235px);
|
||||
height: 100%;
|
||||
right: 0;
|
||||
top: 0;
|
||||
font-size: 18pt;
|
||||
padding-top: 20px;
|
||||
resize: none;
|
||||
border: none;
|
||||
padding: 20px 0px 20px 15px;
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { DocumentComponent } from './document.component';
|
||||
|
||||
describe('DocumentComponent', () => {
|
||||
let component: DocumentComponent;
|
||||
let fixture: ComponentFixture<DocumentComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ DocumentComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(DocumentComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
@ -0,0 +1,30 @@
|
||||
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';
|
||||
|
||||
@Component({
|
||||
selector: 'app-document',
|
||||
templateUrl: './document.component.html',
|
||||
styleUrls: ['./document.component.scss']
|
||||
})
|
||||
export class DocumentComponent implements OnInit, OnDestroy {
|
||||
document: Document;
|
||||
private _docSub: Subscription;
|
||||
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'})
|
||||
).subscribe(document => this.document = document);
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this._docSub.unsubscribe();
|
||||
}
|
||||
|
||||
editDoc() {
|
||||
this.documentService.editDocument(this.document);
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
<div id="postinput">
|
||||
<textarea id='input' placeholder="Post something ..." rows='3' wrap="soft"></textarea>
|
||||
<button id="attach" type='submit'><span><i class="fa fa-paperclip fa-2x" aria-hidden="true"></i></span></button>
|
||||
<button id="submit" type='submit'><span><i class="fa fa-send-o fa-2x" aria-hidden="true"></i></span></button>
|
||||
</div>
|
||||
<div id='completeFeed'>
|
||||
<div id='feedchooser'>
|
||||
<button id="new" (click)="showNew()">New</button>
|
||||
<button id='mostliked' (click)="showMostLiked()">Most Liked</button>
|
||||
</div>
|
||||
<div id="feedlist">
|
||||
<div *ngIf = "viewNew">
|
||||
<feed-postlist [childPostList]="parentSelectedPostList"></feed-postlist>
|
||||
</div>
|
||||
<div *ngIf = "viewMostLiked">
|
||||
<feed-postlist [childPostList]="parentSelectedPostList"></feed-postlist>
|
||||
</div>
|
||||
<!--
|
||||
<div class="feeditem">
|
||||
<div class="itemhead">
|
||||
<div class="usertag">
|
||||
<span class="title">post.username</span>
|
||||
<span class="handle"><a href="#">post.handle</a></span>
|
||||
</div>
|
||||
<span class="date">post.date</span>
|
||||
</div>
|
||||
<div class="itembody">
|
||||
<div class='text'>
|
||||
<p>post.message</p>
|
||||
</div>
|
||||
<div class="vote">
|
||||
<button id="down" type='submit'><span><i class="fa fa-thumbs-o-down fa-2x" aria-hidden="true"></i></span></button>
|
||||
<button id="up" type='submit'><span><i class="fa fa-thumbs-o-up fa-2x" aria-hidden="true"></i></span></button>
|
||||
<span id="votecounter">post.votes</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
-->
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,73 @@
|
||||
@import '../../../styles/mixins.sass'
|
||||
@import '../../../styles/vars.sass'
|
||||
|
||||
#postinput
|
||||
@include gridPosition(1, 2, 1, 2)
|
||||
margin: 0.5em
|
||||
display: grid
|
||||
grid-template: 100% /80% 10% 10%
|
||||
#input
|
||||
@include gridPosition(1, 2, 1, 2)
|
||||
border-radius: 0.25em
|
||||
border: 1px solid $cFeedInputBorder
|
||||
padding: 0.125em
|
||||
resize: none
|
||||
#attach
|
||||
@include gridPosition(1, 2, 2, 3)
|
||||
#submit
|
||||
@include gridPosition(1, 2, 3, 4)
|
||||
|
||||
#completeFeed
|
||||
@include gridPosition(2, 3, 1, 2)
|
||||
display: grid
|
||||
grid-template: 5% 95% /100%
|
||||
background-color: $cFeedBackground
|
||||
|
||||
#feedchooser
|
||||
@include gridPosition(1, 2, 1, 2)
|
||||
display: grid
|
||||
grid-template: 100% /50% 50%
|
||||
background-color: $cFontWhite
|
||||
padding: 0
|
||||
margin: 0
|
||||
button
|
||||
background-color: $cFeedChooserBackground
|
||||
border: none
|
||||
font-size: 1.5em
|
||||
color: $cFontWhite
|
||||
button:hover
|
||||
background-color: lighten($cFeedChooserBackground, 10%)
|
||||
cursor: pointer
|
||||
#new
|
||||
@include gridPosition(1, 2, 1, 2)
|
||||
#mostliked
|
||||
@include gridPosition(1, 2, 2, 3)
|
||||
|
||||
#feedlist
|
||||
@include gridPosition(2, 3, 1, 2)
|
||||
overflow: auto
|
||||
width: 100%
|
||||
height: 100%
|
||||
|
||||
.feeditemPicture
|
||||
background-color: $cFeedItemBackground
|
||||
min-height: 2em
|
||||
margin: 0.5em
|
||||
padding: 0.25em
|
||||
border-radius: 0.25em
|
||||
.itemhead
|
||||
align-items: flex-start
|
||||
|
||||
.title, .handle, .date
|
||||
margin: 0.125em
|
||||
.title
|
||||
font-weight: bold
|
||||
|
||||
.handle, .date
|
||||
color: $cInactiveText
|
||||
.handle a
|
||||
text-decoration: none
|
||||
color: $cInactiveText
|
||||
font-style: normal
|
||||
.handle a:hover
|
||||
text-decoration: underline
|
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { FeedComponent } from './feed.component';
|
||||
|
||||
describe('FeedComponent', () => {
|
||||
let component: FeedComponent;
|
||||
let fixture: ComponentFixture<FeedComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ FeedComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(FeedComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
@ -0,0 +1,50 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Post } from 'src/app/models/post';
|
||||
|
||||
@Component({
|
||||
selector: 'home-feed',
|
||||
templateUrl: './feed.component.html',
|
||||
styleUrls: ['./feed.component.sass']
|
||||
})
|
||||
export class FeedComponent implements OnInit {
|
||||
|
||||
viewNew: boolean = true
|
||||
viewMostLiked: boolean = false
|
||||
|
||||
feedNew: Array<Post> = [
|
||||
new Post("1", "Niklas", "@nick123", "This is a test message", "01.10.2019 10:00 Uhr", 10),
|
||||
new Post("2", "Niklas", "@nick123", "This is a test message", "01.10.2019 10:00 Uhr", 10),
|
||||
new Post("3", "Niklas", "@nick123", "This is a test message", "01.10.2019 10:00 Uhr", 10),
|
||||
new Post("4", "Niklas", "@nick123", "This is a test message", "01.10.2019 10:00 Uhr", 10),
|
||||
new Post("5", "Niklas", "@nick123", "This is a test message", "01.10.2019 10:00 Uhr", 10),
|
||||
new Post("6", "Niklas", "@nick123", "This is a test message", "01.10.2019 10:00 Uhr", 10),
|
||||
new Post("7", "Niklas", "@nick123", "This is a test message", "01.10.2019 10:00 Uhr", 10)
|
||||
]
|
||||
feedMostLiked: Array<Post> = [
|
||||
new Post("1", "Max", "@max123", "This is a test message", "01.10.2019 10:00 Uhr", 50),
|
||||
new Post("2", "Max", "@max123", "This is a test message", "01.10.2019 10:00 Uhr", 50),
|
||||
new Post("3", "Max", "@max123", "This is a test message", "01.10.2019 10:00 Uhr", 50),
|
||||
new Post("4", "Max", "@max123", "This is a test message", "01.10.2019 10:00 Uhr", 50),
|
||||
new Post("5", "Max", "@max123", "This is a test message", "01.10.2019 10:00 Uhr", 50)
|
||||
]
|
||||
|
||||
parentSelectedPostList: Array<Post> = this.feedNew
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
showNew() {
|
||||
this.viewNew = true
|
||||
this.viewMostLiked = false
|
||||
this.parentSelectedPostList = this.feedNew
|
||||
}
|
||||
|
||||
showMostLiked() {
|
||||
this.viewNew = false
|
||||
this.viewMostLiked = true
|
||||
this.parentSelectedPostList = this.feedMostLiked
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
<div class="feeditem" *ngFor = "let post of childPostList">
|
||||
<div class="itemhead">
|
||||
<div class="usertag">
|
||||
<span class="title">{{post.username}}</span>
|
||||
<span class="handle"><a href="#">{{post.handle}}</a></span>
|
||||
</div>
|
||||
<span class="date">{{post.date}}</span>
|
||||
</div>
|
||||
<div class="itembody">
|
||||
<div class='text'>
|
||||
<p>{{post.message}}</p>
|
||||
</div>
|
||||
<div class="vote">
|
||||
<button id="down" type='submit'><span><i class="fa fa-thumbs-o-down fa-2x" aria-hidden="true"></i></span></button>
|
||||
<button id="up" type='submit'><span><i class="fa fa-thumbs-o-up fa-2x" aria-hidden="true"></i></span></button>
|
||||
<span id="votecounter"> Votes: {{post.votes}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,58 @@
|
||||
@import '../../../../styles/mixins.sass'
|
||||
@import '../../../../styles/vars.sass'
|
||||
|
||||
.feeditem
|
||||
background-color: $cFeedItemBackground
|
||||
min-height: 2em
|
||||
//max-heigth: 5em
|
||||
margin: 0.5em
|
||||
padding: 0.25em
|
||||
border-radius: 0.25em
|
||||
|
||||
.itemhead
|
||||
display: grid
|
||||
grid-template: 100% /70% 30%
|
||||
.usertag
|
||||
@include gridPosition(1, 2, 1, 2)
|
||||
.title, .handle, .date
|
||||
margin: 0.125em
|
||||
.title
|
||||
font-weight: bold
|
||||
.date
|
||||
@include gridPosition(1, 2, 2, 3)
|
||||
text-align: right
|
||||
.handle, .date
|
||||
color: $cInactiveText
|
||||
.handle a
|
||||
text-decoration: none
|
||||
color: $cInactiveText
|
||||
font-style: normal
|
||||
.handle a:hover
|
||||
text-decoration: underline
|
||||
.itembody
|
||||
display: grid
|
||||
grid-template: 100% /85% 15%
|
||||
.text
|
||||
@include gridPosition(1, 2, 1, 2)
|
||||
.vote
|
||||
@include gridPosition(1, 2, 2, 3)
|
||||
display: grid
|
||||
grid-template: 70% 30% /50% 50%
|
||||
button
|
||||
background-color: $cFeedItemBackground
|
||||
border: none
|
||||
button:hover
|
||||
cursor: pointer
|
||||
#up
|
||||
@include gridPosition(1, 2, 2, 3)
|
||||
color: $cFeedUpVote
|
||||
#up:hover
|
||||
color: darken($cFeedUpVote, 10%)
|
||||
#down
|
||||
@include gridPosition(1, 2, 1, 2)
|
||||
color: $cFeedDownVote
|
||||
#down:hover
|
||||
color: darken($cFeedDownVote, 10%)
|
||||
#votecounter
|
||||
@include gridPosition(2, 3, 1, 3)
|
||||
text-align: center
|
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { PostlistComponent } from './postlist.component';
|
||||
|
||||
describe('PostlistComponent', () => {
|
||||
let component: PostlistComponent;
|
||||
let fixture: ComponentFixture<PostlistComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ PostlistComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(PostlistComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
@ -0,0 +1,18 @@
|
||||
import { Component, OnInit, Input } from '@angular/core';
|
||||
import { Post } from 'src/app/models/post';
|
||||
|
||||
@Component({
|
||||
selector: 'feed-postlist',
|
||||
templateUrl: './postlist.component.html',
|
||||
styleUrls: ['./postlist.component.sass']
|
||||
})
|
||||
export class PostlistComponent implements OnInit {
|
||||
|
||||
@Input() childPostList: Array<Post>
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
<div id="content">
|
||||
<app-scaffold id="headerbar"></app-scaffold>
|
||||
<home-chatmanager id="chatcontainer"></home-chatmanager>
|
||||
<home-feed id="feedcontainer"></home-feed>
|
||||
<home-social id="socialcontainer"></home-social>
|
||||
</div>
|
@ -0,0 +1,31 @@
|
||||
@import '../../../styles/mixins.sass'
|
||||
@import '../../../styles/vars.sass'
|
||||
|
||||
#content
|
||||
grid-template: 7.5% 92.5% / 25% 50% 25%
|
||||
display: grid
|
||||
min-height: 100vh
|
||||
max-height: 100vh
|
||||
|
||||
#headerbar
|
||||
@include gridPosition(1, 2, 1, 4)
|
||||
display: grid
|
||||
grid-template: 100% /30% 10% 10% 10% 10% 10% 15% 5%
|
||||
background-color: $cHeadPrimaryBackground
|
||||
color: $cHeadFontColor
|
||||
|
||||
#chatcontainer
|
||||
@include gridPosition(2, 3, 1, 2)
|
||||
background-color: $cBoxBodyBackground
|
||||
|
||||
#feedcontainer
|
||||
@include gridPosition(2, 3, 2, 3)
|
||||
display: grid
|
||||
grid-template: 10% 90% /100%
|
||||
background-color: $cSecondaryBackground
|
||||
|
||||
#socialcontainer
|
||||
@include gridPosition(2, 3, 3, 4)
|
||||
display: grid
|
||||
grid-template: 50% 50% /100%
|
||||
background-color: $cBoxBodyBackground
|
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { HomeComponent } from './home.component';
|
||||
|
||||
describe('HomeComponent', () => {
|
||||
let component: HomeComponent;
|
||||
let fixture: ComponentFixture<HomeComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ HomeComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(HomeComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
@ -0,0 +1,15 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-home',
|
||||
templateUrl: './home.component.html',
|
||||
styleUrls: ['./home.component.sass']
|
||||
})
|
||||
export class HomeComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
<div id="imprint">
|
||||
<div id="imprintcontainer">
|
||||
<h1>Imprint</h1>
|
||||
<p>The greenvironment network is being developed by Bliblablub</p>
|
||||
<h2>Contact</h2>
|
||||
<p>Email: mailadress</p>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,17 @@
|
||||
@import '../../../styles/mixins.sass'
|
||||
@import '../../../styles/vars.sass'
|
||||
|
||||
#imprint
|
||||
background-color: $cSecondaryBackground
|
||||
grid-template: 15% 70% 15% / 15% 70% 15%
|
||||
display: grid
|
||||
min-height: 100vh
|
||||
max-height: 100vh
|
||||
|
||||
#imprintcontainer
|
||||
@include gridPosition(2, 2,2,2)
|
||||
background-color: $cPrimaryBackground
|
||||
input
|
||||
margin: 0.25em
|
||||
#header
|
||||
@include gridPosition(1, 2, 1, 2)
|
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ImprintComponent } from './imprint.component';
|
||||
|
||||
describe('ImprintComponent', () => {
|
||||
let component: ImprintComponent;
|
||||
let fixture: ComponentFixture<ImprintComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ImprintComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ImprintComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
@ -0,0 +1,15 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-imprint',
|
||||
templateUrl: './imprint.component.html',
|
||||
styleUrls: ['./imprint.component.sass']
|
||||
})
|
||||
export class ImprintComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
@import '../../../styles/mixins.sass'
|
||||
@import '../../../styles/vars.sass'
|
||||
|
||||
#login
|
||||
background-color: $cSecondaryBackground
|
||||
grid-template: 15% 70% 15% / 15% 70% 15%
|
||||
display: grid
|
||||
min-height: 100vh
|
||||
max-height: 100vh
|
||||
|
||||
#logincontainer
|
||||
@include gridPosition(2, 2,2,2)
|
||||
grid-template: 15% 15% 15% 15% 15% 15% / 100%
|
||||
background-color: $cPrimaryBackground
|
||||
input
|
||||
margin: 0.25em
|
||||
#header
|
||||
@include gridPosition(1, 2, 1, 2)
|
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { LoginComponent } from './login.component';
|
||||
|
||||
describe('LoginComponent', () => {
|
||||
let component: LoginComponent;
|
||||
let fixture: ComponentFixture<LoginComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ LoginComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(LoginComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
@ -0,0 +1,15 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-login',
|
||||
templateUrl: './login.component.html',
|
||||
styleUrls: ['./login.component.sass']
|
||||
})
|
||||
export class LoginComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
<app-scaffold id="headerbar"></app-scaffold>
|
||||
<home-chatmanager id="chatcontainer"></home-chatmanager>
|
||||
<!--<home-feed id="feedcontainer"></home-feed>-->
|
||||
<home-social id="socialcontainer"></home-social>
|
@ -0,0 +1,25 @@
|
||||
@import '../../../styles/mixins.sass'
|
||||
@import '../../../styles/vars.sass'
|
||||
|
||||
#headerbar
|
||||
@include gridPosition(1, 2, 1, 4)
|
||||
display: grid
|
||||
grid-template: 100% /30% 10% 10% 10% 10% 10% 10% 10%
|
||||
background-color: $cHeadPrimaryBackground
|
||||
color: $cHeadFontColor
|
||||
|
||||
#chatcontainer
|
||||
@include gridPosition(2, 3, 1, 2)
|
||||
background-color: $cBoxBodyBackground
|
||||
|
||||
#feedcontainer
|
||||
@include gridPosition(2, 3, 2, 3)
|
||||
display: grid
|
||||
grid-template: 10% 90% /100%
|
||||
background-color: $cSecondaryBackground
|
||||
|
||||
#socialcontainer
|
||||
@include gridPosition(2, 3, 3, 4)
|
||||
display: grid
|
||||
grid-template: 50% 50% /100%
|
||||
background-color: $cBoxBodyBackground
|
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ProfileComponent } from './profile.component';
|
||||
|
||||
describe('ProfileComponent', () => {
|
||||
let component: ProfileComponent;
|
||||
let fixture: ComponentFixture<ProfileComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ProfileComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ProfileComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
@ -0,0 +1,15 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-profile',
|
||||
templateUrl: './profile.component.html',
|
||||
styleUrls: ['./profile.component.sass']
|
||||
})
|
||||
export class ProfileComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
<div id="register">
|
||||
<div id="registercontainer">
|
||||
<table style="width:100%">
|
||||
<tr>
|
||||
<td>username: </td>
|
||||
<td><input #username type="text" name="username" username.value=''><br></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>email:</td>
|
||||
<td><input #email type="text" name="email"><br></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>password:</td>
|
||||
<td> <input #password type="text" name="password"><br></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>repeat password:</td>
|
||||
<td> <input #repeatpassword type="text" name="repeatpassword"><br></td>
|
||||
</tr>
|
||||
</table>
|
||||
<button type="registerbutton" (click)="onClickSubmit(username.value,email.value,password.value, repeatpassword.value)">Register</button>
|
||||
<br>
|
||||
<a href="/login">You are already part of greenvironment? - login</a>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,20 @@
|
||||
@import '../../../styles/mixins.sass'
|
||||
@import '../../../styles/vars.sass'
|
||||
|
||||
#register
|
||||
background-color: $cSecondaryBackground
|
||||
grid-template: 15% 70% 15% / 15% 70% 15%
|
||||
display: grid
|
||||
min-height: 100vh
|
||||
max-height: 100vh
|
||||
|
||||
#registercontainer
|
||||
@include gridPosition(2, 2,2,2)
|
||||
grid-template: 15% 15% 15% 15% 15% 15% / 100%
|
||||
background-color: $cPrimaryBackground
|
||||
padding: 1em
|
||||
input
|
||||
margin: 0.25em
|
||||
|
||||
#header
|
||||
@include gridPosition(1, 2, 1, 2)
|
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { RegisterComponent } from './register.component';
|
||||
|
||||
describe('RegisterComponent', () => {
|
||||
let component: RegisterComponent;
|
||||
let fixture: ComponentFixture<RegisterComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ RegisterComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(RegisterComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
@ -0,0 +1,34 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import {RegisterService} from '../../services/register/register.service';
|
||||
import {Registration} from '../../models/registration';
|
||||
|
||||
@Component({
|
||||
selector: 'registration',
|
||||
templateUrl: './register.component.html',
|
||||
styleUrls: ['./register.component.sass']
|
||||
})
|
||||
export class RegisterComponent implements OnInit {
|
||||
registration: Registration
|
||||
|
||||
constructor(private registerService: RegisterService) {
|
||||
this.registration = {username: null, passwordHash: null, email: null};
|
||||
}
|
||||
|
||||
onClickSubmit(pUsername: string, pEmail: string, pPasswordHash: string,pPasswordHashRepeat: string ) {
|
||||
console.log('username: ' + pUsername);
|
||||
console.log('email: ' + pEmail);
|
||||
|
||||
if(pPasswordHash == pPasswordHashRepeat){
|
||||
console.log('password same');
|
||||
this.registration.username = pUsername
|
||||
this.registration.email = pEmail
|
||||
this.registration.passwordHash = pPasswordHash
|
||||
|
||||
this.registerService.register(this.registration)
|
||||
} else{console.log('password NOT same'); }
|
||||
}
|
||||
|
||||
ngOnInit() {}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,10 @@
|
||||
<div id="header">
|
||||
<span class="title">Friends</span>
|
||||
<button id="new" type="submit"><span><i class="fa fa-plus fa-3x" aria-hidden="true"></i></span></button>
|
||||
<button id="invitations" type="submit"><span><i class="fa fa-envelope-o fa-3x" aria-hidden="true"></i></span></button>
|
||||
</div>
|
||||
<div id="friendslist">
|
||||
<div class="frienditem" *ngFor="let friend of friends">
|
||||
<div class="friendname">{{friend}}</div>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,24 @@
|
||||
@import '../../../../styles/mixins.sass'
|
||||
@import '../../../../styles/vars.sass'
|
||||
@import '../social.component.sass'
|
||||
|
||||
#friendslist
|
||||
overflow: auto
|
||||
@include gridPosition(2, 3, 1, 2)
|
||||
.frienditem
|
||||
background-color: $cPrimaryBackground
|
||||
height: 3em
|
||||
margin: 0.2em
|
||||
padding: 0.25em
|
||||
border-radius: 0.25em
|
||||
border: solid
|
||||
display: flex;
|
||||
.friendname
|
||||
font-weight: bold
|
||||
text-align: left
|
||||
border: solid
|
||||
width: 60%
|
||||
padding-left: 1em
|
||||
margin: auto
|
||||
span
|
||||
font-size: 125%
|
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { FriendsComponent } from './friends.component';
|
||||
|
||||
describe('FriendsComponent', () => {
|
||||
let component: FriendsComponent;
|
||||
let fixture: ComponentFixture<FriendsComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ FriendsComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(FriendsComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
@ -0,0 +1,15 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'social-friends',
|
||||
templateUrl: './friends.component.html',
|
||||
styleUrls: ['./friends.component.sass']
|
||||
})
|
||||
export class FriendsComponent implements OnInit {
|
||||
friends: Array<String> = ["Friend 1", "Friend 2", "Friend 3", "Friend 4", "Friend 5", "Friend 6"]
|
||||
constructor() { }
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
<div id="header">
|
||||
<span class="title">Groups</span>
|
||||
<button id="new" type="submit"><span><i class="fa fa-plus fa-3x" aria-hidden="true"></i></span></button>
|
||||
<button id="invitations" type="submit"><span><i class="fa fa-envelope-o fa-3x" aria-hidden="true"></i></span></button>
|
||||
</div>
|
||||
<div id="groupslist">
|
||||
<div class="groupitem" *ngFor="let group of groups">
|
||||
<div class="groupname">{{group}}</div>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,24 @@
|
||||
@import '../../../../styles/mixins.sass'
|
||||
@import '../../../../styles/vars.sass'
|
||||
@import '../social.component.sass'
|
||||
|
||||
#groupslist
|
||||
overflow: auto
|
||||
@include gridPosition(2, 3, 1, 2)
|
||||
.groupitem
|
||||
background-color: $cPrimaryBackground
|
||||
height: 3em
|
||||
margin: 0.2em
|
||||
padding: 0.25em
|
||||
border-radius: 0.25em
|
||||
border: solid
|
||||
display: flex;
|
||||
.groupname
|
||||
font-weight: bold
|
||||
text-align: left
|
||||
border: solid
|
||||
width: 60%
|
||||
padding-left: 1em
|
||||
margin: auto
|
||||
span
|
||||
font-size: 125%
|
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { GroupsComponent } from './groups.component';
|
||||
|
||||
describe('GroupsComponent', () => {
|
||||
let component: GroupsComponent;
|
||||
let fixture: ComponentFixture<GroupsComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ GroupsComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(GroupsComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
@ -0,0 +1,15 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'social-groups',
|
||||
templateUrl: './groups.component.html',
|
||||
styleUrls: ['./groups.component.sass']
|
||||
})
|
||||
export class GroupsComponent implements OnInit {
|
||||
groups: Array<String> = ["Group 1", "Group 2", "Group 3", "Group 4", "Group 5", "Group 6"]
|
||||
constructor() { }
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
<social-friends id="friendscontainer"></social-friends>
|
||||
<social-groups id="groupscontainer"></social-groups>
|
@ -0,0 +1,44 @@
|
||||
@import '../../../styles/mixins.sass'
|
||||
@import '../../../styles/vars.sass'
|
||||
|
||||
#friendscontainer
|
||||
@include gridPosition(1, 2, 1, 2)
|
||||
display: grid
|
||||
grid-template: 15% 85% /100%
|
||||
|
||||
#groupscontainer
|
||||
@include gridPosition(2, 3, 1, 2)
|
||||
display: grid
|
||||
grid-template: 15% 85% /100%
|
||||
|
||||
#header
|
||||
@include gridPosition(1, 2, 1, 2)
|
||||
background-color: $cBoxHeaderBackground
|
||||
display: grid
|
||||
grid-template: 100% /60% 20% 20%
|
||||
|
||||
span
|
||||
color: $cFontWhite
|
||||
span.title
|
||||
@include gridPosition(1, 2, 1, 2)
|
||||
margin-top: 0.25em
|
||||
margin-left: 0.25em
|
||||
line-height: 100%
|
||||
font-size: 2em
|
||||
|
||||
button
|
||||
background-color: $cBoxHeaderBackground
|
||||
border: none
|
||||
|
||||
button:hover
|
||||
background-color: lighten($cBoxHeaderBackground, 10%)
|
||||
cursor: pointer
|
||||
|
||||
button:active
|
||||
background-color: darken($cBoxHeaderBackground, 5%)
|
||||
|
||||
#new
|
||||
@include gridPosition(1, 2, 2, 3)
|
||||
|
||||
#invitations
|
||||
@include gridPosition(1, 2, 3, 4)
|
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { SocialComponent } from './social.component';
|
||||
|
||||
describe('SocialComponent', () => {
|
||||
let component: SocialComponent;
|
||||
let fixture: ComponentFixture<SocialComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ SocialComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(SocialComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
@ -0,0 +1,15 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'home-social',
|
||||
templateUrl: './social.component.html',
|
||||
styleUrls: ['./social.component.sass']
|
||||
})
|
||||
export class SocialComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
import {NgModule} from '@angular/core';
|
||||
import {ApolloModule, APOLLO_OPTIONS} from 'apollo-angular';
|
||||
import {HttpLinkModule, HttpLink} 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 {
|
||||
link: httpLink.create({uri}),
|
||||
cache: new InMemoryCache(),
|
||||
};
|
||||
}
|
||||
|
||||
@NgModule({
|
||||
exports: [ApolloModule, HttpLinkModule],
|
||||
providers: [
|
||||
{
|
||||
provide: APOLLO_OPTIONS,
|
||||
useFactory: createApollo,
|
||||
deps: [HttpLink],
|
||||
},
|
||||
],
|
||||
})
|
||||
export class GraphQLModule {}
|
@ -0,0 +1,9 @@
|
||||
export class Chatinfo {
|
||||
id: string;
|
||||
date: string;
|
||||
|
||||
constructor(pId: string, pDate: string) {
|
||||
this.id = pId
|
||||
this.date = pDate
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
export class Chatmessage {
|
||||
content: string;
|
||||
myself: boolean;
|
||||
|
||||
constructor(pContent: string, pMyself: boolean) {
|
||||
this.content = pContent
|
||||
this.myself = pMyself
|
||||
}
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
export class Document {
|
||||
id: string;
|
||||
doc: string;
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
export class Post {
|
||||
id: string
|
||||
username: string
|
||||
handle: string
|
||||
message: string
|
||||
date: string
|
||||
votes: number
|
||||
|
||||
constructor(pId: string, pUsername: string, pHandle: string, pMessage: string, pDate: string, pVotes: number) {
|
||||
this.id = pId
|
||||
this.username = pUsername
|
||||
this.handle = pHandle
|
||||
this.message = pMessage
|
||||
this.date = pDate
|
||||
this.votes = pVotes
|
||||
}
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
export interface Registration {
|
||||
username: string;
|
||||
email: string;
|
||||
passwordHash: string
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ChatService } from './chat.service';
|
||||
|
||||
describe('ChatService', () => {
|
||||
beforeEach(() => TestBed.configureTestingModule({}));
|
||||
|
||||
it('should be created', () => {
|
||||
const service: ChatService = TestBed.get(ChatService);
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
@ -0,0 +1,59 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import {Http, URLSearchParams, Headers} from '@angular/http';
|
||||
import {Apollo} from 'apollo-angular';
|
||||
import gql from 'graphql-tag';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class ChatService {
|
||||
|
||||
name: any
|
||||
|
||||
rates: any[];
|
||||
loading = true;
|
||||
error: any;
|
||||
|
||||
constructor(private apollo: Apollo) { }
|
||||
|
||||
public getSelfName2() {
|
||||
this.apollo
|
||||
.watchQuery<any>({
|
||||
query: gql`
|
||||
{
|
||||
getSelf {
|
||||
name
|
||||
}
|
||||
}
|
||||
`,
|
||||
})
|
||||
.valueChanges.subscribe(result => {
|
||||
this.name = result.data && result.data.name;
|
||||
this.loading = result.loading;
|
||||
this.error = result.errors;
|
||||
});
|
||||
|
||||
console.log(this.name)
|
||||
}
|
||||
|
||||
public getSelfName() {
|
||||
this.apollo
|
||||
.query<any>({
|
||||
query: gql`
|
||||
{
|
||||
rates(currency: "USD") {
|
||||
currency
|
||||
rate
|
||||
}
|
||||
}
|
||||
`,
|
||||
})
|
||||
.subscribe(result => {
|
||||
this.rates = result.data && result.data.rates;
|
||||
this.loading = result.loading;
|
||||
this.error = result.errors;
|
||||
});
|
||||
|
||||
console.log(this.rates)
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { DocumentService } from './document.service';
|
||||
|
||||
describe('DocumentService', () => {
|
||||
beforeEach(() => TestBed.configureTestingModule({}));
|
||||
|
||||
it('should be created', () => {
|
||||
const service: DocumentService = TestBed.get(DocumentService);
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
@ -0,0 +1,38 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
import { Socket } from 'ngx-socket-io';
|
||||
|
||||
import { Document } from '../models/document';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class DocumentService {
|
||||
currentDocument = this.socket.fromEvent<Document>('document');
|
||||
documents = this.socket.fromEvent<string[]>('documents');
|
||||
|
||||
constructor(private socket: Socket) { }
|
||||
|
||||
getDocument(id: string) {
|
||||
this.socket.emit('getDoc', id);
|
||||
}
|
||||
|
||||
newDocument() {
|
||||
this.socket.emit('addDoc', { id: this.docId(), doc: '' });
|
||||
}
|
||||
|
||||
editDocument(document: Document) {
|
||||
this.socket.emit('editDoc', document);
|
||||
}
|
||||
|
||||
private docId() {
|
||||
let text = '';
|
||||
const possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
||||
|
||||
for (let i = 0; i < 5; i++) {
|
||||
text += possible.charAt(Math.floor(Math.random() * possible.length));
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { LoginService } from './login.service';
|
||||
|
||||
describe('LoginService', () => {
|
||||
beforeEach(() => TestBed.configureTestingModule({}));
|
||||
|
||||
it('should be created', () => {
|
||||
const service: LoginService = TestBed.get(LoginService);
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
@ -0,0 +1,9 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class LoginService {
|
||||
|
||||
constructor() { }
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { RegisterService } from './register.service';
|
||||
|
||||
describe('RegisterService', () => {
|
||||
beforeEach(() => TestBed.configureTestingModule({}));
|
||||
|
||||
it('should be created', () => {
|
||||
const service: RegisterService = TestBed.get(RegisterService);
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
@ -0,0 +1,34 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import {Http, URLSearchParams, Headers} from '@angular/http';
|
||||
import { Registration } from '../../models/registration';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class RegisterService {
|
||||
|
||||
constructor(private http: Http) { }
|
||||
|
||||
public register(registration: Registration) {
|
||||
|
||||
//let url = './graphql'
|
||||
let url = 'https://greenvironment.net/graphql'
|
||||
|
||||
let headers = new Headers();
|
||||
headers.set('Content-Type', 'application/json');
|
||||
|
||||
return this.http.post(url, this.buildJson(registration)).subscribe(response => console.log(response.text()));
|
||||
}
|
||||
|
||||
public buildJson(registration: Registration): any {
|
||||
const body = {query: `mutation($username: String, $email: String, $pwHash: String) {
|
||||
register(username: $username, email: $email, passwordHash: $pwHash) {id}
|
||||
}`, variables: {
|
||||
email: registration.email,
|
||||
pwHash: registration.passwordHash,
|
||||
username: registration.username,
|
||||
}};
|
||||
return body;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,11 @@
|
||||
# This file is currently used by autoprefixer to adjust CSS to support the below specified browsers
|
||||
# For additional information regarding the format and rule options, please see:
|
||||
# https://github.com/browserslist/browserslist#queries
|
||||
#
|
||||
# For IE 9-11 support, please remove 'not' from the last line of the file and adjust as needed
|
||||
|
||||
> 0.5%
|
||||
last 2 versions
|
||||
Firefox ESR
|
||||
not dead
|
||||
not IE 9-11
|
@ -0,0 +1,3 @@
|
||||
export const environment = {
|
||||
production: true
|
||||
};
|
@ -0,0 +1,16 @@
|
||||
// This file can be replaced during build by using the `fileReplacements` array.
|
||||
// `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.
|
||||
// The list of file replacements can be found in `angular.json`.
|
||||
|
||||
export const environment = {
|
||||
production: false
|
||||
};
|
||||
|
||||
/*
|
||||
* For easier debugging in development mode, you can import the following file
|
||||
* to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
|
||||
*
|
||||
* This import should be commented out in production mode because it will have a negative impact
|
||||
* on performance if an error is thrown.
|
||||
*/
|
||||
// import 'zone.js/dist/zone-error'; // Included with Angular CLI.
|
Binary file not shown.
After Width: | Height: | Size: 5.3 KiB |
@ -0,0 +1,14 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Greenvironment</title>
|
||||
<base href="/">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
||||
<script src="https://kit.fontawesome.com/84cf838715.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<app-root></app-root>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,31 @@
|
||||
// Karma configuration file, see link for more information
|
||||
// https://karma-runner.github.io/1.0/config/configuration-file.html
|
||||
|
||||
module.exports = function (config) {
|
||||
config.set({
|
||||
basePath: '',
|
||||
frameworks: ['jasmine', '@angular-devkit/build-angular'],
|
||||
plugins: [
|
||||
require('karma-jasmine'),
|
||||
require('karma-chrome-launcher'),
|
||||
require('karma-jasmine-html-reporter'),
|
||||
require('karma-coverage-istanbul-reporter'),
|
||||
require('@angular-devkit/build-angular/plugins/karma')
|
||||
],
|
||||
client: {
|
||||
clearContext: false // leave Jasmine Spec Runner output visible in browser
|
||||
},
|
||||
coverageIstanbulReporter: {
|
||||
dir: require('path').join(__dirname, '../coverage'),
|
||||
reports: ['html', 'lcovonly'],
|
||||
fixWebpackSourcePaths: true
|
||||
},
|
||||
reporters: ['progress', 'kjhtml'],
|
||||
port: 9876,
|
||||
colors: true,
|
||||
logLevel: config.LOG_INFO,
|
||||
autoWatch: true,
|
||||
browsers: ['Chrome'],
|
||||
singleRun: false
|
||||
});
|
||||
};
|
@ -0,0 +1,13 @@
|
||||
import { enableProdMode } from '@angular/core';
|
||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||
|
||||
import { AppModule } from './app/app.module';
|
||||
import { environment } from './environments/environment';
|
||||
import 'rxjs';
|
||||
|
||||
if (environment.production) {
|
||||
enableProdMode();
|
||||
}
|
||||
|
||||
platformBrowserDynamic().bootstrapModule(AppModule)
|
||||
.catch(err => console.error(err));
|
@ -0,0 +1,82 @@
|
||||
/**
|
||||
* This file includes polyfills needed by Angular and is loaded before the app.
|
||||
* You can add your own extra polyfills to this file.
|
||||
*
|
||||
* This file is divided into 2 sections:
|
||||
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
|
||||
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main
|
||||
* file.
|
||||
*
|
||||
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
|
||||
* automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
|
||||
* Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
|
||||
*
|
||||
* Learn more in https://angular.io/guide/browser-support
|
||||
*/
|
||||
|
||||
/***************************************************************************************************
|
||||
* BROWSER POLYFILLS
|
||||
*/
|
||||
|
||||
(window as any).global = window;
|
||||
|
||||
/** IE9, IE10 and IE11 requires all of the following polyfills. **/
|
||||
// import 'core-js/es6/symbol';
|
||||
// import 'core-js/es6/object';
|
||||
// import 'core-js/es6/function';
|
||||
// import 'core-js/es6/parse-int';
|
||||
// import 'core-js/es6/parse-float';
|
||||
// import 'core-js/es6/number';
|
||||
// import 'core-js/es6/math';
|
||||
// import 'core-js/es6/string';
|
||||
// import 'core-js/es6/date';
|
||||
// import 'core-js/es6/array';
|
||||
// import 'core-js/es6/regexp';
|
||||
// import 'core-js/es6/map';
|
||||
// import 'core-js/es6/weak-map';
|
||||
// import 'core-js/es6/set';
|
||||
|
||||
/**
|
||||
* If the application will be indexed by Google Search, the following is required.
|
||||
* Googlebot uses a renderer based on Chrome 41.
|
||||
* https://developers.google.com/search/docs/guides/rendering
|
||||
**/
|
||||
// import 'core-js/es6/array';
|
||||
|
||||
/** IE10 and IE11 requires the following for NgClass support on SVG elements */
|
||||
// import 'classlist.js'; // Run `npm install --save classlist.js`.
|
||||
|
||||
/** IE10 and IE11 requires the following for the Reflect API. */
|
||||
// import 'core-js/es6/reflect';
|
||||
|
||||
/**
|
||||
* Web Animations `@angular/platform-browser/animations`
|
||||
* Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
|
||||
* Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
|
||||
**/
|
||||
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
|
||||
|
||||
/**
|
||||
* By default, zone.js will patch all possible macroTask and DomEvents
|
||||
* user can disable parts of macroTask/DomEvents patch by setting following flags
|
||||
*/
|
||||
|
||||
// (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
|
||||
// (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
|
||||
// (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
|
||||
|
||||
/*
|
||||
* in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
|
||||
* with the following flag, it will bypass `zone.js` patch for IE/Edge
|
||||
*/
|
||||
// (window as any).__Zone_enable_cross_context_check = true;
|
||||
|
||||
/***************************************************************************************************
|
||||
* Zone JS is required by default for Angular itself.
|
||||
*/
|
||||
import 'zone.js/dist/zone'; // Included with Angular CLI.
|
||||
|
||||
|
||||
/***************************************************************************************************
|
||||
* APPLICATION IMPORTS
|
||||
*/
|
@ -0,0 +1,10 @@
|
||||
@import 'styles/mixins.sass'
|
||||
@import 'styles/vars.sass'
|
||||
|
||||
body
|
||||
font-family: Arial, serif
|
||||
margin: 0
|
||||
padding: 0
|
||||
min-height: 100vh
|
||||
max-height: 100vh
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue