diff --git a/src/components/ToggleXpertButton/index.jsx b/src/components/ToggleXpertButton/index.jsx
index da1d95d1..455affbd 100644
--- a/src/components/ToggleXpertButton/index.jsx
+++ b/src/components/ToggleXpertButton/index.jsx
@@ -7,7 +7,8 @@ import {
Button,
Icon,
IconButton,
- ProductTour,
+ ModalCloseButton,
+ ModalPopup,
} from '@edx/paragon';
import { Close } from '@edx/paragon/icons';
@@ -20,7 +21,9 @@ const ToggleXpert = ({
courseId,
contentToolsEnabled,
}) => {
- const [hasDismissed, setHasDismissed] = useState(false);
+ const [hasDismissedCTA, setHasDismissedCTA] = useState(false);
+ const [isModalOpen, setIsModalOpen] = useState(true);
+ const [target, setTarget] = useState(null);
const { userId } = getAuthenticatedUser();
const handleClick = (event) => {
@@ -35,6 +38,8 @@ const ToggleXpert = ({
},
);
}
+ setIsModalOpen(false);
+ localStorage.setItem('completedLearningAssistantTour', 'true');
setIsOpen(!isOpen);
};
@@ -42,16 +47,16 @@ const ToggleXpert = ({
// prevent default and propagation to prevent sidebar from opening
event.preventDefault();
event.stopPropagation();
- setHasDismissed(true);
+ setHasDismissedCTA(true);
localStorage.setItem('dismissedLearningAssistantCallToAction', 'true');
sendTrackEvent('edx.ui.lms.learning_assistant.dismiss_action_message', {
course_id: courseId,
});
};
- const handleProductTourEnd = () => {
- setIsOpen(true);
+ const handleModalClose = () => {
localStorage.setItem('completedLearningAssistantTour', 'true');
+ setIsModalOpen(false);
sendTrackEvent(
'edx.ui.lms.learning_assistant.launch',
{
@@ -62,31 +67,53 @@ const ToggleXpert = ({
);
};
- const learningAssistantTour = {
- tourId: 'learningAssistantTour',
- endButtonText: 'Check it out',
- onEnd: () => { handleProductTourEnd(); },
- enabled: !localStorage.getItem('completedLearningAssistantTour'),
- checkpoints: [
- {
- placement: 'left',
- target: '#cta-button',
- body: 'Xpert is a new part of your learning experience. '
- + 'You can ask questions and get tutoring help during your course.',
- },
- ],
- };
+ const shouldDisplayCTA = (
+ (!localStorage.getItem('dismissedLearningAssistantCallToAction') && !hasDismissedCTA)
+ && (localStorage.getItem('completedLearningAssistantTour') || !isModalOpen)
+ );
return (
(!isOpen && (
<>
-
+ Xpert is a new part of your learning experience.
+ You can ask questions and get tutoring help during your course.
+