aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--client/src/app/shared/shared-user-settings/user-interface-settings.component.html6
-rw-r--r--client/src/app/shared/shared-user-settings/user-interface-settings.component.ts15
-rw-r--r--client/src/root-helpers/index.ts1
-rw-r--r--client/src/root-helpers/string.ts7
4 files changed, 26 insertions, 3 deletions
diff --git a/client/src/app/shared/shared-user-settings/user-interface-settings.component.html b/client/src/app/shared/shared-user-settings/user-interface-settings.component.html
index 0d0ddc0f2..b739e881b 100644
--- a/client/src/app/shared/shared-user-settings/user-interface-settings.component.html
+++ b/client/src/app/shared/shared-user-settings/user-interface-settings.component.html
@@ -5,10 +5,10 @@
5 5
6 <div class="peertube-select-container"> 6 <div class="peertube-select-container">
7 <select formControlName="theme" id="theme" class="form-control"> 7 <select formControlName="theme" id="theme" class="form-control">
8 <option i18n value="instance-default">instance default</option> 8 <option i18n value="instance-default">Instance default theme ({{ getDefaultThemeLabel() }})</option>
9 <option i18n value="default">peertube default</option> 9 <option i18n value="default">{{ defaultThemeLabel }}</option>
10 10
11 <option *ngFor="let theme of availableThemes" [value]="theme">{{ theme }}</option> 11 <option *ngFor="let theme of availableThemes" [value]="theme">{{ capitalizeFirstLetter(theme) }}</option>
12 </select> 12 </select>
13 </div> 13 </div>
14 </div> 14 </div>
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 d04a2c348..932db498a 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
@@ -2,6 +2,7 @@ import { 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, 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'
5import { HTMLServerConfig, User, UserUpdateMe } from '@shared/models' 6import { HTMLServerConfig, User, UserUpdateMe } from '@shared/models'
6 7
7@Component({ 8@Component({
@@ -17,6 +18,8 @@ export class UserInterfaceSettingsComponent extends FormReactive implements OnIn
17 18
18 formValuesWatcher: Subscription 19 formValuesWatcher: Subscription
19 20
21 defaultThemeLabel = $localize`Light/Orange`
22
20 private serverConfig: HTMLServerConfig 23 private serverConfig: HTMLServerConfig
21 24
22 constructor ( 25 constructor (
@@ -57,6 +60,18 @@ export class UserInterfaceSettingsComponent extends FormReactive implements OnIn
57 this.formValuesWatcher?.unsubscribe() 60 this.formValuesWatcher?.unsubscribe()
58 } 61 }
59 62
63 getDefaultThemeLabel () {
64 const theme = this.serverConfig.theme.default
65
66 if (theme === 'default') return this.defaultThemeLabel
67
68 return theme
69 }
70
71 capitalizeFirstLetter (str: string) {
72 return capitalizeFirstLetter(str)
73 }
74
60 updateInterfaceSettings () { 75 updateInterfaceSettings () {
61 const theme = this.form.value['theme'] 76 const theme = this.form.value['theme']
62 77
diff --git a/client/src/root-helpers/index.ts b/client/src/root-helpers/index.ts
index 3b95b4b99..0492924fd 100644
--- a/client/src/root-helpers/index.ts
+++ b/client/src/root-helpers/index.ts
@@ -4,5 +4,6 @@ export * from './images'
4export * from './local-storage-utils' 4export * from './local-storage-utils'
5export * from './peertube-web-storage' 5export * from './peertube-web-storage'
6export * from './plugins-manager' 6export * from './plugins-manager'
7export * from './string'
7export * from './utils' 8export * from './utils'
8export * from './video' 9export * from './video'
diff --git a/client/src/root-helpers/string.ts b/client/src/root-helpers/string.ts
new file mode 100644
index 000000000..f81587494
--- /dev/null
+++ b/client/src/root-helpers/string.ts
@@ -0,0 +1,7 @@
1function capitalizeFirstLetter (str: string) {
2 return str.charAt(0).toUpperCase() + str.slice(1)
3}
4
5export {
6 capitalizeFirstLetter
7}