-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add messages functionality to desktop client
- Loading branch information
Showing
13 changed files
with
265 additions
and
6 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,17 @@ | ||
/** | ||
* This class defines a model for Messages in TraMS. | ||
*/ | ||
export class Message { | ||
|
||
public subject: string; | ||
public content: string; | ||
public folder: string; | ||
|
||
constructor(subject: string, content: string, folder: string) { | ||
this.subject = subject; | ||
this.content = content; | ||
this.folder = folder; | ||
} | ||
|
||
|
||
} |
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,3 @@ | ||
.nav-background-color { | ||
background-color: whitesmoke; | ||
} |
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,33 @@ | ||
<!-- Show the header --> | ||
<app-header></app-header> | ||
|
||
<!-- Jumbotron with page title --> | ||
<div class="jumbotron"> | ||
<h1 class="display-4 text-center">Messages</h1> | ||
</div> | ||
|
||
<div class="row"> | ||
<div class="col-2 nav-background-color"> | ||
<div class="m-5"> | ||
<span (click)="onInboxSelect()"><fa-icon [icon]="faInbox"></fa-icon> INBOX</span> | ||
</div> | ||
<div class="m-5"> | ||
<span (click)="onOutboxSelect()"><fa-icon [icon]="faSnareFromSquare"></fa-icon> OUTBOX</span> | ||
</div> | ||
<div class="m-5"> | ||
<span (click)="onSentSelect()"><fa-icon [icon]="faEnvelopeCircleCheck"></fa-icon> SENT ITEMS</span> | ||
</div> | ||
<div class="m-5"> | ||
<span (click)="onTrashSelect()"><fa-icon [icon]="faTrash"></fa-icon> TRASH</span> | ||
</div> | ||
</div> | ||
<div class="col-10"> | ||
<div *ngIf="displayMessages.length === 0"> | ||
<h1>There are no messages in this folder.</h1> | ||
</div> | ||
<div *ngFor="let message of displayMessages, let i = index"> | ||
<h2>{{message.subject}}</h2> | ||
<p style="white-space: pre-wrap">{{message.content}}</p> | ||
</div> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { MessagesComponent } from './messages.component'; | ||
|
||
describe('MessagesComponent', () => { | ||
let component: MessagesComponent; | ||
let fixture: ComponentFixture<MessagesComponent>; | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [MessagesComponent] | ||
}); | ||
fixture = TestBed.createComponent(MessagesComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
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,59 @@ | ||
import { Component } from '@angular/core'; | ||
import { faInbox } from '@fortawesome/free-solid-svg-icons'; | ||
import { faEnvelopeCircleCheck } from '@fortawesome/free-solid-svg-icons'; | ||
import { faShareFromSquare } from '@fortawesome/free-solid-svg-icons'; | ||
import { faTrash } from '@fortawesome/free-solid-svg-icons'; | ||
import {Message} from "./message.model"; | ||
import {GameService} from "../shared/game.service"; | ||
|
||
@Component({ | ||
selector: 'app-messages', | ||
templateUrl: './messages.component.html', | ||
styleUrls: ['./messages.component.css'] | ||
}) | ||
export class MessagesComponent { | ||
faInbox = faInbox; | ||
faEnvelopeCircleCheck = faEnvelopeCircleCheck; | ||
faSnareFromSquare = faShareFromSquare; | ||
faTrash = faTrash; | ||
displayMessages: Message[]; | ||
gameService: GameService; | ||
|
||
constructor(private gameService2: GameService) { | ||
this.displayMessages = []; | ||
this.gameService = gameService2; | ||
this.onInboxSelect(); | ||
} | ||
|
||
onInboxSelect(): void { | ||
this.displayMessages = this.gameService.getGame().messages.filter(this.checkForInbox); | ||
} | ||
|
||
checkForInbox(message) { | ||
return message.folder.valueOf() === "INBOX"; | ||
} | ||
|
||
onOutboxSelect(): void { | ||
this.displayMessages = this.gameService.getGame().messages.filter(this.checkForOutbox); | ||
} | ||
|
||
checkForOutbox(message) { | ||
return message.folder.valueOf() === "OUTBOX"; | ||
} | ||
|
||
onSentSelect(): void { | ||
this.displayMessages = this.gameService.getGame().messages.filter(this.checkForSentItems); | ||
} | ||
|
||
checkForSentItems(message) { | ||
return message.folder.valueOf() === "SENT ITEMS"; | ||
} | ||
|
||
onTrashSelect(): void { | ||
this.displayMessages = this.gameService.getGame().messages.filter(this.checkForTrash); | ||
} | ||
|
||
checkForTrash(message) { | ||
return message.folder.valueOf() === "TRASH"; | ||
} | ||
} |
Oops, something went wrong.