bugfixes, clean code

This commit is contained in:
Chneemann 2024-05-26 18:23:28 +02:00
parent 20f52ae411
commit 97348d048f
7 changed files with 40 additions and 23 deletions

2
.gitignore vendored
View file

@ -45,4 +45,4 @@ Thumbs.db
.firebase .firebase
*-debug.log *-debug.log
.runtimeconfig.json .runtimeconfig.json
/src/app/environments/config.ts src/environments/config.ts

View file

@ -8,7 +8,7 @@ import { provideStorage, getStorage } from '@angular/fire/storage';
import { provideAnimationsAsync } from '@angular/platform-browser/animations/async'; import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';
import { TranslateModule, TranslateLoader } from '@ngx-translate/core'; import { TranslateModule, TranslateLoader } from '@ngx-translate/core';
import { TranslateHttpLoader } from '@ngx-translate/http-loader'; import { TranslateHttpLoader } from '@ngx-translate/http-loader';
import { firebaseConfig } from './environments/config'; import { firebaseConfig } from '../environments/config';
export function HttpLoaderFactory(httpClient: HttpClient) { export function HttpLoaderFactory(httpClient: HttpClient) {
return new TranslateHttpLoader(httpClient, './assets/i18n/', '.json'); return new TranslateHttpLoader(httpClient, './assets/i18n/', '.json');

View file

@ -24,15 +24,6 @@
(click)="addReactionIcon('clap-hands', currentChat)" (click)="addReactionIcon('clap-hands', currentChat)"
> >
</app-small-btn> </app-small-btn>
<app-small-btn
[imgSrc]="'add-reaction.svg'"
[imgSize]="viewWidth >= RESPONSIVE_THRESHOLD_MOBILE ? '24px' : '17px'"
[btnSize]="viewWidth >= RESPONSIVE_THRESHOLD_MOBILE ? '36px' : '25px'"
[btnBgHoverColor]="'#edeefe'"
[ngClass]="{ mirror: user.id === userService.getCurrentUserId() }"
(click)="toggleEmojiPicker()"
>
</app-small-btn>
@if (!isPrivatChannel) { @if (!isPrivatChannel) {
<app-small-btn <app-small-btn
[imgSrc]="'answer.svg'" [imgSrc]="'answer.svg'"
@ -81,13 +72,25 @@
} @else { } @else {
<div class="content"> <div class="content">
<app-small-btn <app-small-btn
[imgSrc]="'add-reaction.svg'" [imgSrc]="'okay.svg'"
[imgSize]="viewWidth >= RESPONSIVE_THRESHOLD_MOBILE ? '24px' : '17px'" [imgSize]="viewWidth >= RESPONSIVE_THRESHOLD_MOBILE ? '24px' : '17px'"
[btnSize]="viewWidth >= RESPONSIVE_THRESHOLD_MOBILE ? '36px' : '25px'" [btnSize]="viewWidth >= RESPONSIVE_THRESHOLD_MOBILE ? '36px' : '25px'"
[imgFilter]="'none'"
[btnBgHoverColor]="'#edeefe'" [btnBgHoverColor]="'#edeefe'"
[ngClass]="{ mirror: user.id === userService.getCurrentUserId() }" [ngClass]="{ mirror: user.id === userService.getCurrentUserId() }"
(click)="toggleEmojiPicker()" (click)="addReactionIcon('okay', currentChat)"
></app-small-btn> >
</app-small-btn>
<app-small-btn
[imgSrc]="'clap-hands.svg'"
[imgSize]="viewWidth >= RESPONSIVE_THRESHOLD_MOBILE ? '24px' : '17px'"
[btnSize]="viewWidth >= RESPONSIVE_THRESHOLD_MOBILE ? '36px' : '25px'"
[imgFilter]="'none'"
[btnBgHoverColor]="'#edeefe'"
[ngClass]="{ mirror: user.id === userService.getCurrentUserId() }"
(click)="addReactionIcon('clap-hands', currentChat)"
>
</app-small-btn>
@if (user.id === userService.getCurrentUserId()) { @if (user.id === userService.getCurrentUserId()) {
<app-small-btn <app-small-btn
[imgSrc]="'more-vertical.svg'" [imgSrc]="'more-vertical.svg'"

View file

@ -246,4 +246,7 @@ button {
.loginContainer { .loginContainer {
max-width: 306px; max-width: 306px;
} }
.error {
font-size: 11px;
}
} }

View file

@ -132,4 +132,7 @@ button {
max-width: 306px; max-width: 306px;
gap: 12px !important; gap: 12px !important;
} }
.error {
font-size: 11px;
}
} }

View file

@ -27,7 +27,7 @@ export interface MessageData {
message: string; message: string;
publishedTimestamp: number; publishedTimestamp: number;
userId: string; userId: string;
channelId?: string; channelId: string;
chatId?: string; chatId: string;
edited: boolean; edited: boolean;
} }

View file

@ -166,7 +166,6 @@ export class loginService {
email: this.email, email: this.email,
status: true, status: true,
}; };
this.createUserInFirestore(userDataToSave); this.createUserInFirestore(userDataToSave);
this.deleteUserFormData(); this.deleteUserFormData();
}) })
@ -176,6 +175,15 @@ export class loginService {
}); });
} }
/**
* Clears user forms data.
*/
deleteUserFormData() {
this.name = '';
this.email = '';
this.password = '';
}
/** /**
* Saves user data to Firestore and updates the application state. * Saves user data to Firestore and updates the application state.
* @param user The user object containing information to be saved. * @param user The user object containing information to be saved.
@ -369,18 +377,18 @@ export class loginService {
window.location.reload(); window.location.reload();
} }
deleteUserFormData() { /**
this.name = ''; * Toggles password visibility.
this.email = ''; */
this.password = '';
}
togglePasswordVisibility() { togglePasswordVisibility() {
this.passwordFieldType = this.passwordFieldType =
this.passwordFieldType === 'password' ? 'text' : 'password'; this.passwordFieldType === 'password' ? 'text' : 'password';
this.toggleIcon(); this.toggleIcon();
} }
/**
* Toggles password icon.
*/
toggleIcon() { toggleIcon() {
this.passwordIcon = this.passwordIcon =
this.passwordIcon === './assets/img/login/close-eye.svg' this.passwordIcon === './assets/img/login/close-eye.svg'