|
@@ -1,12 +1,12 @@
|
|
|
import React, { useCallback } from 'react';
|
|
import React, { useCallback } from 'react';
|
|
|
|
|
|
|
|
-import { useIsAiEnabled, useIsGuestUser } from '~/stores-universal/context';
|
|
|
|
|
|
|
+import { NotAvailableForGuest } from '~/client/components/NotAvailableForGuest';
|
|
|
|
|
+import { useIsAiEnabled } from '~/stores-universal/context';
|
|
|
import { useRagSearchModal } from '~/stores/rag-search';
|
|
import { useRagSearchModal } from '~/stores/rag-search';
|
|
|
|
|
|
|
|
import styles from './RagSearchButton.module.scss';
|
|
import styles from './RagSearchButton.module.scss';
|
|
|
|
|
|
|
|
const RagSearchButton = (): JSX.Element => {
|
|
const RagSearchButton = (): JSX.Element => {
|
|
|
- const { data: isGuestUser } = useIsGuestUser();
|
|
|
|
|
const { data: isAiEnabled } = useIsAiEnabled();
|
|
const { data: isAiEnabled } = useIsAiEnabled();
|
|
|
const { open: openRagSearchModal } = useRagSearchModal();
|
|
const { open: openRagSearchModal } = useRagSearchModal();
|
|
|
|
|
|
|
@@ -14,19 +14,21 @@ const RagSearchButton = (): JSX.Element => {
|
|
|
openRagSearchModal();
|
|
openRagSearchModal();
|
|
|
}, [openRagSearchModal]);
|
|
}, [openRagSearchModal]);
|
|
|
|
|
|
|
|
- if (!isAiEnabled || isGuestUser) {
|
|
|
|
|
|
|
+ if (!isAiEnabled) {
|
|
|
return <></>;
|
|
return <></>;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
|
- <button
|
|
|
|
|
- type="button"
|
|
|
|
|
- className={`btn btn-search ${styles['btn-rag-search']}`}
|
|
|
|
|
- onClick={ragSearchButtonClickHandler}
|
|
|
|
|
- data-testid="open-search-modal-button"
|
|
|
|
|
- >
|
|
|
|
|
- <span className="material-symbols-outlined">chat</span>
|
|
|
|
|
- </button>
|
|
|
|
|
|
|
+ <NotAvailableForGuest>
|
|
|
|
|
+ <button
|
|
|
|
|
+ type="button"
|
|
|
|
|
+ className={`btn btn-search ${styles['btn-rag-search']}`}
|
|
|
|
|
+ onClick={ragSearchButtonClickHandler}
|
|
|
|
|
+ data-testid="open-search-modal-button"
|
|
|
|
|
+ >
|
|
|
|
|
+ <span className="material-symbols-outlined">chat</span>
|
|
|
|
|
+ </button>
|
|
|
|
|
+ </NotAvailableForGuest>
|
|
|
);
|
|
);
|
|
|
};
|
|
};
|
|
|
|
|
|