Skip to content

chore(optimiser): Change UI to standardise the components#4267

Merged
leslieyip02 merged 24 commits intonusmodifications:masterfrom
thejus03:chore/UI-changes
Feb 18, 2026
Merged

chore(optimiser): Change UI to standardise the components#4267
leslieyip02 merged 24 commits intonusmodifications:masterfrom
thejus03:chore/UI-changes

Conversation

@thejus03
Copy link
Copy Markdown
Contributor

@thejus03 thejus03 commented Dec 5, 2025

@vercel
Copy link
Copy Markdown

vercel Bot commented Dec 5, 2025

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

A member of the Team first needs to authorize it.

@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 5, 2025

Codecov Report

❌ Patch coverage is 0% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 56.76%. Comparing base (988c6fd) to head (e4a42e6).
⚠️ Report is 173 commits behind head on master.

Files with missing lines Patch % Lines
...s/optimiser/OptimiserFAQ/OptimiserFAQComponent.tsx 0.00% 6 Missing ⚠️
...s/optimiser/OptimiserFAQ/OptimiserFAQContainer.tsx 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4267      +/-   ##
==========================================
+ Coverage   54.52%   56.76%   +2.23%     
==========================================
  Files         274      300      +26     
  Lines        6076     6957     +881     
  Branches     1455     1682     +227     
==========================================
+ Hits         3313     3949     +636     
- Misses       2763     3008     +245     

☔ 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.

@vercel
Copy link
Copy Markdown

vercel Bot commented Dec 15, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
nusmods-export Ready Ready Preview, Comment Feb 18, 2026 1:51pm
nusmods-website Ready Ready Preview, Comment Feb 18, 2026 1:51pm

Request Review

Copy link
Copy Markdown
Member

@leslieyip02 leslieyip02 left a comment

Choose a reason for hiding this comment

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

Generally LGTM. I think the FAQ section could be useful, so I think we could add a couple more questions.

Comment thread website/src/views/optimiser/OptimiserContainer/OptimiserDescription.scss Outdated
Comment on lines +42 to +43
The optimiser will explore thousands of timetable combination amongst your
selected modules that meet your preferences and return an optimal one.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Typo: "The optimiser will explore thousands of timetable combinations amongst your selected modules that meet your preferences and return an optimal one."

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Actually maybe we could expand this to explain how to use the optimiser?

What is the Timetable Optimiser?

Having trouble planning your timetable? The optimiser explores thousands of possible timetable configurations to help you find one that best fits your preferences.

You can indicate your preferences in the form above, and hit "Optimise Timetable" to generate an optimised timetable. When you click the "Open Optimised Timetable" button, it will bring you to a new page with the optimised timetable. If the timetable looks good to you, click "Import" to update your timetable.

Comment on lines +45 to +59
<p className={styles.bodyText}>
The returned timetable will be optimised for the following preferences:
<ul>
<b className={styles.boldConstraint}>Hard constraints</b>
<li>No live lessons on your chosen free days</li>
<li>No live lessons outside your preferred time range</li>

<b className={styles.boldConstraint}>Soft constraints</b>
<li>Minimise travel distance between class venues</li>
<li>Prioritise lunch break within your preferred time range</li>
<li>
Prioritise having less than your chosen number of consecutive hours of study
</li>
</ul>
</p>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe this could be a separate FAQ?

What does the optimiser prioritise?

While the optimiser will try to generate a timetable that matches your preferences as closely as possible, there are certain preferences that may be harder to meet (due to course schedules and conflicts).

When you submit your preferences, there will generate 2 types of constraints:

Hard Constraints

These constraints must be satisfied by the optimiser:

  • No live lessons on your chosen free days
  • No live lessons outside your preferred time range

Soft Constraints

These constraints may be loosened/ignored if it's not possible to generate a valid timetable:

  • Minimise travel distance between class venues
  • Prioritise lunch break within your preferred time range
  • Prioritise having less than your chosen number of consecutive hours of study

<span className={styles.toggleIcon}>{isOpen ? <ChevronUp /> : <ChevronDown />}</span>
</button>
</div>
<div
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we can add 1 more FAQ:

What happens if the optimiser can't generate a suitable timetable?

If there happens to conflicts in your selected modules or your preferences, the optimiser will still try to generate a timetable for you. However, it will only generate a partial timetable. You may have to edit the time table manually in this case.

(add more if you want)

@thejus03 thejus03 requested a review from leslieyip02 December 20, 2025 04:04
@leslieyip02
Copy link
Copy Markdown
Member

@greptile

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Feb 18, 2026

Confidence Score: 3/5

  • This PR has HTML validity issues that should be fixed before merging but no risk of data loss or security concerns
  • The PR introduces useful UI changes, but the new FAQ component has duplicate HTML IDs (rendered 4 times with the same IDs, breaking accessibility) and invalid HTML nesting (ul inside p). These are real issues that will produce browser warnings and incorrect accessibility behavior, but they won't crash the app.
  • Pay close attention to OptimiserFAQComponent.tsx (duplicate IDs) and OptimiserFAQContainer.tsx (invalid HTML nesting)

Important Files Changed

