Skip to content

Update VideoDemo component dimensions and improve layout responsiveness#283

Merged
yamcodes merged 3 commits intomainfrom
fix-video-size
Nov 5, 2025
Merged

Update VideoDemo component dimensions and improve layout responsiveness#283
yamcodes merged 3 commits intomainfrom
fix-video-size

Conversation

@yamcodes
Copy link
Owner

@yamcodes yamcodes commented Nov 5, 2025

  • Adjusted video dimensions to 2048x1672 for better quality.
  • Updated aspect ratio calculation for the video button to enhance responsiveness.
  • Increased max width of the surrounding container to 6xl for improved layout on larger screens.

These changes aim to provide a better user experience by ensuring the video demo displays correctly across various screen sizes.

Closes #282

Summary by CodeRabbit

  • Style

    • Increased video demo container max width and centered layout for a wider, cleaner display
    • Centralized aspect-ratio handling and updated fallback image sizing for improved responsive scaling
  • Tests

    • Adjusted UI tests to expect the wider layout and updated aspect ratio/sizing expectations
    • Reduced flakiness by adding a short wait and tighter navigation timeout in end-to-end tests

- Adjusted video dimensions to 2048x1672 for better quality.
- Updated aspect ratio calculation for the video button to enhance responsiveness.
- Increased max width of the surrounding container to 6xl for improved layout on larger screens.

These changes aim to provide a better user experience by ensuring the video demo displays correctly across various screen sizes.
@changeset-bot
Copy link

changeset-bot bot commented Nov 5, 2025

⚠️ No Changeset found

Latest commit: 85bf374

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link

vercel bot commented Nov 5, 2025

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

Project Deployment Preview Comments Updated (UTC)
arkenv Ready Ready Preview Comment Nov 5, 2025 7:08pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 5, 2025

Walkthrough

Increase demo video source dimensions and container width; replace hard-coded video size with an aspect-ratio helper; adjust fallback image sizing and tests; add small Playwright timing/timeout adjustments for flakiness.

Changes

Cohort / File(s) Change Summary
Page layout
apps/www/app/(home)/page.tsx
Increased VideoDemo container max-width from max-w-5xl to max-w-6xl
Video demo component
apps/www/components/page/video-demo.tsx
Replace hard-coded WIDTH/HEIGHT 800x653 → 2048x1672; add getAspectRatio(width,height) and apply as inline aspect-ratio; remove fixed max-w-[800px] and use w-full mx-auto; change fallback Image sizes to 100vw
Unit tests
apps/www/components/page/video-demo.test.tsx
Update expected container classes (removed max-w-[800px]), expected aspect-ratio style to 2048 / 1672, and fallback sizes expectation to 100vw
Playwright tests
tooling/playwright-www/tests/homepage.test.ts, tooling/playwright-www/tests/responsive.test.ts
Add short delay after video button visibility; add timeout for new-tab navigation wait; relax large-screen bounding assertion from ~810 → 1300 to match wider container

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Page as Home Page
  participant Comp as VideoDemo
  participant Helper as getAspectRatio()
  participant DOM as Browser DOM

  Page->>Comp: render VideoDemo
  Comp->>Helper: getAspectRatio(2048,1672)
  Helper-->>Comp: "2048 / 1672"
  Comp->>DOM: set container style aspect-ratio:"2048 / 1672" and class w-full mx-auto
  alt video available
    Comp->>DOM: render video element (2048x1672 source)
  else video unavailable
    Comp->>DOM: render fallback Image with sizes="100vw"
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20–30 minutes

  • Pay attention to aspect-ratio math and browser support where applied inline
  • Verify responsive behavior across breakpoints (fallback image, centering, and max-width)
  • Check updated Playwright timeouts and the relaxed bounding assertion for flakiness vs. false positives

Possibly related PRs

Poem

🐰
I measured pixels, stretched my paws wide,
From tiny frames to a grander stride.
Aspect-ratio neat, centered with glee,
A jump, a hop — now the demo's roomy! 🎬

Pre-merge checks and finishing touches

✅ 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 clearly summarizes the main changes: updating VideoDemo dimensions and improving layout responsiveness, which directly aligns with the PR objectives.
Linked Issues check ✅ Passed The PR addresses all coding requirements from issue #282: increased video dimensions by ~156% (2048x1672 vs implied ~800x653), updated aspect ratio calculation, increased container max-width to 6xl, and synchronized fallback GIF sizing.
Out of Scope Changes check ✅ Passed Test updates for homepage.test.ts and responsive.test.ts are directly scoped to validating the video dimension and layout changes, with no unrelated modifications detected.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-video-size

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.

@github-actions github-actions bot added the www Improvements or additions to arkenv.js.org label Nov 5, 2025
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: 0

🧹 Nitpick comments (2)
apps/www/components/page/video-demo.tsx (2)

12-13: Consider inlining the helper or adding a GCD-based simplification.

