Skip to content

Commit

Permalink
frontend compile fix
Browse files Browse the repository at this point in the history
  • Loading branch information
danielcampagnolitg committed Sep 10, 2024
1 parent 9929aa1 commit 9495079
Show file tree
Hide file tree
Showing 11 changed files with 44 additions and 69 deletions.
23 changes: 5 additions & 18 deletions frontend/src/app/chat/chat-controls/chat-controls.component.html
Original file line number Diff line number Diff line change
@@ -1,31 +1,18 @@
<mat-card
[formGroup]="chatForm"
style="width: 100%; min-height: 125px; margin-bottom: 8px"
>
<mat-card [formGroup]="chatForm" style="width: 100%; min-height: 125px; margin-bottom: 8px">
<mat-card-content>
<div fxLayout="row" fxLayoutGap="8px" fxLayoutAlign="center center">
<!-- TODO: Better layout of form controls -->
<mat-form-field fxFlex="calc(100%-56px-56px-16px-16px-8px-8px)">
<textarea
matInput
placeholder="Message"
formControlName="message"
(keydown.enter)="submit()"
></textarea>
<textarea matInput placeholder="Message" formControlName="message" (keydown.enter)="submit()"></textarea>
</mat-form-field>

<button
mat-fab
color="primary"
(click)="submit()"
[disabled]="!chatForm.get('message')?.value"
>
<button mat-fab color="primary" (click)="submit()" [disabled]="!chatForm.get('message')?.value">
<mat-icon>send</mat-icon>
</button>

<input
#fileInput
style="display: none;"
style="display: none"
id="input-file-id"
multiple
type="file"
Expand All @@ -41,7 +28,7 @@ <h6 *ngIf="hasAttachments()">Attachments:</h6>

<mat-chip-list
#chipList
style="width: 100%; margin-bottom: 8px;"
style="width: 100%; margin-bottom: 8px"
fxLayout="row"
fxLayoutGap="8px"
fxLayoutAlign="start center"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ describe('ChatControlsComponent', () => {

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ChatControlsComponent ]
})
.compileComponents();
declarations: [ChatControlsComponent],
}).compileComponents();
}));

beforeEach(() => {
Expand Down
14 changes: 7 additions & 7 deletions frontend/src/app/chat/chat-controls/chat-controls.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import { Component, Input, OnInit } from '@angular/core';
import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
import { debounceTime, filter, throttleTime } from 'rxjs/operators';
// import {FirebaseAttachmentService} from "@app/chat/services/firebase/firebase-attachment.service";
import {FirebaseChatService} from "@app/chat/services/firebase/firebase-chat.service";
import { FirebaseChatService } from '@app/chat/services/firebase/firebase-chat.service';

@Component({
selector: 'app-chat-controls',
templateUrl: './chat-controls.component.html',
styleUrls: ['./chat-controls.component.scss']
styleUrls: ['./chat-controls.component.scss'],
})
export class ChatControlsComponent implements OnInit {
@Input() chatId: string = '';
Expand All @@ -30,19 +30,19 @@ export class ChatControlsComponent implements OnInit {

this.messageControl.valueChanges
.pipe(
filter(data => data !== ''),
filter((data) => data !== ''),
throttleTime(1400)
)
.subscribe(data => {
.subscribe((data) => {
// this.chatService.sendIsTyping(this.chatId).then();
});

this.messageControl.valueChanges
.pipe(
filter(data => data !== ''),
filter((data) => data !== ''),
debounceTime(1500)
)
.subscribe(data => {
.subscribe((data) => {
// this.chatService.deleteIsTyping(this.chatId).then();
});
}
Expand Down Expand Up @@ -75,7 +75,7 @@ export class ChatControlsComponent implements OnInit {

getAttachments(): File[] {
// return this.attachmentService.getFiles();
return []
return [];
}

hasAttachments() {
Expand Down
16 changes: 7 additions & 9 deletions frontend/src/app/chat/chat-header/chat-header.component.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<mat-toolbar color="primary" >
<span
>Asset Chat<span *ngIf="chatId"> - {{ chatId }}</span></span
>
<span style="flex: 1 1 auto;"></span>
<button mat-button routerLink="/" style="font-size: 20px;">
Back
</button>
</mat-toolbar>
<mat-toolbar color="primary">
<span
>Asset Chat<span *ngIf="chatId"> - {{ chatId }}</span></span
>
<span style="flex: 1 1 auto"></span>
<button mat-button routerLink="/" style="font-size: 20px">Back</button>
</mat-toolbar>
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ describe('ChatHeaderComponent', () => {

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ChatHeaderComponent ]
})
.compileComponents();
declarations: [ChatHeaderComponent],
}).compileComponents();
}));

beforeEach(() => {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/chat/chat-header/chat-header.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Component, Input } from '@angular/core';
@Component({
selector: 'app-chat-header',
templateUrl: './chat-header.component.html',
styleUrls: ['./chat-header.component.scss']
styleUrls: ['./chat-header.component.scss'],
})
export class ChatHeaderComponent {
@Input() chatId: string = '';
Expand Down
17 changes: 7 additions & 10 deletions frontend/src/app/chat/chat-message/chat-message.component.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div style="display: flex; flex-direction: column;">
<div style="display: flex; flex-direction: column">
<mat-chip
style="width: fit-content; align-self: center; margin: 8px"
*ngIf="isPreviousMessageFromOtherDay()"
Expand All @@ -8,7 +8,7 @@
>{{ getDateDivider(msg) }}</mat-chip
>
<mat-card
style="box-shadow: none; background-color: transparent;"
style="box-shadow: none; background-color: transparent"
[ngStyle]="{
'align-self': msg.uid !== user.uid ? 'flex-end' : 'flex-start',
'padding-top': !(isPredecessorSameAuthor() && isTemporalClose()) ? '16px' : '0px',
Expand All @@ -31,19 +31,16 @@
/>
<mat-card-title
*ngIf="!(isPredecessorSameAuthor() && isTemporalClose())"
style="font-size: 16px; margin-bottom: 6px;"
style="font-size: 16px; margin-bottom: 6px"
>
{{ getUserName(msg.user) }}
</mat-card-title>
</mat-card-header>
<mat-card-content
style="display: inline-flex; flex-direction: column; width: 100%;"
>
<mat-card-content style="display: inline-flex; flex-direction: column; width: 100%">
<!-- Message content-->
<mat-card
[ngStyle]="{
'background-color':
msg.uid !== user.uid ? 'lightslategrey' : '#536DFE',
'background-color': msg.uid !== user.uid ? 'lightslategrey' : '#536DFE',
color: msg.uid !== user.uid ? 'white' : 'white',
'align-self': msg.uid !== user.uid ? 'flex-end' : 'flex-start',
'text-align': msg.uid !== user.uid ? 'end' : 'start',
Expand All @@ -55,10 +52,10 @@
padding: '16px 12px 12px 12px'
}"
>
<div style="top: 2px;position: absolute;right: 4px; font-size: 12px; opacity: 0.6">
<div style="top: 2px; position: absolute; right: 4px; font-size: 12px; opacity: 0.6">
{{ getCreatedDate(msg) }}
</div>
<span style="overflow-wrap: break-word;">{{ msg.content }}</span>
<span style="overflow-wrap: break-word">{{ msg.content }}</span>
</mat-card>

<button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe('ChatMessageComponent', () => {

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ChatMessageComponent]
declarations: [ChatMessageComponent],
}).compileComponents();
}));

