initial commit
- contains basic chat via websocket - contains button to test websocket - contains button to test rest api
This commit is contained in:
35
src/app/chat/entry/entry.component.css
Normal file
35
src/app/chat/entry/entry.component.css
Normal 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;
|
||||
}
|
||||
|
||||
15
src/app/chat/entry/entry.component.html
Normal file
15
src/app/chat/entry/entry.component.html
Normal 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>
|
||||
25
src/app/chat/entry/entry.component.spec.ts
Normal file
25
src/app/chat/entry/entry.component.spec.ts
Normal 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();
|
||||
});
|
||||
});
|
||||
18
src/app/chat/entry/entry.component.ts
Normal file
18
src/app/chat/entry/entry.component.ts
Normal 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 {
|
||||
}
|
||||
|
||||
}
|
||||
7
src/app/chat/entry/entry.spec.ts
Normal file
7
src/app/chat/entry/entry.spec.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { Entry } from './entry';
|
||||
|
||||
describe('Entry', () => {
|
||||
it('should create an instance', () => {
|
||||
expect(new Entry()).toBeTruthy();
|
||||
});
|
||||
});
|
||||
10
src/app/chat/entry/entry.ts
Normal file
10
src/app/chat/entry/entry.ts
Normal 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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user