Skip to content

Architectural Improvement of Settings Page for Adaptive Multi-Section Desktop Rendering#74

Open
aniket866 wants to merge 3 commits intoAOSSIE-Org:mainfrom
aniket866:desktop-setting-page
Open

Architectural Improvement of Settings Page for Adaptive Multi-Section Desktop Rendering#74
aniket866 wants to merge 3 commits intoAOSSIE-Org:mainfrom
aniket866:desktop-setting-page

Conversation

@aniket866
Copy link
Contributor

@aniket866 aniket866 commented Feb 12, 2026

Addressed Issues:

Closes #73

previous:

screen-capture.25.webm

Screenshots/Recordings:

screen-capture.24.webm

Additional Notes:

Checklist

  • My PR addresses a single issue, fixes a single bug or makes a single improvement.
  • My code follows the project's code style and conventions
  • My changes generate no new warnings or errors
  • I have joined the Discord server and I will share a link to this PR with the project maintainers there
  • I have read the Contribution Guidelines
  • Once I submit my PR, CodeRabbit AI will automatically review it and I will address CodeRabbit's comments.

⚠️ AI Notice - Important!

We encourage contributors to use AI tools responsibly when creating Pull Requests. While AI can be a valuable aid, it is essential to ensure that your contributions meet the task requirements, build successfully, include relevant tests, and pass all linters. Submissions that do not meet these standards may be closed without warning to maintain the quality and integrity of the project. Please take the time to understand the changes you are proposing and their impact.

@imxade Please check this out , an improvement to the desktop viewport , can be merged.

Thankyou

Summary by CodeRabbit

  • New Features

    • Redesigned settings page with a two-column responsive layout: settings controls on the left and a sticky "Connect Mobile" panel (QR code + trackpad link) on the right.
    • Prominent Save Config button preserved for saving settings.
  • UI Improvements

    • Improved layout, container sizing and heading spacing for clearer visual hierarchy.
    • Warning alert and footer repositioned for better context and accessibility.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 12, 2026

Warning

Rate limit exceeded

@aniket866 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 18 minutes and 7 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📝 Walkthrough

Walkthrough

Refactors the Settings page from a single-column to a responsive two-column layout: left column contains the settings form (IP, mouse sensitivity, invert scroll, port, warning, Save), right column contains a sticky "Connect Mobile" panel with QR code and trackpad link. Functionality unchanged.

Changes

Cohort / File(s) Summary
Settings Layout Refactor
src/routes/settings.tsx
Reworked UI into a two-column responsive layout. Left column: settings form (server IP, mouse sensitivity, invert scroll, port), warning alert, Save Config button. Right column: sticky "Connect Mobile" card with QR visualization and trackpad URL link; footer moved into right column. Adjusted container widths and heading margins; preserved existing WebSocket save/navigation behavior.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • client-server-settings #66: Modifies src/routes/settings.tsx and the settings UI/save flow (client-side mouse settings and update-config payload changes), showing direct code-level overlap.

Poem

🐰 I hopped the layout, left and right,

