[PULSE-49] Welcome flow, add-site step 2, shared ScriptSetupBlock, and dashboard empty state#17
Conversation
…allback and handle organization checks
…welcome page with tracking and error handling
…switching functionality
…th appropriate security attributes
…nd site availability
…nd script copying functionality
…structions and tracking script functionality across pages
Greptile OverviewGreptile SummaryThis PR successfully implements a unified welcome/onboarding flow with improved UX for site creation. The changes consolidate duplicate script setup UI into a shared Key improvements:
Architecture:
The code is well-structured, follows React best practices, and maintains consistency with the existing codebase. No critical issues found. Confidence Score: 5/5
|
| Filename | Overview |
|---|---|
| components/sites/ScriptSetupBlock.tsx | New shared component for script setup UI with framework picker, clean implementation with good accessibility |
| app/sites/new/page.tsx | Two-step site creation flow with sessionStorage persistence, proper error handling and analytics tracking |
| app/welcome/page.tsx | Complete onboarding wizard with 5 steps, clean state management and proper URL state synchronization |
| lib/welcomeAnalytics.ts | Analytics tracking utility with custom events for welcome flow, proper error handling |
| app/page.tsx | Added finish setup banner and empty state for zero sites, conditional rendering of SiteList |
Sequence Diagram
sequenceDiagram
participant User
participant Browser
participant Welcome as /welcome
participant SitesNew as /sites/new
participant Dashboard as /page
participant ScriptSetup as ScriptSetupBlock
participant Analytics as welcomeAnalytics
alt New User Flow (Welcome)
User->>Welcome: Navigate to /welcome
Welcome->>Browser: Check localStorage (pulse_pending_checkout)
Welcome->>Analytics: trackWelcomeStepView(1)
User->>Welcome: Create workspace (Step 2)
Welcome->>Analytics: trackWelcomeWorkspaceCreated()
User->>Welcome: Select plan (Step 3)
Welcome->>Analytics: trackWelcomePlanContinue/Skip()
User->>Welcome: Add first site (Step 4)
Welcome->>Analytics: trackWelcomeSiteAdded()
Welcome->>ScriptSetup: Show script with framework picker
User->>ScriptSetup: Copy script
Welcome->>Analytics: trackWelcomeCompleted()
Welcome->>Dashboard: Redirect to dashboard
end
alt Dashboard Add Site Flow
User->>Dashboard: Click "Add site"
Dashboard->>SitesNew: Navigate to /sites/new
User->>SitesNew: Submit site form (Step 1)
SitesNew->>Analytics: trackSiteCreatedFromDashboard()
SitesNew->>Browser: Store in sessionStorage (pulse_last_created_site)
SitesNew->>ScriptSetup: Show Step 2 with script setup
User->>ScriptSetup: Copy script
ScriptSetup->>Analytics: trackSiteCreatedScriptCopied()
User->>SitesNew: Click "Back to dashboard"
SitesNew->>Browser: Clear sessionStorage
SitesNew->>Dashboard: router.refresh() + push('/')
end
alt Session Restoration
User->>Browser: Refresh page on /sites/new
Browser->>SitesNew: Load with sessionStorage data
SitesNew->>Browser: Check pulse_last_created_site
Browser->>SitesNew: Return site ID
SitesNew->>ScriptSetup: Restore Step 2 view
end
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.
Work Item
PULSE-49
Summary
/sites/new(script + verify + edit details)./welcomeand/sites/new.Changes
components/sites/ScriptSetupBlock.tsx— Shared block: framework picker, script snippet with copy (always visible,aria-label), “View all integrations” and “See full [Framework] guide” links; used by welcome step 5,/sites/newstep 2, and site settings.app/sites/new/layout.tsx— Metadata: title “Create site | Pulse”, description for new site page.app/welcome/layout.tsx— Metadata: title “Welcome | Pulse”, description for welcome page.lib/welcomeAnalytics.ts: New events and helpers:site_created_from_dashboard,site_created_script_copied;trackSiteCreatedFromDashboard(),trackSiteCreatedScriptCopied()(emit onpulse_welcome).app/sites/new/page.tsx: Two-step flow: after create, show step 2 (ScriptSetupBlock, Verify installation modal, Edit site details link). Persist step 2 in sessionStorage (pulse_last_created_site) and restore on refresh viagetSite(id). “Back to dashboard” callsrouter.refresh()thenrouter.push('/'). Solo plan at limit:atLimitstate, disable Create Site, optional message. Tracksite_created_from_dashboardon create andsite_created_script_copiedvia ScriptSetupBlockonScriptCopy.app/welcome/page.tsx: Step 5 usesScriptSetupBlock; “View all integrations” and “See full [Framework] guide” open in new tab. Removed local script/framework UI and related imports/state.app/page.tsx: RenderSiteListonly whensitesLoading || sites.length > 0so the duplicate “No sites yet” empty state is not shown when there are no sites.app/sites/[id]/settings/page.tsx: Tracking Script section replaced withScriptSetupBlock(framework picker + script + copy). Removed localscriptCopied,copyScript, andAPI_URLimport; copy button always visible with accessible label.Test Plan
/sites/new: Create site → step 2 shows (script + framework + verify); “Edit site details” returns to form with name/domain; “Verify installation” opens modal; refresh on step 2 keeps step 2; “Back to dashboard” shows new site in list./sites/newredirects or form shows with Create Site disabled./welcome, “Create site | Pulse” on/sites/new.pulse_welcome; confirmsite_created_from_dashboardandsite_created_script_copiedwhen adding site from dashboard and copying script.