Skip to content

(SP: 2) [Frontend] Update Code cards, button behavior, and layout#270

Merged
ViktorSvertoka merged 2 commits into
developfrom
yn/fix/home/ui
Feb 4, 2026
Merged

(SP: 2) [Frontend] Update Code cards, button behavior, and layout#270
ViktorSvertoka merged 2 commits into
developfrom
yn/fix/home/ui

Conversation

@YNazymko12
Copy link
Copy Markdown
Collaborator

@YNazymko12 YNazymko12 commented Feb 4, 2026

Description

This PR improves the Home page.

Changes

  • Increased code cards size
  • Ensured button text is visible on initial load
  • Updated mobile position of online counter
  • Made Q&A section full-screen height

Summary by CodeRabbit

  • New Features

    • Improved responsive layout across lg/xl breakpoints for cards and hero section
    • CTA button hover text and interaction behavior refined
  • Bug Fixes

    • Mobile popup placement recalculated for better viewport positioning
    • Online counter popup removed from the locale layout (no longer shown in that area)
  • Style

    • Extended card-breathe animation to xl for consistent effects
    • Adjusted typography and spacing for larger screens

Increase code cards size
Ensure button text visible on initial load
Update mobile position of online counter
Make Q&A section full height
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Feb 4, 2026

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

Project Deployment Actions Updated (UTC)
devlovers-net Ready Ready Preview, Comment Feb 4, 2026 0:13am

@netlify
Copy link
Copy Markdown

netlify Bot commented Feb 4, 2026

Deploy Preview for develop-devlovers ready!

Name Link
🔨 Latest commit 895654d
🔍 Latest deploy log https://app.netlify.com/projects/develop-devlovers/deploys/698337ae10f6aa00086fa2de
😎 Deploy Preview https://deploy-preview-270--develop-devlovers.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 4, 2026

📝 Walkthrough

Walkthrough

Removed OnlineCounterPopup from locale layout and moved it into HeroSection (wired via a forwarded ctaRef); InteractiveCTAButton now forwards refs and manages hover text state; Footer accepts an optional footerRef; responsive sizing/typography added to home cards; unused CTA variant utilities removed.

Changes

Cohort / File(s) Summary
OnlineCounterPopup relocation & positioning
frontend/app/[locale]/layout.tsx, frontend/components/home/HeroSection.tsx, frontend/components/shared/OnlineCounterPopup.tsx
Removed popup from layout, added it to HeroSection and passed a ctaRef; OnlineCounterPopup now accepts ctaRef, computes top/placement via useLayoutEffect, and repositions on window resize (mobile-aware).
Component ref forwarding
frontend/components/home/InteractiveCTAButton.tsx, frontend/components/shared/Footer.tsx
InteractiveCTAButton rewritten as a forwardRef component (forwards anchor ref, adds hover/initial-render text state). Footer now accepts and forwards an optional footerRef to its root element.
Responsive design updates
frontend/components/home/CodeCard.tsx, frontend/components/home/HeroCodeCards.tsx, frontend/app/[locale]/q&a/page.tsx, frontend/globals.css
Added lg/xl responsive sizing, padding, and typography variants for CodeCard and status dots; adjusted HeroCodeCards positioning at xl; wrapped Q&A page content in min-h-screen container; extended animate-card-breathe rules to xl breakpoint.
Code cleanup
frontend/lib/home/cta-variants.ts
Removed exported CTAVariant interface and createCTAVariants factory function (unused exports deleted).

Sequence Diagram(s)

sequenceDiagram
    participant Layout as App Layout
    participant Hero as HeroSection
    participant CTA as InteractiveCTAButton
    participant Popup as OnlineCounterPopup
    participant Window as Window

    Layout->>Hero: render HeroSection
    Hero->>CTA: create InteractiveCTAButton with forwarded ref (ctaRef)
    Hero->>Popup: render OnlineCounterPopup(ctaRef)
    Popup->>CTA: read ctaRef position (useLayoutEffect) -> compute top/isMobile
    Popup->>Popup: set position state -> apply inline styles
    Window->>Popup: resize event
    Popup->>Popup: recompute position (if mobile)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related issues

