mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-26 08:56:47 +08:00
### What problem does this PR solve? Feat: Remove HMAC from the webhook #10427 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
37 lines
1.0 KiB
TypeScript
37 lines
1.0 KiB
TypeScript
import { useTranslate } from '@/hooks/common-hooks';
|
|
import { CheckOutlined, CopyOutlined } from '@ant-design/icons';
|
|
import { Tooltip } from 'antd';
|
|
import { useState } from 'react';
|
|
import { CopyToClipboard as Clipboard, Props } from 'react-copy-to-clipboard';
|
|
|
|
const CopyToClipboard = ({ text }: Props) => {
|
|
const [copied, setCopied] = useState(false);
|
|
const { t } = useTranslate('common');
|
|
|
|
const handleCopy = () => {
|
|
setCopied(true);
|
|
setTimeout(() => {
|
|
setCopied(false);
|
|
}, 2000);
|
|
};
|
|
|
|
return (
|
|
<Tooltip title={copied ? t('copied') : t('copy')}>
|
|
<Clipboard text={text} onCopy={handleCopy}>
|
|
{copied ? <CheckOutlined /> : <CopyOutlined />}
|
|
</Clipboard>
|
|
</Tooltip>
|
|
);
|
|
};
|
|
|
|
export default CopyToClipboard;
|
|
|
|
export function CopyToClipboardWithText({ text }: { text: string }) {
|
|
return (
|
|
<div className="bg-bg-card p-1 rounded-md flex gap-2">
|
|
<span className="flex-1 truncate">{text}</span>
|
|
<CopyToClipboard text={text}></CopyToClipboard>
|
|
</div>
|
|
);
|
|
}
|