2024-01-03 19:17:42 -05:00
|
|
|
import { useRecoilState } from 'recoil';
|
2024-06-21 15:58:04 +02:00
|
|
|
import HoverCardSettings from '../HoverCardSettings';
|
2024-01-03 19:17:42 -05:00
|
|
|
import { Switch } from '~/components/ui';
|
|
|
|
|
import { useLocalize } from '~/hooks';
|
|
|
|
|
import store from '~/store';
|
|
|
|
|
|
2024-01-18 14:44:10 -05:00
|
|
|
export default function LaTeXParsingSwitch({
|
2024-01-03 19:17:42 -05:00
|
|
|
onCheckedChange,
|
|
|
|
|
}: {
|
|
|
|
|
onCheckedChange?: (value: boolean) => void;
|
|
|
|
|
}) {
|
2024-01-18 14:44:10 -05:00
|
|
|
const [LaTeXParsing, setLaTeXParsing] = useRecoilState<boolean>(store.LaTeXParsing);
|
2024-01-03 19:17:42 -05:00
|
|
|
const localize = useLocalize();
|
|
|
|
|
|
|
|
|
|
const handleCheckedChange = (value: boolean) => {
|
2024-01-18 14:44:10 -05:00
|
|
|
setLaTeXParsing(value);
|
2024-01-03 19:17:42 -05:00
|
|
|
if (onCheckedChange) {
|
|
|
|
|
onCheckedChange(value);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className="flex items-center justify-between">
|
2024-06-21 15:58:04 +02:00
|
|
|
<div className="flex items-center space-x-2">
|
|
|
|
|
<div>{localize('com_nav_latex_parsing')}</div>
|
|
|
|
|
<HoverCardSettings side="bottom" text="com_nav_info_latex_parsing" />
|
|
|
|
|
</div>
|
2024-01-03 19:17:42 -05:00
|
|
|
<Switch
|
2024-01-18 14:44:10 -05:00
|
|
|
id="LaTeXParsing"
|
|
|
|
|
checked={LaTeXParsing}
|
2024-01-03 19:17:42 -05:00
|
|
|
onCheckedChange={handleCheckedChange}
|
2024-10-20 17:29:47 +02:00
|
|
|
className="ml-4"
|
2024-01-18 14:44:10 -05:00
|
|
|
data-testid="LaTeXParsing"
|
2024-01-03 19:17:42 -05:00
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|