Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add Feedback component #38

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/course-home/outline-tab/OutlineTab.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { sendTrackEvent } from '@edx/frontend-platform/analytics';
import { getAuthenticatedUser } from '@edx/frontend-platform/auth';
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
import { Button } from '@openedx/paragon';
import { FeedbackModal, useProgressStatus } from '@edunext/frontend-essentials';
import { AlertList } from '../../generic/user-messages';

import CourseDates from './widgets/CourseDates';
Expand Down Expand Up @@ -123,6 +124,8 @@ const OutlineTab = ({ intl }) => {
}
}, [location.search]);

const { isComplete, isGraded, isPassing } = useProgressStatus(courseId);

return (
<>
<div data-learner-type={learnerType} className="row w-100 mx-0 my-3 justify-content-between">
Expand Down Expand Up @@ -211,6 +214,7 @@ const OutlineTab = ({ intl }) => {
<CourseHandouts />
</div>
)}
<FeedbackModal courseId={courseId} showModal={isGraded ? isPassing : isComplete} />
</div>
</>
);
Expand Down
4 changes: 4 additions & 0 deletions src/course-home/outline-tab/OutlineTab.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ describe('Outline Tab', () => {
const masqueradeUrl = `${getConfig().LMS_BASE_URL}/courses/${courseId}/masquerade`;
const outlineUrl = `${getConfig().LMS_BASE_URL}/api/course_home/outline/${courseId}`;
const proctoringInfoUrl = `${getConfig().LMS_BASE_URL}/api/edx_proctoring/v1/user_onboarding/status?is_learning_mfe=true&course_id=${encodeURIComponent(courseId)}&username=MockUser`;
const progressUrl = `${getConfig().LMS_BASE_URL}/api/course_home/progress/${courseId}`;

const store = initializeStore();
const defaultMetadata = Factory.build('courseHomeMetadata');
Expand Down Expand Up @@ -94,6 +95,9 @@ describe('Outline Tab', () => {
onboarding_link: 'test',
expiration_date: null,
});
// This will return 404 in order to set the failure behavior and don't set extra
// extra conditions required by the success path.
axiosMock.onGet(progressUrl).reply(404, {});

// Mock courseware search params
mockSearchParams();
Expand Down
4 changes: 4 additions & 0 deletions src/product-tours/ProductTours.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ describe('Course Home Tours', () => {
const outlineUrl = `${getConfig().LMS_BASE_URL}/api/course_home/outline/${courseId}`;
const tourDataUrl = `${getConfig().LMS_BASE_URL}/api/user_tours/v1/MockUser`;
const proctoringUrl = `${getConfig().LMS_BASE_URL}/api/edx_proctoring/v1/user_onboarding/status?is_learning_mfe=true&course_id=course-v1%3AedX%2BTest%2Brun&username=MockUser`;
const progressUrl = `${getConfig().LMS_BASE_URL}/api/course_home/progress/${courseId}`;

const store = initializeStore();
const defaultTabData = Factory.build('outlineTabData');
Expand Down Expand Up @@ -80,6 +81,9 @@ describe('Course Home Tours', () => {
course_home_tour_status: 'no-tour',
show_courseware_tour: false,
});
// This will return 404 in order to set the failure behavior and don't set extra
// extra conditions required by the success path.
axiosMock.onGet(progressUrl).reply(404, {});

logUnhandledRequests(axiosMock);
});
Expand Down