Skip to content

Ui responsive for mobile#5

Open
Yuvraj-Sarathe wants to merge 2 commits into
KDM-cli:mainfrom
Yuvraj-Sarathe:responsive-ui
Open

Ui responsive for mobile#5
Yuvraj-Sarathe wants to merge 2 commits into
KDM-cli:mainfrom
Yuvraj-Sarathe:responsive-ui

Conversation

@Yuvraj-Sarathe
Copy link
Copy Markdown
Member

@Yuvraj-Sarathe Yuvraj-Sarathe commented May 25, 2026

The UI is now reponsive for mobile and it solves issue #4

The other files I change that are not related to UI are

  • vite.config.ts
  • scripts/patch-lovable-config.cjs
  • package.json (done during installing dependencies of vite)

The above two files are changed because when the website was made by lovavble the vite config used an outdated npm version that is no longer supported for most part. SO I made sure it is synced to my npm (current LTS)

Summary by CodeRabbit

  • New Features

    • Mobile navigation drawer (hamburger) added for improved navigation on small screens
  • Style

    • Metrics display updated to a responsive 1–3 column layout with adjusted typography
    • Terminal and command list sizing made more responsive across breakpoints
    • Command list overflow handling and button height refined for better touch/scroll behavior

Review Change Stack

@vercel
Copy link
Copy Markdown

vercel Bot commented May 25, 2026

@Yuvraj-Sarathe is attempting to deploy a commit to the utkarsh232005's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 25, 2026

📝 Walkthrough

Walkthrough

Adds a postinstall patch script and npm scripts, updates Vite cloudflare configuration, and applies responsive UI changes across Commands, Hero, Terminal, and Navbar (adds a mobile Sheet-based navigation drawer).

Changes

Build Setup and Responsive UI

Layer / File(s) Summary
Postinstall patch and npm scripts
package.json, scripts/patch-lovable-config.cjs
format and postinstall scripts added to package.json; new scripts/patch-lovable-config.cjs creates an exports field in @lovable.dev/vite-tanstack-config/package.json (import → ./dist/index.js, require → ./dist/index.cjs) when missing, with existence and idempotency checks.
Vite Cloudflare plugin configuration
vite.config.ts
Cloudflare option changed from negated boolean (!isVercel) to explicit ternary (isVercel ? false : {}), preserving behavior but making intent explicit.
Responsive container and spacing updates
src/components/Commands.tsx, src/components/Hero.tsx, src/components/Terminal.tsx
Commands list adds horizontal overflow and per-command min-h-[44px]; Hero metrics grid becomes responsive grid-cols-1 sm:grid-cols-3 with adjusted font sizes; Terminal container uses responsive min-height (min-h-[240px], md:min-h-[360px]).
Mobile navigation drawer in Navbar
src/components/Navbar.tsx
Navbar imports Menu icon and Sheet primitives; adds a mobile hamburger SheetTrigger that opens a right-side drawer containing navigation links and the GitHub CTA wrapped in SheetClose; desktop GitHub CTA hidden on small screens via responsive classes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐇 I hopped through scripts and classes bright,
Patched a package in the night,
Tailwind tweaked to fit each view,
Drawer slides in — hello, new!
Stars and metrics shine in sight. ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Ui responsive for mobile' directly and clearly describes the main change—adding responsive UI for mobile devices across multiple components.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


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

Copy link
Copy Markdown

@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

🧹 Nitpick comments (6)
scripts/patch-lovable-config.cjs (4)

1-2: 💤 Low value

Clarify comment: script adds both import and require entries.

The comment says the script "prefer[s] the ESM entrypoint" but it actually adds an exports mapping with both import and require entries, not just ESM preference.

