clean code

This commit is contained in:
Chneemann 2024-05-27 16:26:38 +02:00
parent c7e64d34c3
commit e0677e9971
8 changed files with 56 additions and 73 deletions

View file

@ -1,10 +1,9 @@
import { Component } from '@angular/core';
import { RegisterComponent } from "./register/register.component";
import { ChooseAvatarComponent } from "./choose-avatar/choose-avatar.component";
import { LoginComponent } from "./login/login.component";
import { PasswordForgetComponent } from "./password-forget/password-forget.component";
import { PasswordResetComponent } from "./password-reset/password-reset.component";
import { loginService } from '../../service/login.service';
import { RegisterComponent } from './register/register.component';
import { ChooseAvatarComponent } from './choose-avatar/choose-avatar.component';
import { LoginComponent } from './login/login.component';
import { PasswordForgetComponent } from './password-forget/password-forget.component';
import { PasswordResetComponent } from './password-reset/password-reset.component';
import { CommonModule } from '@angular/common';
import { RouterLink } from '@angular/router';
@ -13,8 +12,14 @@ import { RouterLink } from '@angular/router';
standalone: true,
templateUrl: './main-login.component.html',
styleUrl: './main-login.component.scss',
imports: [CommonModule,RegisterComponent, ChooseAvatarComponent, LoginComponent, PasswordForgetComponent, PasswordResetComponent,RouterLink]
imports: [
CommonModule,
RegisterComponent,
ChooseAvatarComponent,
LoginComponent,
PasswordForgetComponent,
PasswordResetComponent,
RouterLink,
],
})
export class MainLoginComponent {
}
export class MainLoginComponent {}

View file

