aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/shared-user-settings/user-interface-settings.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared/shared-user-settings/user-interface-settings.component.ts')
-rw-r--r--client/src/app/shared/shared-user-settings/user-interface-settings.component.ts27
1 files changed, 15 insertions, 12 deletions
diff --git a/client/src/app/shared/shared-user-settings/user-interface-settings.component.ts b/client/src/app/shared/shared-user-settings/user-interface-settings.component.ts
index 932db498a..24ad54b1d 100644
--- a/client/src/app/shared/shared-user-settings/user-interface-settings.component.ts
+++ b/client/src/app/shared/shared-user-settings/user-interface-settings.component.ts
@@ -1,8 +1,7 @@
1import { Subject, Subscription } from 'rxjs' 1import { Subject, Subscription } from 'rxjs'
2import { Component, Input, OnDestroy, OnInit } from '@angular/core' 2import { Component, Input, OnDestroy, OnInit } from '@angular/core'
3import { AuthService, Notifier, ServerService, UserService } from '@app/core' 3import { AuthService, Notifier, ServerService, ThemeService, UserService } from '@app/core'
4import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' 4import { FormReactive, FormValidatorService } from '@app/shared/shared-forms'
5import { capitalizeFirstLetter } from '@root-helpers/string'
6import { HTMLServerConfig, User, UserUpdateMe } from '@shared/models' 5import { HTMLServerConfig, User, UserUpdateMe } from '@shared/models'
7 6
8@Component({ 7@Component({
@@ -18,8 +17,6 @@ export class UserInterfaceSettingsComponent extends FormReactive implements OnIn
18 17
19 formValuesWatcher: Subscription 18 formValuesWatcher: Subscription
20 19
21 defaultThemeLabel = $localize`Light/Orange`
22
23 private serverConfig: HTMLServerConfig 20 private serverConfig: HTMLServerConfig
24 21
25 constructor ( 22 constructor (
@@ -27,14 +24,14 @@ export class UserInterfaceSettingsComponent extends FormReactive implements OnIn
27 private authService: AuthService, 24 private authService: AuthService,
28 private notifier: Notifier, 25 private notifier: Notifier,
29 private userService: UserService, 26 private userService: UserService,
27 private themeService: ThemeService,
30 private serverService: ServerService 28 private serverService: ServerService
31 ) { 29 ) {
32 super() 30 super()
33 } 31 }
34 32
35 get availableThemes () { 33 get instanceName () {
36 return this.serverConfig.theme.registered 34 return this.serverConfig.instance.name
37 .map(t => t.name)
38 } 35 }
39 36
40 ngOnInit () { 37 ngOnInit () {
@@ -61,17 +58,23 @@ export class UserInterfaceSettingsComponent extends FormReactive implements OnIn
61 } 58 }
62 59
63 getDefaultThemeLabel () { 60 getDefaultThemeLabel () {
61 return this.themeService.getDefaultThemeLabel()
62 }
63
64 getAvailableThemes () {
65 return this.themeService.getAvailableThemeLabels()
66 }
67
68 getDefaultInstanceThemeLabel () {
64 const theme = this.serverConfig.theme.default 69 const theme = this.serverConfig.theme.default
65 70
66 if (theme === 'default') return this.defaultThemeLabel 71 if (theme === 'default') {
72 return this.getDefaultThemeLabel()
73 }
67 74
68 return theme 75 return theme
69 } 76 }
70 77
71 capitalizeFirstLetter (str: string) {
72 return capitalizeFirstLetter(str)
73 }
74
75 updateInterfaceSettings () { 78 updateInterfaceSettings () {
76 const theme = this.form.value['theme'] 79 const theme = this.form.value['theme']
77 80