ads: add a persistent "Monetize a new site" button on /ads/slots - #101
Merged
Merged
Conversation
There was no way to start monetizing another site once you already had projects: the only link to project creation lived inside the empty state, which never shows when you have projects. Add an always-visible "Monetize a new site" button in the Monetize header. To close the loop, /projects/new now accepts ?next=<relative-path> and returns there after creating (guarded to same-site relative paths), so "Monetize a new site" lands you back on /ads/slots with the new site ready to "Enable ads". - app/(app)/ads/slots/page.tsx: header button + return-aware empty-state link - app/(app)/projects/new/page.tsx: read `next` from searchParams - app/(app)/projects/new/form.tsx: redirect to `next` when safe Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
vu1nz Security Review0 finding(s) in PR #? No security issues found. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On
/ads/slots("Monetize your site") there was no way to start monetizing another site once you already had projects. The only link to project creation lived inside the empty state (projects.length === 0), which never renders when you have projects — so with sites already added, the page showed the list with no "add a site" affordance. (Not a new regression — the link was always empty-state-only — but it reads as a missing button.)Fix
/projects/newnow accepts?next=<relative-path>and returns there after creating (guarded to same-site relative paths — no open redirect). So the button sends you to/projects/new?next=/ads/slots, and after creating you land back on/ads/slotswith the new site ready to Enable ads.Changes
app/(app)/ads/slots/page.tsx— header button + return-aware empty-state linkapp/(app)/projects/new/page.tsx— readnextfromsearchParams(Next 16 async), pass to formapp/(app)/projects/new/form.tsx— redirect tonextwhen it's a safe relative pathVerified
tsc --noEmitcleannext buildcompiles;/ads/slotsand/projects/newbuild as expected🤖 Generated with Claude Code