-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: enable copy over instructions (#3266)
- Loading branch information
Showing
7 changed files
with
94 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
web/screens/Settings/Advanced/components/CopyOverInstruction.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { ChangeEvent, useCallback } from 'react' | ||
|
||
import { Switch } from '@janhq/joi' | ||
import { useAtom } from 'jotai' | ||
import { atomWithStorage } from 'jotai/utils' | ||
|
||
const COPY_OVER_INSTRUCTION_ENABLED = 'copy_over_instruction_enabled' | ||
export const copyOverInstructionEnabledAtom = atomWithStorage( | ||
COPY_OVER_INSTRUCTION_ENABLED, | ||
false | ||
) | ||
|
||
const CopyOverInstructionItem: React.FC = () => { | ||
const [copyOverInstructionEnabled, setCopyOverInstructionEnabled] = useAtom( | ||
copyOverInstructionEnabledAtom | ||
) | ||
|
||
const onSwitchToggled = useCallback( | ||
(e: ChangeEvent<HTMLInputElement>) => { | ||
setCopyOverInstructionEnabled(e.target.checked) | ||
}, | ||
[setCopyOverInstructionEnabled] | ||
) | ||
|
||
return ( | ||
<div className="flex w-full flex-col items-start justify-between gap-4 border-b border-[hsla(var(--app-border))] py-4 first:pt-0 last:border-none sm:flex-row"> | ||
<div className="flex-shrink-0 space-y-1"> | ||
<div className="flex gap-x-2"> | ||
<h6 className="font-semibold capitalize">Copy Over Instruction</h6> | ||
</div> | ||
<p className="font-medium leading-relaxed text-[hsla(var(--text-secondary))]"> | ||
Enable instruction to be copied to new thread | ||
</p> | ||
</div> | ||
{/**/} | ||
<Switch checked={copyOverInstructionEnabled} onChange={onSwitchToggled} /> | ||
</div> | ||
) | ||
} | ||
|
||
export default CopyOverInstructionItem |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters