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

Commit

Permalink
Merge ba05888 into 93378a1
Browse files Browse the repository at this point in the history
  • Loading branch information
YerayG committed Apr 24, 2019
2 parents 93378a1 + ba05888 commit df88ec0
Show file tree
Hide file tree
Showing 13 changed files with 65 additions and 21 deletions.
2 changes: 1 addition & 1 deletion e2e/src/pages/register.po.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export class RegisterPage {
}

async goToHomePage() {
return await browser.driver.get('localhost:4200');
return await browser.driver.get('localhost:4200').then(() => browser.sleep(2000));
}

async clickRegister() {
Expand Down
8 changes: 5 additions & 3 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import { MessageComponent } from './components/message/message.component';
import { NavbarComponent } from './components/navbar/navbar.component';
import { ChatItemComponent } from './components/chat-item/chat-item.component';
import { ChatListComponent, NewChatDialogComponent } from './components/chat-list/chat-list.component';
import { CustomizationComponent } from './components/customization/customization.component';
import {AboutComponent } from './components/about/about.component';

// Services
import { AuthService } from './services/solid.auth.service';
Expand All @@ -37,8 +39,7 @@ import {MatCardModule} from '@angular/material/card';
import {MatTooltipModule} from '@angular/material/tooltip';
import {MatIconModule} from '@angular/material/icon';
import {MatDialogModule} from '@angular/material/dialog';
import { CustomizationComponent } from './components/customization/customization.component';
import {AboutComponent } from './components/about/about.component';
import {MatSnackBarModule} from '@angular/material/snack-bar';


const routes: Routes = [
Expand Down Expand Up @@ -112,7 +113,8 @@ const routes: Routes = [
MatIconModule,
MatDialogModule,
AngularMultiSelectModule,
BrowserAnimationsModule // required for toastr
BrowserAnimationsModule, // required for toastr
MatSnackBarModule
],
entryComponents: [NewChatDialogComponent],
providers: [AuthService , ChatService],
Expand Down
4 changes: 4 additions & 0 deletions src/app/components/chat-item/chat-item.component.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
.chatTitle {
text-overflow: clip;
color: white;
}

.userItemCurrent {
background: #3f51b5;
}
16 changes: 9 additions & 7 deletions src/app/components/chat-item/chat-item.component.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<mat-list-item (click)="chatClicked()">
<div [ngClass]="{userItemCurrent: (chat.isCurrent), userItem: (!chat.isCurrent)}">
<span class="chatTitle">
{{chat.chatTitle}}
</span>
</div>
</mat-list-item>
<div [ngClass]="{userItemCurrent: (chat.isCurrent), userItem: (!chat.isCurrent)}">
<mat-list-item (click)="chatClicked()">
<div>
<span class="chatTitle">
{{chat.chatTitle}}
</span>
</div>
</mat-list-item>
</div>
6 changes: 3 additions & 3 deletions src/app/components/chat-list/chat-list-new-dialog.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<h1 mat-dialog-title>Crear nuevo Chat</h1>
<h1 mat-dialog-title>Create new chat</h1>
<div mat-dialog-content style="overflow: visible">
<mat-form-field style="width: 100%">
<input matInput placeholder="Como se va a llamar el chat?" [(ngModel)]="data.chatName">
<input matInput placeholder="What is the name of the new chat?" [(ngModel)]="data.chatName">
</mat-form-field>
<angular2-multiselect style="width: 95.9%" [data]="data.items" [(ngModel)]="data.selectedItems"
[settings]="dropdownSettings"
Expand All @@ -11,6 +11,6 @@ <h1 mat-dialog-title>Crear nuevo Chat</h1>
(onDeSelectAll)="onDeSelectAll($event)"></angular2-multiselect>
</div>
<div mat-dialog-actions>
<button mat-button (click)="onNoClick()">Cancelar</button>
<button mat-button (click)="onNoClick()">Cancel</button>
<button mat-button [mat-dialog-close]="data" cdkFocusInitial>Ok</button>
</div>
2 changes: 2 additions & 0 deletions src/app/components/chat-list/chat-list.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { AngularMultiSelectModule } from 'angular2-multiselect-dropdown';
import {MatListModule} from '@angular/material/list';
import {MatIconModule} from '@angular/material/icon';
import {MatDialogModule} from '@angular/material/dialog';
import {MatSnackBarModule} from '@angular/material/snack-bar';

describe('ChatListComponent', () => {
let component: ChatListComponent;
Expand All @@ -24,6 +25,7 @@ describe('ChatListComponent', () => {
MatDialogModule,
BrowserAnimationsModule,
AngularMultiSelectModule,
MatSnackBarModule,
ToastrModule.forRoot() ],
providers: [ ChatService ]
})
Expand Down
13 changes: 9 additions & 4 deletions src/app/components/chat-list/chat-list.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Chat } from '../../models/chat.model';
import { User } from '../../models/user.model';
import { ChatService } from '../../services/chat.service';
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
import { MatSnackBar } from '@angular/material/snack-bar';

export interface DialogData {
chatName: string;
Expand All @@ -22,7 +23,7 @@ export class ChatListComponent {
selectedOthers: Array<User>;
selectedItems: Array<any>;

constructor(private cService: ChatService, public dialog: MatDialog) {
constructor(private cService: ChatService, public dialog: MatDialog, private snackBar: MatSnackBar) {
cService.getConversations().subscribe(chats => {
this.chats = chats;
});
Expand All @@ -45,6 +46,10 @@ export class ChatListComponent {
this.chatName = result.selectedItems[0].item.fullName;
}
this.cService.newConversation(this.selectedItems, this.chatName);
this.snackBar.open('Conversation successfully created', '', {
duration: 2000,
panelClass: ['snackbar-success']
})
});
}

Expand Down Expand Up @@ -83,9 +88,9 @@ export class NewChatDialogComponent implements OnInit {
ngOnInit() {
this.dropdownSettings = {
singleSelection: false,
text: 'Seleccionar amigos',
selectAllText: 'Seleccionar todos',
unSelectAllText: 'Deseleccionar todos',
text: 'Select friends',
selectAllText: 'Select all',
unSelectAllText: 'Deselect all',
enableSearchFilter: true
};
}
Expand Down
2 changes: 2 additions & 0 deletions src/app/components/chat/chat.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {MatListModule} from '@angular/material/list';
import {MatIconModule} from '@angular/material/icon';
import {MatCardModule} from '@angular/material/card';
import {MatDialogModule} from '@angular/material/dialog';
import {MatSnackBarModule} from '@angular/material/snack-bar';

describe('ChatComponent', () => {
let component: ChatComponent;
Expand All @@ -38,6 +39,7 @@ describe('ChatComponent', () => {
MatDialogModule,
AngularMultiSelectModule,
BrowserAnimationsModule,
MatSnackBarModule,
ToastrModule.forRoot() ],
providers: [ ChatService ]
})
Expand Down
2 changes: 2 additions & 0 deletions src/app/components/message/message.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
// Material
import {MatCardModule} from '@angular/material/card';
import {MatIconModule} from '@angular/material/icon';
import { MatSnackBarModule } from '@angular/material/snack-bar';

describe('MessageComponent', () => {
let component: MessageComponent;
Expand All @@ -19,6 +20,7 @@ describe('MessageComponent', () => {
declarations: [MessageComponent],
imports: [MatCardModule,
MatIconModule,
MatSnackBarModule,
BrowserAnimationsModule,
ToastrModule.forRoot()],
providers: [ChatService]
Expand Down
7 changes: 6 additions & 1 deletion src/app/components/message/message.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Component, OnInit, Input } from '@angular/core';
import { ChatService } from '../../services/chat.service';
import { ChatMessage } from '../../models/chat-message.model';
import { User } from 'src/app/models/user.model';
import { MatSnackBar } from '@angular/material/snack-bar';

@Component({
selector: 'app-message',
Expand All @@ -20,11 +21,15 @@ export class MessageComponent implements OnInit {
imageURl: string;


constructor(private chatService: ChatService) {
constructor(private chatService: ChatService, private snackBar: MatSnackBar) {
}

delete() {
this.chatService.deleteMessage(this.chatMessage);
this.snackBar.open('Message successfully deleted', '', {
duration: 2000,
panelClass: ['snackbar-success']
})
}

ngOnInit(chatMessage = this.chatMessage) {
Expand Down
3 changes: 3 additions & 0 deletions src/app/components/profile/profile.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { ActivatedRoute } from '@angular/router';
import { RdfService } from '../../services/rdf.service';
import { AuthService } from '../../services/solid.auth.service';
import { ProfileComponent } from './profile.component';
import { MatSnackBarModule } from '@angular/material/snack-bar';

describe('ProfileComponent', () => {
let component: ProfileComponent;
let fixture: ComponentFixture<ProfileComponent>;
Expand All @@ -21,6 +23,7 @@ describe('ProfileComponent', () => {
TestBed.configureTestingModule({
schemas: [NO_ERRORS_SCHEMA],
declarations: [ProfileComponent],
imports: [MatSnackBarModule],
providers: [
{ provide: ActivatedRoute, useValue: activatedRouteStub },
{ provide: RdfService, useValue: rdfServiceStub },
Expand Down
13 changes: 11 additions & 2 deletions src/app/components/profile/profile.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { NgForm } from '@angular/forms';
import { MatSnackBar } from '@angular/material/snack-bar';
import { SolidProfile } from '../../models/solid-profile.model';
import { RdfService } from '../../services/rdf.service';
import { AuthService } from '../../services/solid.auth.service';
Expand All @@ -21,7 +22,7 @@ export class ProfileComponent implements OnInit {
@ViewChild('f') cardForm: NgForm;

constructor(private rdf: RdfService,
private route: ActivatedRoute, private auth: AuthService) {}
private route: ActivatedRoute, private auth: AuthService, private snackBar: MatSnackBar) {}

ngOnInit() {
this.loadingProfile = true;
Expand Down Expand Up @@ -79,8 +80,16 @@ export class ProfileComponent implements OnInit {
async addFriend() {
try{
this.rdf.addFriend(this.addWebId);
this.snackBar.open('Friend successfully added', '', {
duration: 2000,
panelClass: ['snackbar-success']
});
}catch {
console.log("The URI provided is not well-formed or does not point to a profile")
console.log("The URI provided is not well-formed or does not point to a profile");
this.snackBar.open('Friend does not exist or could not be added', '', {
duration: 2000,
panelClass: ['snackbar-error']
});
}
}
}
8 changes: 8 additions & 0 deletions src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,12 @@ body {
background: var(--main-color);
border: 1px solid #ccc;
color: #fff;
}

.snackbar-success {
background: #2dc466;
}

.snackbar-error {
background: #dd2c2c;
}

0 comments on commit df88ec0

Please sign in to comment.