2024-05-21 09:33:24 +00:00
|
|
|
import { Flex, IconButton, Text } from '@invoke-ai/ui-library';
|
|
|
|
import { t } from 'i18next';
|
|
|
|
import { PiCopyBold } from 'react-icons/pi';
|
|
|
|
|
|
|
|
function onCopy(sessionId: string) {
|
|
|
|
navigator.clipboard.writeText(sessionId);
|
|
|
|
}
|
|
|
|
|
|
|
|
type Props = { message: string; sessionId: string };
|
|
|
|
|
|
|
|
export default function ToastWithSessionRefDescription({ message, sessionId }: Props) {
|
|
|
|
return (
|
|
|
|
<Flex flexDir="column">
|
|
|
|
<Text fontSize="md">{message}</Text>
|
|
|
|
<Flex gap="2" alignItems="center">
|
|
|
|
<Text fontSize="sm">{t('toast.sessionRef', { sessionId })}</Text>
|
|
|
|
<IconButton
|
|
|
|
size="sm"
|
|
|
|
aria-label="Copy"
|
|
|
|
icon={<PiCopyBold />}
|
|
|
|
onClick={onCopy.bind(null, sessionId)}
|
|
|
|
variant="ghost"
|
2024-05-21 19:52:49 +00:00
|
|
|
sx={sx}
|
2024-05-21 09:33:24 +00:00
|
|
|
/>
|
|
|
|
</Flex>
|
|
|
|
</Flex>
|
|
|
|
);
|
|
|
|
}
|
2024-05-21 19:52:49 +00:00
|
|
|
|
|
|
|
const sx = { svg: { fill: 'base.50' } };
|