📝 Suggested rewording
-// Patches `@lovable.dev/vite-tanstack-config` to prefer the ESM entrypoint
-// (dist/index.js) over the CJS one (dist/index.cjs) for import contexts.
+// Patches `@lovable.dev/vite-tanstack-config` to add the missing "exports" field,
+// mapping import to dist/index.js and require to dist/index.cjs.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/patch-lovable-config.cjs` around lines 1 - 2, Update the top-line
comment in patch-lovable-config.cjs to accurately describe the change: state
that the script adds an exports mapping containing both "import" (ESM) and
"require" (CJS) entries for the package (so both entrypoints are added) rather
than saying it prefers only the ESM entrypoint; mention the specific behavior of
adding an exports mapping with import and require keys to clarify intent.

29-34: ⚡ Quick win

Consider validating that dist files exist before adding exports.

The script assumes ./dist/index.js and ./dist/index.cjs exist in the target package. If the package structure changes in a future version, the exports field would point to non-existent files, causing import errors.

🔍 Proposed validation
+const distDir = path.dirname(pkgPath);
+const esmPath = path.join(distDir, "dist", "index.js");
+const cjsPath = path.join(distDir, "dist", "index.cjs");
+
+if (!fs.existsSync(esmPath) || !fs.existsSync(cjsPath)) {
+  console.warn("[patch-lovable-config] dist files not found — skipping");
+  process.exit(0);
+}
+
 pkg.exports = {
   ".": {
     import: "./dist/index.js",
     require: "./dist/index.cjs",
   },
 };
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/patch-lovable-config.cjs` around lines 29 - 34, The exports block is
being set unconditionally (pkg.exports = { ".": { import: "./dist/index.js",
require: "./dist/index.cjs" } }) which can point to missing files; modify the
script to check for the existence of "./dist/index.js" and "./dist/index.cjs"
before adding them to pkg.exports (use fs.existsSync or fs.statSync), only
include the import and require keys when the corresponding file exists, and log
or throw a clear error if neither file is present so the package.json is not
written with invalid exports.

14-14: ⚡ Quick win

Fix formatting: add trailing comma.

Static analysis flagged a missing trailing comma.

✨ Proposed fix
   "node_modules",
   "`@lovable.dev`",
   "vite-tanstack-config",
-  "package.json"
+  "package.json",
 );
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/patch-lovable-config.cjs` at line 14, The list/object in
scripts/patch-lovable-config.cjs that contains the string "package.json" is
missing a trailing comma; update the literal that includes "package.json" (look
for the array or object key/value containing "package.json") and add a trailing
comma after that entry so the file is properly formatted and passes static
analysis.

22-37: ⚡ Quick win

Add error handling for file operations.

The script lacks error handling around JSON.parse and writeFileSync. If the package.json is malformed or the file system is read-only, the postinstall hook will crash, potentially blocking npm install.

🛡️ Proposed fix with try-catch
-const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
+let pkg;
+try {
+  pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
+} catch (err) {
+  console.warn("[patch-lovable-config] failed to read/parse package.json:", err.message);
+  process.exit(0);
+}

 if (pkg.exports) {
   console.log("[patch-lovable-config] exports already present — nothing to do");
   process.exit(0);
 }

 pkg.exports = {
   ".": {
     import: "./dist/index.js",
     require: "./dist/index.cjs",
   },
 };

-fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + "\n");
-console.log("[patch-lovable-config] added exports field to prefer ESM entrypoint");
+try {
+  fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + "\n");
+  console.log("[patch-lovable-config] added exports field to prefer ESM entrypoint");
+} catch (err) {
+  console.warn("[patch-lovable-config] failed to write package.json:", err.message);
+  process.exit(0);
+}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/patch-lovable-config.cjs` around lines 22 - 37, Wrap the file
read/parse and write operations in a try-catch to handle malformed JSON and I/O
errors: when reading/parsing pkg (using fs.readFileSync and JSON.parse on
pkgPath) catch JSON or fs errors, log a descriptive message to console.error
including the caught error, and exit with process.exit(1); do the same around
fs.writeFileSync when writing back the modified pkg.exports (ensure pkg is
validated before mutating). Keep the existing early-exit when pkg.exports
exists, but protect the parse/write sequence with error handling so the
postinstall hook fails gracefully and reports the underlying error.
package.json (1)

12-13: ⚡ Quick win

Consider using patch-package instead of a custom postinstall script.

Directly modifying files in node_modules via a custom postinstall hook is fragile and non-standard. The patch-package tool is the industry-standard solution for maintaining dependency patches:

  • Generates reproducible patch files tracked in git
  • Automatically reapplies patches after npm install
  • Works across package managers (npm, yarn, pnpm)
  • Easier for other contributors to understand
📦 Migration steps to patch-package
  1. Install patch-package:
npm install --save-dev patch-package
  1. Manually apply your fix to node_modules/@lovable.dev/vite-tanstack-config/package.json

  2. Generate the patch:

npx patch-package `@lovable.dev/vite-tanstack-config`
  1. Update the postinstall script:
-    "postinstall": "node scripts/patch-lovable-config.cjs"
+    "postinstall": "patch-package"
  1. Commit the generated patches/ directory to git

  2. Delete scripts/patch-lovable-config.cjs

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@package.json` around lines 12 - 13, Replace the fragile custom postinstall
script with patch-package: add patch-package as a devDependency, remove or
replace the "postinstall": "node scripts/patch-lovable-config.cjs" entry in
package.json with "postinstall": "patch-package", manually apply the needed
change to node_modules/@lovable.dev/vite-tanstack-config/package.json, run npx
patch-package `@lovable.dev/vite-tanstack-config` to generate a patches/ entry,
commit the patches/ directory to git, and delete
scripts/patch-lovable-config.cjs from the repo.
src/components/Commands.tsx (1)

66-66: ⚡ Quick win

Consider adding a scroll hint for better discoverability.

The overflow-x-auto enables horizontal scrolling on mobile, but users may not realize the command list is scrollable without a visual indicator. Consider adding a subtle gradient fade or scroll hint to improve discoverability.

💡 Optional enhancement: Add scroll gradient hint

You could add a subtle gradient overlay to indicate scrollable content:

<div className="relative">
  <div className="flex lg:flex-col gap-px bg-border overflow-x-auto">
    {/* existing buttons */}
  </div>
  {/* Gradient fade on right edge for mobile */}
  <div className="absolute right-0 top-0 bottom-0 w-8 bg-gradient-to-l from-background to-transparent pointer-events-none lg:hidden" />
