Skip to content
This repository has been archived by the owner on Mar 26, 2022. It is now read-only.

Commit

Permalink
Closed #12
Browse files Browse the repository at this point in the history
Better settings and blurred main
  • Loading branch information
Migarve55 committed Mar 7, 2019
1 parent bd3a4eb commit 249f197
Show file tree
Hide file tree
Showing 9 changed files with 79 additions and 37 deletions.
4 changes: 0 additions & 4 deletions src/app/chat-form/chat-form.component.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@
flex-grow: 1;
}

.chatInput:disabled {
background-color: gray;
}

.chatInput:focus{
background-color: #E4F1FE;
color: #222;
Expand Down
8 changes: 8 additions & 0 deletions src/app/chatroom/chatroom.component.css
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
.mainContent{
display: flex;
height: calc(100vh - 50px);
background-color: #7C4DFF;
}

.chat {
display: flex;
flex: 5;
order: 2;
flex-direction: column;
transition: 0.3s ;
}

.blurred {
color: rgba(0, 0, 0, 0.25);
filter: blur(4px) brightness(50%);
transition: 0.3s;
}

.userListWrapper {
Expand Down
2 changes: 1 addition & 1 deletion src/app/chatroom/chatroom.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="userListWrapper">
<app-user-list></app-user-list>
</div>
<div class="chat">
<div class="chat" [ngClass]="{'blurred':!active}">
<div #scroller class="feedWrapper">
<app-feed></app-feed>
</div>
Expand Down
9 changes: 8 additions & 1 deletion src/app/chatroom/chatroom.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Component, OnInit, ViewChild, ElementRef, AfterViewChecked } from '@angular/core';
import { ChatService } from '../services/chat.service';

@Component({
selector: 'app-chatroom',
Expand All @@ -8,7 +9,13 @@ import { Component, OnInit, ViewChild, ElementRef, AfterViewChecked } from '@ang
export class ChatroomComponent implements OnInit, AfterViewChecked {
@ViewChild('scroller') private feedContainer: ElementRef;

constructor() { }
active : boolean = false;

constructor(private chat : ChatService) {
this.chat.isChatActive().subscribe(active => {
this.active = active;
});
}

ngOnInit() {
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/message/message.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ export class MessageComponent implements OnInit {
userName: string;
messageContent: string;
timeStamp: Date = new Date();

isOwnMessage: boolean;
ownEmail: string;

constructor(private chatService : ChatService) {
chatService.getUser().subscribe(user => {
Expand Down
11 changes: 9 additions & 2 deletions src/app/services/chat.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Observable, of, BehaviorSubject } from 'rxjs';
import { ChatMessage } from '../models/chat-message.model';
import { RdfService } from './rdf.service';
import { User } from '../models/user.model';
import { ToastrService } from 'ngx-toastr';

const fileClient = require('solid-file-client');
@Injectable()
Expand All @@ -18,7 +19,7 @@ export class ChatService {

friends: Array<User> = new Array<User>();

constructor(private rdf : RdfService) {
constructor(private rdf : RdfService, private toastr : ToastrService) {
this.rdf.getSession();
this.loadUserData().then(response => {
this.loadFriends();
Expand Down Expand Up @@ -74,7 +75,13 @@ export class ChatService {
}

private async loadMessagesFromTo(user1 : User, user2 : User) {
(await this.rdf.getElementsFromContainer(await this.getChatUrl(user1, user2))).forEach(async element => {
let messages = (await this.rdf.getElementsFromContainer(await this.getChatUrl(user1, user2)))
if (!messages) {
this.toastr.error("Please make sure the other user has clicked on your chat", "Could not load messages");
this.isActive.next(false);
return;
}
messages.forEach(async element => {
const url = element.value + "#message";
await this.rdf.fetcher.load(url);
const sender = this.rdf.getValueFromSchema("sender", url);
Expand Down
48 changes: 31 additions & 17 deletions src/app/settings/settings.component.css
Original file line number Diff line number Diff line change
@@ -1,41 +1,55 @@

.settingsFormWrapper {
display: flex;
flex-direction: column;
font-family: "Open Sans", sans-serif;
width: 100%;
height: calc(100vh - 50px);
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;
}

h2 {
margin-top: 0.2em;
margin-bottom: 0.4em;
}

.setting {
margin: 5em;
padding: 1em;
border-radius: 1em;
background-color: #7C4DFF;
box-shadow: 4px 4px 5px 0px rgba(0,0,0,0.67);
}

.group {
display: flex;
margin: 0.6rm;
}

.addFriendInput{
.textInput {
border-radius: 5px;
margin: 5px;
padding: 5px;
margin: 0.3em;
padding: 0.2em;
font-size: 1.3em;
font-family: 'Open Sans', sans-serif;
background-color: #eee;
color: #000;
transition: 0.1s ease-out;
flex-grow: 1;
}

.addFriendInput:focus{
background-color: #E4F1FE;
color: #222;
transition: 0.2s ease-in;
}

.addFriendButton{
.button {
width: 150px;
border-radius: 5px;
margin: 0px;
padding: 10px;
padding: 8px 24px;
padding: 0.3em;
padding: 0.3em 0.4em;
font-size: 1.3em;
font-family: 'Droid Sans', sans-serif;
background-color: #2A2845;
color: white;
transition: 0.2s ease-out;
min-width: 50px;
}

.addFriendButton:hover{
background-color: #444;
}
15 changes: 9 additions & 6 deletions src/app/settings/settings.component.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
<div class="settingsFormWrapper">
<input class="addFriendInput"
[(ngModel)]="webId"
(keydown)="handleSubmit($event)"
placeholder="Enter your friend's WebID"/>

<button class="addFriendButton" (click)=send()>Send</button>
<div class="setting">
<h2>Add a friend</h2>
<div class="group">
<input class="textInput"
[(ngModel)]="webId" (keydown)="handleSubmit($event)"
placeholder="Enter your friend's WebID"/>
<button class="button" (click)=addFriend()>Add friend</button>
</div>
</div>
</div>
17 changes: 12 additions & 5 deletions src/app/settings/settings.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Component, OnInit } from '@angular/core';
import { ChatService } from '../services/chat.service';
import { ToastrService } from 'ngx-toastr';

@Component({
selector: 'app-settings',
Expand All @@ -10,19 +11,25 @@ export class SettingsComponent implements OnInit {

webId : string;

constructor(private chat : ChatService) { }
constructor(private chat : ChatService, private toastr : ToastrService) { }

ngOnInit() {
}

send() {
this.chat.addFriend(this.webId);
this.webId = '';
addFriend() {
if (!this.webId) {
this.toastr.error("Please add a webId", "Wrong input");
} else if (this.webId.trim() === "") {
this.toastr.error("Please add a webId", "Wrong input");
} else {
this.chat.addFriend(this.webId.trim());
this.webId = "";
}
}

handleSubmit(event) {
if (event.keyCode === 13) {
this.send();
this.addFriend();
}
}

Expand Down

0 comments on commit 249f197

Please sign in to comment.