Skip to content

Fix responsive layout issues on tablet and mobile (#18) - #66

Open
pragnyamehar-create wants to merge 2 commits into
arpit2006:mainfrom
pragnyamehar-create:fix/responsive-dashboard-tablet-mobile-issue-18
Open

pragnyamehar-create wants to merge 2 commits into
arpit2006:mainfrom
pragnyamehar-create:fix/responsive-dashboard-tablet-mobile-issue-18

Conversation

@pragnyamehar-create

Copy link
Copy Markdown
Contributor

Here's a PR description you can paste in when opening the pull request:


Fix Responsive Layout Issues on Tablet and Mobile Devices

Fixes #18

Summary

The dashboard wasn't adapting correctly on tablet and mobile viewports — narrow container on tablets, overflowing profile text, clipped roadmap cards, and an AI chat button that covered content while scrolling. This PR addresses the root causes rather than just patching symptoms.

Root cause

Most of these bugs traced back to one thing: .welcome-card had a mobile rule (flex-direction: column) already defined in style.css, but the EJS template also set flex-direction: row as an inline style — and inline styles always win over external stylesheet rules, regardless of media queries. So the existing "fix" was silently being overridden and never actually applied. Several other elements had the same pattern (fixed inline widths/padding/font-sizes with no responsive path).

Changes

views/dashboard.ejs

  • Removed the inline flex-direction: row (and other layout props now owned by CSS) from the welcome card so it can actually stack on smaller screens
  • Moved the welcome badge's fixed width/height/font-size out of inline styles and into CSS so they can shrink responsively
  • Added a class hook (topic-desc-wrapper) to the topic description container so its padding can be tuned per breakpoint

public/css/style.css

  • Container/card padding scales down at 992px, 768px, and 480px breakpoints instead of staying fixed
  • Student Profile info rows (college, branch, CGPA, etc.) now wrap instead of clipping; long values stack under their label on small phones
  • Roadmap timeline topic cards: header (title + status badge) wraps instead of overflowing; min-width: 0 added to flex children so long topic names/descriptions/resource links can't force horizontal overflow
  • Semester nav bar and dashboard tab bar tightened for small screens, with overflow-x: hidden on the page as a safety net against any residual horizontal scroll
  • Floating AI chat button shrinks to 48px and repositions with env(safe-area-inset-bottom) on mobile; added bottom padding to the dashboard page so it never sits on top of the last card while scrolling

Testing

  • Rendered dashboard.ejs with mock data via ejs.renderFile — no template errors
  • Verified CSS brace balance after edits
  • Manually reviewed against each item in the original bug report:
    • Dashboard container expands properly on tablet
    • Profile info wraps instead of overflowing
    • Timeline cards fit within viewport, no horizontal overflow
    • Semester nav scrolls horizontally without clipping
    • Floating AI button no longer overlaps content
    • Typography/spacing scale down at tablet/mobile/small-phone breakpoints
    • No layout-breaking horizontal scroll

- Remove inline flex-direction:row on .welcome-card that was silently
  overriding the existing mobile stacking rule, so the welcome banner
  now actually stacks on tablet/mobile instead of staying cramped in
  a row.
- Move welcome-badge width/height/font-size into CSS so they can be
  shrunk responsively instead of being locked by inline styles.
- Let Student Profile info rows (college/branch/CGPA/etc.) wrap
  instead of clipping long values; long text now breaks onto a new
  line and stacks label-over-value on small phones.
- Allow topic timeline cards to wrap their header (title + status
  badge) and force min-width:0 on flex children so long topic names,
  descriptions, and resource links can no longer push cards past the
  viewport width.
- Add container/card padding, heading, and icon size reductions for
  tablet (<=992px), mobile (<=768px) and small phones (<=480px) so
  spacing isn't cramped and text stays readable.
- Tighten dashboard tab bar and semester tab bar for small screens
  and guarantee horizontal scroll (with clipped-content safety via
  overflow-x: hidden on <=992px) instead of clipping.
- Shrink and reposition the floating AI chat button on mobile
  (48px, safe-area-aware bottom offset) and add bottom padding to
  the dashboard page so it never overlaps the last card while
  scrolling.
@vercel

vercel Bot commented Aug 13, 2026

Copy link
Copy Markdown

@claude is attempting to deploy a commit to the arpit2006's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions

github-actions Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

📋 Pull Request Preview

📊 Summary

Metric Value
📄 Files Changed 2
➕ Additions +225
➖ Deletions -6
🔄 Total Changes 231
📦 PR Size 🟡 Medium

📂 File Breakdown

Category Files
🎨 Frontend 0
⚙️ Backend 0
🧪 Tests 0
📚 Documentation 0
🤖 GitHub Actions 0
📦 Other 2

⏱️ Estimated Review Time

6 minute(s)


✅ Reviewer Checklist

  • Linked issue
  • Code follows project guidelines
  • Tests added/updated (if required)
  • Documentation updated (if required)
  • CI passes

🤖 Generated automatically by the PR Preview Bot

@github-actions

Copy link
Copy Markdown
Contributor

👋 Welcome Back!

Hi @pragnyamehar-create,

Thanks for contributing to CampusCompass again!

We appreciate your continued support ❤️



🌟 General Tips

  • Keep commits focused
  • Respond to review comments
  • Ask questions if you're unsure
  • Make sure CI passes before requesting review

Happy Coding! 🚀


Generated automatically by Contributor Learning Assistant.

@github-actions

github-actions Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

📏 Pull Request Size Report

🟡 Classification: Medium

Metric Value
Files Changed 2
Lines Added +225
Lines Deleted -6
Total Changes 231

Size Meter

██████░░░░

Recommendation

👍 Reasonable size, but reviewers may take a little longer.


Generated automatically by PR Size Analyzer.

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ PR Needs Maintainer Review

This PR was flagged by automated quality checks.

A maintainer will review it shortly.

@github-actions

github-actions Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

⚠️ Suspicious Generated Code Detected

This PR contains patterns commonly associated with low-quality AI-generated submissions.

🔍 Detected Signals

  • Large insertion in public/css/style.css (+222)
  • Excessive comments in public/css/style.css
  • Generated-style separators in public/css/style.css

This PR has been flagged for manual review.

This is not an automatic rejection. A maintainer will review the changes before making a decision.


🤖 Generated automatically by PR Quality Guard

@github-actions

Copy link
Copy Markdown
Contributor

🎉 Thank you @pragnyamehar-create for submitting a Pull Request!

We're excited to review your contribution.

Before Review

✅ Ensure all CI checks pass
✅ Complete the PR template
✅ Link the related issue

📖 Before your PR is reviewed, check the PR Checklist in our Contributing Guide.

Happy Contributing! 🚀

@pragnyamehar-create

Copy link
Copy Markdown
Contributor Author

@arpit2006 could u pls check and review my PR

@github-actions

Copy link
Copy Markdown
Contributor

⏳ Please Be Patient

Hi @pragnyamehar-create 👋

We noticed that you mentioned @arpit2006 regarding this Pull Request.

Your contribution has been received and will be reviewed by the maintainers. Please be patient while the PR goes through the review and merging process.

Maintainers may need some time to:

  • 🔍 Review the changes
  • 🧪 Test the implementation
  • 💬 Provide feedback
  • ✅ Approve and merge the PR

Please avoid repeatedly mentioning maintainers for merge requests.

Thank you for your contribution and patience! ❤️

— 🤖 Automated Repository Bot

@arpit2006 arpit2006 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

PR #66 — Responsive Dashboard (Tablet/Mobile) — Code Review

Branch: fix/responsive-dashboard-tablet-mobile-issue-18
Files changed: views/dashboard.ejs (+5 / -5), public/css/style.css (+221 / -2)


Root Cause Assessment ✅

The described root cause is accurate and well-explained. The base .welcome-card rule in CSS (line 1800) already declares display: flex, justify-content: space-between, and align-items: center. The old inline style then repeated display: flex; flex-direction: row; justify-content: space-between; align-items: center; — inline styles beat external stylesheets unconditionally, so the existing flex-direction: column media query rule (line 2922) was silently dead code. Removing those from the inline style is exactly the right fix.


Change-by-Change Analysis

views/dashboard.ejs

Line Change Verdict
Welcome card <section> Removed display: flex; flex-direction: row; justify-content: space-between; align-items: center; from inline style (kept decorative props) ✅ Correct. These are now owned entirely by CSS (lines 1806–1808) where they can be overridden by media queries.
Welcome card <section> Also removed padding: 32px from inline (PR desc doesn't call this out) ⚠️ Potential regression — see Finding #1 below
Welcome badge <div> Removed width: 68px; height: 68px; font-size: 32px; from inline, moved to CSS ✅ Correct. Enables the 480px shrink rule (line 4276).
Topic desc wrapper <div> Added class topic-desc-wrapper ✅ Needed for the padding: 16px !important mobile override (line 4231).

public/css/style.css

Non-media-query global fixes (lines 4116–4161)

Rule Verdict
overflow-wrap: break-word on .roadmap-desc-para, .topic-desc, etc. ✅ Correct, no-viewport-width condition needed; these should always wrap gracefully.
.info-list li { flex-wrap: wrap; row-gap: 4px; } ✅ Correct. Doesn't break desktop since items rarely wrap there.
.info-value { max-width: 100%; } ✅ Correct.
.topic-card-header { flex-wrap: wrap; row-gap: 8px; } ✅ Correct, safe on desktop.
.topic-card-header h4 { flex: 1 1 200px; } ✅ Good — prevents badge from pushing title off-screen.
min-width: 0 on .topic-item, .topic-card, .roadmap-header-section > div:first-child ✅ Classic flex overflow fix, well-targeted.

992px breakpoint (lines 4164–4179)

Container padding scaled to 0 20px. ✅ Correct. Note: this duplicates the html, body { overflow-x: hidden } 992px block at line 4110 — two separate @media (max-width: 992px) blocks, 54 lines apart. Not wrong, but a minor style inconsistency (could be merged).

768px breakpoint (lines 4182–4261)

.dashboard-page { padding: 24px 0 100px } — solves AI button overlap. ✅

Roadmap section / tab bar tightening: all targeted and appropriate. ✅

.dashboard-tabs scrollable without scrollbar — correct pattern. ✅

480px breakpoint (lines 4264–4298)

.welcome-badge shrink to 52×52, h1 to 21px. ✅

.info-list li { flex-direction: column !important; } on small phones. ✅

Floating AI button (lines 4303–4311)

env(safe-area-inset-bottom, 0px) fallback is correct for non-iOS. ✅


Findings

🔴 Finding #1padding removed from welcome-card inline, but CSS base rule doesn't match

Old inline: padding: 32px
CSS base rule (line 1804): padding: 24px 32px
Mobile override (line 4927): padding: 24px !important

The PR removed padding: 32px from the inline style. The CSS base rule already declares padding: 24px 32px (24px top/bottom, 32px left/right), so at ≥ 769px the card will now have 24px top/bottom instead of the previous 32px all-around — a visible change on desktop that isn't mentioned in the PR description or tested. Whether or not the visual difference is intentional, it should be explicitly acknowledged.

Recommendation: Either update the base CSS rule to padding: 32px to match the old inline value, or confirm the new 24px 32px behaviour is intentionally acceptable.


🟡 Finding #2 — Duplicate @media (max-width: 992px) blocks

Lines 4110–4114 and lines 4164–4179 are two separate 992px blocks in the same stylesheet, 50+ lines apart. Browsers handle this correctly (later declarations win on conflict), but it reduces maintainability.

Recommendation: Merge into one block. Low priority — request changes or note as follow-up.


🟡 Finding #3.topic-card-header has three definitions, one conflicting

  • Line 2219: base rule — display: flex; justify-content: space-between; align-items: center; gap: 12px;
  • Line 2934 (inside existing @media (max-width: 768px)): flex-direction: column; align-items: flex-start; gap: 6px;
  • Line 4142 (new global rule): flex-wrap: wrap; row-gap: 8px;
  • Line 4223 (new 768px rule): padding: 14px 16px !important;
  • Line 4147: h4 { flex: 1 1 200px; }

The existing 768px rule at line 2934 sets flex-direction: column + align-items: flex-start, which stacks the title and badge vertically on mobile. The new global flex-wrap: wrap (line 4142) is redundant on mobile since column direction already wraps. On desktop though, flex-wrap: wrap is a sensible addition. No actual bug here, just an overlap worth noting.


🟢 Finding #4!important usage is justified, but widespread

The PR uses !important on ~15 declarations inside media queries. This is necessary because the EJS template sets many of these properties as inline styles (which have higher specificity), and the PR description explicitly notes this pattern. Given the inline-style-heavy template, !important is the only way to override without touching every inline attribute. Acceptable in context.


🟢 Finding #5overflow-x: hidden on html, body at 992px

This is a safe "catch-all" guard. It can mask layout bugs rather than fix them, but the PR also fixes the actual overflow sources (flex min-width: 0, overflow-wrap), so using it as a fallback is reasonable.


Checklist Against PR Claims

PR Claim Verified?
Welcome card stacks on mobile (flex-direction fix)
Welcome badge size/font moved out of inline
topic-desc-wrapper class hook added
Container padding scales at 992/768/480px
Info rows wrap instead of clipping
Roadmap topic headers wrap
min-width: 0 on flex children
Semester nav + tab bar tightened
overflow-x: hidden safety net
Floating AI button shrinks + repositions
Bottom padding on .dashboard-page
Desktop padding change (unannounced) ⚠️ See Finding #1

Verdict

Request Changes on one item before approving:

Finding #1 is a blocker: the removal of padding: 32px from the inline style silently changes the desktop welcome card's top/bottom padding from 32px → 24px. This side-effect isn't mentioned in the PR description or tested. The author needs to either restore padding: 32px to the CSS base rule or explicitly call out the padding change as intentional.

Findings #2 and #3 are non-blocking style suggestions. Everything else is clean, well-targeted, and correctly solves the stated issues.

@github-actions
github-actions Bot requested a review from arpit2006 August 15, 2026 18:57
@pragnyamehar-create

Copy link
Copy Markdown
Contributor Author

@arpit2006 Thanks for the review! Fixed Finding #1 by restoring the base .welcome-card padding to 32px, preserving the previous desktop spacing while keeping the existing 24px mobile override. I also verified the changes with git diff --check.

@github-actions

Copy link
Copy Markdown
Contributor

👋 This pull request has been automatically marked as stale because it has had no activity for 14 days.

It will be closed in 7 days if no further activity occurs.

If you are still working on this, please:

  • Push new commits or leave a comment with a status update
  • Ensure all CI checks are passing
  • Request a review from a maintainer

Thank you for your contribution to CampusCompass! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Responsive Layout Issues on Tablet and Mobile Devices

3 participants