Compare commits

...

4 Commits

Author SHA1 Message Date
AhtishamShahid
fb65e9597d fix: resolved linter errors 2023-03-29 13:59:38 +05:00
AhtishamShahid
1bf861ef1e fix: resolved linter issues 2023-03-29 13:59:38 +05:00
AhtishamShahid
e11bd9f141 feat: added support for dual feedback forms 2023-03-29 13:59:38 +05:00
AhtishamShahid
f07d72f2b0 feat: added support for dual feedback forms 2023-03-29 13:59:38 +05:00
3 changed files with 40 additions and 5 deletions

View File

@@ -180,10 +180,7 @@
var r = (window.lightningjs = t(e));
(r.require = t), (r.modules = n);
})({});
window.usabilla_live = lightningjs.require(
"usabilla_live",
"//w.usabilla.com/9e6036348fa1.js"
);
</script>
<!-- end usabilla live embed code -->
</body>

View File

@@ -29,6 +29,7 @@ import { postMessageToParent } from '../utils';
import BlackoutInformationBanner from './BlackoutInformationBanner';
import DiscussionContent from './DiscussionContent';
import DiscussionSidebar from './DiscussionSidebar';
import useFeedbackWrapper from './FeedbackWrapper';
import InformationBanner from './InformationBanner';
export default function DiscussionsHome() {
@@ -52,7 +53,7 @@ export default function DiscussionsHome() {
useCourseDiscussionData(courseId);
useRedirectToThread(courseId, enableInContextSidebar);
useFeedbackWrapper();
/* Display the content area if we are currently viewing/editing a post or creating one.
If the window is larger than a particular size, show the sidebar for navigating between posts/topics.
However, for smaller screens or embeds, onlyshow the sidebar if the content area isn't displayed. */

View File

@@ -0,0 +1,37 @@
import { useEffect } from 'react';
import { useSelector } from 'react-redux';
import { logError } from '@edx/frontend-platform/logging';
import { RequestStatus } from '../../data/constants';
import {
selectconfigLoadingStatus,
selectIsCourseAdmin,
selectIsCourseStaff,
selectUserIsGroupTa,
selectUserIsStaff,
} from '../data/selectors';
export default function useFeedbackWrapper() {
const isStaff = useSelector(selectUserIsStaff);
const isUserGroupTA = useSelector(selectUserIsGroupTa);
const isCourseAdmin = useSelector(selectIsCourseAdmin);
const isCourseStaff = useSelector(selectIsCourseStaff);
const configStatus = useSelector(selectconfigLoadingStatus);
useEffect(() => {
if (configStatus === RequestStatus.SUCCESSFUL) {
let url = '//w.usabilla.com/9e6036348fa1.js';
if (isStaff || isUserGroupTA || isCourseAdmin || isCourseStaff) {
url = '//w.usabilla.com/767740a06856.js';
}
try {
// eslint-disable-next-line no-undef
window.usabilla_live = lightningjs.require('usabilla_live', url);
} catch (err) {
logError(err);
}
}
}, [configStatus]);
}