From 1ef2639ca547add1c4a17bb34ab2fbefeb94931b Mon Sep 17 00:00:00 2001 From: Maya Date: Sat, 14 Feb 2026 07:34:47 +0300 Subject: [PATCH] fix: better checkbox & settings behaviour doing this on the way to a national robotics competition lmao --- .../components/functional/FancyInput.svelte | 40 ++++-- .../functional/SettingsModal.svelte | 124 ++++++++++-------- src/lib/css/app.scss | 20 ++- 3 files changed, 114 insertions(+), 70 deletions(-) diff --git a/src/lib/components/functional/FancyInput.svelte b/src/lib/components/functional/FancyInput.svelte index 179f8af..4a46298 100644 --- a/src/lib/components/functional/FancyInput.svelte +++ b/src/lib/components/functional/FancyInput.svelte @@ -9,6 +9,8 @@ let { class: className, value = $bindable(), + checked = $bindable(), + type = "text", disabled = false, extension, prefix, @@ -17,14 +19,36 @@
- + {#if type === "checkbox"} +
+ + {#if checked} +
+ + + +
+ {/if} +
+ {:else} + + {/if} + {#if prefix}
{prefix}>({}); + const handleSettingChange = (key: string, value: any) => { if (!file) return; - file.conversionSettings[key] = value; + settings[key] = value; + console.log( + `Changed settings for ${file.name}: ${JSON.stringify(settings, null, 2)}`, + ); }; const applySettings = () => { onclose?.(); + if (!file) return; + file.conversionSettings = { ...file.conversionSettings, ...settings }; + console.log( + `Applied settings for ${file.name}: ${JSON.stringify(file.conversionSettings, null, 2)}`, + ); }; @@ -63,61 +72,64 @@ {m["settings.conversion.no_settings"]?.() || "No settings available for this converter"}

- {:else} -
- {#each settings as setting (setting.key)} -
-

- {setting.label} -

- - {#if setting.description} -

- {setting.description} -

- {/if} + {:else} +
+ {#each settings as setting (setting.key)} +
+

+ {setting.label} +

+ + {#if setting.description} +

+ {setting.description} +

+ {/if} - {#if setting.type === "select"} - opt.value, - ) || []} - selected={file.conversionSettings[ - setting.key - ] ?? setting.default} - settingsStyle - onselect={(value) => - handleSettingChange(setting.key, value)} - /> - {:else if setting.type === "boolean"} - - handleSettingChange( - setting.key, - e.currentTarget.checked, - )} - class="w-4 h-4" - /> - {:else} - - handleSettingChange( - setting.key, - e.detail.value, - )} - /> - {/if} -
- {/each} -
+ {#if setting.type === "select"} + opt.value, + ) || []} + selected={file.conversionSettings[ + setting.key + ] ?? setting.default} + settingsStyle + onselect={(value) => + handleSettingChange( + setting.key, + value, + )} + /> + {:else if setting.type === "boolean"} + + handleSettingChange( + setting.key, + e.currentTarget.checked, + )} + + /> + {:else} + + handleSettingChange( + setting.key, + e.currentTarget.value, + )} + /> + {/if} +
+ {/each} +
{/if}
{/if} diff --git a/src/lib/css/app.scss b/src/lib/css/app.scss index 2a12baf..becfa7a 100644 --- a/src/lib/css/app.scss +++ b/src/lib/css/app.scss @@ -59,6 +59,8 @@ --fg-accent: var(--accent-pink-muted); --fg-failure: var(--accent-red-alt); + --text-panel: hsl(0, 0%, 100%); + // backgrounds --bg: hsl(0, 0%, 95%); @@ -188,6 +190,8 @@ // backgrounds --bg: hsl(220, 5%, 15%); + --text-panel: hsl(220, 4%, 24%); + --bg-gradient-from: hsla(303, 100%, 50%, 0.1); --bg-gradient-to: hsla(303, 100%, 50%, 0); --bg-gradient-pink-from: hsla(303, 100%, 50%, 0.1); @@ -393,16 +397,20 @@ body { @apply outline outline-accent outline-2; } - input[type="range"] { - @apply appearance-none bg-panel h-2 rounded-lg; + input[type="checkbox"] { + @apply appearance-none w-5 h-5 rounded-md bg-button border-2 border-button cursor-pointer transition-colors duration-200; } - input[type="range"]::-webkit-slider-thumb { - @apply appearance-none w-4 h-4 bg-accent rounded-full cursor-pointer; + input[type="checkbox"]:hover { + @apply bg-button border-accent; } - input[type="range"]::-moz-range-thumb { - @apply w-4 h-4 bg-accent rounded-full cursor-pointer; + input[type="checkbox"]:checked { + @apply bg-accent border-accent; + } + + input[type="checkbox"]:focus { + @apply outline outline-accent outline-2; } hr {