-
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.
- Loading branch information
1 parent
53f196a
commit a2c3c24
Showing
19 changed files
with
430 additions
and
10 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
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
Empty file.
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,16 @@ | ||
<mat-toolbar>Your Groups | ||
</mat-toolbar> | ||
|
||
<mat-list *ngIf="groups"> | ||
<mat-list-item *ngFor="let group of groups" style="width:100%"> | ||
<span style="display: inline-block;width:100px;">{{group.group}}</span> | ||
|
||
<mat-icon aria-hidden="false" aria-label="icon" style="cursor: pointer;" (click)="startChat(group.mobile,group.group)">chat</mat-icon> | ||
|
||
<mat-icon aria-hidden="false" aria-label="icon" style="cursor: pointer; margin-left:20px;" >info</mat-icon> | ||
<span class="spacer"></span> | ||
<mat-icon aria-hidden="false" aria-label="icon" style="cursor: pointer;" (click)="deleteGroup(group.mobile,group.group)">delete</mat-icon> | ||
</mat-list-item> | ||
</mat-list> | ||
<mat-toolbar *ngIf="!groups">It is lonely here.</mat-toolbar> | ||
|
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,25 @@ | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { GroupListComponent } from './group-list.component'; | ||
|
||
describe('GroupListComponent', () => { | ||
let component: GroupListComponent; | ||
let fixture: ComponentFixture<GroupListComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ GroupListComponent ] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(GroupListComponent); | ||
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,57 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { ChatService } from './../services/chat.service'; | ||
import { LoginService } from '../services/login.service'; | ||
import {Router} from '@angular/router'; | ||
|
||
@Component({ | ||
selector: 'app-group-list', | ||
templateUrl: './group-list.component.html', | ||
styleUrls: ['./group-list.component.css'] | ||
}) | ||
export class GroupListComponent implements OnInit { | ||
private groups; | ||
private user; | ||
constructor(private chatService: ChatService, private loginService: LoginService, private router: Router) { | ||
this.user = loginService.getLoggedUser(); | ||
this.chatService.getAllGroups(this.user).subscribe( | ||
res => { | ||
if (res.status === 200) { | ||
this.groups = res.body; | ||
// console.log(this.groups); | ||
} | ||
}, | ||
err => { | ||
console.log('Error:', err.error); | ||
}); | ||
} | ||
private startChat(user, group) { | ||
if ((typeof user !== 'undefined') && (typeof group !== 'undefined')) { | ||
this.router.navigateByUrl('dashboard/group/' + user + '/' + group); | ||
} else { | ||
alert('Not able to locate the room'); | ||
} | ||
} | ||
|
||
// delete group function | ||
private deleteGroup(user, group) { | ||
this.chatService.deleteGroup(user, group).subscribe( | ||
res => { | ||
if (res.status === 200) { | ||
this.groups = res.body; | ||
} | ||
}, | ||
err => { | ||
if (err.status === 400) { | ||
// no user left | ||
delete this.groups; | ||
} else { | ||
console.log('Error:', err.status); | ||
alert('Error: ' + err.error); | ||
} | ||
}); | ||
} | ||
|
||
ngOnInit() { | ||
} | ||
|
||
} |
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,10 @@ | ||
* { margin: 0; padding: 0; box-sizing: border-box; } | ||
body { font: 13px Helvetica, Arial; } | ||
div { background: #000000; padding: 1px; position: relative;right: 0; bottom: 0;width: 100%;border: 1px solid black } | ||
div input { border: 0; padding: 10px; width: 100%; margin-right: 1px; outline:none;border: 1px solid black;background: #ffffff; | ||
font-size: 15px;} | ||
div button { width: calc(10% - 1px); border: none;border-radius: 0} | ||
#conversation { list-style-type: none; margin: 0; padding: 0; } | ||
#conversation li { padding: 5px 10px; } | ||
.server { background: #444444; } | ||
|
Oops, something went wrong.