openreplay/frontend/app/components/shared/SharePopup/SessionCopyLink/SessionCopyLink.tsx
Andrey Babushkin fd5c0c9747
Add lokalisation (#3092)
* applied eslint

* add locales and lint the project

* removed error boundary

* updated locales

* fix min files

* fix locales
2025-03-06 17:43:15 +01:00

34 lines
912 B
TypeScript

import React from 'react';
import { Button } from 'antd';
import { LinkOutlined } from '@ant-design/icons';
import copy from 'copy-to-clipboard';
import { useTranslation } from 'react-i18next';
function SessionCopyLink({ time }: { time: number }) {
const [copied, setCopied] = React.useState(false);
const { t } = useTranslation();
const copyHandler = () => {
setCopied(true);
copy(
`${window.location.origin + window.location.pathname}?jumpto=${Math.round(
time,
)}`,
);
setTimeout(() => {
setCopied(false);
}, 1000);
};
return (
<div className="flex justify-between items-center w-full mt-2">
<Button type="text" onClick={copyHandler} icon={<LinkOutlined />}>
{t('Copy URL at Current Time')}
</Button>
{copied && <div className="color-gray-medium">{t('Copied')}</div>}
</div>
);
}
export default SessionCopyLink;