mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-15 05:36:17 -08:00
refactor: convert settings to standalone component
This commit is contained in:
1 parent
885572b179
commit
209e63fd6a
5 files changed
+15
-36
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { Routes, RouterModule } from '@angular/router';
|
||||
import { RouterModule, Routes } from '@angular/router';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
@@ -14,8 +14,10 @@ const routes: Routes = [
|
||||
},
|
||||
{
|
||||
path: 'settings',
|
||||
loadChildren: () =>
|
||||
import('./settings/settings.module').then((m) => m.SettingsModule),
|
||||
loadComponent: () =>
|
||||
import('./settings/settings.component').then(
|
||||
(c) => c.SettingsComponent
|
||||
),
|
||||
},
|
||||
{
|
||||
path: '**',
|
||||
|
||||
@@ -59,8 +59,8 @@ export class SettingsService {
|
||||
* Returns the version of the released app
|
||||
*/
|
||||
getAppVersion() {
|
||||
return this.http.get<string>(PACKAGE_JSON_URL).pipe(
|
||||
map((response) => response['version']),
|
||||
return this.http.get<{ version: string }>(PACKAGE_JSON_URL).pipe(
|
||||
map((response) => response.version),
|
||||
catchError((err) => {
|
||||
console.error(err);
|
||||
throw new Error(err);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import {
|
||||
UntypedFormArray,
|
||||
@@ -15,6 +16,7 @@ import { EPG_FORCE_FETCH } from '../../../shared/ipc-commands';
|
||||
import { DataService } from '../services/data.service';
|
||||
import { EpgService } from '../services/epg.service';
|
||||
import { STORE_KEY } from '../shared/enums/store-keys.enum';
|
||||
import { SharedModule } from '../shared/shared.module';
|
||||
import { selectIsEpgAvailable } from '../state/selectors';
|
||||
import { SettingsService } from './../services/settings.service';
|
||||
import { Language } from './language.enum';
|
||||
@@ -22,9 +24,10 @@ import { Settings, VideoPlayer } from './settings.interface';
|
||||
import { Theme } from './theme.enum';
|
||||
|
||||
@Component({
|
||||
selector: 'app-settings',
|
||||
templateUrl: './settings.component.html',
|
||||
styleUrls: ['./settings.component.scss'],
|
||||
standalone: true,
|
||||
imports: [CommonModule, SharedModule],
|
||||
})
|
||||
export class SettingsComponent implements OnInit {
|
||||
/** List with available languages as enum */
|
||||
@@ -149,9 +152,10 @@ export class SettingsComponent implements OnInit {
|
||||
* settings UI
|
||||
*/
|
||||
checkAppVersion(): void {
|
||||
this.settingsService.getAppVersion().subscribe((version) => {
|
||||
this.showVersionInformation(version);
|
||||
});
|
||||
this.settingsService
|
||||
.getAppVersion()
|
||||
.pipe(take(1))
|
||||
.subscribe((version) => this.showVersionInformation(version));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { SettingsComponent } from './settings.component';
|
||||
import { SettingsRoutingModule } from './settings.routing';
|
||||
import { SharedModule } from '../shared/shared.module';
|
||||
|
||||
@NgModule({
|
||||
imports: [CommonModule, SettingsRoutingModule, SharedModule],
|
||||
declarations: [SettingsComponent],
|
||||
})
|
||||
export class SettingsModule {}
|
||||
@@ -1,16 +0,0 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { Routes, RouterModule } from '@angular/router';
|
||||
import { SettingsComponent } from './settings.component';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
component: SettingsComponent,
|
||||
},
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forChild(routes)],
|
||||
exports: [RouterModule],
|
||||
})
|
||||
export class SettingsRoutingModule {}
|
||||
Reference in new issue
Block a user