File size: 1,077 Bytes
f0743f4 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | import { useCallback } from 'react';
import { useSetRecoilState } from 'recoil';
import { Button } from '@librechat/client';
import { useLocalize, useCustomLink } from '~/hooks';
import { cn } from '~/utils';
import store from '~/store';
export default function ManagePrompts({ className }: { className?: string }) {
const localize = useLocalize();
const setPromptsName = useSetRecoilState(store.promptsName);
const setPromptsCategory = useSetRecoilState(store.promptsCategory);
const clickCallback = useCallback(() => {
setPromptsName('');
setPromptsCategory('');
}, [setPromptsName, setPromptsCategory]);
const customLink = useCustomLink('/d/prompts', clickCallback);
const clickHandler = (e: React.MouseEvent<HTMLButtonElement>) => {
customLink(e as unknown as React.MouseEvent<HTMLAnchorElement>);
};
return (
<Button
variant="outline"
className={cn(className, 'bg-transparent')}
onClick={clickHandler}
aria-label="Manage Prompts"
role="button"
>
{localize('com_ui_manage')}
</Button>
);
}
|