Remove unused OnInit lifecycle and theme toggle logic from incorrect component

Removed the duplicate OnInit lifecycle and associated theme toggling methods from the HeaderComponent.
This commit is contained in:
Teriuihi 2025-04-04 20:31:20 +02:00
parent dbfe5b38ab
commit 5737de3cfc

View File

@ -1,4 +1,4 @@
import {Component, Input, OnInit} from '@angular/core';
import {Component, Input} from '@angular/core';
import {ALTITUDE_VERSION} from '../constant';
@Component({
@ -7,15 +7,11 @@ import {ALTITUDE_VERSION} from '../constant';
templateUrl: './header.component.html',
styleUrls: ['./header.component.scss']
})
export class HeaderComponent implements OnInit {
export class HeaderComponent {
@Input() title: string = '';
@Input() sub_title: string = '';
@Input() current_page: string = ''
public ngOnInit(): void {
this.toggleTheme()//TODO fix theme
}
public getCurrentPageId(options: string[]) {
if (options.includes(this.current_page)) {
return 'current_page'
@ -23,19 +19,5 @@ export class HeaderComponent implements OnInit {
return null;
}
public setTheme(themeName: string) {
localStorage.setItem('theme', themeName);
document.body.className = themeName;
}
// function to toggle between light and dark theme
public toggleTheme() {
if (localStorage.getItem('theme') === 'theme-light') {
this.setTheme('theme-dark');
} else {
this.setTheme('theme-light');
}
}
protected readonly ALTITUDE_VERSION = ALTITUDE_VERSION;
}