Skip to content

website: Implement random course picker button #4039

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

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

Glenn-Chiang
Copy link

@Glenn-Chiang Glenn-Chiang commented Mar 20, 2025

Context

Closes #3671 random course picker button

Implementation

I added a "Random Course" button to the /courses page. When the button is clicked, the user will be redirected to the page of a random course.

image

Other Information

Hi, this is my first time contributing to an open source project. I hope that my changes are acceptable and look forward to making more substantial contributions as I learn more about the codebase.

Copy link

vercel bot commented Mar 20, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
nusmods-export ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 20, 2025 0:34am
nusmods-website ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 20, 2025 0:34am

Copy link

vercel bot commented Mar 20, 2025

@Glenn-Chiang is attempting to deploy a commit to the modsbot's projects Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

codecov bot commented Mar 20, 2025

Codecov Report

Attention: Patch coverage is 0% with 24 lines in your changes missing coverage. Please review.

Project coverage is 52.80%. Comparing base (988c6fd) to head (c1db282).
Report is 124 commits behind head on master.

Files with missing lines Patch % Lines
...te/src/views/components/searchkit/RandomPicker.tsx 0.00% 15 Missing ⚠️
website/src/views/modules/ModuleRandomButton.tsx 0.00% 9 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4039      +/-   ##
==========================================
- Coverage   54.52%   52.80%   -1.72%     
==========================================
  Files         274      290      +16     
  Lines        6076     6698     +622     
  Branches     1455     1631     +176     
==========================================
+ Hits         3313     3537     +224     
- Misses       2763     3161     +398     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@leslieyip02
Copy link
Member

Hi @Glenn-Chiang, thanks for the PR! Your code looks fine, and I think the course search page is a good place to put this feature. However, I think the feature would be more useful if it respected the search filters, so I've pushed some changes to support that as well.

Sorry for the late review!

@leslieyip02 leslieyip02 changed the title website: Implement random course picker button (#3735) website: Implement random course picker button Jul 7, 2025
@ZhangYiJiang
Copy link
Member

Not a blocker but I would suggest reviewing the UI/UX here a little.

The button is quite large and prominent for a feature that I'm not sure many students would use. Also the tooltip goes over the search bar

@leslieyip02
Copy link
Member

@ZhangYiJiang Maybe this would be better? I made the button more subtle and shifted the tooltip placement to bottom instead.

image

Copy link
Member

@ZhangYiJiang ZhangYiJiang left a comment

Choose a reason for hiding this comment

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

The new placement is better, but you might still want to iterate on this.

First it's best to avoid having interactive (the random course button) and non-interactive elements (the courses counter) share the exact same design, since that makes it hard to distinguish what you can interact with

Second I'm not sure adding the icons is a good idea since it doesn't really communicate anything that the text does not already, and kind of just adds noise, the page is already quite complex so you want to minimize these

@leslieyip02
Copy link
Member

leslieyip02 commented Jul 13, 2025

Another option would be the bottom of the filter list? This would allow the button to not be as jarring, but still visuallly look like a button.

image

@ZhangYiJiang
Copy link
Member

ZhangYiJiang commented Jul 16, 2025

I think that's a better placement yeah. The only change I would ask for is you're currently using a primary, which is typically reserved for the primary interactive element on the screen - think the submit button in a form for example. Here it's btn-secondary or even btn-link, since it's a navigational link of sorts, probably makes more sense

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature Request: Random Course Picker
4 participants