initial commit

- contains basic chat via websocket
- contains button to test websocket
- contains button to test rest api
This commit is contained in:
2020-07-19 22:16:23 +02:00
commit d90204d34c
51 changed files with 14772 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
.avatar {
background-image: url(src/assets/avatar.png);
background-size: cover;
}
.character {
font-size: 16px;
font-weight: bold;
}
.header {
margin-bottom: -8px;
width: 100%;
}
/* this class is wrapped around header text by angular */
/deep/ .mat-card-header-text {
width: 100%;
}
.messages {
/* margin-left: 4px; */
}
.timestamp {
color: #888888;
float: right;
font-weight: normal;
font-size: 14px;
}
.user {
font-size: 14px;
}

View File

@@ -0,0 +1,15 @@
<mat-card>
<mat-card-header class="header">
<div mat-card-avatar class="avatar"></div>
<mat-card-title class="character">
{{entry.character}}
<div class="timestamp">23:31</div>
</mat-card-title>
<mat-card-subtitle class="user">played by {{entry.user}}</mat-card-subtitle>
</mat-card-header>
<mat-card-content>
<div class="messages" *ngFor="let message of entry.messages">
{{message}}
</div>
</mat-card-content>
</mat-card>

View File

@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { EntryComponent } from './entry.component';
describe('EntryComponent', () => {
let component: EntryComponent;
let fixture: ComponentFixture<EntryComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ EntryComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(EntryComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -0,0 +1,18 @@
import { Component, Input, OnInit } from '@angular/core';
import { Entry } from './entry';
@Component({
selector: 'app-entry',
templateUrl: './entry.component.html',
styleUrls: ['./entry.component.css']
})
export class EntryComponent implements OnInit {
@Input() entry: Entry;
constructor() { }
ngOnInit(): void {
}
}

View File

@@ -0,0 +1,7 @@
import { Entry } from './entry';
describe('Entry', () => {
it('should create an instance', () => {
expect(new Entry()).toBeTruthy();
});
});

View File

@@ -0,0 +1,10 @@
export class Entry {
public messages: Array<string> = new Array<string>();
constructor(public character: string,
public user: string,
message: string) {
this.messages.push(message);
}
}