@ -8,7 +8,7 @@ import { getAuth, sendPasswordResetEmail } from 'firebase/auth';
import { Firestore } from '@angular/fire/firestore';
import { Router } from '@angular/router';
import { StartHeaderComponent } from '../../../shared/components/login/start-header/start-header.component';
import { TranslateModule} from '@ngx-translate/core';
import { TranslateModule } from '@ngx-translate/core';
@Component({
selector: 'app-password-forget',
@ -22,17 +22,15 @@ import { TranslateModule} from '@ngx-translate/core';
RouterModule,
SmallBtnComponent,
StartHeaderComponent,
TranslateModule
TranslateModule,
],
})
export class PasswordForgetComponent {
email: string = '';
emailSentBtn = false;
firestore: Firestore = inject(Firestore);
constructor(private router: Router) {}
/**
* Initiates a password reset process for the user.
* Sends a password reset email to the user's registered email address.
@ -52,7 +50,6 @@ export class PasswordForgetComponent {
});
}
/**
* Handles the form submission, invoking the password reset function and then sending a notification email.
*
@ -63,7 +60,6 @@ export class PasswordForgetComponent {
this.sendEmail();
}
/**
* Simulates sending an email by toggling a button state to show feedback to the user.
* After a set timeout, resets the button state.

View file

@ -1,4 +1,4 @@
import { Component, inject } from '@angular/core';
import { Component } from '@angular/core';
import { FooterComponent } from '../../../shared/components/login/footer/footer.component';
import { FormsModule, NgForm } from '@angular/forms';
import { CommonModule } from '@angular/common';
@ -21,7 +21,7 @@ import { TranslateModule } from '@ngx-translate/core';
FooterComponent,
RouterModule,
SmallBtnComponent,
TranslateModule
TranslateModule,
],
templateUrl: './password-reset.component.html',
styleUrl: './password-reset.component.scss',
@ -32,13 +32,9 @@ export class PasswordResetComponent {
oobCode: string = '';
private queryParamsSubscription: Subscription = new Subscription();
constructor(
private route: ActivatedRoute,
private router: Router,
) {}
constructor(private route: ActivatedRoute, private router: Router) {}
/**
/**
* Initializes the component by subscribing to query parameters.
*/
ngOnInit(): void {
@ -49,8 +45,7 @@ export class PasswordResetComponent {
);
}
/**
/**
* Handles the submission of the password reset form.
* @param ngForm The form data of the password reset form.
*/
@ -58,8 +53,7 @@ export class PasswordResetComponent {
this.resetPassword(ngForm);
}
/**
/**
* Performs the password reset operation using Firebase Authentication.
* @param ngForm The form data of the password reset form.
*/
@ -76,7 +70,6 @@ export class PasswordResetComponent {
});
}
/**
* Cleans up the component by unsubscribing from the query parameters subscription.
*/
@ -84,7 +77,6 @@ export class PasswordResetComponent {
this.queryParamsSubscription.unsubscribe();
}
/**
* Checks if the entered passwords match.
* @returns true if the password and repeated password are the same.

View file

@ -1,6 +1,5 @@
import {
AfterViewChecked,
AfterViewInit,
Component,
ElementRef,
Input,
@ -10,12 +9,10 @@ import {
import { UserService } from '../../service/user.service';
import { ChannleService } from '../../service/channle.service';
import { ChatService } from '../../service/chat.service';
import { Channel } from '../../interface/channel.interface';
import { MainComponent } from '../main/main.component';
import { SingleChatComponent } from '../main-chat/single-chat/single-chat.component';
import { Chat, ChatAnswers } from '../../interface/chat.interface';
import { CommonModule } from '@angular/common';
import { User } from '../../interface/user.interface';
import { ChatMsgBoxComponent } from '../main-chat/chat-msg-box/chat-msg-box.component';
import { TranslateModule } from '@ngx-translate/core';

View file

@ -1,4 +1,4 @@
import { ChangeDetectorRef, Component, Input, OnInit } from '@angular/core';
import { Component, Input, OnInit } from '@angular/core';
import { ActivatedRoute, RouterModule } from '@angular/router';
import { SidebarChannelsComponent } from './sidebar-channels/sidebar-channels.component';
import { SidebarDirectMessagesComponent } from './sidebar-direct-messages/sidebar-direct-messages.component';

View file

@ -1,4 +1,4 @@
import { Injectable, Input, OnInit } from '@angular/core';
import { Injectable } from '@angular/core';
import {
getDownloadURL,
getStorage,
@ -23,7 +23,6 @@ export class DownloadFilesService {
}
loadAllFiles(docID: string) {
// lädt die fails in den firebase storage
const storage = getStorage();
for (const file of this.uploadFiles) {
const storageRef = ref(storage, `chatFiles/${docID}/${file.name}`);
@ -54,7 +53,6 @@ export class DownloadFilesService {
downloadedFilesData.push({ id: folderID, files: folderFiles });
}
// Emit the updated value
this.downloadedFiles.next(downloadedFilesData);
})

View file

@ -11,12 +11,9 @@ export class LanguageService {
this.translate.setDefaultLang(this.currentLang);
}
/**
* Switches the application's current language.
*
* This method sets the current language based on the specified `lang` parameter and updates the translation service to use the new language. This is useful for enabling runtime language switching in a multi-lingual application.
*
* @param lang The language code to switch to. Supported values are 'en' for English and 'de' for German.
*/
switchLanguage() {

View file

@ -1,25 +1,23 @@
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
providedIn: 'root',
})
export class ToggleBooleanService {
constructor() { }
constructor() {}
openSearchWindow: boolean = false;
openChannelMemberWindow: boolean = false;
closeChannelMemberWindow: boolean = false;
openSearchWindowHead: boolean = false;
selectUserInMsgBox:boolean = false;
selectUserInMsgBox: boolean = false;
isSidebarOpen: boolean = true;
/**
* Opens or closes the add member window based on the provided boolean value.
* @param boolean A boolean value to determine whether to open or close the add member window.
*/
openAddMemberWindow(boolean : boolean){
openAddMemberWindow(boolean: boolean) {
this.closeChannelMemberWindow = boolean;
}
}