1- import Toggle from '~/components/inputs/toggle'
21import { type GeneralSettings as GeneralSettingsType , useSettingsStore } from '../../../stores/settings-store'
2+ import InputWithLabel from '~/components/inputs/input-with-label'
33import RadioList from '~/components/inputs/radio-list'
4+ import Toggle from '~/components/inputs/toggle'
45import ValidatedInput from '~/components/inputs/validatedInput'
56
67export default function GeneralSettings ( ) {
@@ -11,8 +12,8 @@ export default function GeneralSettings() {
1112 < div className = "border-border bg-background space-y-6 rounded-md border p-6" >
1213 < p > Customize the application to your liking</ p >
1314
14- < div className = "border-border rounded-md border p-4" >
15- < p > Select Theme</ p >
15+ < div className = "border-border space-y-2 rounded-md border p-4" >
16+ < p className = "font-medium" > Theme</ p >
1617 < RadioList
1718 options = { {
1819 light : { Light : 'Light themed' } ,
@@ -23,23 +24,29 @@ export default function GeneralSettings() {
2324 onChange = { ( theme ) => setGeneralSettings ( { theme : theme as GeneralSettingsType [ 'theme' ] } ) }
2425 />
2526 </ div >
26- < div className = "border-border rounded-md border p-4" >
27- < p > Autosave Settings</ p >
28- < div className = "mt-2 flex items-center gap-4" >
29- < label className = "mb-2 block" htmlFor = "enable-autosave" >
30- Enable Autosave
31- </ label >
27+
28+ < div className = "border-border space-y-4 rounded-md border p-4" >
29+ < p className = "font-medium" > Autosave</ p >
30+ < InputWithLabel
31+ inputSide = "right"
32+ grow
33+ htmlFor = "enable-autosave"
34+ label = "Enable Autosave"
35+ description = "Automatically save changes after a period of inactivity"
36+ >
3237 < Toggle
3338 id = "enable-autosave"
3439 checked = { general . autoSave . enabled }
3540 onChange = { ( checked ) => setGeneralSettings ( { autoSave : { ...general . autoSave , enabled : checked } } ) }
3641 />
37- </ div >
38- < div className = "mt-2 flex items-center gap-4" >
39- < label className = "mb-2 block" htmlFor = "autosave-delay" >
40- Autosave Delay (ms) < p className = "text-muted-foreground text-sm" > (Saves after X ms of inactivity)</ p >
41- </ label >
42-
42+ </ InputWithLabel >
43+ < InputWithLabel
44+ inputSide = "right"
45+ grow
46+ htmlFor = "autosave-delay"
47+ label = "Autosave Delay"
48+ description = "Saves after this many milliseconds of inactivity"
49+ >
4350 < ValidatedInput
4451 id = "autosave-delay"
4552 value = { general . autoSave . delayMs . toString ( ) }
@@ -49,8 +56,6 @@ export default function GeneralSettings() {
4956 } }
5057 onChange = { ( event ) => {
5158 const value = event . target . value
52-
53- // Only update store if valid number
5459 if ( / ^ [ 1 - 9 ] \d * $ / . test ( value ) ) {
5560 setGeneralSettings ( {
5661 autoSave : {
@@ -61,7 +66,7 @@ export default function GeneralSettings() {
6166 }
6267 } }
6368 />
64- </ div >
69+ </ InputWithLabel >
6570 </ div >
6671 </ div >
6772 </ div >
0 commit comments