Filename Overview
website/src/views/optimiser/OptimiserFAQ/OptimiserFAQComponent.tsx New FAQ accordion component with duplicate hardcoded HTML IDs and unused Bootstrap global class names
website/src/views/optimiser/OptimiserFAQ/OptimiserFAQContainer.tsx FAQ container rendering 4 FAQ items; contains invalid HTML nesting (ul inside p tag)
website/src/views/optimiser/OptimiserFAQ/OptimiserFAQ.scss New stylesheet for FAQ accordion with custom animations and theming; uses hardcoded accent color values
website/src/views/optimiser/OptimiserContainer/OptimiserContent.tsx Imports and renders new FAQ container between error display and optimiser results
website/src/views/optimiser/OptimiserForm/OptimiserFreeDayConflicts.scss Replaced Bootstrap alert-warning composition with custom border/radius styles and updated warning colors
website/src/views/optimiser/OptimiserResults.scss Replaced Bootstrap alert-warning composition with custom styles; removed background-color from success section

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[OptimiserContent] --> B[OptimiserHeader]
    A --> C[OptimiserForm]
    A --> D[OptimiserButton]
    A --> E{Error?}
    E -->|Yes| F[ApiError]
    A --> G[OptimiserFAQContainer]
    G --> H[FAQComponent: What is the Timetable Optimiser?]
    G --> I[FAQComponent: What does the optimiser prioritise?]
    G --> J[FAQComponent: Can't generate suitable timetable?]
    G --> K[FAQComponent: What if I am a TA?]
    A --> L[OptimiserResults]

    style G fill:#fff3e0,stroke:#ff5138
    style H fill:#fff8f6,stroke:#ff5138
    style I fill:#fff8f6,stroke:#ff5138
    style J fill:#fff8f6,stroke:#ff5138
    style K fill:#fff8f6,stroke:#ff5138
Loading

Last reviewed commit: d90ff2e

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

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

9 files reviewed, 3 comments

Edit Code Review Agent Settings | Greptile

const [isOpen, setIsOpen] = useState<boolean>(false);
return (
<div className={styles.descriptionSection}>
<div className={classnames('accordion', styles.accordion)} id="optimiserDescriptionAccordion">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Duplicate HTML IDs across FAQ instances

FAQComponent is rendered 4 times in OptimiserFAQContainer, but uses hardcoded id attributes (optimiserDescriptionAccordion, optimiserAccordionHeading, optimiserAccordionBody). This produces 4 elements with each ID in the DOM, which is invalid HTML and breaks the aria-controls / aria-labelledby associations (they'll point at the first matching element rather than the sibling).

Consider generating unique IDs per instance, for example using React.useId() (React 18+) or passing an id prop:

const uniqueId = React.useId();
// then use `${uniqueId}-accordion`, `${uniqueId}-heading`, `${uniqueId}-body`
Prompt To Fix With AI
This is a comment left during a code review.
Path: website/src/views/optimiser/OptimiserFAQ/OptimiserFAQComponent.tsx
Line: 16

Comment:
**Duplicate HTML IDs across FAQ instances**

`FAQComponent` is rendered 4 times in `OptimiserFAQContainer`, but uses hardcoded `id` attributes (`optimiserDescriptionAccordion`, `optimiserAccordionHeading`, `optimiserAccordionBody`). This produces 4 elements with each ID in the DOM, which is invalid HTML and breaks the `aria-controls` / `aria-labelledby` associations (they'll point at the first matching element rather than the sibling).

Consider generating unique IDs per instance, for example using `React.useId()` (React 18+) or passing an `id` prop:

```
const uniqueId = React.useId();
// then use `${uniqueId}-accordion`, `${uniqueId}-heading`, `${uniqueId}-body`
```

How can I resolve this? If you propose a fix, please make it concise.

Comment thread website/src/views/optimiser/OptimiserFAQ/OptimiserFAQContainer.tsx Outdated
Comment on lines +37 to +39
className={classnames('collapse', styles.collapse, {
[styles.open]: isOpen,
})}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bootstrap collapse and card classes are no-ops

The global Bootstrap class names 'collapse', 'accordion', 'card', 'card-header', and 'card-body' used throughout this component have no effect because the project's Bootstrap import (website/src/styles/bootstrap/bootstrap.scss) has _transitions.scss and _card.scss commented out. These classes are inert and only add noise to the DOM. Consider removing them and relying solely on the CSS module classes.

Prompt To Fix With AI
This is a comment left during a code review.
Path: website/src/views/optimiser/OptimiserFAQ/OptimiserFAQComponent.tsx
Line: 37-39

Comment:
**Bootstrap `collapse` and `card` classes are no-ops**

The global Bootstrap class names `'collapse'`, `'accordion'`, `'card'`, `'card-header'`, and `'card-body'` used throughout this component have no effect because the project's Bootstrap import (`website/src/styles/bootstrap/bootstrap.scss`) has `_transitions.scss` and `_card.scss` commented out. These classes are inert and only add noise to the DOM. Consider removing them and relying solely on the CSS module classes.

How can I resolve this? If you propose a fix, please make it concise.

Copy link
Copy Markdown
Member

@leslieyip02 leslieyip02 left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for the patience!

@leslieyip02 leslieyip02 merged commit 801b2e3 into nusmodifications:master Feb 18, 2026
5 of 6 checks passed
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.

Optimiser: UI issues

2 participants