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

Roadmap Search Redesign (Part 1) #514

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open

Conversation

Awesome-E
Copy link
Member

@Awesome-E Awesome-E commented Nov 17, 2024

Description

SortableJS instead of React Beautiful DND

This library makes the animations more smooth when being dragged (cloned) from the search bar and when being dropped (inserted) into a quarter in the user's roadmap.

Previously, it used to move the dragged element into the quarter, then have a sudden transition in it's shape as it re-rendered the component. Now, there's a placeholder component when dragging so there's no layout change.

Compare https://peterportal.org/roadmap vs https://staging-514.peterportal.org/roadmap

Search Layout and Desktop Year Layout

  • Quarters with one row won't take up the whole space (this looked really weird with just a fall quarter, for example).
  • When the search box is empty, the course bag is shown instead of a placeholder message.

Before (left) and after (right):

Mobile "Add Course" Menu

  • This is now a slide-in-from-bottom panel instead of a floating window that replaces the entire page content
  • The quarter is now shown on the cancel button so users have context of the quarter before they tap a course
  • When tapping a course, the full information is shown, and this serves as the confirmation instead of a popup that shows the year and quarter name

Before:

After:

Steps to verify/test this change:

  • Verify changes work as expected on staging instance
  • Verify successful deployment

Issues

Didn't find any

@Awesome-E Awesome-E requested a review from js0mmer December 7, 2024 01:59
@Awesome-E Awesome-E changed the title [Incomplete] Roadmap search redesign Roadmap Search Redesign Dec 7, 2024
@Awesome-E Awesome-E changed the title Roadmap Search Redesign Roadmap Search Redesign (Part 1) Dec 7, 2024
@Awesome-E Awesome-E marked this pull request as ready for review December 7, 2024 01:59
Copy link
Member

@js0mmer js0mmer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The grabbing cursor only shows when you first start the drag and are still hovering over the original spot which bothers me. I think the way around would have to be adding/removing the cursor: grabbing style to the document body within the onStart and onEnd listeners for dragging.


.add-course-modal {
@include globals.bottom-overlay(500);
background-color: var(--background);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
background-color: var(--background);
background-color: var(--overlay1);

background color is a little dark IMO in dark mode, and for most modals or divs containing content, the background is overlay1 or 2 so this would be more consistent

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

react-beautiful-dnd still needs to be removed as well as any dead code (e.g. CourseHitItem component in RoadmapPage)

@@ -112,8 +113,7 @@ const SideBar = () => {
<div className="sidebar mini">{links}</div>
<CSSTransition in={showSidebar} timeout={500} unmountOnExit>
{/* Clicking this is only an alternative action to something that is already accessible */}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this comment looks like it can be removed

.add-course-form {
border-radius: var(--border-radius);
// border-radius: var(--border-radius);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// border-radius: var(--border-radius);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this component is unused right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can be deleted

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this file still used?


const { coursebag } = useCoursebag();
const { results, searchInProgress } = useAppSelector((state) => state.search.courses);
const shownCourses = JSON.parse(JSON.stringify(showCourseBag ? coursebag : results)) as CourseGQLData[];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume JSON.parse(JSON.stringify(...) is a way to make a deep copy of the array of courses. Is that necessary? If so, add a comment stating why. Also not sure if this is the best way to make a deep copy but can't think of any other off the top of my head.

</Draggable>
);
});
const coursesCopy = JSON.parse(JSON.stringify(data.courses));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment I had for SearchSidebar

@js0mmer js0mmer linked an issue Dec 10, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Roadmap search is cut off
2 participants