The getAspectRatio helper is used only once. You could either:

  1. Inline it directly: style={{ aspectRatio: \${WIDTH} / ${HEIGHT}` }}`
  2. Or enhance it to simplify ratios (2048/1672 reduces to 128/104.5, though the current form is acceptable for CSS).

If you prefer inlining:

-const getAspectRatio = (width: number, height: number) =>
-	`${width} / ${height}`;

And on line 36:

-			style={{ aspectRatio: getAspectRatio(WIDTH, HEIGHT) }}
+			style={{ aspectRatio: `${WIDTH} / ${HEIGHT}` }}

44-44: Restore responsive sizes for better performance.

Changing from (max-width: 768px) 100vw, 800px to 100vw tells the browser to always download a full-viewport-width image, even on large screens where the container is constrained to max-w-6xl (1152px). This can waste bandwidth and increase load times.

Apply this diff to restore responsive sizing with the new constraint:

-					sizes="100vw"
+					sizes="(max-width: 1152px) 100vw, 1152px"

Alternatively, use Tailwind's max-w-6xl breakpoint equivalent (1280px):

-					sizes="100vw"
+					sizes="(max-width: 1280px) 100vw, 1152px"
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c6fb702 and 4b83e06.

📒 Files selected for processing (2)
  • apps/www/app/(home)/page.tsx (1 hunks)
  • apps/www/components/page/video-demo.tsx (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: test-e2e (e2e)
  • GitHub Check: test-e2e (a11y)
🔇 Additional comments (4)
apps/www/components/page/video-demo.tsx (3)

29-29: LGTM: Container layout now more flexible.

Removing the hard-coded max-w-[800px] and using w-full with mx-auto correctly delegates width control to the parent container, which now uses max-w-6xl.


36-36: LGTM: Dynamic aspect ratio maintains correct proportions.

Using the getAspectRatio helper in the inline style ensures the button container maintains the correct aspect ratio regardless of screen size.


8-10: Verify video and GIF dimensions match the 2048×1672 constants.

The constants are labeled "Actual video dimensions," but we cannot definitively verify them in this environment. The video is hosted on Mux (external streaming service, not local), and the metadata file lacks dimension information. While the GIF file exists at /assets/demo.gif, the sandbox lacks tools to inspect its dimensions directly. Please manually confirm that both the video source and the GIF fallback have been updated to exactly 2048×1672 pixels to avoid visual mismatches or distortion.

apps/www/app/(home)/page.tsx (1)

43-43: LGTM: Container width increase aligns with PR objectives.

Changing from max-w-5xl (1024px) to max-w-6xl (1152px) provides a ~12.5% increase in maximum width, which falls within the requested 10-20% size increase for the video demo.

- Removed the max width constraint from the container for improved layout flexibility.
- Updated the button's aspect ratio to reflect the new video dimensions of 2048x1672.
- Adjusted the fallback image's sizes attribute for better responsiveness.

These changes enhance the test coverage for the VideoDemo component, ensuring it accurately reflects the latest design updates.
…curacy

- Added a wait timeout in the homepage test to reduce flakiness when loading the video.
- Updated the responsive test to reflect the new maximum width constraint for videos, adjusting it to 1300px for better layout consistency.

These changes aim to enhance the stability of the tests and ensure they accurately represent the latest design specifications.
@github-actions github-actions bot added the tests This issue or PR is about adding, removing or changing tests label Nov 5, 2025
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: 0

🧹 Nitpick comments (1)
tooling/playwright-www/tests/homepage.test.ts (1)

146-147: Replace arbitrary timeout with condition-based waiting.

Hardcoded timeouts like waitForTimeout(500) are brittle and can still be flaky. Instead, wait for a specific condition that indicates the video is ready for interaction.

Consider replacing the arbitrary delay with a condition-based wait:

-		// Wait a bit for video to be fully loaded to reduce flakiness
-		await page.waitForTimeout(500);
+		// Wait for video to be ready for interaction
+		await videoButton.locator('video').evaluate((video: HTMLVideoElement) => {
+			return video.readyState >= 2; // HAVE_CURRENT_DATA or higher
+		}).catch(() => {
+			// Fallback if video doesn't exist (e.g., using GIF fallback)
+		});

Alternatively, if the flakiness is related to event handlers, ensure the component's JavaScript has hydrated:

-		// Wait a bit for video to be fully loaded to reduce flakiness
-		await page.waitForTimeout(500);
+		// Wait for interactive hydration
+		await page.waitForLoadState('domcontentloaded');
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4b83e06 and 85bf374.

📒 Files selected for processing (3)
  • apps/www/components/page/video-demo.test.tsx (2 hunks)
  • tooling/playwright-www/tests/homepage.test.ts (1 hunks)
  • tooling/playwright-www/tests/responsive.test.ts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: test-e2e (e2e)
  • GitHub Check: test-e2e (a11y)
🔇 Additional comments (4)
apps/www/components/page/video-demo.test.tsx (2)

347-347: LGTM! Aspect ratio correctly updated.

The test expectation correctly reflects the new video dimensions (2048×1672) mentioned in the PR objectives.


363-363: Verify the performance impact of removing responsive image sizing.

The sizes attribute changed from "(max-width: 768px) 100vw, 800px" to "100vw". This removes the optimization that capped image width at 800px on larger screens, potentially causing the browser to load unnecessarily large images on desktop devices where the image is displayed at a smaller size.

Consider whether the fallback GIF should retain responsive sizing like "(max-width: 768px) 100vw, (max-width: 1536px) 1280px, 100vw" to align with the max-w-6xl container while avoiding over-fetching on smaller viewports.

tooling/playwright-www/tests/homepage.test.ts (1)

151-151: LGTM! Appropriate timeout for external navigation.

The 10-second timeout is reasonable for waiting on a new page to open when navigating to StackBlitz, as external sites can have variable load times.

tooling/playwright-www/tests/responsive.test.ts (1)

172-174: LGTM! Correctly reflects the max-w-6xl container change.

The updated assertion aligns with the container width increase from max-w-5xl to max-w-6xl (1280px in Tailwind), with appropriate tolerance for padding and sub-pixel rendering.

@yamcodes yamcodes merged commit ffbcd3b into main Nov 5, 2025
15 checks passed
@yamcodes yamcodes deleted the fix-video-size branch November 5, 2025 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests This issue or PR is about adding, removing or changing tests www Improvements or additions to arkenv.js.org

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Video is too small

1 participant