Skip to content

Commit

Permalink
chore: make notification trigger default to open for audit user
Browse files Browse the repository at this point in the history
  • Loading branch information
leangseu-edx committed Nov 8, 2023
1 parent 9a0cdc0 commit 34f1468
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions src/courseware/course/Course.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const Course = ({
const {
celebrations,
isStaff,
verifiedMode,
} = useModel('courseHomeMeta', courseId);
const sequence = useModel('sequences', sequenceId);
const section = useModel('sections', sequence ? sequence.sectionId : null);
Expand All @@ -54,17 +55,15 @@ const Course = ({
const shouldDisplayTriggers = windowWidth >= breakpoints.small.minWidth;
const daysPerWeek = course?.courseGoals?.selectedGoal?.daysPerWeek;

// Responsive breakpoints for showing the notification button/tray
const shouldDisplayNotificationTrayOpenOnLoad = windowWidth > breakpoints.medium.minWidth;

// Course specific notification tray open/closed persistance by browser session
if (!getSessionStorage(`notificationTrayStatus.${courseId}`)) {
if (shouldDisplayNotificationTrayOpenOnLoad) {
setSessionStorage(`notificationTrayStatus.${courseId}`, 'open');
} else {
// responsive version displays the tray closed on initial load, set the sessionStorage to closed
setSessionStorage(`notificationTrayStatus.${courseId}`, 'closed');
}
// open the notification tray if the user has not purchased the course and is on a desktop
const shouldDisplayNotificationTrayOpenOnLoad = windowWidth > breakpoints.medium.minWidth && !!verifiedMode;

if (shouldDisplayNotificationTrayOpenOnLoad) {
setSessionStorage(`notificationTrayStatus.${courseId}`, 'open');
}

Check failure on line 63 in src/courseware/course/Course.jsx

View workflow job for this annotation

GitHub Actions / tests

Closing curly brace does not appear on the same line as the subsequent block
// default to closed if the user has purchased the course and hasn't opened the tray yet
else if (!getSessionStorage(`notificationTrayStatus.${courseId}`)) {
setSessionStorage(`notificationTrayStatus.${courseId}`, 'closed');
}

useEffect(() => {
Expand Down

0 comments on commit 34f1468

Please sign in to comment.