Skip to content

small screen warning#185

Open
interim17 wants to merge 1 commit intomainfrom
small-screen
Open

small screen warning#185
interim17 wants to merge 1 commit intomainfrom
small-screen

Conversation

@interim17
Copy link
Contributor

@interim17 interim17 commented Mar 20, 2026

Minimal fix and warning for cell pack studio site on small screens, still looks pretty busted, but we're owning it.
More extensive work in #186 if folks want to consider it.

Screenshot 2026-03-19 at 5 08 32 PM

@github-actions
Copy link

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 32.15% 663 / 2062
🔵 Statements 32.15% 663 / 2062
🔵 Functions 39.42% 41 / 104
🔵 Branches 72.72% 144 / 198
File Coverage
File Stmts % Branch % Funcs % Lines Uncovered Lines
Changed Files
src/App.tsx 0% 0% 0% 0% 1-8, 17-21, 23, 25-26, 28-38, 40, 42-44, 46-52, 54-67, 69-113, 115-123, 125-161, 163-168, 170-174, 176-196, 198, 200
src/components/SmallScreenWarning/index.tsx 0% 0% 0% 0% 1-4, 6-8, 10-12, 14-24, 26, 28
src/hooks/useMediaQuery.tsx 0% 0% 0% 0% 1, 3-6, 8-10, 12-17, 19-20
Generated in workflow #245

@github-actions
Copy link

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://AllenCell.github.io/cellpack-client/pr-preview/pr-185/

Built to branch gh-pages at 2026-03-20 00:24 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a small-screen warning banner and a few responsive CSS tweaks to improve (or at least acknowledge) usability on narrow viewports in the cellPACK Studio client.

Changes:

  • Introduces a reusable useMediaQuery hook and a new SmallScreenWarning component (Ant Design Alert) shown under 900px.
  • Adjusts layout sizing to use small-viewport units and adds a couple responsive CSS breakpoints for tighter spacing.
  • Tunes StatusBar spacing on smaller widths.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/hooks/useMediaQuery.tsx New hook to track media query matches for responsive UI behavior.
src/components/SmallScreenWarning/index.tsx New banner component that shows a dismissible small-screen warning.
src/components/SmallScreenWarning/style.css Styles the warning banner container and message wrapping.
src/App.tsx Renders the warning banner at the top of the app layout.
src/App.css Switches to sv* viewport units and adds basic responsive spacing/font adjustments.
src/components/StatusBar/style.css Adds a 900px breakpoint to reduce gaps/padding on small screens.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +5 to +8
() => window.matchMedia(query).matches
);

useEffect(() => {
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

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

useMediaQuery initializes state by calling window.matchMedia(query) during render. This will throw in environments where matchMedia is undefined (e.g., jsdom tests) and makes the hook harder to reuse outside the browser. Consider using optional chaining + a safe default (or deferring to an effect) similar to ThemeRoot’s window.matchMedia?.(...).matches ?? false pattern.

Suggested change
() => window.matchMedia(query).matches
);
useEffect(() => {
() =>
typeof window !== "undefined"
? window.matchMedia?.(query).matches ?? false
: false
);
useEffect(() => {
if (typeof window === "undefined" || !window.matchMedia) {
return;
}

Copilot uses AI. Check for mistakes.
Comment on lines +15 to +16
mediaQuery.addEventListener("change", handleChange);
return () => mediaQuery.removeEventListener("change", handleChange);
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

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

MediaQueryList.addEventListener("change", ...) isn’t supported in some older browsers; elsewhere in the repo (ThemeRoot) this is guarded with optional chaining. Consider using addEventListener?./removeEventListener?. and/or falling back to addListener/removeListener for broader compatibility.

Suggested change
mediaQuery.addEventListener("change", handleChange);
return () => mediaQuery.removeEventListener("change", handleChange);
const supportsAddEventListener =
typeof mediaQuery.addEventListener === "function";
if (supportsAddEventListener) {
mediaQuery.addEventListener("change", handleChange);
} else if (typeof mediaQuery.addListener === "function") {
mediaQuery.addListener(handleChange);
}
return () => {
if (supportsAddEventListener && typeof mediaQuery.removeEventListener === "function") {
mediaQuery.removeEventListener("change", handleChange);
} else if (typeof mediaQuery.removeListener === "function") {
mediaQuery.removeListener(handleChange);
}
};

Copilot uses AI. Check for mistakes.
Comment on lines +11 to +16
width: 100svw;
height: 100svh;
}

.header {
width: 100vw;
width: 100svw;
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

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

Using only svw/svh can break layout in browsers that don’t support the newer viewport units (they’ll drop the declaration entirely). Add a vw/vh fallback before the sv* declarations so unsupported browsers still get a sensible size.

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +8
.small-screen-warning {
position: fixed;
top: 0;
left: 0;
width: 100svw;
z-index: 1000;
box-sizing: border-box;
}
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

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

The warning container is position: fixed at top: 0 and is rendered before the <Header>, but it doesn’t reserve space in the layout. This will visually overlay the header/content while the banner is shown. Consider using position: sticky (so it participates in flow) or adding top padding/margin equal to the banner height when the warning is visible.

Copilot uses AI. Check for mistakes.
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.

2 participants