* chore: upgrade to turbo v2 and reduce ci quality gate runtime * chore: upgrade to yarn v4 and deprecate turborepo * chore: reconfigure modules and fix tests * chore: switch to github-hosted runner * fix: dependency resolving * chore: clean redundant step * chore: headless test * chore: remove headed param * fix: resolve dependency version * fix: ubuntu no-sandbox test --------- Co-authored-by: Hien To <tominhhien97@gmail.com> Co-authored-by: Louis <louis@jan.ai>
33 lines
909 B
TypeScript
33 lines
909 B
TypeScript
import { ChangeEvent, useCallback } from 'react'
|
|
|
|
import { Switch } from '@janhq/joi'
|
|
import { useAtom } from 'jotai'
|
|
|
|
import { copyOverInstructionEnabledAtom } from '@/helpers/atoms/App.atom'
|
|
|
|
const CopyOverInstruction: React.FC = () => {
|
|
const [copyOverInstructionEnabled, setCopyOverInstructionEnabled] = useAtom(
|
|
copyOverInstructionEnabledAtom
|
|
)
|
|
|
|
const onSwitchToggled = useCallback(
|
|
(e: ChangeEvent<HTMLInputElement>) => {
|
|
setCopyOverInstructionEnabled(e.target.checked)
|
|
},
|
|
[setCopyOverInstructionEnabled]
|
|
)
|
|
|
|
return (
|
|
<div className="my-2 flex w-full flex-row items-center justify-center gap-x-2">
|
|
<h6 className="flex-1 font-medium">Save instructions for new threads</h6>
|
|
<Switch
|
|
checked={copyOverInstructionEnabled}
|
|
onChange={onSwitchToggled}
|
|
className="flex-shrink-0"
|
|
/>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export default CopyOverInstruction
|