2024-01-26 20:02:48 +00:00
|
|
|
import { IconButton, Tooltip } from '@invoke-ai/ui-library';
|
2023-12-29 03:05:56 +00:00
|
|
|
import { memo } from 'react';
|
2023-12-28 13:03:21 +00:00
|
|
|
import { useTranslation } from 'react-i18next';
|
2024-01-19 03:40:31 +00:00
|
|
|
import { PiCodeBold } from 'react-icons/pi';
|
2023-12-28 13:03:21 +00:00
|
|
|
|
|
|
|
type Props = {
|
|
|
|
isOpen: boolean;
|
|
|
|
onOpen: () => void;
|
|
|
|
};
|
|
|
|
|
2023-12-29 03:05:56 +00:00
|
|
|
export const AddEmbeddingButton = memo((props: Props) => {
|
2023-12-28 13:03:21 +00:00
|
|
|
const { onOpen, isOpen } = props;
|
|
|
|
const { t } = useTranslation();
|
|
|
|
return (
|
2024-01-20 00:04:19 +00:00
|
|
|
<Tooltip label={t('embedding.addEmbedding')}>
|
|
|
|
<IconButton
|
2023-12-28 13:03:21 +00:00
|
|
|
variant="promptOverlay"
|
|
|
|
isDisabled={isOpen}
|
|
|
|
aria-label={t('embedding.addEmbedding')}
|
2024-01-18 04:08:38 +00:00
|
|
|
icon={<PiCodeBold />}
|
2023-12-28 13:03:21 +00:00
|
|
|
onClick={onOpen}
|
|
|
|
/>
|
2024-01-20 00:04:19 +00:00
|
|
|
</Tooltip>
|
2023-12-28 13:03:21 +00:00
|
|
|
);
|
2023-12-29 03:05:56 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
AddEmbeddingButton.displayName = 'AddEmbeddingButton';
|