Possibly related PRs

Suggested labels

UI, refactor

Suggested reviewers

  • AM1007
  • ViktorSvertoka

Poem

🐰 I hopped from layout to the hero's light,
A ref in paw to place me right.
Cards stretch wide at breakpoints new,
Buttons forward refs and text that skew—
Small rabbit cheers for frontend bright! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 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 (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main changes in the changeset, which include updates to code cards (responsive sizing, typography), button behavior (InteractiveCTAButton refactored with ref forwarding), and layout adjustments (Q&A section full-screen height, responsive breakpoints, and online counter positioning).

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

✨ 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 yn/fix/home/ui

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
Copy Markdown
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: 3

🤖 Fix all issues with AI agents
In `@frontend/components/home/CodeCard.tsx`:
- Line 26: In the CodeCard component replace the malformed Tailwind token in the
status-dot span: find the span element with className containing "xl:w-2."
(inside CodeCard / the green status dot) and change that token to "xl:w-2.5" so
the width matches the xl height (keeping the rest of the className unchanged.

In `@frontend/components/home/InteractiveCTAButton.tsx`:
- Around line 46-49: The angle calculation for the particles in
InteractiveCTAButton.tsx is wrong: the particles array creates 12 items but the
angle uses (i * 360) / 8, causing overlaps; update the angle computation for the
particles constant (the `particles` initializer) to divide by 12 or, better, use
particles.length (e.g., (i * 360) / count) so each of the 12 items is evenly
spaced; change the divisor in the angle expression accordingly to fix the
distribution.

In `@frontend/components/shared/Footer.tsx`:
- Around line 21-31: The prop type for footerRef in the Footer component
currently uses React.RefObject which relies on the React namespace; import the
Ref type from 'react' and change the prop definition to use Ref<HTMLElement>
(e.g., update the Footer props signature that declares footerRef?:
React.RefObject<HTMLElement> to footerRef?: Ref<HTMLElement>) so the type is
available without the React namespace and supports callback refs; ensure the new
import (Ref) is added at the top of the file and update any references to
footerRef accordingly.
🧹 Nitpick comments (3)
frontend/components/shared/OnlineCounterPopup.tsx (1)

34-77: Consider extracting the duplicated position calculation logic.

The position calculation logic is duplicated between useLayoutEffect (lines 35-50) and the resize handler in useEffect (lines 55-70). Extracting this into a shared function would improve maintainability.

♻️ Proposed refactor
+  const calculatePosition = React.useCallback(() => {
+    const mobile = window.innerWidth < 768;
+    let newTop = 0;
+
+    if (mobile && ctaRef.current) {
+      const rect = ctaRef.current.getBoundingClientRect();
+      const desired = rect.bottom + window.scrollY + rect.height + 14;
+      const popupHeight = 56;
+      const safeBottom = 16;
+      const max =
+        window.scrollY + window.innerHeight - popupHeight - safeBottom;
+      newTop = Math.min(desired, max);
+    }
+
+    setPosition({ top: newTop, isMobile: mobile });
+  }, [ctaRef]);
+
   useLayoutEffect(() => {
-    const calculatePosition = () => {
-      const mobile = window.innerWidth < 768;
-      let newTop = 0;
-
-      if (mobile && ctaRef.current) {
-        const rect = ctaRef.current.getBoundingClientRect();
-        const desired = rect.bottom + window.scrollY + rect.height + 14;
-        const popupHeight = 56;
-        const safeBottom = 16;
-        const max =
-          window.scrollY + window.innerHeight - popupHeight - safeBottom;
-        newTop = Math.min(desired, max);
-      }
-
-      setPosition({ top: newTop, isMobile: mobile });
-    };
-
     calculatePosition();
-  }, [ctaRef]);
+  }, [calculatePosition]);
+
   useEffect(() => {
-    const handleResize = () => {
-      const mobile = window.innerWidth < 768;
-      let newTop = 0;
-
-      if (mobile && ctaRef.current) {
-        const rect = ctaRef.current.getBoundingClientRect();
-        const desired = rect.bottom + window.scrollY + rect.height + 14;
-        const popupHeight = 56;
-        const safeBottom = 16;
-        const max =
-          window.scrollY + window.innerHeight - popupHeight - safeBottom;
-        newTop = Math.min(desired, max);
-      }
-
-      setPosition({ top: newTop, isMobile: mobile });
-    };
-
-    window.addEventListener('resize', handleResize);
-
+    window.addEventListener('resize', calculatePosition);
     return () => {
-      window.removeEventListener('resize', handleResize);
+      window.removeEventListener('resize', calculatePosition);
     };
-  }, [ctaRef]);
+  }, [calculatePosition]);
frontend/components/home/InteractiveCTAButton.tsx (2)