</div>
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/Commands.tsx` at line 66, Wrap the existing scrollable
container in a relatively positioned wrapper and add a right-edge gradient
overlay to serve as a scroll hint for the horizontal command list: locate the
div with className "flex lg:flex-col gap-px bg-border overflow-x-auto" in the
Commands component and make it a child of a wrapper with position relative, then
add an absolutely positioned gradient element (use classes like "absolute
right-0 top-0 bottom-0 w-8 bg-gradient-to-l from-background to-transparent
pointer-events-none lg:hidden") so the fade appears on mobile only and does not
intercept pointer events.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components/Navbar.tsx`:
- Around line 4-9: Consolidate the multi-line import of Sheet components into a
single-line import to satisfy the prettier/prettier ESLint rule: replace the
block import of Sheet, SheetTrigger, SheetContent, SheetClose with a single-line
import statement; locate the import that currently lists Sheet, SheetTrigger,
SheetContent, and SheetClose in src/components/Navbar.tsx and reformat it to one
line (or run the project's Prettier) so the import passes linting.

---

Nitpick comments:
In `@package.json`:
- Around line 12-13: Replace the fragile custom postinstall script with
patch-package: add patch-package as a devDependency, remove or replace the
"postinstall": "node scripts/patch-lovable-config.cjs" entry in package.json
with "postinstall": "patch-package", manually apply the needed change to
node_modules/@lovable.dev/vite-tanstack-config/package.json, run npx
patch-package `@lovable.dev/vite-tanstack-config` to generate a patches/ entry,
commit the patches/ directory to git, and delete
scripts/patch-lovable-config.cjs from the repo.

In `@scripts/patch-lovable-config.cjs`:
- Around line 1-2: Update the top-line comment in patch-lovable-config.cjs to
accurately describe the change: state that the script adds an exports mapping
containing both "import" (ESM) and "require" (CJS) entries for the package (so
both entrypoints are added) rather than saying it prefers only the ESM
entrypoint; mention the specific behavior of adding an exports mapping with
import and require keys to clarify intent.
- Around line 29-34: The exports block is being set unconditionally (pkg.exports
= { ".": { import: "./dist/index.js", require: "./dist/index.cjs" } }) which can
point to missing files; modify the script to check for the existence of
"./dist/index.js" and "./dist/index.cjs" before adding them to pkg.exports (use
fs.existsSync or fs.statSync), only include the import and require keys when the
corresponding file exists, and log or throw a clear error if neither file is
present so the package.json is not written with invalid exports.
- Line 14: The list/object in scripts/patch-lovable-config.cjs that contains the
string "package.json" is missing a trailing comma; update the literal that
includes "package.json" (look for the array or object key/value containing
"package.json") and add a trailing comma after that entry so the file is
properly formatted and passes static analysis.
- Around line 22-37: Wrap the file read/parse and write operations in a
try-catch to handle malformed JSON and I/O errors: when reading/parsing pkg
(using fs.readFileSync and JSON.parse on pkgPath) catch JSON or fs errors, log a
descriptive message to console.error including the caught error, and exit with
process.exit(1); do the same around fs.writeFileSync when writing back the
modified pkg.exports (ensure pkg is validated before mutating). Keep the
existing early-exit when pkg.exports exists, but protect the parse/write
sequence with error handling so the postinstall hook fails gracefully and
reports the underlying error.

In `@src/components/Commands.tsx`:
- Line 66: Wrap the existing scrollable container in a relatively positioned
wrapper and add a right-edge gradient overlay to serve as a scroll hint for the
horizontal command list: locate the div with className "flex lg:flex-col gap-px
bg-border overflow-x-auto" in the Commands component and make it a child of a
wrapper with position relative, then add an absolutely positioned gradient
element (use classes like "absolute right-0 top-0 bottom-0 w-8 bg-gradient-to-l
from-background to-transparent pointer-events-none lg:hidden") so the fade
appears on mobile only and does not intercept pointer events.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 5f057399-a9d5-4f71-9855-859b54e712a1

📥 Commits

Reviewing files that changed from the base of the PR and between 7612ecf and 476e8aa.

📒 Files selected for processing (7)
  • package.json
  • scripts/patch-lovable-config.cjs
  • src/components/Commands.tsx
  • src/components/Hero.tsx
  • src/components/Navbar.tsx
  • src/components/Terminal.tsx
  • vite.config.ts

Comment thread src/components/Navbar.tsx Outdated
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Copy Markdown

@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

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components/Navbar.tsx`:
- Line 4: The import statement for Sheet components contains stray backticks in
the module specifier which will break resolution; open the Navbar component and
fix the import that references Sheet, SheetTrigger, SheetContent, and SheetClose
by removing the surrounding backticks so the module specifier is a normal string
("`@/components/ui/sheet`") and ensure the import reads from that path without any
extra characters.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 78bf39a2-d7f9-4315-ad8b-0c3a71806baa

📥 Commits

Reviewing files that changed from the base of the PR and between 476e8aa and 9e38971.

📒 Files selected for processing (1)
  • src/components/Navbar.tsx

Comment thread src/components/Navbar.tsx
@Yuvraj-Sarathe
Copy link
Copy Markdown
Member Author

@utkarsh232005 merge PR please

@vercel
Copy link
Copy Markdown

vercel Bot commented May 26, 2026

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

Project Deployment Actions Updated (UTC)
kdm-website Ready Ready Preview, Comment May 26, 2026 6:53am

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.

fix: Improve website responsiveness across mobile and tablet viewports

1 participant