mirror of https://github.com/Chocobozzz/PeerTube
Clearer theme select labels
parent
b46489f8e4
commit
ff6a266e3f
|
@ -5,10 +5,10 @@
|
|||
|
||||
<div class="peertube-select-container">
|
||||
<select formControlName="theme" id="theme" class="form-control">
|
||||
<option i18n value="instance-default">instance default</option>
|
||||
<option i18n value="default">peertube default</option>
|
||||
<option i18n value="instance-default">Instance default theme ({{ getDefaultThemeLabel() }})</option>
|
||||
<option i18n value="default">{{ defaultThemeLabel }}</option>
|
||||
|
||||
<option *ngFor="let theme of availableThemes" [value]="theme">{{ theme }}</option>
|
||||
<option *ngFor="let theme of availableThemes" [value]="theme">{{ capitalizeFirstLetter(theme) }}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -2,6 +2,7 @@ import { Subject, Subscription } from 'rxjs'
|
|||
import { Component, Input, OnDestroy, OnInit } from '@angular/core'
|
||||
import { AuthService, Notifier, ServerService, UserService } from '@app/core'
|
||||
import { FormReactive, FormValidatorService } from '@app/shared/shared-forms'
|
||||
import { capitalizeFirstLetter } from '@root-helpers/string'
|
||||
import { HTMLServerConfig, User, UserUpdateMe } from '@shared/models'
|
||||
|
||||
@Component({
|
||||
|
@ -17,6 +18,8 @@ export class UserInterfaceSettingsComponent extends FormReactive implements OnIn
|
|||
|
||||
formValuesWatcher: Subscription
|
||||
|
||||
defaultThemeLabel = $localize`Light/Orange`
|
||||
|
||||
private serverConfig: HTMLServerConfig
|
||||
|
||||
constructor (
|
||||
|
@ -57,6 +60,18 @@ export class UserInterfaceSettingsComponent extends FormReactive implements OnIn
|
|||
this.formValuesWatcher?.unsubscribe()
|
||||
}
|
||||
|
||||
getDefaultThemeLabel () {
|
||||
const theme = this.serverConfig.theme.default
|
||||
|
||||
if (theme === 'default') return this.defaultThemeLabel
|
||||
|
||||
return theme
|
||||
}
|
||||
|
||||
capitalizeFirstLetter (str: string) {
|
||||
return capitalizeFirstLetter(str)
|
||||
}
|
||||
|
||||
updateInterfaceSettings () {
|
||||
const theme = this.form.value['theme']
|
||||
|
||||
|
|
|
@ -4,5 +4,6 @@ export * from './images'
|
|||
export * from './local-storage-utils'
|
||||
export * from './peertube-web-storage'
|
||||
export * from './plugins-manager'
|
||||
export * from './string'
|
||||
export * from './utils'
|
||||
export * from './video'
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
function capitalizeFirstLetter (str: string) {
|
||||
return str.charAt(0).toUpperCase() + str.slice(1)
|
||||
}
|
||||
|
||||
export {
|
||||
capitalizeFirstLetter
|
||||
}
|
Loading…
Reference in New Issue