clean code
This commit is contained in:
parent
37fb795594
commit
91afdbf8f7
10 changed files with 52 additions and 53 deletions
|
|
@ -14,7 +14,7 @@
|
||||||
<div class="contentChannel">
|
<div class="contentChannel">
|
||||||
@for (channel of getChannelName(currentChannel); track channel) {
|
@for (channel of getChannelName(currentChannel); track channel) {
|
||||||
<div class="contentHeadline">
|
<div class="contentHeadline">
|
||||||
<p>{{ "channel-informations.header" | translate }}</p>
|
<p>{{ "channel-information.header" | translate }}</p>
|
||||||
@if (!openEditNameInput) {
|
@if (!openEditNameInput) {
|
||||||
<!--check if user is creator-->
|
<!--check if user is creator-->
|
||||||
@if(checkCreator(currentChannel)){
|
@if(checkCreator(currentChannel)){
|
||||||
|
|
@ -60,7 +60,7 @@
|
||||||
@for (channel of getChannelName(currentChannel); track channel) {
|
@for (channel of getChannelName(currentChannel); track channel) {
|
||||||
|
|
||||||
<div class="contentHeadline">
|
<div class="contentHeadline">
|
||||||
<p>{{ "channel-informations.channelInfo" | translate }}</p>
|
<p>{{ "channel-information.channelInfo" | translate }}</p>
|
||||||
@if (!openEditNameDescription) {
|
@if (!openEditNameDescription) {
|
||||||
<!--check if user is creator-->
|
<!--check if user is creator-->
|
||||||
@if(checkCreator(currentChannel)){
|
@if(checkCreator(currentChannel)){
|
||||||
|
|
@ -88,7 +88,7 @@
|
||||||
@if (channel.description !== "") {
|
@if (channel.description !== "") {
|
||||||
<p>{{ channel.description }}</p>
|
<p>{{ channel.description }}</p>
|
||||||
} @else {
|
} @else {
|
||||||
<p>{{ "channel-informations.channelInfo2" | translate }}</p>
|
<p>{{ "channel-information.channelInfo2" | translate }}</p>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
} @else {
|
} @else {
|
||||||
|
|
@ -103,7 +103,7 @@
|
||||||
}
|
}
|
||||||
<div class="line"></div>
|
<div class="line"></div>
|
||||||
<div class="contentHeadline">
|
<div class="contentHeadline">
|
||||||
<p>{{ "channel-informations.channelMadeBy" | translate }}</p>
|
<p>{{ "channel-information.channelMadeBy" | translate }}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="channelCreator">
|
<div class="channelCreator">
|
||||||
@if(channel.creator == "Admin") {
|
@if(channel.creator == "Admin") {
|
||||||
|
|
@ -112,7 +112,7 @@
|
||||||
<p class="creatorName">{{ user.firstName }} {{ user.lastName }}</p>
|
<p class="creatorName">{{ user.firstName }} {{ user.lastName }}</p>
|
||||||
} } @if(!checkCreator(currentChannel)){
|
} } @if(!checkCreator(currentChannel)){
|
||||||
<p class="warningPTag">
|
<p class="warningPTag">
|
||||||
{{ "channel-informations.channelErrorText" | translate }}
|
{{ "channel-information.channelErrorText" | translate }}
|
||||||
</p>
|
</p>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -125,7 +125,7 @@
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<div class="contentHeadline">
|
<div class="contentHeadline">
|
||||||
<p>{{ "channel-informations.members" | translate }}</p>
|
<p>{{ "channel-information.members" | translate }}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="allUsers">
|
<div class="allUsers">
|
||||||
@for(allMembers of getAllChannelMembers(currentChannel)[0].addedUser;
|
@for(allMembers of getAllChannelMembers(currentChannel)[0].addedUser;
|
||||||
|
|
@ -156,14 +156,14 @@
|
||||||
}"
|
}"
|
||||||
[user]="user"
|
[user]="user"
|
||||||
[openUserWindowBoolean]="openUserWindowBoolean"
|
[openUserWindowBoolean]="openUserWindowBoolean"
|
||||||
(closeUserWondow)="changeOpenUserWindowBoolean($event)"
|
(closeUserWindow)="changeOpenUserWindowBoolean($event)"
|
||||||
></app-open-send-prv-message-window>
|
></app-open-send-prv-message-window>
|
||||||
<div class="leaveChannel">
|
<div class="leaveChannel">
|
||||||
<button
|
<button
|
||||||
[disabled]="openEditNameInput || openEditNameDescription"
|
[disabled]="openEditNameInput || openEditNameDescription"
|
||||||
(click)="leaveChannel(currentChannel, $event)"
|
(click)="leaveChannel(currentChannel, $event)"
|
||||||
>
|
>
|
||||||
{{ "channel-informations.leave" | translate }}
|
{{ "channel-information.leave" | translate }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -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<ChannelInformationComponent>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
imports: [ChannelInformationComponent],
|
||||||
|
}).compileComponents();
|
||||||
|
|
||||||
|
fixture = TestBed.createComponent(ChannelInformationComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
@ -12,7 +12,7 @@ import { OpenSendPrvMessageWindowComponent } from '../show-channel-member/open-s
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-channel-informations',
|
selector: 'app-channel-information',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [
|
imports: [
|
||||||
CommonModule,
|
CommonModule,
|
||||||
|
|
@ -21,10 +21,10 @@ import { TranslateModule } from '@ngx-translate/core';
|
||||||
OpenSendPrvMessageWindowComponent,
|
OpenSendPrvMessageWindowComponent,
|
||||||
TranslateModule,
|
TranslateModule,
|
||||||
],
|
],
|
||||||
templateUrl: './channel-informations.component.html',
|
templateUrl: './channel-information.component.html',
|
||||||
styleUrl: './channel-informations.component.scss',
|
styleUrl: './channel-information.component.scss',
|
||||||
})
|
})
|
||||||
export class ChannelInformationsComponent {
|
export class ChannelInformationComponent {
|
||||||
@Input() currentChannel: string = '';
|
@Input() currentChannel: string = '';
|
||||||
@Input() viewWidth: number = 0;
|
@Input() viewWidth: number = 0;
|
||||||
@Output() closeEditEmitter: EventEmitter<boolean> =
|
@Output() closeEditEmitter: EventEmitter<boolean> =
|
||||||
|
|
@ -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<ChannelInformationsComponent>;
|
|
||||||
|
|
||||||
beforeEach(async () => {
|
|
||||||
await TestBed.configureTestingModule({
|
|
||||||
imports: [ChannelInformationsComponent]
|
|
||||||
})
|
|
||||||
.compileComponents();
|
|
||||||
|
|
||||||
fixture = TestBed.createComponent(ChannelInformationsComponent);
|
|
||||||
component = fixture.componentInstance;
|
|
||||||
fixture.detectChanges();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should create', () => {
|
|
||||||
expect(component).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<section>
|
<section>
|
||||||
@if (checkCurrentChannel(currentChannel) == 'searchBar') {
|
@if (checkCurrentChannel(currentChannel) == 'searchBar') {
|
||||||
<!----- Searchwindow ----->
|
<!----- Search window ----->
|
||||||
<div class="headerSearchBar">
|
<div class="headerSearchBar">
|
||||||
<p>{{ "main-chat.message" | translate }}</p>
|
<p>{{ "main-chat.message" | translate }}</p>
|
||||||
<input
|
<input
|
||||||
|
|
@ -165,13 +165,13 @@
|
||||||
>
|
>
|
||||||
</app-chat-content>
|
</app-chat-content>
|
||||||
}
|
}
|
||||||
<!----- Channel informations dialog ----->
|
<!----- Channel information dialog ----->
|
||||||
@if (openMenu) {
|
@if (openMenu) {
|
||||||
<app-channel-informations
|
<app-channel-information
|
||||||
[viewWidth]="viewWidth"
|
[viewWidth]="viewWidth"
|
||||||
(closeEditEmitter)="closeEditEmitter($event)"
|
(closeEditEmitter)="closeEditEmitter($event)"
|
||||||
[currentChannel]="currentChannel"
|
[currentChannel]="currentChannel"
|
||||||
></app-channel-informations>
|
></app-channel-information>
|
||||||
} } } @if (showProfil) {
|
} } } @if (showProfil) {
|
||||||
<app-open-send-prv-message-window
|
<app-open-send-prv-message-window
|
||||||
[showProfil]="showProfil"
|
[showProfil]="showProfil"
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ import { FormsModule } from '@angular/forms';
|
||||||
import { SmallBtnComponent } from '../../shared/components/small-btn/small-btn.component';
|
import { SmallBtnComponent } from '../../shared/components/small-btn/small-btn.component';
|
||||||
import { ShowChannelMemberComponent } from './show-channel-member/show-channel-member.component';
|
import { ShowChannelMemberComponent } from './show-channel-member/show-channel-member.component';
|
||||||
import { SharedService } from '../../service/shared.service';
|
import { SharedService } from '../../service/shared.service';
|
||||||
import { ChannelInformationsComponent } from './channel-informations/channel-informations.component';
|
import { ChannelInformationComponent } from './channel-information/channel-information.component';
|
||||||
import { filter } from 'rxjs';
|
import { filter } from 'rxjs';
|
||||||
import { OpenSendPrvMessageWindowComponent } from './show-channel-member/open-send-prv-message-window/open-send-prv-message-window.component';
|
import { OpenSendPrvMessageWindowComponent } from './show-channel-member/open-send-prv-message-window/open-send-prv-message-window.component';
|
||||||
import { HighlightPipe } from '../../highlight.pipe';
|
import { HighlightPipe } from '../../highlight.pipe';
|
||||||
|
|
@ -37,7 +37,7 @@ import { TranslateModule } from '@ngx-translate/core';
|
||||||
FormsModule,
|
FormsModule,
|
||||||
SmallBtnComponent,
|
SmallBtnComponent,
|
||||||
ShowChannelMemberComponent,
|
ShowChannelMemberComponent,
|
||||||
ChannelInformationsComponent,
|
ChannelInformationComponent,
|
||||||
OpenSendPrvMessageWindowComponent,
|
OpenSendPrvMessageWindowComponent,
|
||||||
HighlightPipe,
|
HighlightPipe,
|
||||||
TranslateModule,
|
TranslateModule,
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ export class OpenSendPrvMessageWindowComponent {
|
||||||
@Input() talkToUser!: User[];
|
@Input() talkToUser!: User[];
|
||||||
@Input() openUserWindowBoolean!: boolean;
|
@Input() openUserWindowBoolean!: boolean;
|
||||||
@Input() showProfil!: boolean;
|
@Input() showProfil!: boolean;
|
||||||
@Output() closeUserWondow = new EventEmitter<boolean>();
|
@Output() closeUserWindow = new EventEmitter<boolean>();
|
||||||
@Output() showProfilWindow = new EventEmitter<boolean>();
|
@Output() showProfilWindow = new EventEmitter<boolean>();
|
||||||
isOnline: boolean = false;
|
isOnline: boolean = false;
|
||||||
|
|
||||||
|
|
@ -37,7 +37,7 @@ export class OpenSendPrvMessageWindowComponent {
|
||||||
closeWindow() {
|
closeWindow() {
|
||||||
this.openUserWindowBoolean = false;
|
this.openUserWindowBoolean = false;
|
||||||
this.showProfil = false;
|
this.showProfil = false;
|
||||||
this.closeUserWondow.emit(this.openUserWindowBoolean);
|
this.closeUserWindow.emit(this.openUserWindowBoolean);
|
||||||
this.showProfilWindow.emit(this.showProfil);
|
this.showProfilWindow.emit(this.showProfil);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -47,7 +47,7 @@ export class OpenSendPrvMessageWindowComponent {
|
||||||
*/
|
*/
|
||||||
closeEverything() {
|
closeEverything() {
|
||||||
this.openUserWindowBoolean = false;
|
this.openUserWindowBoolean = false;
|
||||||
this.closeUserWondow.emit(this.openUserWindowBoolean);
|
this.closeUserWindow.emit(this.openUserWindowBoolean);
|
||||||
this.toggleBoolean.openChannelMemberWindow = false;
|
this.toggleBoolean.openChannelMemberWindow = false;
|
||||||
this.toggleBoolean.closeChannelMemberWindow = false;
|
this.toggleBoolean.closeChannelMemberWindow = false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -77,13 +77,13 @@
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="showSearchedUsersWindow"
|
class="showSearchedUsersWindow"
|
||||||
[ngClass]="{ dBlock: showExistenUsers, dNone: !showExistenUsers }"
|
[ngClass]="{ dBlock: showExistedUsers, dNone: !showExistedUsers }"
|
||||||
>
|
>
|
||||||
<div class="positionOfAllUsersBox">
|
<div class="positionOfAllUsersBox">
|
||||||
@if(getSearchedUser.length <= 0) {
|
@if(getSearchedUser.length <= 0) {
|
||||||
<span>{{ "show-channel-member.result" | translate }}</span> }
|
<span>{{ "show-channel-member.result" | translate }}</span> }
|
||||||
@for(user of getSearchedUser; track user){
|
@for(user of getSearchedUser; track user){
|
||||||
@if(!isUserAlreadySelectet(user)) {
|
@if(!isUserAlreadySelected(user)) {
|
||||||
<div class="userBox" (click)="chooseUser(user)">
|
<div class="userBox" (click)="chooseUser(user)">
|
||||||
<div class="positionImgsBox">
|
<div class="positionImgsBox">
|
||||||
<img src="{{ user.avatar }}" class="addAvatarImg" />
|
<img src="{{ user.avatar }}" class="addAvatarImg" />
|
||||||
|
|
@ -129,5 +129,5 @@
|
||||||
[ngClass]="{ dBlock: openUserWindowBoolean, dNone: !openUserWindowBoolean }"
|
[ngClass]="{ dBlock: openUserWindowBoolean, dNone: !openUserWindowBoolean }"
|
||||||
[user]="user"
|
[user]="user"
|
||||||
[openUserWindowBoolean]="openUserWindowBoolean"
|
[openUserWindowBoolean]="openUserWindowBoolean"
|
||||||
(closeUserWondow)="changeOpenUserWindowBoolean($event)"
|
(closeUserWindow)="changeOpenUserWindowBoolean($event)"
|
||||||
></app-open-send-prv-message-window>
|
></app-open-send-prv-message-window>
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ export class ShowChannelMemberComponent {
|
||||||
@Input() isSecondaryChatOpen: boolean = false;
|
@Input() isSecondaryChatOpen: boolean = false;
|
||||||
|
|
||||||
userName: string = '';
|
userName: string = '';
|
||||||
showExistenUsers: boolean = false;
|
showExistedUsers: boolean = false;
|
||||||
getSearchedUser: User[] = [];
|
getSearchedUser: User[] = [];
|
||||||
getCurrentChannelName: string = '';
|
getCurrentChannelName: string = '';
|
||||||
getSelectedUsers: User[] = [];
|
getSelectedUsers: User[] = [];
|
||||||
|
|
@ -59,7 +59,7 @@ export class ShowChannelMemberComponent {
|
||||||
*/
|
*/
|
||||||
filterUsers(searchValue: string) {
|
filterUsers(searchValue: string) {
|
||||||
if (searchValue != '') {
|
if (searchValue != '') {
|
||||||
this.showExistenUsers = true;
|
this.showExistedUsers = true;
|
||||||
this.getSearchedUser = [];
|
this.getSearchedUser = [];
|
||||||
const searchedUser = searchValue.toLowerCase().trim();
|
const searchedUser = searchValue.toLowerCase().trim();
|
||||||
const filteredUsers = this.userService.getUsers().filter((user) => {
|
const filteredUsers = this.userService.getUsers().filter((user) => {
|
||||||
|
|
@ -99,7 +99,7 @@ export class ShowChannelMemberComponent {
|
||||||
* @param {User} user - The user to check.
|
* @param {User} user - The user to check.
|
||||||
* @returns {boolean} Returns true if the user is already selected, otherwise false.
|
* @returns {boolean} Returns true if the user is already selected, otherwise false.
|
||||||
*/
|
*/
|
||||||
isUserAlreadySelectet(user: User) {
|
isUserAlreadySelected(user: User) {
|
||||||
return this.getSelectedUsers.some(
|
return this.getSelectedUsers.some(
|
||||||
(selectedUser) => selectedUser.id === user.id
|
(selectedUser) => selectedUser.id === user.id
|
||||||
);
|
);
|
||||||
|
|
@ -119,7 +119,7 @@ export class ShowChannelMemberComponent {
|
||||||
this.getSelectedUsers.push(user);
|
this.getSelectedUsers.push(user);
|
||||||
}
|
}
|
||||||
this.userName = '';
|
this.userName = '';
|
||||||
this.showExistenUsers = false;
|
this.showExistedUsers = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -128,7 +128,7 @@ export class ShowChannelMemberComponent {
|
||||||
*/
|
*/
|
||||||
spliceCurrentUser(index: number) {
|
spliceCurrentUser(index: number) {
|
||||||
this.getSelectedUsers.splice(index, 1);
|
this.getSelectedUsers.splice(index, 1);
|
||||||
this.showExistenUsers = false;
|
this.showExistedUsers = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -184,7 +184,7 @@ export class ShowChannelMemberComponent {
|
||||||
*/
|
*/
|
||||||
resetValues() {
|
resetValues() {
|
||||||
this.userName = '';
|
this.userName = '';
|
||||||
this.showExistenUsers = false;
|
this.showExistedUsers = false;
|
||||||
this.getSearchedUser = [];
|
this.getSearchedUser = [];
|
||||||
this.getCurrentChannelName = '';
|
this.getCurrentChannelName = '';
|
||||||
this.getSelectedUsers = [];
|
this.getSelectedUsers = [];
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue