Skip to content

Add Fourthwall t-shirt promo banners#8

Merged
danmooney merged 5 commits into
mainfrom
develop
May 20, 2026
Merged

Add Fourthwall t-shirt promo banners#8
danmooney merged 5 commits into
mainfrom
develop

Conversation

@danmooney
Copy link
Copy Markdown
Owner

@danmooney danmooney commented May 20, 2026

Summary by CodeRabbit

Release Notes

New Features

  • Introduced t-shirt advertisements strategically placed across the application with responsive layouts optimized for various screen sizes
  • Users can dismiss ads, which remain hidden for one week
  • Analytics tracking enabled for ad engagement monitoring

Review Change Stack

danmooney and others added 4 commits May 20, 2026 13:02
New TshirtAds component renders three fixed-position display-ad-style
slots (160x600 side rails, 728x90 desktop bottom banner, 320x50 mobile
bottom banner) via ReactDOM portals. Each slot cycles through its image
pool on every page load with non-overlapping random selection. Clicks
and dismissals fire GA4 events tagged with ad_position. Dismissal
persists 7 days via localStorage. Side rails hidden under 1280px,
bottom banner hidden under 768px, mobile banner hidden at 768px+.

Includes 4 IAB-compliant 160x600 t-shirt mockup creatives. Updates
.gitignore to whitelist public/ads/ so creatives ship with the build,
while keeping public/ads/_originals/ local-only.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
At viewports >= 1280px the 160x600 side rails occupy 0-176px from each
edge, but .content-section and footer were sized at max-width: 80%,
which only clears 10% on each side. Below ~1760px viewport width the
content slid underneath the ads.

Cap .content-section and footer at min(80%, calc(100% - 400px)) inside
a min-width: 1280px media query so they always leave at least 200px on
each side for the ads plus breathing room.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 20, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e77c1f15-ffa6-441f-8268-1e8801296ecb

📥 Commits

Reviewing files that changed from the base of the PR and between 98dd5fa and 4cab3ac.

📒 Files selected for processing (1)
  • src/components/TshirtAds.js
💤 Files with no reviewable changes (1)
  • src/components/TshirtAds.js

📝 Walkthrough

Walkthrough

The PR integrates a dismissible Fourthwall ad component into dict2json.com. It adds TshirtAds, a React component that renders fixed-position ads via portals, persists dismissal state in localStorage with a 7-day TTL, logs analytics events, and responds to multiple viewport breakpoints. Supporting CSS and layout adjustments ensure responsive visibility and prevent content overlap.

Changes

Fourthwall T-shirt Ads Integration

Layer / File(s) Summary
Repository setup
.gitignore
Configures git to exclude ad asset directories (public/ads/, public/ads/_originals/) while tracking ads.txt.
TshirtAds component with portal rendering and dismissal logic
src/components/TshirtAds.js
Implements a React component that configures ad slots and per-size image pools, shuffles image assignments on mount, renders ads via createPortal into document.body, persists dismissal state in localStorage with a 7-day TTL, and emits gtag analytics events on ad clicks and dismissal.
Ad slot styling and responsive breakpoints
src/styles/ads.css
Defines CSS for fixed-position ad containers (left/right 160×600, bottom 728×90), dismiss button and label styling, and media queries that hide side rails below 1280px and manage bottom banner visibility across mobile and tablet breakpoints.
App integration and layout adjustments
src/App.js, src/styles/layout.css
Imports the TshirtAds component and ads.css stylesheet, renders the component in the page layout, and adjusts .content-section and footer max-widths at 1280px+ viewports to reserve space for 160×600 side rails.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 Ads spring forth with portal might,
Dismissed with timestamps, hidden from sight,
Left and right at scales so wide,
Mobile banners below collide,
Analytics whisper every click—
A commerce trick both smooth and quick! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ 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 'Add Fourthwall t-shirt promo banners' clearly and directly summarizes the main change: introducing new advertisement components featuring Fourthwall t-shirt promotions across the application.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch develop

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

- Drop stale TODO comment in TshirtAds.js — the Fourthwall URL is set
- Remove plan file plans/generic-dancing-goose.md; intermediate work
  product shouldn't ship to main

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.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.

🧹 Nitpick comments (2)
src/components/TshirtAds.js (2)

