Fix: Changed hint text when the sidebar menu is open or closed.

This commit is contained in:
Chneemann 2024-09-20 04:57:01 +02:00
parent 6e27b9e8cb
commit e833d4a5dd
4 changed files with 12 additions and 5 deletions

View file

@ -1,6 +1,10 @@
<section (click)="toggleSidebar()"> <section (click)="toggleSidebar()">
<div class="menu"> <div class="menu">
<img src="./assets/img/sidebar/toggle.svg" alt="" /> <img src="./assets/img/sidebar/toggle.svg" alt="" />
<p>{{ 'sidebar-toggle.openWorkspace' | translate }}</p> @if (isSidebarOpen) {
<p>{{ "sidebar-toggle.openWorkspace" | translate }}</p>
} @else {
<p>{{ "sidebar-toggle.closeWorkspace" | translate }}</p>
}
</div> </div>
</section> </section>

View file

@ -12,28 +12,29 @@ import { TranslateModule } from '@ngx-translate/core';
}) })
export class SidebarToggleComponent { export class SidebarToggleComponent {
@Input() viewWidth: number = 0; @Input() viewWidth: number = 0;
isSidebarOpen: boolean = false;
constructor( constructor(
private chatService: ChatService, private chatService: ChatService,
private toggleBoolean: ToggleBooleanService private toggleBoolean: ToggleBooleanService
) {} ) {}
/** /**
* Toggles the sidebar visibility and checks the view width. * Toggles the sidebar visibility and checks the view width.
*/ */
toggleSidebar() { toggleSidebar() {
this.isSidebarOpen = !this.isSidebarOpen;
this.toggleBoolean.isSidebarOpen = !this.toggleBoolean.isSidebarOpen; this.toggleBoolean.isSidebarOpen = !this.toggleBoolean.isSidebarOpen;
this.checkViewWidth(); this.checkViewWidth();
} }
/** /**
* Checks the view width and adjusts sidebar and chat states accordingly. * Checks the view width and adjusts sidebar and chat states accordingly.
*/ */
checkViewWidth() { checkViewWidth() {
if (this.viewWidth <= 1900 && this.chatService.isSecondaryChatOpen) { if (this.viewWidth <= 1900 && this.chatService.isSecondaryChatOpen) {
this.toggleBoolean.isSidebarOpen = true; this.toggleBoolean.isSidebarOpen = true;
this.isSidebarOpen = true;
} }
if (this.viewWidth <= 1900) { if (this.viewWidth <= 1900) {
this.chatService.isSecondaryChatId = ''; this.chatService.isSecondaryChatId = '';

View file

@ -166,7 +166,8 @@
}, },
"sidebar-toggle": { "sidebar-toggle": {
"openWorkspace": "Menü öffnen" "openWorkspace": "Menü öffnen",
"closeWorkspace": "Menü schließen"
}, },
"edit-user-details": { "edit-user-details": {

View file

@ -166,7 +166,8 @@
}, },
"sidebar-toggle": { "sidebar-toggle": {
"openWorkspace": "Open Menu" "openWorkspace": "Open Menu",
"closeWorkspace": "Close Menu"
}, },
"edit-user-details": { "edit-user-details": {