Two columns now to greet the light.
A sticky QR, a save that sings,
Trackpad link on nimble wings.
Hooray — the settings take a flight! 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: converting Settings page from single-column to two-column responsive layout for desktop, which matches the primary focus of the changeset.
Linked Issues check ✅ Passed The PR successfully implements the core requirement from issue #73: refactoring the Settings page to support multi-column layout for desktop viewports, reducing vertical stacking and improving QR section positioning.
Out of Scope Changes check ✅ Passed All changes are scoped to the Settings page layout refactoring as defined in issue #73; no unrelated modifications detected outside the two-column redesign objective.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@src/routes/settings.tsx`:
- Around line 113-127: Add explicit id/htmlFor associations for the IP and Port
inputs to satisfy accessibility checks: give the IP input element (the one with
value={ip} and onChange={e => setIp(e.target.value)}) a unique id (e.g.
"remote-ip") and update its corresponding label (the one with text "Server IP
(for Remote)") to include htmlFor="remote-ip"; do the same for the Port input
(the one with value={port} and onChange={e => setPort(e.target.value)}) using a
matching id (e.g. "remote-port") and htmlFor on its label; leave the small
descriptive/alt labels as spans or keep them unchanged.
- Around line 194-221: The Save Config button in src/routes/settings.tsx is
missing an explicit type and will default to type="submit", which can
unintentionally submit a parent form; update the JSX button element (the
<button> that constructs and uses WebSocket/send logic) to include type="button"
so clicking it only runs the onClick handler and does not trigger form
submission.
🧹 Nitpick comments (1)
src/routes/settings.tsx (1)

196-216: No validation or error handling on save.

parseInt(frontendPort) will produce NaN for non-numeric input, causing a redirect to an invalid URL. Consider adding basic validation before sending the WebSocket message. The missing socket.onerror handler is pre-existing, but worth noting — a failed connection silently drops the save action with no user feedback.

Sketch: validate port before sending
                             onClick={() => {
+                                const port = parseInt(frontendPort);
+                                if (!Number.isFinite(port) || port < 1 || port > 65535) {
+                                    alert('Please enter a valid port number (1–65535).');
+                                    return;
+                                }
                                 const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
                                 const host = window.location.host;
                                 const wsUrl = `${protocol}//${host}/ws`;
                                 const socket = new WebSocket(wsUrl);

                                 socket.onopen = () => {
                                     socket.send(JSON.stringify({
                                         type: 'update-config',
                                         config: {
-                                            frontendPort: parseInt(frontendPort),
+                                            frontendPort: port,
                                         }
                                     }));

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/routes/settings.tsx (1)

52-66: ⚠️ Potential issue | 🟡 Minor

QR code and display URL ignore the user-editable port value.

displayUrl (Line 102) and the QR code effect (Line 58–60) both use CONFIG.FRONTEND_PORT instead of the frontendPort state. If a user changes the port in the input and saves, the QR code and link still point to the old port, which would be confusing. Consider using frontendPort and adding it to the effect's dependency array.

Proposed fix for the QR effect
     useEffect(() => {
         if (!ip) return;
         localStorage.setItem('rein_ip', ip);
 
         if (typeof window !== 'undefined') {
-            const appPort = String(CONFIG.FRONTEND_PORT);
+            const appPort = frontendPort || String(CONFIG.FRONTEND_PORT);
             const protocol = window.location.protocol;
             const shareUrl = `${protocol}//${ip}:${appPort}/trackpad`;
 
             QRCode.toDataURL(shareUrl)
                 .then(setQrData)
                 .catch((e) => console.error('QR Error:', e));
         }
-    }, [ip]);
+    }, [ip, frontendPort]);
     const displayUrl = typeof window !== 'undefined'
-        ? `${window.location.protocol}//${ip}:${CONFIG.FRONTEND_PORT}/trackpad`
-        : `http://${ip}:${CONFIG.FRONTEND_PORT}/trackpad`;
+        ? `${window.location.protocol}//${ip}:${frontendPort}/trackpad`
+        : `http://${ip}:${frontendPort}/trackpad`;

Also applies to: 101-103

🤖 Fix all issues with AI agents
In `@src/routes/settings.tsx`:
- Around line 194-222: The Save Config onClick currently opens a WebSocket
(wsUrl) and only handles socket.onopen and a delayed redirect, but it lacks
socket.onerror/onclose handling and does not validate frontendPort before
parseInt; update the handler to: validate frontendPort (use
parseInt(frontendPort,10) and check Number.isFinite/!Number.isNaN and positive
port range) and show an error/early return if invalid, attach socket.onerror and
socket.onclose to surface connection errors to the user (e.g., set an error
state or alert) and clean up the socket on failure, and keep the existing
socket.onopen flow otherwise so you never send NaN to the server or redirect to
an invalid URL; reference: frontendPort, onClick handler, WebSocket/socket,
socket.onopen, socket.onerror, socket.onclose, parseInt.

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
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.

[Feature]: Refactor Settings Page for Multi-Column Desktop Structure

1 participant