116-122: ⚡ Quick win

Consider adding srcset for retina displays.

The plan document specifies supporting @2x retina variants via srcset, but the current implementation only uses the src attribute. This may result in lower quality images on high-DPI displays.

📱 Proposed enhancement for retina support
 <img
   className="tshirt-ad__image"
   src={`/ads/${slot.filename}`}
+  srcSet={`/ads/${slot.filename} 1x, /ads/${slot.filename.replace(/\.(png|jpg)$/, '`@2x`.$1')} 2x`}
   alt={TSHIRT_ALT}
   width={slot.width}
   height={slot.height}
 />

Note: This assumes @2x variants follow the naming pattern filename@2x.extension. You may need to adjust the IMAGE_POOLS structure to explicitly track 1x and 2x variants if the naming differs.

🤖 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/TshirtAds.js` around lines 116 - 122, The image element in
TshirtAds.js uses only src (src={`/ads/${slot.filename}`}) and lacks a srcset
for `@2x` retina variants; update the <img> rendering logic in the TshirtAds
component to generate and include a srcset that points to the 2x filename
variant (e.g., derive `${base}`@2x`.${ext}` from slot.filename) alongside the
existing src, keep alt={TSHIRT_ALT} and width/height as-is, and ensure the
srcset string uses the "2x" descriptor so high-DPI displays load the `@2x` asset.

4-5: TODO: Fourthwall product URL needs to be finalized.

The placeholder URL should be replaced with the actual product URL before deployment. The plan document lists this as an open item requiring user input.

Do you have the final Fourthwall product URL ready, or would you like me to help verify this is the correct one?

🤖 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/TshirtAds.js` around lines 4 - 5, Replace the placeholder
FOURTHWALL_URL constant in TshirtAds.js with the final Fourthwall product URL
(update the value of FOURTHWALL_URL to the production product link) or, if you
prefer configurability, refactor FOURTHWALL_URL into a runtime configuration/env
var (e.g., process.env.FOURTHWALL_URL) and ensure the component uses that symbol
so the correct URL can be provided without code changes.
🤖 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.

Nitpick comments:
In `@src/components/TshirtAds.js`:
- Around line 116-122: The image element in TshirtAds.js uses only src
(src={`/ads/${slot.filename}`}) and lacks a srcset for `@2x` retina variants;
update the <img> rendering logic in the TshirtAds component to generate and
include a srcset that points to the 2x filename variant (e.g., derive
`${base}`@2x`.${ext}` from slot.filename) alongside the existing src, keep
alt={TSHIRT_ALT} and width/height as-is, and ensure the srcset string uses the
"2x" descriptor so high-DPI displays load the `@2x` asset.
- Around line 4-5: Replace the placeholder FOURTHWALL_URL constant in
TshirtAds.js with the final Fourthwall product URL (update the value of
FOURTHWALL_URL to the production product link) or, if you prefer
configurability, refactor FOURTHWALL_URL into a runtime configuration/env var
(e.g., process.env.FOURTHWALL_URL) and ensure the component uses that symbol so
the correct URL can be provided without code changes.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d896e08c-80b6-4342-8abd-335e1e084500

📥 Commits

Reviewing files that changed from the base of the PR and between e178855 and 98dd5fa.

⛔ Files ignored due to path filters (6)
  • public/ads/horizontal-mobile.jpg is excluded by !**/*.jpg
  • public/ads/horizontal.jpg is excluded by !**/*.jpg
  • public/ads/unisex-staple-t-shirt-black-front-6a0df0764472a.png is excluded by !**/*.png
  • public/ads/unisex-staple-t-shirt-black-left-front-6a0df07642e27.png is excluded by !**/*.png
  • public/ads/unisex-staple-t-shirt-black-right-front-6a0df0763f3d0.png is excluded by !**/*.png
  • public/ads/unisex-staple-t-shirt-black-right-front-6a0df07641fa5.png is excluded by !**/*.png
📒 Files selected for processing (6)
  • .gitignore
  • plans/generic-dancing-goose.md
  • src/App.js
  • src/components/TshirtAds.js
  • src/styles/ads.css
  • src/styles/layout.css

@danmooney danmooney merged commit a9ab17f into main May 20, 2026
2 checks passed
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.

1 participant