feat(react/settings): port content languages

This commit is contained in:
Elian Doran
2025-08-15 10:26:25 +03:00
parent c039f06c2b
commit c368ec3c38
6 changed files with 70 additions and 67 deletions

View File

@@ -40,7 +40,8 @@ function FormRadio({ name, value, label, currentValue, onChange, labelClassName
name={useUniqueName(name)}
value={value}
checked={value === currentValue}
onChange={e => onChange((e.target as HTMLInputElement).value)} />
onChange={e => onChange((e.target as HTMLInputElement).value)}
/>
{label}
</label>
)

View File

@@ -142,6 +142,14 @@ export function useTriliumOptionInt(name: OptionNames): [number, (newValue: numb
]
}
export function useTriliumOptionJson<T>(name: OptionNames): [ T, (newValue: T) => Promise<void> ] {
const [ value, setValue ] = useTriliumOption(name);
return [
(JSON.parse(value) as T),
(newValue => setValue(JSON.stringify(newValue)))
];
}
/**
* Generates a unique name via a random alphanumeric string of a fixed length.
*