From 91afdbf8f779b2ce6852e667c0b95a9aea432c34 Mon Sep 17 00:00:00 2001 From: Chneemann Date: Tue, 11 Jun 2024 21:08:20 +0200 Subject: [PATCH] clean code --- .../channel-information.component.html} | 16 ++++++------- .../channel-information.component.scss} | 0 .../channel-information.component.spec.ts | 22 ++++++++++++++++++ .../channel-information.component.ts} | 8 +++---- .../channel-informations.component.spec.ts | 23 ------------------- .../main-chat/main-chat.component.html | 8 +++---- .../main-chat/main-chat.component.ts | 4 ++-- .../open-send-prv-message-window.component.ts | 6 ++--- .../show-channel-member.component.html | 6 ++--- .../show-channel-member.component.ts | 12 +++++----- 10 files changed, 52 insertions(+), 53 deletions(-) rename src/app/components/main-chat/{channel-informations/channel-informations.component.html => channel-information/channel-information.component.html} (90%) rename src/app/components/main-chat/{channel-informations/channel-informations.component.scss => channel-information/channel-information.component.scss} (100%) create mode 100644 src/app/components/main-chat/channel-information/channel-information.component.spec.ts rename src/app/components/main-chat/{channel-informations/channel-informations.component.ts => channel-information/channel-information.component.ts} (97%) delete mode 100644 src/app/components/main-chat/channel-informations/channel-informations.component.spec.ts diff --git a/src/app/components/main-chat/channel-informations/channel-informations.component.html b/src/app/components/main-chat/channel-information/channel-information.component.html similarity index 90% rename from src/app/components/main-chat/channel-informations/channel-informations.component.html rename to src/app/components/main-chat/channel-information/channel-information.component.html index 40588a8..bb7e32c 100644 --- a/src/app/components/main-chat/channel-informations/channel-informations.component.html +++ b/src/app/components/main-chat/channel-information/channel-information.component.html @@ -14,7 +14,7 @@
@for (channel of getChannelName(currentChannel); track channel) {
-

{{ "channel-informations.header" | translate }}

+

{{ "channel-information.header" | translate }}

@if (!openEditNameInput) { @if(checkCreator(currentChannel)){ @@ -60,7 +60,7 @@ @for (channel of getChannelName(currentChannel); track channel) {
-

{{ "channel-informations.channelInfo" | translate }}

+

{{ "channel-information.channelInfo" | translate }}

@if (!openEditNameDescription) { @if(checkCreator(currentChannel)){ @@ -88,7 +88,7 @@ @if (channel.description !== "") {

{{ channel.description }}

} @else { -

{{ "channel-informations.channelInfo2" | translate }}

+

{{ "channel-information.channelInfo2" | translate }}

}
} @else { @@ -103,7 +103,7 @@ }
-

{{ "channel-informations.channelMadeBy" | translate }}

+

{{ "channel-information.channelMadeBy" | translate }}

@if(channel.creator == "Admin") { @@ -112,7 +112,7 @@

{{ user.firstName }} {{ user.lastName }}

} } @if(!checkCreator(currentChannel)){

- {{ "channel-informations.channelErrorText" | translate }} + {{ "channel-information.channelErrorText" | translate }}

}
@@ -125,7 +125,7 @@ }" >
-

{{ "channel-informations.members" | translate }}

+

{{ "channel-information.members" | translate }}

@for(allMembers of getAllChannelMembers(currentChannel)[0].addedUser; @@ -156,14 +156,14 @@ }" [user]="user" [openUserWindowBoolean]="openUserWindowBoolean" - (closeUserWondow)="changeOpenUserWindowBoolean($event)" + (closeUserWindow)="changeOpenUserWindowBoolean($event)" >
diff --git a/src/app/components/main-chat/channel-informations/channel-informations.component.scss b/src/app/components/main-chat/channel-information/channel-information.component.scss similarity index 100% rename from src/app/components/main-chat/channel-informations/channel-informations.component.scss rename to src/app/components/main-chat/channel-information/channel-information.component.scss diff --git a/src/app/components/main-chat/channel-information/channel-information.component.spec.ts b/src/app/components/main-chat/channel-information/channel-information.component.spec.ts new file mode 100644 index 0000000..f69a753 --- /dev/null +++ b/src/app/components/main-chat/channel-information/channel-information.component.spec.ts @@ -0,0 +1,22 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ChannelInformationComponent } from './channel-information.component'; + +describe('ChannelInformationComponent', () => { + let component: ChannelInformationComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [ChannelInformationComponent], + }).compileComponents(); + + fixture = TestBed.createComponent(ChannelInformationComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/components/main-chat/channel-informations/channel-informations.component.ts b/src/app/components/main-chat/channel-information/channel-information.component.ts similarity index 97% rename from src/app/components/main-chat/channel-informations/channel-informations.component.ts rename to src/app/components/main-chat/channel-information/channel-information.component.ts index 83fd8ab..5fb5299 100644 --- a/src/app/components/main-chat/channel-informations/channel-informations.component.ts +++ b/src/app/components/main-chat/channel-information/channel-information.component.ts @@ -12,7 +12,7 @@ import { OpenSendPrvMessageWindowComponent } from '../show-channel-member/open-s import { TranslateModule } from '@ngx-translate/core'; @Component({ - selector: 'app-channel-informations', + selector: 'app-channel-information', standalone: true, imports: [ CommonModule, @@ -21,10 +21,10 @@ import { TranslateModule } from '@ngx-translate/core'; OpenSendPrvMessageWindowComponent, TranslateModule, ], - templateUrl: './channel-informations.component.html', - styleUrl: './channel-informations.component.scss', + templateUrl: './channel-information.component.html', + styleUrl: './channel-information.component.scss', }) -export class ChannelInformationsComponent { +export class ChannelInformationComponent { @Input() currentChannel: string = ''; @Input() viewWidth: number = 0; @Output() closeEditEmitter: EventEmitter = diff --git a/src/app/components/main-chat/channel-informations/channel-informations.component.spec.ts b/src/app/components/main-chat/channel-informations/channel-informations.component.spec.ts deleted file mode 100644 index c46c4ab..0000000 --- a/src/app/components/main-chat/channel-informations/channel-informations.component.spec.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { ChannelInformationsComponent } from './channel-informations.component'; - -describe('ChannelInformationsComponent', () => { - let component: ChannelInformationsComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - imports: [ChannelInformationsComponent] - }) - .compileComponents(); - - fixture = TestBed.createComponent(ChannelInformationsComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/components/main-chat/main-chat.component.html b/src/app/components/main-chat/main-chat.component.html index ab91121..b78c5e4 100644 --- a/src/app/components/main-chat/main-chat.component.html +++ b/src/app/components/main-chat/main-chat.component.html @@ -1,6 +1,6 @@
@if (checkCurrentChannel(currentChannel) == 'searchBar') { - +

{{ "main-chat.message" | translate }}

} - + @if (openMenu) { - + > } } } @if (showProfil) { (); + @Output() closeUserWindow = new EventEmitter(); @Output() showProfilWindow = new EventEmitter(); isOnline: boolean = false; @@ -37,7 +37,7 @@ export class OpenSendPrvMessageWindowComponent { closeWindow() { this.openUserWindowBoolean = false; this.showProfil = false; - this.closeUserWondow.emit(this.openUserWindowBoolean); + this.closeUserWindow.emit(this.openUserWindowBoolean); this.showProfilWindow.emit(this.showProfil); } @@ -47,7 +47,7 @@ export class OpenSendPrvMessageWindowComponent { */ closeEverything() { this.openUserWindowBoolean = false; - this.closeUserWondow.emit(this.openUserWindowBoolean); + this.closeUserWindow.emit(this.openUserWindowBoolean); this.toggleBoolean.openChannelMemberWindow = false; this.toggleBoolean.closeChannelMemberWindow = false; } diff --git a/src/app/components/main-chat/show-channel-member/show-channel-member.component.html b/src/app/components/main-chat/show-channel-member/show-channel-member.component.html index 7763276..d384e0c 100644 --- a/src/app/components/main-chat/show-channel-member/show-channel-member.component.html +++ b/src/app/components/main-chat/show-channel-member/show-channel-member.component.html @@ -77,13 +77,13 @@
@if(getSearchedUser.length <= 0) { {{ "show-channel-member.result" | translate }} } @for(user of getSearchedUser; track user){ - @if(!isUserAlreadySelectet(user)) { + @if(!isUserAlreadySelected(user)) {
@@ -129,5 +129,5 @@ [ngClass]="{ dBlock: openUserWindowBoolean, dNone: !openUserWindowBoolean }" [user]="user" [openUserWindowBoolean]="openUserWindowBoolean" - (closeUserWondow)="changeOpenUserWindowBoolean($event)" + (closeUserWindow)="changeOpenUserWindowBoolean($event)" > diff --git a/src/app/components/main-chat/show-channel-member/show-channel-member.component.ts b/src/app/components/main-chat/show-channel-member/show-channel-member.component.ts index 89ab11f..589c092 100644 --- a/src/app/components/main-chat/show-channel-member/show-channel-member.component.ts +++ b/src/app/components/main-chat/show-channel-member/show-channel-member.component.ts @@ -26,7 +26,7 @@ export class ShowChannelMemberComponent { @Input() isSecondaryChatOpen: boolean = false; userName: string = ''; - showExistenUsers: boolean = false; + showExistedUsers: boolean = false; getSearchedUser: User[] = []; getCurrentChannelName: string = ''; getSelectedUsers: User[] = []; @@ -59,7 +59,7 @@ export class ShowChannelMemberComponent { */ filterUsers(searchValue: string) { if (searchValue != '') { - this.showExistenUsers = true; + this.showExistedUsers = true; this.getSearchedUser = []; const searchedUser = searchValue.toLowerCase().trim(); const filteredUsers = this.userService.getUsers().filter((user) => { @@ -99,7 +99,7 @@ export class ShowChannelMemberComponent { * @param {User} user - The user to check. * @returns {boolean} Returns true if the user is already selected, otherwise false. */ - isUserAlreadySelectet(user: User) { + isUserAlreadySelected(user: User) { return this.getSelectedUsers.some( (selectedUser) => selectedUser.id === user.id ); @@ -119,7 +119,7 @@ export class ShowChannelMemberComponent { this.getSelectedUsers.push(user); } this.userName = ''; - this.showExistenUsers = false; + this.showExistedUsers = false; } /** @@ -128,7 +128,7 @@ export class ShowChannelMemberComponent { */ spliceCurrentUser(index: number) { this.getSelectedUsers.splice(index, 1); - this.showExistenUsers = false; + this.showExistedUsers = false; } /** @@ -184,7 +184,7 @@ export class ShowChannelMemberComponent { */ resetValues() { this.userName = ''; - this.showExistenUsers = false; + this.showExistedUsers = false; this.getSearchedUser = []; this.getCurrentChannelName = ''; this.getSelectedUsers = [];