@@ -23,7 +23,6 @@ import * as CustomBackgroundFilter from "../elements/custom-background-filter";
2323import {
2424 ConfigValue ,
2525 CustomBackgroundSchema ,
26- CustomLayoutFluid ,
2726} from "@monkeytype/contracts/schemas/configs" ;
2827import {
2928 getAllFunboxes ,
@@ -433,10 +432,6 @@ async function initGroups(): Promise<void> {
433432 UpdateConfig . setCustomBackgroundSize ,
434433 "button"
435434 ) as SettingsGroup < ConfigValue > ;
436- // groups.customLayoutfluid = new SettingsGroup(
437- // "customLayoutfluid",
438- // UpdateConfig.setCustomLayoutfluid
439- // );
440435}
441436
442437function reset ( ) : void {
@@ -693,6 +688,31 @@ async function fillSettingsPage(): Promise<void> {
693688 Config . customLayoutfluid . replace ( / # / g, " " )
694689 ) ;
695690
691+ const customLayoutfluidActive = Config . customLayoutfluid . split ( "#" ) ;
692+ const customLayoutfluidElement = document . querySelector (
693+ ".pageSettings .section[data-config-name='customLayoutfluid'] select"
694+ ) as Element ;
695+
696+ new SlimSelect ( {
697+ select : customLayoutfluidElement ,
698+ data : [
699+ ...customLayoutfluidActive ,
700+ ...LayoutsList . filter ( ( it ) => ! customLayoutfluidActive . includes ( it ) ) ,
701+ ] . map ( ( layout ) => ( {
702+ text : layout . replace ( / _ / g, " " ) ,
703+ value : layout ,
704+ selected : customLayoutfluidActive . includes ( layout ) ,
705+ } ) ) ,
706+ settings : { keepOrder : true } ,
707+ events : {
708+ afterChange : ( newVal ) : void => {
709+ void UpdateConfig . setCustomLayoutfluid (
710+ newVal . map ( ( it ) => it . value ) . join ( "#" )
711+ ) ;
712+ } ,
713+ } ,
714+ } ) ;
715+
696716 $ ( ".pageSettings .section[data-config-name='tapeMargin'] input" ) . val (
697717 Config . tapeMargin
698718 ) ;
@@ -1324,29 +1344,6 @@ $(
13241344 }
13251345} ) ;
13261346
1327- const handleLayoutfluid = ( ) : void => {
1328- if (
1329- UpdateConfig . setCustomLayoutfluid (
1330- $ (
1331- ".pageSettings .section[data-config-name='customLayoutfluid'] .inputAndButton input"
1332- ) . val ( ) as CustomLayoutFluid
1333- )
1334- ) {
1335- Notifications . add ( "Custom layoutfluid saved" , 1 ) ;
1336- }
1337- } ;
1338- $ (
1339- ".pageSettings .section[data-config-name='customLayoutfluid'] .inputAndButton button.save"
1340- ) . on ( "click" , handleLayoutfluid ) ;
1341-
1342- $ (
1343- ".pageSettings .section[data-config-name='customLayoutfluid'] .inputAndButton .input"
1344- ) . on ( "keypress" , ( e ) => {
1345- if ( e . key === "Enter" ) {
1346- handleLayoutfluid ( ) ;
1347- }
1348- } ) ;
1349-
13501347$ ( ".pageSettings .quickNav .links a" ) . on ( "click" , ( e ) => {
13511348 const settingsGroup = e . target . innerText ;
13521349 const isClosed = $ ( `.pageSettings .settingsGroup.${ settingsGroup } ` ) . hasClass (
0 commit comments