10-11: Consider adding a displayName for better debugging.

When using forwardRef, setting a displayName helps with React DevTools debugging.

♻️ Proposed addition after the component
   }
 );
+
+InteractiveCTAButton.displayName = 'InteractiveCTAButton';

Also applies to: 163-165


19-28: textVariants array is recreated on every render.

Since this array depends on translations that don't change during the component's lifecycle, consider memoizing it.

♻️ Proposed optimization
-    const textVariants = [
+    const textVariants = React.useMemo(() => [
       t('ctaVariants.1'),
       t('ctaVariants.2'),
       t('ctaVariants.3'),
       t('ctaVariants.4'),
       t('ctaVariants.5'),
       t('ctaVariants.6'),
       t('ctaVariants.7'),
       t('ctaVariants.8'),
-    ];
+    ], [t]);

Comment thread frontend/components/home/CodeCard.tsx Outdated
<span className="h-1.5 w-1.5 rounded-full bg-green-400/80 shadow-sm" />
<span className="h-1.5 w-1.5 rounded-full bg-red-400/80 shadow-sm lg:h-2 lg:w-2 xl:h-2.5 xl:w-2.5" />
<span className="h-1.5 w-1.5 rounded-full bg-yellow-400/80 shadow-sm lg:h-2 lg:w-2 xl:h-2.5 xl:w-2.5" />
<span className="xl:w-2. h-1.5 w-1.5 rounded-full bg-green-400/80 shadow-sm lg:h-2 lg:w-2 xl:h-2.5" />
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Typo in Tailwind class: xl:w-2. should be xl:w-2.5.

The green status dot has a malformed class. Based on the pattern from the adjacent dots (lines 24-25), this should be xl:w-2.5 to match the height.

🐛 Proposed fix
-            <span className="xl:w-2. h-1.5 w-1.5 rounded-full bg-green-400/80 shadow-sm lg:h-2 lg:w-2 xl:h-2.5" />
+            <span className="h-1.5 w-1.5 rounded-full bg-green-400/80 shadow-sm lg:h-2 lg:w-2 xl:h-2.5 xl:w-2.5" />
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<span className="xl:w-2. h-1.5 w-1.5 rounded-full bg-green-400/80 shadow-sm lg:h-2 lg:w-2 xl:h-2.5" />
<span className="h-1.5 w-1.5 rounded-full bg-green-400/80 shadow-sm lg:h-2 lg:w-2 xl:h-2.5 xl:w-2.5" />
🤖 Prompt for AI Agents
In `@frontend/components/home/CodeCard.tsx` at line 26, In the CodeCard component
replace the malformed Tailwind token in the status-dot span: find the span
element with className containing "xl:w-2." (inside CodeCard / the green status
dot) and change that token to "xl:w-2.5" so the width matches the xl height
(keeping the rest of the className unchanged.

Comment thread frontend/components/home/InteractiveCTAButton.tsx
Comment thread frontend/components/shared/Footer.tsx
Fix particle angle distribution
Correct malformed Tailwind width class
Use Ref type instead of React.RefObject in Footer
@ViktorSvertoka ViktorSvertoka merged commit 839ac57 into develop Feb 4, 2026
10 checks passed
@ViktorSvertoka ViktorSvertoka deleted the yn/fix/home/ui branch February 4, 2026 12:22
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