Expand Down
6 changes: 3 additions & 3 deletions frontend/src/app/chat/chat-message/chat-message.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import * as moment from 'moment';
@Component({
selector: 'app-chat-message',
templateUrl: './chat-message.component.html',
styleUrls: ['./chat-message.component.scss']
styleUrls: ['./chat-message.component.scss'],
})
export class ChatMessageComponent implements OnInit {
@Input() msg: Message = {} as Message;
Expand All @@ -24,7 +24,7 @@ export class ChatMessageComponent implements OnInit {
// }
//
// return msg.createdAt.format('l');
return ''
return '';
}

getUserName(user: User | undefined): string | null {
Expand All @@ -39,7 +39,7 @@ export class ChatMessageComponent implements OnInit {
return null;
}
// return msg.createdAt.format('LT');
return ''
return '';
}

isPredecessorSameAuthor(): boolean {
Expand Down
5 changes: 2 additions & 3 deletions frontend/src/app/chat/chat.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ export class ChatComponent implements OnInit {

constructor(
public chatService: FirebaseChatService,
private route: ActivatedRoute
) // public auth: FirebaseAuthService
{}
private route: ActivatedRoute // public auth: FirebaseAuthService
) {}

ngOnInit() {
const chatId: string | null = this.route.snapshot.paramMap.get('id');
Expand Down
18 changes: 7 additions & 11 deletions frontend/src/app/chat/services/api/api-chat.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,25 @@ export class ApiChatService extends ChatBaseService {
super();
}

create(): Promise<boolean> {
return undefined;
async create(): Promise<boolean> {
return false;
}

deleteIsTyping(chatId: string): Promise<void> {
async deleteIsTyping(chatId: string): Promise<void> {
return undefined;
}

deleteMessage(chat: Chat, msg: Message): Promise<void> {
async deleteMessage(chat: Chat, msg: Message): Promise<void> {
return undefined;
}

getHistory(chatId: string): Observable<any> {
return undefined;
return new Observable<any>();
}

sendIsTyping(chatId: string): Promise<void> {
return undefined;
}
async sendIsTyping(chatId: string): Promise<void> {}

sendMessage(chatId: string, content: string): Promise<void> {
return undefined;
}
async sendMessage(chatId: string, content: string): Promise<void> {}

buildChat(source: Observable<any>) {}
}

0 comments on commit 9495079

Please sign in to comment.