This repository has been archived by the owner on Mar 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
41 changed files
with
568 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,6 @@ | ||
<router-outlet></router-outlet> | ||
<div class="chatRoom"> | ||
<div class="chatHeaderWrapper"> | ||
<app-navbar></app-navbar> | ||
</div> | ||
<router-outlet></router-outlet> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
|
||
.chatInput{ | ||
width: calc(100vw - 195px); | ||
border-radius: 5px; | ||
margin: 5px; | ||
padding: 5px; | ||
font-size: 1.3em; | ||
font-family: 'Open Sans', sans-serif; | ||
background-color: #eee; | ||
color: #000; | ||
transition: 0.1s ease-out; | ||
} | ||
|
||
.chatInput:focus{ | ||
background-color: #E4F1FE; | ||
color: #222; | ||
transition: 0.2s ease-in; | ||
} | ||
|
||
.chatButton{ | ||
width: 150px; | ||
border-radius: 5px; | ||
margin: 0px; | ||
padding: 10px; | ||
padding: 8px 24px; | ||
font-size: 1.3em; | ||
font-family: 'Droid Sans', sans-serif; | ||
background-color: #2A2845; | ||
color: white; | ||
transition: 0.2s ease-out; | ||
min-width: 50px; | ||
} | ||
|
||
.chatButton:hover{ | ||
background-color: #444; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
<p> | ||
chat-form works! | ||
</p> | ||
<input | ||
class="chatInput" | ||
[(ngModel)]="message" | ||
(keydown)="handleSubmit($event)"/> | ||
|
||
<button class="chatButton" (click)=send()>Send</button> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,27 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { ChatService } from '../services/chat.service'; | ||
|
||
@Component({ | ||
selector: 'app-chat-form', | ||
templateUrl: './chat-form.component.html', | ||
styleUrls: ['./chat-form.component.css'] | ||
}) | ||
export class ChatFormComponent implements OnInit { | ||
message: string; | ||
|
||
constructor() { } | ||
constructor(private chat: ChatService) { } | ||
|
||
ngOnInit() { | ||
} | ||
|
||
send() { | ||
this.chat.sendMessage(this.message); | ||
this.message = ''; | ||
} | ||
|
||
handleSubmit(event) { | ||
if (event.keyCode === 13) { | ||
this.send(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
.mainContent{ | ||
display: flex; | ||
height: calc(100vh - 100px); | ||
} | ||
|
||
.userListWrapper { | ||
background-color: #2A2845; | ||
color: #fff; | ||
display: flex; | ||
font-family: "Open Sans", sans-serif; | ||
font-size: 1.2em; | ||
flex: 1; | ||
order: 1; | ||
padding:20px 0px 40px 30px; | ||
border-right: 1px solid #222; | ||
} | ||
|
||
.feedWrapper { | ||
background-color: #fff; | ||
background: | ||
linear-gradient(181deg, rgba(100,200,255,0.6), rgba(0, 0, 0, 0.9)), | ||
url('../../assets/images/Solid_Pattern.png') center center no-repeat; | ||
font-family: "Open Sans", sans-serif; | ||
font-size: 1.2em; | ||
flex: 5; | ||
order: 2; | ||
overflow-y: scroll; | ||
padding:20px 0px 0px 24px; | ||
} | ||
|
||
.chatFormWrapper { | ||
height: 50px; | ||
background-color: #7C4DFF; | ||
} | ||
|
||
#scroll-style::-webkit-scrollbar-track | ||
{ | ||
border-radius: 10px; | ||
background-color: #F5F5F5; | ||
} | ||
|
||
app-user-list { | ||
width: 100%; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,12 @@ | ||
<p> | ||
chatroom works! | ||
</p> | ||
<div class="mainContent"> | ||
<div class="userListWrapper"> | ||
<app-user-list></app-user-list> | ||
</div> | ||
<div #scroller class="feedWrapper"> | ||
<app-feed></app-feed> | ||
</div> | ||
</div> | ||
|
||
<div class="chatFormWrapper"> | ||
<app-chat-form></app-chat-form> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,24 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { Component, OnInit, ViewChild, ElementRef, AfterViewChecked } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'app-chatroom', | ||
templateUrl: './chatroom.component.html', | ||
styleUrls: ['./chatroom.component.css'] | ||
}) | ||
export class ChatroomComponent implements OnInit { | ||
export class ChatroomComponent implements OnInit, AfterViewChecked { | ||
@ViewChild('scroller') private feedContainer: ElementRef; | ||
|
||
constructor() { } | ||
|
||
ngOnInit() { | ||
} | ||
|
||
scrollToBottom(): void { | ||
this.feedContainer.nativeElement.scrollTop | ||
= this.feedContainer.nativeElement.scrollHeight; | ||
} | ||
|
||
ngAfterViewChecked() { | ||
this.scrollToBottom(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.feed{ | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
|
||
.message{ | ||
flex-direction: column; | ||
margin: 10px 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
<p> | ||
feed works! | ||
</p> | ||
<div class="feed"> | ||
<div *ngFor="let message of feed | async" class="message"> | ||
<app-message [chatMessage]=message></app-message> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,24 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { Component, OnInit, OnChanges } from '@angular/core'; | ||
import { ChatService } from '../services/chat.service'; | ||
import { Observable } from 'rxjs'; | ||
import { ChatMessage } from '../models/chat-message.model'; | ||
|
||
@Component({ | ||
selector: 'app-feed', | ||
templateUrl: './feed.component.html', | ||
styleUrls: ['./feed.component.css'] | ||
}) | ||
export class FeedComponent implements OnInit { | ||
export class FeedComponent implements OnInit, OnChanges { | ||
feed: Observable<ChatMessage[]>; | ||
|
||
constructor() { } | ||
constructor(private chat: ChatService) { } | ||
|
||
ngOnInit() { | ||
this.feed = this.chat.getMessages(); | ||
} | ||
|
||
ngOnChanges() { | ||
this.feed = this.chat.getMessages(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.