@@ -14,15 +14,27 @@ import { isDesktop } from "../../common/api/common/Env"
14
14
import { locator } from "../../common/api/main/CommonLocator"
15
15
import { EntityUpdateData , isUpdateForTypeRef } from "../../common/api/common/utils/EntityUpdateUtils.js"
16
16
import { client } from "../misc/ClientDetector.js"
17
+ import { DateTime } from "../../../libs/luxon.js"
17
18
18
19
export class AppearanceSettingsViewer implements UpdatableSettingsViewer {
19
20
private _customThemes : Array < ThemeId > | null = null
21
+ private timeOptions : Array < { name : string ; value : number } > = [ ]
20
22
21
23
oncreate ( ) {
22
24
locator . themeController . getCustomThemes ( ) . then ( ( themes ) => {
23
25
this . _customThemes = themes
24
26
m . redraw ( )
25
27
} )
28
+
29
+ const userSettingsGroupRoot = locator . logins . getUserController ( ) . userSettingsGroupRoot
30
+ const timeFormat = userSettingsGroupRoot . timeFormat
31
+
32
+ for ( let hour = 0 ; hour < 24 ; hour ++ ) {
33
+ this . timeOptions . push ( {
34
+ name : DateTime . fromFormat ( hour . toString ( ) , "h" ) . toFormat ( timeFormat === TimeFormat . TWENTY_FOUR_HOURS ? "HH:mm" : "hh:mm a" ) ,
35
+ value : hour ,
36
+ } )
37
+ }
26
38
}
27
39
28
40
view ( ) : Children {
@@ -117,6 +129,7 @@ export class AppearanceSettingsViewer implements UpdatableSettingsViewer {
117
129
m ( ".h4.mt-l" , lang . get ( "settingsForDevice_label" ) ) ,
118
130
m ( DropDownSelector , languageDropDownAttrs ) ,
119
131
this . _renderThemeSelector ( ) ,
132
+ this . renderScrollTimeSelector ( ) ,
120
133
m ( ".h4.mt-l" , lang . get ( "userSettings_label" ) ) ,
121
134
m ( DropDownSelector , hourFormatDropDownAttrs ) ,
122
135
m ( DropDownSelector , weekStartDropDownAttrs ) ,
@@ -145,6 +158,18 @@ export class AppearanceSettingsViewer implements UpdatableSettingsViewer {
145
158
return m ( DropDownSelector , themeDropDownAttrs )
146
159
}
147
160
161
+ renderScrollTimeSelector ( ) : Children {
162
+ const themeDropDownAttrs : DropDownSelectorAttrs < number > = {
163
+ label : "weekScrollTime_label" ,
164
+ helpLabel : ( ) => lang . get ( "weekScrollTime_msg" ) ,
165
+ items : this . timeOptions as SelectorItemList < number > ,
166
+ selectedValue : deviceConfig . getScrollTime ( ) ,
167
+ selectionChangedHandler : ( value ) => deviceConfig . setScrollTime ( value ) ,
168
+ dropdownWidth : 300 ,
169
+ }
170
+ return m ( DropDownSelector , themeDropDownAttrs )
171
+ }
172
+
148
173
entityEventsReceived ( updates : ReadonlyArray < EntityUpdateData > ) : Promise < void > {
149
174
return promiseMap ( updates , ( update ) => {
150
175
if ( isUpdateForTypeRef ( UserSettingsGroupRootTypeRef , update ) ) {
0 commit comments