chore(optimiser): Change UI to standardise the components#4267
chore(optimiser): Change UI to standardise the components#4267leslieyip02 merged 24 commits intonusmodifications:masterfrom
Conversation
…d update color scheme
|
@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 Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
leslieyip02
left a comment
There was a problem hiding this comment.
Generally LGTM. I think the FAQ section could be useful, so I think we could add a couple more questions.
| The optimiser will explore thousands of timetable combination amongst your | ||
| selected modules that meet your preferences and return an optimal one. |
There was a problem hiding this comment.
Typo: "The optimiser will explore thousands of timetable combinations amongst your selected modules that meet your preferences and return an optimal one."
There was a problem hiding this comment.
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.
| <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> |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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)
…ontainer and components, and add new styles
|
@greptile |
Confidence Score: 3/5
|
| 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
Last reviewed commit: d90ff2e
| const [isOpen, setIsOpen] = useState<boolean>(false); | ||
| return ( | ||
| <div className={styles.descriptionSection}> | ||
| <div className={classnames('accordion', styles.accordion)} id="optimiserDescriptionAccordion"> |
There was a problem hiding this 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`
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.| className={classnames('collapse', styles.collapse, { | ||
| [styles.open]: isOpen, | ||
| })} |
There was a problem hiding this 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.
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.…ty and improve markup structure
…cy and responsiveness
… markup in FAQComponent
leslieyip02
left a comment
There was a problem hiding this comment.
LGTM! Thanks for the patience!
Context