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

UI: Adds dark mode image for master slot empty state #1111

Merged
merged 8 commits into from
Apr 7, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Binary file added static/img/emptystates/masterslots-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
127 changes: 65 additions & 62 deletions static/js/redux/ui/SideBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,80 +103,80 @@

const savedTimetables = savedTimetablesState
? savedTimetablesState.map((t: Timetable) => (
<div className="tt-name" key={t.id} onClick={() => dispatch(loadTimetable(t))}>
{t.name}
<div className="tt-name" key={t.id} onClick={() => dispatch(loadTimetable(t))}>
{t.name}
<button
onClick={(event) =>
stopPropagation(
() => dispatch(alertsActions.alertDeleteTimetable(t)),
event
)
}
className="row-button"
>
<i className="fa fa-trash-o" />
</button>
<button
onClick={(event) =>
stopPropagation(() => dispatch(duplicateTimetable(t)), event)
}
className="row-button"
>
<i className="fa fa-clone" />
</button>
{!isMobile && activeTimetable.name !== t.name && (
<button
onClick={(event) =>
stopPropagation(
() => dispatch(alertsActions.alertDeleteTimetable(t)),
event
)
}
onClick={(event) => {
dispatch(
startComparingTimetables({
activeTimetable,
comparedTimetable: t,
theme: curTheme,
})
);
event.stopPropagation();
}}
className="row-button"
>
<i className="fa fa-trash-o" />
<i className="fa-solid fa-arrows-left-right" />
</button>
<button
onClick={(event) =>
stopPropagation(() => dispatch(duplicateTimetable(t)), event)
}
className="row-button"
>
<i className="fa fa-clone" />
</button>
{!isMobile && activeTimetable.name !== t.name && (
<button
onClick={(event) => {
dispatch(
startComparingTimetables({
activeTimetable,
comparedTimetable: t,
theme: curTheme,
})
);
event.stopPropagation();
}}
className="row-button"
>
<i className="fa-solid fa-arrows-left-right" />
</button>
)}
</div>
))
)}
</div>
))
: null;

// Contains all keys for masterSlots (Iterated over for hoveredCourse, i.e. state for index of up/down keyboard shortcuts)
const masterSlotList: number[] = [];

let masterSlots = mandatoryCourses
? mandatoryCourses.map((course) => {
const colourIndex =
course.id in courseToColourIndex
? courseToColourIndex[course.id]
: getNextAvailableColour(courseToColourIndex);
const professors = course.sections.map((section) => section.instructors);
const sectionId = timetable.slots.find(
(slot) => slot.course === course.id
).section;
const colourIndex =
course.id in courseToColourIndex
? courseToColourIndex[course.id]
: getNextAvailableColour(courseToColourIndex);
const professors = course.sections.map((section) => section.instructors);
const sectionId = timetable.slots.find(
(slot) => slot.course === course.id
).section;

masterSlotList.push(course.id);
masterSlotList.push(course.id);

return (
<MasterSlot
key={course.id}
sectionId={sectionId}
professors={professors}
colourIndex={colourIndex}
classmates={courseToClassmates[course.id]}
course={course}
fetchCourseInfo={() => dispatch(fetchCourseInfo(course.id))}
removeCourse={() => dispatch(addOrRemoveCourse(course.id))}
getShareLink={getShareLink}
colorData={colorData}
isHovered={masterSlotList[hoveredCourse] === course.id}
/>
);
})
return (
<MasterSlot
key={course.id}
sectionId={sectionId}
professors={professors}
colourIndex={colourIndex}
classmates={courseToClassmates[course.id]}
course={course}
fetchCourseInfo={() => dispatch(fetchCourseInfo(course.id))}
removeCourse={() => dispatch(addOrRemoveCourse(course.id))}
getShareLink={getShareLink}
colorData={colorData}
isHovered={masterSlotList[hoveredCourse] === course.id}
/>
);
})
: null;

// This detects changes to the size of masterSlotList (i.e. how many courses are on the current timetable) and updates the masterSlotList length accordingly
Expand Down Expand Up @@ -230,7 +230,10 @@
// @ts-ignore
masterSlots = (
<div className="empty-state">
<img src="/static/img/emptystates/masterslots.png" alt="No courses added." />
<img
src={curTheme.name == 'light' ? "/static/img/emptystates/masterslots.png" : "/static/img/emptystates/masterslots-dark.png"}

Check failure on line 234 in static/js/redux/ui/SideBar.tsx

View workflow job for this annotation

GitHub Actions / build (3.8, 14.x)

Expected '===' and instead saw '=='
alt="No courses added."
/>
<h4>Looks like you don&#39;t have any courses yet!</h4>
<h3>
Your selections will appear here along with credits, professors and friends in
Expand Down
Loading