diff options
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' | |||
2 | import { Component, Input, OnDestroy, OnInit } from '@angular/core' | 2 | import { Component, Input, OnDestroy, OnInit } from '@angular/core' |
3 | import { AuthService, Notifier, ServerService, UserService } from '@app/core' | 3 | import { AuthService, Notifier, ServerService, UserService } from '@app/core' |
4 | import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' | 4 | import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' |
5 | import { capitalizeFirstLetter } from '@root-helpers/string' | ||
5 | import { HTMLServerConfig, User, UserUpdateMe } from '@shared/models' | 6 | import { 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' | |||
4 | export * from './local-storage-utils' | 4 | export * from './local-storage-utils' |
5 | export * from './peertube-web-storage' | 5 | export * from './peertube-web-storage' |
6 | export * from './plugins-manager' | 6 | export * from './plugins-manager' |
7 | export * from './string' | ||
7 | export * from './utils' | 8 | export * from './utils' |
8 | export * from './video' | 9 | export * 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 @@ | |||
1 | function capitalizeFirstLetter (str: string) { | ||
2 | return str.charAt(0).toUpperCase() + str.slice(1) | ||
3 | } | ||
4 | |||
5 | export { | ||
6 | capitalizeFirstLetter | ||
7 | } | ||