-
Notifications
You must be signed in to change notification settings - Fork 288
feat: full lift simulation with malfunction mode and UI enhancements (#18) #41
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
base: main
Are you sure you want to change the base?
feat: full lift simulation with malfunction mode and UI enhancements (#18) #41
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Summary by CodeRabbit
WalkthroughA full-featured lift simulation web application was implemented, including a new HTML structure, comprehensive CSS styling, and a JavaScript class handling lift operations, state management, UI updates, and malfunction simulation. The README was extensively rewritten to document features, milestones, and enhanced capabilities, with new UI images added. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant UI (index.html)
participant LiftSimulation (main.js)
participant Lift
User->>UI (index.html): Enter lift number & click "Disable"
UI (index.html)->>LiftSimulation: disableLift()
LiftSimulation->>Lift: Set disabled=true, clear queue
LiftSimulation->>Lift: Move to nearest floor, open doors
Lift-->>LiftSimulation: Status updated, doors open
LiftSimulation->>UI (index.html): Update lift visual (red border), update status display
Assessment against linked issues
Poem
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review by Korbit AI
Korbit automatically attempts to detect when you fix issues in new commits.
| Category | Issue | Status |
|---|---|---|
| Inconsistent Method Indentation ▹ view | ||
| Violation of Single Responsibility Principle ▹ view | ||
| Silent Failure in Door Operation ▹ view | ||
| Queue Loss During Lift Failure ▹ view | ||
| Missing max value constraint for lift ID ▹ view | ||
| Missing Simulation Component Structure ▹ view | ||
| Non-Optimized CSS Loading ▹ view | ||
| Blocking Script Load ▹ view | ||
| Vague Dynamic Content Comment ▹ view | ||
| Improper HTML Element Spacing ▹ view | ✅ Fix detected |
Files scanned
| File Path | Reviewed |
|---|---|
| src/index.html | ✅ |
| src/js/main.js | ✅ |
Explore our documentation to understand the languages and file types we support and the files we ignore.
Check out our docs on how you can make Korbit work best for you and your team.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 6
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
⛔ Files ignored due to path filters (3)
image-1.pngis excluded by!**/*.pngimage-3.pngis excluded by!**/*.pngimage.pngis excluded by!**/*.png
📒 Files selected for processing (4)
README.md(1 hunks)src/css/main.css(1 hunks)src/index.html(1 hunks)src/js/main.js(1 hunks)
🧰 Additional context used
🪛 LanguageTool
README.md
[uncategorized] ~33-~33: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ... every floor where it was called ✓ - Mobile friendly design ✓ Enhanced Features (New):...
(EN_COMPOUND_ADJECTIVE_INTERNAL)
🪛 markdownlint-cli2 (0.17.2)
README.md
6-6: Multiple consecutive blank lines
Expected: 1; Actual: 4
(MD012, no-multiple-blanks)
7-7: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
7-7: Multiple top-level headings in the same document
null
(MD025, single-title, single-h1)
8-8: Lists should be surrounded by blank lines
null
(MD032, blanks-around-lists)
19-19: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
19-19: Multiple top-level headings in the same document
null
(MD025, single-title, single-h1)
20-20: Lists should be surrounded by blank lines
null
(MD032, blanks-around-lists)
25-25: Unordered list indentation
Expected: 0; Actual: 3
(MD007, ul-indent)
25-25: Lists should be surrounded by blank lines
null
(MD032, blanks-around-lists)
26-26: Unordered list indentation
Expected: 0; Actual: 3
(MD007, ul-indent)
27-27: Unordered list indentation
Expected: 0; Actual: 3
(MD007, ul-indent)
28-28: Trailing spaces
Expected: 0 or 2; Actual: 3
(MD009, no-trailing-spaces)
30-30: Unordered list indentation
Expected: 0; Actual: 3
(MD007, ul-indent)
30-30: Lists should be surrounded by blank lines
null
(MD032, blanks-around-lists)
31-31: Unordered list indentation
Expected: 0; Actual: 3
(MD007, ul-indent)
32-32: Unordered list indentation
Expected: 0; Actual: 3
(MD007, ul-indent)
33-33: Unordered list indentation
Expected: 0; Actual: 3
(MD007, ul-indent)
34-34: Trailing spaces
Expected: 0 or 2; Actual: 3
(MD009, no-trailing-spaces)
36-36: Unordered list indentation
Expected: 0; Actual: 3
(MD007, ul-indent)
36-36: Lists should be surrounded by blank lines
null
(MD032, blanks-around-lists)
37-37: Unordered list indentation
Expected: 0; Actual: 3
(MD007, ul-indent)
38-38: Unordered list indentation
Expected: 0; Actual: 3
(MD007, ul-indent)
39-39: Unordered list indentation
Expected: 0; Actual: 3
(MD007, ul-indent)
40-40: Unordered list indentation
Expected: 0; Actual: 3
(MD007, ul-indent)
41-41: Unordered list indentation
Expected: 0; Actual: 3
(MD007, ul-indent)
43-43: Trailing spaces
Expected: 0 or 2; Actual: 1
(MD009, no-trailing-spaces)
43-43: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
43-43: Multiple top-level headings in the same document
null
(MD025, single-title, single-h1)
46-46: Files should end with a single newline character
null
(MD047, single-trailing-newline)
🪛 Biome (1.9.4)
src/js/main.js
[error] 608-621: Avoid classes that contain only static members.
Prefer using simple functions instead of classes with only static members.
(lint/complexity/noStaticOnlyClass)
[error] 27-27: Use Number.parseInt instead of the equivalent global.
ES2015 moved some globals into the Number namespace for consistency.
Safe fix: Use Number.parseInt instead.
(lint/style/useNumberNamespace)
[error] 28-28: Use Number.parseInt instead of the equivalent global.
ES2015 moved some globals into the Number namespace for consistency.
Safe fix: Use Number.parseInt instead.
(lint/style/useNumberNamespace)
[error] 439-439: Use Number.parseInt instead of the equivalent global.
ES2015 moved some globals into the Number namespace for consistency.
Safe fix: Use Number.parseInt instead.
(lint/style/useNumberNamespace)
🔇 Additional comments (1)
src/js/main.js (1)
298-308: ```shell
#!/bin/bashDisplay the body of operateDoors to check for internal delays
sed -n '405,480p' src/js/main.js
</details> </blockquote></details> </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
🚀 Pull Request: Lift Simulation Enhancement & Maintenance Mode
This PR implements the full lift simulation web app from scratch as per the issue request, along with several enhancements and a special malfunction/maintenance feature.
✅ Features Implemented from Scratch
Fully built the UI and logic from empty files (index.html, main.css, main.js)
User inputs number of floors and lifts to generate the simulation
Interactive lift call buttons on each floor
Lifts move to requested floors with animation and realistic timings:
2s per floor travel
2.5s door open + 2.5s door close delay
Responsive design with mobile support
🛠️ Lift Identification & UI Enhancements
Unique color schemes for each lift for clear distinction
Shaft identifiers for easy recognition
Lift ID labels improved for better visibility and contrast
Direction and arrival indicators added for better user feedback
Floor indicators and lift panels enhanced with clear visuals
🧠 Malfunction / Maintenance Mode (Fixes #18)
Input + button to enter a lift number (e.g., "Lift 2")
On submit:
Disables the lift
Moves it to the nearest floor
Doors open and stay open
Red border highlights the disabled lift
Lift stops responding to future requests
📦 Code Optimizations
Removed unused/placeholder code
Improved the lift allocation logic for better performance
Reorganized JS for modularity (generateUI(), moveLift(), disableLift(), etc.)
Optimized CSS and animations for smoother transitions
📱 Responsive Design
Layout adapts to mobile and tablet screens
UI elements scale appropriately for smaller displays
Buttons and labels remain accessible on all devices
🧪 Testing
Tested the simulation with various combinations:
3 to 10 floors
1 to 5 lifts
Edge cases like disabling a lift while moving
All transitions, UI states, and logic verified to be working smoothly
Let me know if you'd like any changes or refactoring. Happy to contribute! ✨
Description by Korbit AI
What change is being made?
Implement a full lift simulation with enhanced UI that includes malfunction mode, a sophisticated lift scheduling algorithm, detailed status displays, and improved animations and responsiveness.
Why are these changes being made?
To provide a more realistic and feature-rich lift simulation experience, addressing user feedback by enabling lift malfunction testing, enhancing visual and audio feedback, and optimizing lift operations with advanced algorithms. The enhancements aim to improve user interaction and simulate real-world lift mechanics more accurately.