Skip to content

Open source alternative to Semrush and Ahrefs

Simplify onboarding and guide Search Console setup (#938)

Ben Senescu95d6899b2364
diff --git a/src/client/features/ai-mcp/AgentSetup.tsx b/src/client/features/ai-mcp/AgentSetup.tsx
index f1c62d39..b8b32e60 100644
--- a/src/client/features/ai-mcp/AgentSetup.tsx
+++ b/src/client/features/ai-mcp/AgentSetup.tsx
@@ -43,7 +43,7 @@ export function AgentSetup({
className="h-8 gap-2 px-3 text-xs font-semibold"
onClick={onNext}
>
- Continue <ArrowRight className="size-4" />
+ Finish <ArrowRight className="size-4" />
</Button>
}
/>
diff --git a/src/client/features/dashboard/DashboardCards.tsx b/src/client/features/dashboard/DashboardCards.tsx
index 520ad058..936aa4b9 100644
--- a/src/client/features/dashboard/DashboardCards.tsx
+++ b/src/client/features/dashboard/DashboardCards.tsx
@@ -212,7 +212,13 @@ export function AuditHealthCard({
</CardShell>
);
- if (audit.status === "running")
+ if (audit.status === "running") {
+ const isLighthouse = audit.currentPhase === "lighthouse";
+ const isFinalizing = audit.currentPhase === "finalizing";
+ const checked = isLighthouse
+ ? audit.lighthouseCompleted + audit.lighthouseFailed
+ : audit.pagesCrawled;
+ const total = isLighthouse ? audit.lighthouseTotal : audit.pagesTotal;
// A running crawl has at most a partial issue list, and an empty one is
// not the same as a healthy site, so show progress instead.
return (
@@ -231,19 +237,34 @@ export function AuditHealthCard({
>
<div className="flex flex-1 flex-col items-center justify-center gap-3 py-6 text-center">
<LoaderCircle className="size-7 animate-spin text-muted-foreground" />
- <h3 className="font-medium">Scanning your website</h3>
- <Progress
- className="w-full max-w-xs"
- value={audit.pagesCrawled}
- max={audit.pagesTotal || 1}
- aria-label="Pages checked"
- />
+ <h3 className="font-medium">
+ {isLighthouse
+ ? "Running Lighthouse checks"
+ : isFinalizing
+ ? "Preparing your results"
+ : audit.currentPhase === "discovery"
+ ? "Finding pages to scan"
+ : "Scanning your website"}
+ </h3>
+ {!isFinalizing && (
+ <Progress
+ className="w-full max-w-xs"
+ value={checked}
+ max={total || 1}
+ aria-label={isLighthouse ? "Lighthouse checks" : "Pages crawled"}
+ />
+ )}
<p className="text-sm text-muted-foreground tabular-nums">
- {audit.pagesCrawled} of up to {audit.pagesTotal} pages checked
+ {isLighthouse
+ ? `${checked} of ${total} checks${audit.lighthouseFailed > 0 ? ` (${audit.lighthouseFailed} failed)` : ""}`
+ : isFinalizing
+ ? `${audit.pagesCrawled} pages crawled. Finishing your report.`
+ : `${checked} of up to ${total} pages crawled`}
</p>
</div>
</CardShell>
);
+ }
return (
<CardShell
diff --git a/src/client/features/integrations/GooglePropertyPicker.tsx b/src/client/features/integrations/GooglePropertyPicker.tsx
index d605507b..084135ff 100644
--- a/src/client/features/integrations/GooglePropertyPicker.tsx
+++ b/src/client/features/integrations/GooglePropertyPicker.tsx
@@ -1,3 +1,8 @@
+import {
+ GscPropertySetupHelp,
+ hasNoGscWebsites,
+ EmptyAccountMessage,
+} from "./GscPropertySetupHelp";
import { GoogleAccountRemovalDialog } from "@/client/features/integrations/GoogleAccountRemovalDialog";
import { QueryError } from "@/client/components/QueryState";
import { Spinner } from "@/client/components/Spinner";
@@ -68,7 +73,7 @@ export function GooglePropertyPicker({
onRetry: () => void;
onReconnect: () => void;
secondaryAction?: SecondaryAction;
- renderActions?: (saveButton: ReactNode) => ReactNode;
+ renderActions?: (disabled: boolean) => ReactNode;
}) {
const [open, setOpen] = useState(false);
const [removing, setRemoving] = useState<GooglePickerAccount | null>(null);
@@ -87,6 +92,8 @@ export function GooglePropertyPicker({
!selectedAccount?.unavailable &&
!loading &&
!error;
+ const emptyGsc =
+ provider === "gsc" && hasNoGscWebsites(accounts, loading, error);
const query = search.trim().toLowerCase();
const filtered = accounts
.map((account) => ({
@@ -127,194 +134,213 @@ export function GooglePropertyPicker({
}}
/>
) : null}
- <div>
- <p className="mb-2 text-sm font-medium">
- {readOnly ? "Manage Google accounts" : "Choose property"}
- </p>
- <Button
- ref={trigger}
- variant="outline"
- aria-expanded={open}
- aria-controls={panelId}
- disabled={saving}
- className="h-auto w-full justify-between gap-3 px-3.5 py-3 text-left font-normal"
- onClick={() => {
- setOpen(!open);
- setSearch("");
- }}
- >
- <span className="min-w-0">
- <span className="block truncate">
- {selected?.name ?? "Select a property…"}
- </span>
- {selectedAccount ? (
- <span className="mt-0.5 block truncate text-xs text-muted-foreground">
- {accountLabel(selectedAccount)}
- </span>
- ) : null}
- </span>
- <ChevronDown className="size-4 shrink-0 text-muted-foreground" />
- </Button>
- {open ? (
- <div
- id={panelId}
- role="region"
- aria-label="Google properties"
- className="mt-2 overflow-hidden rounded-lg border border-border bg-popover shadow-sm"
- onKeyDown={(event) => handlePropertyKeyDown(event, close)}
+ {provider === "gsc" ? (
+ <GscPropertySetupHelp
+ accounts={accounts}
+ emptyGsc={emptyGsc}
+ loading={loading}
+ error={error}
+ busy={saving || linking}
+ linking={linking}
+ onRetry={onRetry}
+ onReconnect={onReconnect}
+ />
+ ) : null}
+ {!emptyGsc || readOnly ? (
+ <div>
+ <p className="mb-2 text-sm font-medium">
+ {readOnly ? "Manage Google accounts" : "Choose property"}
+ </p>
+ <Button
+ ref={trigger}
+ variant="outline"
+ aria-expanded={open}
+ aria-controls={panelId}
+ disabled={saving}
+ className="h-auto w-full justify-between gap-3 px-3.5 py-3 text-left font-normal"
+ onClick={() => {
+ setOpen(!open);
+ setSearch("");
+ }}
>
- <label className="flex items-center gap-2 border-b border-border px-3.5 py-3">
- <Search className="size-4 shrink-0 text-muted-foreground" />
- <Input
- autoFocus
- type="search"
- aria-label="Search properties or accounts"
- placeholder="Search properties or accounts…"
- value={search}
- onChange={(event) => setSearch(event.target.value)}
- className="h-auto min-w-0 border-0 bg-transparent p-0 shadow-none focus-visible:ring-0"
- />
- </label>
- <div className="max-h-72 overflow-y-auto overscroll-contain p-1.5">
- {loading ? (
- <Spinner
- size="sm"
- label="Loading properties…"
- className="p-3"
- />
- ) : error ? (
- <QueryError
- fallback="Couldn't load properties."
- onRetry={onRetry}
+ <span className="min-w-0">
+ <span className="block truncate">
+ {selected?.name ?? "Select a property…"}
+ </span>
+ {selectedAccount ? (
+ <span className="mt-0.5 block truncate text-xs text-muted-foreground">
+ {accountLabel(selectedAccount)}
+ </span>
+ ) : null}
+ </span>
+ <ChevronDown className="size-4 shrink-0 text-muted-foreground" />
+ </Button>
+ {open ? (
+ <div
+ id={panelId}
+ role="region"
+ aria-label="Google properties"
+ className="mt-2 overflow-hidden rounded-lg border border-border bg-popover shadow-sm"
+ onKeyDown={(event) => handlePropertyKeyDown(event, close)}
+ >
+ <label className="flex items-center gap-2 border-b border-border px-3.5 py-3">
+ <Search className="size-4 shrink-0 text-muted-foreground" />
+ <Input
+ autoFocus
+ type="search"
+ aria-label="Search properties or accounts"
+ placeholder="Search properties or accounts…"
+ value={search}
+ onChange={(event) => setSearch(event.target.value)}
+ className="h-auto min-w-0 border-0 bg-transparent p-0 shadow-none focus-visible:ring-0"
/>
- ) : (
- <>
- {filtered.map((account) => (
- <div
- key={account.accountId}
- className="py-1"
- role="group"
- aria-label={accountLabel(account)}
- >
- <div className="flex items-center justify-between gap-2 px-2 py-2 text-xs font-medium text-muted-foreground">
- <span className="min-w-0 break-all">
- {accountLabel(account)}
- </span>
- <Button
- variant="ghost"
- size="xs"
- className="shrink-0 text-destructive"
- disabled={saving}
- onClick={() => setRemoving(account)}
- aria-label={`Remove ${accountLabel(account)}`}
- >
- Remove account
- </Button>
- </div>
- {account.requiresReconnect ? (
- <div className="flex flex-wrap items-center justify-between gap-2 px-2 pb-2 text-sm">
- <span className="text-muted-foreground">
- Connection expired
+ </label>
+ <div className="max-h-72 overflow-y-auto overscroll-contain p-1.5">
+ {loading ? (
+ <Spinner
+ size="sm"
+ label="Loading properties…"
+ className="p-3"
+ />
+ ) : error ? (
+ <QueryError
+ fallback="Couldn't load properties."
+ onRetry={onRetry}
+ />
+ ) : (
+ <>
+ {filtered.map((account) => (
+ <div
+ key={account.accountId}
+ className="py-1"
+ role="group"
+ aria-label={accountLabel(account)}
+ >
+ <div className="flex items-center justify-between gap-2 px-2 py-2 text-xs font-medium text-muted-foreground">
+ <span className="min-w-0 break-all">
+ {accountLabel(account)}
</span>
<Button
variant="ghost"
size="xs"
- onClick={onReconnect}
- aria-label={`Reconnect ${accountLabel(account)}`}
- disabled={linking}
- aria-busy={linking}
+ className="shrink-0 text-destructive"
+ disabled={saving}
+ onClick={() => setRemoving(account)}
+ aria-label={`Remove ${accountLabel(account)}`}
>
- {linking ? "Opening Google…" : "Reconnect"}
- </Button>
- </div>
- ) : account.unavailable ? (
- <div className="flex flex-wrap items-center justify-between gap-2 px-2 pb-2 text-sm">
- <span className="text-muted-foreground">
- Couldn't load properties
- </span>
- <Button variant="ghost" size="xs" onClick={onRetry}>
- Try again
+ Remove account
</Button>
</div>
- ) : account.properties.length === 0 ? (
- <p className="px-2 pb-3 text-sm text-muted-foreground">
- No properties available
- </p>
- ) : (
- account.properties.map((property) => {
- const chosen =
- selection?.accountId === account.accountId &&
- selection?.propertyId === property.id;
- return (
+ {account.requiresReconnect ? (
+ <div className="flex flex-wrap items-center justify-between gap-2 px-2 pb-2 text-sm">
+ <span className="text-muted-foreground">
+ Connection expired
+ </span>
<Button
- key={property.id}
- data-property
- type="button"
variant="ghost"
- aria-pressed={chosen}
- disabled={
- readOnly || !property.selectable || saving
- }
- className={`h-auto w-full justify-between gap-3 rounded-md px-2 py-2.5 text-left font-normal hover:bg-accent focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-40 ${chosen ? "bg-accent" : ""}`}
- onClick={() => {
- onSelect({
- accountId: account.accountId,
- propertyId: property.id,
- });
- close();
- }}
+ size="xs"
+ onClick={onReconnect}
+ aria-label={`Reconnect ${accountLabel(account)}`}
+ disabled={linking}
+ aria-busy={linking}
>
- <span className="min-w-0">
- <span className="block break-words">
- {property.name}
- </span>
- {property.detail ? (
- <span className="mt-0.5 block text-xs text-muted-foreground">
- {property.detail}
- </span>
- ) : null}
- {!property.selectable ? (
- <span className="block text-xs">
- No verified access
+ {linking ? "Opening Google…" : "Reconnect"}
+ </Button>
+ </div>
+ ) : account.unavailable ? (
+ <div className="flex flex-wrap items-center justify-between gap-2 px-2 pb-2 text-sm">
+ <span className="text-muted-foreground">
+ Couldn't load properties
+ </span>
+ <Button variant="ghost" size="xs" onClick={onRetry}>
+ Try again
+ </Button>
+ </div>
+ ) : account.properties.length === 0 ? (
+ <p className="px-2 pb-3 text-sm text-muted-foreground">
+ <EmptyAccountMessage
+ provider={provider}
+ filtered={Boolean(query)}
+ />
+ </p>
+ ) : (
+ account.properties.map((property) => {
+ const chosen =
+ selection?.accountId === account.accountId &&
+ selection?.propertyId === property.id;
+ return (
+ <Button
+ key={property.id}
+ data-property
+ type="button"
+ variant="ghost"
+ aria-pressed={chosen}
+ disabled={
+ readOnly || !property.selectable || saving
+ }
+ className={`h-auto w-full justify-between gap-3 rounded-md px-2 py-2.5 text-left font-normal hover:bg-accent focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-40 ${chosen ? "bg-accent" : ""}`}
+ onClick={() => {
+ onSelect({
+ accountId: account.accountId,
+ propertyId: property.id,
+ });
+ close();
+ }}
+ >
+ <span className="min-w-0">
+ <span className="block break-words">
+ {property.name}
</span>
+ {property.detail ? (
+ <span className="mt-0.5 block text-xs text-muted-foreground">
+ {property.detail}
+ </span>
+ ) : null}
+ {!property.selectable ? (
+ <span className="block text-xs">
+ {provider === "gsc"
+ ? "Ask the property owner for Full access, or verify ownership in Search Console."
+ : "No verified access"}
+ </span>
+ ) : null}
+ </span>
+ {chosen ? (
+ <Check className="size-4 shrink-0" />
) : null}
- </span>
- {chosen ? (
- <Check className="size-4 shrink-0" />
- ) : null}
- </Button>
- );
- })
- )}
- </div>
- ))}
- {filtered.length === 0 ? (
- <p className="p-3 text-sm text-muted-foreground">
- {query
- ? "No matching properties or accounts"
- : "Add a Google account to find properties."}
- </p>
- ) : null}
- </>
- )}
- </div>
- <div className="border-t border-border p-1.5">
- <Button
- variant="ghost"
- className="h-auto w-full justify-start px-2 py-2.5"
- onClick={onReconnect}
- disabled={saving || linking}
- pending={linking}
- >
- {linking ? null : <Plus className="size-4" />}
- {linking ? "Opening Google…" : "Add Google account"}
- </Button>
+ </Button>
+ );
+ })
+ )}
+ </div>
+ ))}
+ {filtered.length === 0 ? (
+ <p className="p-3 text-sm text-muted-foreground">
+ {query
+ ? "No matching properties or accounts"
+ : "Add a Google account to find properties."}
+ </p>
+ ) : null}
+ </>
+ )}
+ </div>
+ <div className="border-t border-border p-1.5">
+ <Button
+ variant="ghost"
+ className="h-auto w-full justify-start px-2 py-2.5"
+ onClick={onReconnect}
+ disabled={saving || linking}
+ pending={linking}
+ >
+ {linking ? null : <Plus className="size-4" />}
+ {linking ? "Opening Google…" : "Add Google account"}
+ </Button>
+ </div>
</div>
- </div>
- ) : null}
- </div>
+ ) : null}
+ </div>
+ ) : null}
{renderActions ? (
- renderActions(saveButton)
+ renderActions(!canSave || saving)
) : (
<div className="flex flex-wrap items-center gap-1">
{saveButton}
diff --git a/src/client/features/integrations/GscPropertySetupHelp.tsx b/src/client/features/integrations/GscPropertySetupHelp.tsx
new file mode 100644
index 00000000..4b21c682
--- /dev/null
+++ b/src/client/features/integrations/GscPropertySetupHelp.tsx
@@ -0,0 +1,149 @@
+import { Button } from "@/client/components/ui/button";
+import { QueryError } from "@/client/components/QueryState";
+import type { GooglePickerAccount } from "./GooglePropertyPicker";
+
+export function GscPropertySetupHelp({
+ accounts,
+ emptyGsc,
+ loading,
+ error,
+ busy,
+ linking,
+ onRetry,
+ onReconnect,
+}: {
+ accounts: GooglePickerAccount[];
+ emptyGsc: boolean;
+ loading: boolean;
+ error: boolean;
+ busy: boolean;
+ linking: boolean;
+ onRetry: () => void;
+ onReconnect: () => void;
+}) {
+ if (!emptyGsc && !error) return null;
+
+ return (
+ <>
+ {emptyGsc ? (
+ <div className="space-y-3 rounded-lg border border-border bg-muted/30 p-4 text-sm">
+ <h2 className="font-semibold">We couldn’t find your website</h2>
+ <p className="break-words text-muted-foreground">
+ We checked{" "}
+ {accounts
+ .map(
+ (account) =>
+ account.email ??
+ `Google account · ${account.accountId.slice(-6)}`,
+ )
+ .join(", ")}
+ .
+ </p>
+ <p className="text-muted-foreground">
+ Add your site to Search Console, or ask whoever manages it to give
+ {accounts.length === 1
+ ? " this account"
+ : " one of these accounts"}{" "}
+ access.
+ </p>
+ <div className="flex flex-wrap gap-x-4 gap-y-2">
+ <a
+ href="https://search.google.com/search-console"
+ target="_blank"
+ rel="noopener noreferrer"
+ className="underline underline-offset-4"
+ >
+ Open Search Console ↗
+ </a>
+ <a
+ href="https://openseo.so/blogs/google-search-console-setup"
+ target="_blank"
+ rel="noopener noreferrer"
+ className="underline underline-offset-4"
+ >
+ Setup guide
+ </a>
+ </div>
+ </div>
+ ) : null}
+ <div className="space-y-2">
+ {error ? (
+ <QueryError
+ fallback="Couldn't load Search Console websites."
+ onRetry={onRetry}
+ />
+ ) : null}
+ {emptyGsc ? (
+ <div className="flex flex-wrap gap-2">
+ <Button
+ variant="outline"
+ size="sm"
+ onClick={onRetry}
+ disabled={loading || busy}
+ >
+ {loading ? "Refreshing…" : "Refresh"}
+ </Button>
+ <Button
+ variant="ghost"
+ size="sm"
+ onClick={onReconnect}
+ disabled={loading || busy}
+ pending={linking}
+ >
+ {linking ? "Opening Google…" : "Use a different Google account"}
+ </Button>
+ </div>
+ ) : null}
+ </div>
+ </>
+ );
+}
+
+export function EmptyAccountMessage({
+ provider,
+ filtered,
+}: {
+ provider: "gsc" | "ga4";
+ filtered: boolean;
+}) {
+ return (
+ <>
+ {filtered ? (
+ "No matching properties in this account"
+ ) : provider === "gsc" ? (
+ <>
+ No websites found for this account.{" "}
+ <a
+ href="https://openseo.so/blogs/google-search-console-setup"
+ target="_blank"
+ rel="noopener noreferrer"
+ className="underline underline-offset-4"
+ >
+ Add a website or get access
+ </a>
+ , then refresh the list.
+ </>
+ ) : (
+ "No properties available"
+ )}
+ </>
+ );
+}
+
+export function hasNoGscWebsites(
+ accounts: GooglePickerAccount[],
+ loading: boolean,
+ error: boolean,
+) {
+ return (
+ !loading &&
+ !error &&
+ accounts.length > 0 &&
+ accounts.every(
+ (account) =>
+ !account.requiresReconnect &&
+ !account.unavailable &&
+ account.properties.length === 0,
+ )
+ );
+}
diff --git a/src/client/features/integrations/googleSetupState.test.ts b/src/client/features/integrations/googleSetupState.test.ts
index 18bb9eae..267f9cc3 100644
--- a/src/client/features/integrations/googleSetupState.test.ts
+++ b/src/client/features/integrations/googleSetupState.test.ts
@@ -3,6 +3,7 @@ import { renderToStaticMarkup } from "react-dom/server";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { describe, expect, it, vi } from "vitest";
import { GoogleConnectionCard } from "@/client/features/integrations/GoogleConnectionCard";
+import type { GooglePickerAccount } from "./GooglePropertyPicker";
import { SearchConsoleOnboardingStep } from "@/client/features/onboarding/SearchConsoleOnboardingStep";
vi.mock("@/serverFunctions/gsc", () => ({
@@ -38,7 +39,13 @@ function renderSetup(
hasGrant: boolean,
connected = false,
canManage = true,
- connectionError?: "initial" | "refetch",
+ {
+ connectionError,
+ accounts,
+ }: {
+ connectionError?: "initial" | "refetch";
+ accounts?: GooglePickerAccount[];
+ } = {},
) {
const client = new QueryClient({
defaultOptions: { queries: { retry: false, retryOnMount: false } },
@@ -52,6 +59,12 @@ function renderSetup(
googleOAuthConfigured: true,
property: "https://example.com/",
});
+ if (accounts) {
+ client.setQueryData(
+ [provider === "gsc" ? "gscSites" : "ga4Properties", "project-a"],
+ { accounts },
+ );
+ }
if (connectionError) {
client
.getQueryCache()
@@ -105,7 +118,9 @@ it.each(["gsc", "ga4"] as const)(
describe("onboarding connection actions", () => {
it("keeps cached property setup and a single footer after a failed refetch", () => {
- const html = renderSetup("onboarding", true, false, true, "refetch");
+ const html = renderSetup("onboarding", true, false, true, {
+ connectionError: "refetch",
+ });
expect(html).toContain("Choose property");
expect(html).not.toContain("check your Google connection.");
expect(html.match(/Save and continue/g)).toHaveLength(1);
@@ -114,17 +129,65 @@ describe("onboarding connection actions", () => {
});
it("keeps a saved connection usable after a failed refetch", () => {
- const html = renderSetup("onboarding", true, true, true, "refetch");
+ const html = renderSetup("onboarding", true, true, true, {
+ connectionError: "refetch",
+ });
expect(html).toContain("https://example.com/");
expect(html).toMatch(/>Continue[ <]/);
expect(html).not.toContain("Save and continue");
});
it("offers retry and disables saving when the initial connection check fails", () => {
- const html = renderSetup("onboarding", false, false, true, "initial");
+ const html = renderSetup("onboarding", false, false, true, {
+ connectionError: "initial",
+ });
expect(html).toContain("Couldn&#x27;t check your Google connection.");
expect(html).toContain("Try again");
expect(html).not.toContain("Choose property");
expect(html).toMatch(/disabled=""[^>]*>Save and continue/);
});
});
+
+describe("Search Console website setup guidance", () => {
+ const emptyAccount = {
+ accountId: "account-a",
+ email: "[email protected]",
+ requiresReconnect: false,
+ properties: [],
+ };
+
+ it.each(["gsc", "onboarding"] as const)(
+ "explains empty accounts without opening the %s picker",
+ (surface) => {
+ const html = renderSetup(surface, true, false, true, {
+ accounts: [emptyAccount],
+ });
+ expect(html).toContain("We couldn’t find your website");
+ expect(html).toContain("[email protected]");
+ expect(html).not.toContain("Select a property");
+ expect(html).toContain("/blogs/google-search-console-setup");
+ expect(html).toContain("Refresh");
+ expect(html).toContain("Use a different Google account");
+ if (surface === "onboarding") expect(html).toContain("Skip for now");
+ },
+ );
+
+ it.each([
+ { requiresReconnect: true },
+ { unavailable: true },
+ {
+ properties: [
+ { id: "https://example.com/", name: "example.com", selectable: true },
+ ],
+ },
+ ])(
+ "does not mistake expired, failed, or populated accounts for a new website",
+ (patch) => {
+ const html = renderSetup("gsc", true, false, true, {
+ accounts: [{ ...emptyAccount, ...patch }],
+ });
+ expect(html).toContain("Choose property");
+ expect(html).not.toContain("We couldn’t find your website");
+ },
+ );
+});
diff --git a/src/client/features/onboarding/OnboardingCard.tsx b/src/client/features/onboarding/OnboardingCard.tsx
index 8a6486cc..15ec9ac9 100644
--- a/src/client/features/onboarding/OnboardingCard.tsx
+++ b/src/client/features/onboarding/OnboardingCard.tsx
@@ -1,12 +1,21 @@
import type { ReactNode } from "react";
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger,
+} from "@/client/components/ui/tooltip";
export function OnboardingCard({
step,
- total,
+ steps,
+ onStepChange,
+ disabled,
children,
}: {
step: number;
- total: number;
+ steps: string[];
+ onStepChange: (index: number) => void;
+ disabled: boolean;
children: ReactNode;
}) {
return (
@@ -16,22 +25,25 @@ export function OnboardingCard({
OpenSEO
</div>
<main className="mt-8 rounded-2xl border border-border bg-card p-6 shadow-sm md:mt-12 md:p-10">
- <div
- className="mb-8 flex gap-2"
- role="progressbar"
- aria-label="Onboarding progress"
- aria-valuemin={1}
- aria-valuemax={total}
- aria-valuenow={step}
- aria-valuetext={`Step ${step} of ${total}`}
- >
- {Array.from({ length: total }, (_, index) => (
- <span
- key={index}
- className={`h-1 flex-1 rounded-full ${index < step ? "bg-primary" : "bg-border"}`}
- />
+ <nav className="-mt-3 mb-5 flex gap-2" aria-label="Onboarding steps">
+ {steps.map((label, index) => (
+ <Tooltip key={label}>
+ <TooltipTrigger
+ render={<button type="button" />}
+ aria-label={`Step ${index + 1}: ${label}`}
+ aria-current={index === step - 1 ? "step" : undefined}
+ disabled={disabled}
+ onClick={() => onStepChange(index)}
+ className="group flex min-h-7 flex-1 cursor-pointer items-center rounded-sm focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring disabled:cursor-default"
+ >
+ <span
+ className={`h-1 w-full rounded-full transition-colors group-hover:bg-primary/70 ${index === step - 1 ? "bg-primary" : "bg-border"}`}
+ />
+ </TooltipTrigger>
+ <TooltipContent>{label}</TooltipContent>
+ </Tooltip>
))}
- </div>
+ </nav>
{children}
</main>
</div>
diff --git a/src/client/features/onboarding/PostSignupOnboarding.tsx b/src/client/features/onboarding/PostSignupOnboarding.tsx
index e5130629..3ffddeda 100644
--- a/src/client/features/onboarding/PostSignupOnboarding.tsx
+++ b/src/client/features/onboarding/PostSignupOnboarding.tsx
@@ -1,31 +1,15 @@
-import { OnboardingCard } from "./OnboardingCard";
-import { Check } from "lucide-react";
import type { ReactNode } from "react";
-import { Fragment } from "react";
-import {
- CLIENT_WEBSITE_COUNT_OPTIONS,
- CLIENT_WORK_FOR,
- INTEREST_OPTIONS,
- ONBOARDING_LAST_STEP,
- ONBOARDING_OPTION_LABELS,
- ONBOARDING_STEPS,
- type OnboardingAnswers,
- SOURCE_OPTIONS,
- WORK_FOR_OPTIONS,
-} from "@/client/features/onboarding/onboardingModel";
+import { OnboardingCard } from "./OnboardingCard";
+import { ONBOARDING_STEPS } from "./onboardingModel";
+import { WebsiteOnboardingStep } from "./WebsiteOnboardingStep";
import { AgentSetup } from "@/client/features/ai-mcp/AgentSetup";
-import { WebsiteOnboardingStep } from "@/client/features/onboarding/WebsiteOnboardingStep";
-import { SearchConsoleOnboardingStep } from "@/client/features/onboarding/SearchConsoleOnboardingStep";
-import { WizardFooter } from "@/client/features/onboarding/WizardFooter";
-import { Input } from "@/client/components/ui/input";
-import { Toggle } from "@/client/components/ui/toggle";
+import { SearchConsoleOnboardingStep } from "./SearchConsoleOnboardingStep";
type PostSignupOnboardingProps = {
step: number;
- answers: OnboardingAnswers;
- onAnswersChange: (answers: OnboardingAnswers) => void;
onNext: () => void;
onBack: () => void;
+ onStepChange: (step: number) => void;
onSkip: () => void;
onFinish: () => void;
isSaving: boolean;
@@ -36,222 +20,42 @@ type PostSignupOnboardingProps = {
export function PostSignupOnboarding({
step,
- answers,
- onAnswersChange,
onNext,
onBack,
+ onStepChange,
onSkip,
onFinish,
isSaving,
accountMenu,
suggestedDomain,
}: PostSignupOnboardingProps) {
- const stepName = ONBOARDING_STEPS[step];
- const isLastStep = step === ONBOARDING_LAST_STEP;
- const canContinue =
- stepName === "interests"
- ? answers.selectedInterests.length > 0
- : stepName === "work_for"
- ? Boolean(answers.workFor)
- : Boolean(answers.source);
-
- const updateAnswers = (patch: Partial<OnboardingAnswers>) =>
- onAnswersChange({ ...answers, ...patch });
-
return (
<>
{accountMenu}
- <OnboardingCard step={step + 1} total={ONBOARDING_LAST_STEP + 1}>
+ <OnboardingCard
+ step={step + 1}
+ steps={["Website", "Google Search Console", "Agent setup"]}
+ onStepChange={onStepChange}
+ disabled={isSaving}
+ >
<fieldset disabled={isSaving} className="min-w-0">
- {stepName === "website" ? (
+ {ONBOARDING_STEPS[step] === "website" ? (
<WebsiteOnboardingStep
onNext={onNext}
onSkip={onSkip}
suggestedDomain={suggestedDomain}
/>
- ) : stepName === "search_console" ? (
+ ) : ONBOARDING_STEPS[step] === "search_console" ? (
<SearchConsoleOnboardingStep
onNext={onNext}
onBack={onBack}
onSkip={onSkip}
/>
- ) : stepName === "agent_setup" ? (
- <AgentSetup onNext={onNext} onBack={onBack} disabled={isSaving} />
- ) : stepName === "interests" ? (
- <OnboardingChoiceGroup
- title="What brings you here?"
- description="Pick up to three things you want to work on."
- maxSelections={3}
- options={[...INTEREST_OPTIONS]}
- selectedValues={answers.selectedInterests}
- onToggle={(value) => {
- updateAnswers({
- selectedInterests: answers.selectedInterests.includes(value)
- ? answers.selectedInterests.filter((item) => item !== value)
- : [...answers.selectedInterests, value],
- });
- }}
- otherValue={answers.interestOther}
- onOtherChange={(interestOther) =>
- updateAnswers({ interestOther })
- }
- multiple
- />
- ) : stepName === "work_for" ? (
- <OnboardingChoiceGroup
- title="Who are you doing SEO for?"
- options={[...WORK_FOR_OPTIONS]}
- selectedValues={answers.workFor ? [answers.workFor] : []}
- onToggle={(workFor) => updateAnswers({ workFor })}
- otherValue={answers.workForOther}
- onOtherChange={(workForOther) => updateAnswers({ workForOther })}
- followUp={
- <ClientWebsiteCountPicker
- value={answers.clientWebsiteCount}
- onChange={(clientWebsiteCount) =>
- updateAnswers({ clientWebsiteCount })
- }
- />
- }
- />
) : (
- <OnboardingChoiceGroup
- title="How did you find OpenSEO?"
- options={[...SOURCE_OPTIONS]}
- selectedValues={answers.source ? [answers.source] : []}
- onToggle={(source) => updateAnswers({ source })}
- otherValue={answers.sourceOther}
- onOtherChange={(sourceOther) => updateAnswers({ sourceOther })}
- />
- )}
-
- {step > ONBOARDING_STEPS.indexOf("agent_setup") && (
- <WizardFooter
- onBack={onBack}
- onSkip={isLastStep ? onFinish : onSkip}
- onContinue={isLastStep ? onFinish : onNext}
- continueLabel={isLastStep ? "Finish" : "Continue"}
- continueDisabled={!canContinue || isSaving}
- />
+ <AgentSetup onNext={onFinish} onBack={onBack} disabled={isSaving} />
)}
</fieldset>
</OnboardingCard>
</>
);
}
-
-function OnboardingChoiceGroup({
- title,
- description,
- options,
- selectedValues,
- onToggle,
- otherValue,
- onOtherChange,
- multiple = false,
- maxSelections,
- followUp,
-}: {
- title: string;
- description?: string;
- options: string[];
- selectedValues: string[];
- onToggle: (value: string) => void;
- otherValue: string;
- onOtherChange: (value: string) => void;
- multiple?: boolean;
- maxSelections?: number;
- /** Shown under the "My clients" option while it is selected. */
- followUp?: ReactNode;
-}) {
- const isOtherSelected = selectedValues.includes("Other");
- const atLimit =
- maxSelections !== undefined && selectedValues.length >= maxSelections;
-
- return (
- <div>
- <div className="mb-8">
- <h1 className="text-2xl font-semibold tracking-tight">{title}</h1>
- {description ? (
- <p className="mt-3 text-sm leading-relaxed text-muted-foreground">
- {description}
- </p>
- ) : null}
- </div>
-
- <div className="flex flex-wrap gap-2">
- {options.map((option) => {
- const selected = selectedValues.includes(option);
- const disabled = atLimit && !selected;
-
- return (
- <Fragment key={option}>
- <Toggle
- variant="outline"
- pressed={selected}
- className={`h-auto min-h-11 gap-3 rounded-full px-4 py-2.5 text-left font-normal disabled:opacity-35 ${selected ? "border-primary bg-primary/5 text-primary aria-pressed:bg-primary/5" : "border-border hover:bg-background"}`}
- disabled={disabled}
- onPressedChange={() => onToggle(option)}
- >
- <span
- className={`flex size-4 shrink-0 items-center justify-center border ${multiple ? "rounded" : "rounded-full"} ${selected ? "border-primary bg-primary text-primary-foreground" : "border-foreground/30"}`}
- >
- {selected && <Check className="size-3" />}
- </span>
- <span className="capitalize">
- {ONBOARDING_OPTION_LABELS[option] ?? option}
- </span>
- </Toggle>
-
- {selected && option === CLIENT_WORK_FOR ? followUp : null}
- </Fragment>
- );
- })}
- </div>
-
- {isOtherSelected ? (
- <Input
- type="text"
- className="mt-4 border-foreground/20 bg-card text-base md:text-base"
- aria-label={multiple ? "Other tasks" : "Other answer"}
- placeholder={multiple ? "Tell us what else..." : "Tell us more..."}
- value={otherValue}
- onChange={(event) => onOtherChange(event.target.value)}
- />
- ) : null}
- </div>
- );
-}
-
-function ClientWebsiteCountPicker({
- value,
- onChange,
-}: {
- value: string;
- onChange: (value: string) => void;
-}) {
- return (
- <div className="w-full rounded-lg border border-border bg-background/40 p-4">
- <p className="text-sm text-foreground/70">
- About how many client sites do you work on?
- </p>
- <div className="mt-2 flex flex-wrap gap-2">
- {CLIENT_WEBSITE_COUNT_OPTIONS.map((option) => {
- const selected = value === option;
-
- return (
- <Toggle
- key={option}
- variant="outline"
- pressed={selected}
- className={`h-auto rounded-md px-3 py-1.5 font-normal ${selected ? "border-foreground aria-pressed:bg-background" : "border-border text-foreground/75 hover:border-foreground/40 hover:bg-background/60"}`}
- onPressedChange={() => onChange(selected ? "" : option)}
- >
- {option}
- </Toggle>
- );
- })}
- </div>
- </div>
- );
-}
diff --git a/src/client/features/onboarding/SearchConsoleOnboardingStep.tsx b/src/client/features/onboarding/SearchConsoleOnboardingStep.tsx
index e643af8c..3363bbd2 100644
--- a/src/client/features/onboarding/SearchConsoleOnboardingStep.tsx
+++ b/src/client/features/onboarding/SearchConsoleOnboardingStep.tsx
@@ -32,7 +32,7 @@ const GRANT_STATUS_KEY = ["gscGrantStatus"];
*/
type NavigationProps = {
onNext: () => void;
- onBack: () => void;
+ onBack?: () => void;
onSkip: () => void;
};
@@ -44,11 +44,10 @@ export function SearchConsoleOnboardingStep(props: NavigationProps) {
<div className="space-y-4">
<div>
<h1 className="text-2xl font-semibold tracking-tight">
- Connect Google Search Console now?
+ Connect Google Search Console
</h1>
- <p className="mt-3 text-sm leading-relaxed text-muted-foreground">
- Bring your real clicks and queries into OpenSEO and your AI agent. You
- can also do this later from the dashboard.
+ <p className="mt-3 text-sm text-muted-foreground">
+ See which Google searches bring people to your site.
</p>
</div>
@@ -89,6 +88,11 @@ function GscConnect({
const linking = useGoogleLinkPending();
const [selection, setSelection] =
React.useState<GooglePickerSelection | null>(null);
+ const continueRef = React.useRef<HTMLButtonElement>(null);
+
+ React.useEffect(() => {
+ if (selection) continueRef.current?.focus();
+ }, [selection]);
const connectionOptions = googleConnectionOptions("gsc", projectId);
const connectionKey = connectionOptions.queryKey;
@@ -175,13 +179,19 @@ function GscConnect({
onSave={() =>
selection && !busy && setSiteMutation.mutate(selection)
}
- saveLabel="Save and continue"
- renderActions={(saveButton) => (
+ renderActions={(disabled) => (
<WizardFooter
onBack={onBack}
onSkip={onSkip}
skipLabel="Skip for now"
- continueAction={saveButton}
+ continueLabel={
+ setSiteMutation.isPending ? "Saving…" : "Save and continue"
+ }
+ continueDisabled={disabled}
+ continueRef={continueRef}
+ onContinue={() =>
+ selection && !busy && setSiteMutation.mutate(selection)
+ }
/>
)}
saving={setSiteMutation.isPending}
diff --git a/src/client/features/onboarding/WebsiteOnboardingStep.tsx b/src/client/features/onboarding/WebsiteOnboardingStep.tsx
index b197b027..5d930cb0 100644
--- a/src/client/features/onboarding/WebsiteOnboardingStep.tsx
+++ b/src/client/features/onboarding/WebsiteOnboardingStep.tsx
@@ -1,12 +1,17 @@
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import { revalidateLogic } from "@tanstack/react-form";
-import { ArrowRight } from "lucide-react";
+import { ArrowRight, ChevronDown } from "lucide-react";
import { toast } from "sonner";
import { z } from "zod";
import { useAppForm } from "@/client/components/form/useAppForm";
import { QueryError } from "@/client/components/QueryState";
import { Spinner } from "@/client/components/Spinner";
import { Button } from "@/client/components/ui/button";
+import {
+ Collapsible,
+ CollapsibleContent,
+ CollapsibleTrigger,
+} from "@/client/components/ui/collapsible";
import { WizardFooter } from "@/client/features/onboarding/WizardFooter";
import { toastInitialAudit } from "@/client/features/projects/initialAuditToast";
import { ProjectMarketFields } from "@/client/features/projects/ProjectMarketFields";
@@ -149,14 +154,22 @@ function WebsiteForm({
/>
)}
</form.AppField>
- <form.Field name="market">
- {(field) => (
- <ProjectMarketFields
- value={field.state.value}
- onChange={field.handleChange}
- />
- )}
- </form.Field>
+ <Collapsible>
+ <CollapsibleTrigger className="group flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground">
+ <ChevronDown className="size-4 transition-transform group-data-panel-open:rotate-180" />
+ Choose default country &amp; language
+ </CollapsibleTrigger>
+ <CollapsibleContent keepMounted className="pt-4">
+ <form.Field name="market">
+ {(field) => (
+ <ProjectMarketFields
+ value={field.state.value}
+ onChange={field.handleChange}
+ />
+ )}
+ </form.Field>
+ </CollapsibleContent>
+ </Collapsible>
<WizardFooter
className="mt-4"
onSkip={onSkip}
diff --git a/src/client/features/onboarding/WizardFooter.tsx b/src/client/features/onboarding/WizardFooter.tsx
index 4c316528..c62608c2 100644
--- a/src/client/features/onboarding/WizardFooter.tsx
+++ b/src/client/features/onboarding/WizardFooter.tsx
@@ -1,4 +1,4 @@
-import type { ReactNode } from "react";
+import type { ReactNode, Ref } from "react";
import { ArrowLeft, ArrowRight } from "lucide-react";
import { cn } from "cn";
import { Button } from "@/client/components/ui/button";
@@ -11,6 +11,7 @@ export function WizardFooter({
continueLabel = "Continue",
continueDisabled = false,
continueAction,
+ continueRef,
className,
}: {
onBack?: () => void;
@@ -20,6 +21,7 @@ export function WizardFooter({
continueLabel?: string;
continueDisabled?: boolean;
continueAction?: ReactNode;
+ continueRef?: Ref<HTMLButtonElement>;
className?: string;
}) {
return (
@@ -54,15 +56,14 @@ export function WizardFooter({
) : null}
{continueAction ?? (
<Button
+ ref={continueRef}
type="button"
- // Without onContinue this is a placeholder for a step that has
- // nothing to save yet, so it renders small, like the Skip beside it.
- className={`font-semibold disabled:bg-foreground/10 disabled:text-foreground/20 disabled:opacity-100 ${onContinue ? "" : "h-8 px-3 text-xs"}`}
+ className="font-semibold disabled:bg-foreground/10 disabled:text-foreground/20 disabled:opacity-100"
onClick={onContinue}
disabled={continueDisabled || !onContinue}
>
{continueLabel}
- {onContinue ? <ArrowRight className="size-4" /> : null}
+ <ArrowRight className="size-4" />
</Button>
)}
</div>
diff --git a/src/client/features/onboarding/onboardingModel.test.ts b/src/client/features/onboarding/onboardingModel.test.ts
deleted file mode 100644
index d1045158..00000000
--- a/src/client/features/onboarding/onboardingModel.test.ts
+++ /dev/null
@@ -1,44 +0,0 @@
-import { describe, expect, it, vi } from "vitest";
-import {
- buildOnboardingPayload,
- ONBOARDING_LAST_STEP,
- restoreOnboardingAnswers,
-} from "./onboardingModel";
-
-vi.mock("@/serverFunctions/onboarding", () => ({
- getOnboardingAnswers: vi.fn(),
-}));
-const saved = {
- interestedFeatures: ["Keyword research"],
- workFor: "My own startup or business",
- clientWebsiteCount: null,
- foundVia: "Google",
-};
-
-// Persisted analytics values must round-trip unchanged (not become "Other")
-// even when the display labels change.
-describe("historical onboarding values", () => {
- it.each(["My own startup or business", "My employer's website"])(
- "restores and saves the original work-for value: %s",
- (workFor) => {
- const answers = restoreOnboardingAnswers({ ...saved, workFor });
- expect(answers.workFor).toBe(workFor);
- expect(answers.workForOther).toBe("");
- expect(
- buildOnboardingPayload(answers, ONBOARDING_LAST_STEP).workFor,
- ).toBe(workFor);
- },
- );
-
- it("keeps the original source and AI workflow values", () => {
- const interestedFeatures = ["AI workflows with Claude or Codex (MCP)"];
- const answers = restoreOnboardingAnswers({ ...saved, interestedFeatures });
- expect(answers.source).toBe("Google");
- expect(answers.sourceOther).toBe("");
- expect(answers.selectedInterests).toEqual(interestedFeatures);
- expect(answers.interestOther).toBe("");
- const payload = buildOnboardingPayload(answers, ONBOARDING_LAST_STEP);
- expect(payload.foundVia).toBe("Google");
- expect(payload.interestedFeatures).toEqual(interestedFeatures);
- });
-});
diff --git a/src/client/features/onboarding/onboardingModel.ts b/src/client/features/onboarding/onboardingModel.ts
index 59034b61..efaebd25 100644
--- a/src/client/features/onboarding/onboardingModel.ts
+++ b/src/client/features/onboarding/onboardingModel.ts
@@ -1,158 +1,16 @@
import { queryOptions } from "@tanstack/react-query";
import { getOnboardingAnswers } from "@/serverFunctions/onboarding";
-// Step names go to analytics alongside the index, so reports survive reorders.
+// Preserve main's setup step indices for existing links and OAuth returns.
export const ONBOARDING_STEPS = [
"website",
"search_console",
"agent_setup",
- "interests",
- "work_for",
- "source",
] as const;
export const ONBOARDING_LAST_STEP = ONBOARDING_STEPS.length - 1;
-const INTERESTS_STEP = ONBOARDING_STEPS.indexOf("interests");
-
-// Option values below are persisted and used by analytics. Change display copy
-// here instead of renaming those values, so historical answers stay comparable.
-export const ONBOARDING_OPTION_LABELS: Readonly<Record<string, string>> = {
- "AI workflows with Claude or Codex (MCP)": "AI Workflows (MCP + Skills)",
- "My own startup or business": "My Own Business",
- "My employer's website": "My Company's Website",
-};
-
-export const INTEREST_OPTIONS = [
- "AI workflows with Claude or Codex (MCP)",
- "Keyword research",
- "Competitor research",
- "Backlink analysis",
- "Site audits",
- "Rank tracking",
- "Other",
-] as const;
-
-export const WORK_FOR_OPTIONS = [
- "My own startup or business",
- "My clients",
- "My employer's website",
- "My own side project",
- "I'm exploring before choosing a project",
- "Other",
-] as const;
-
-export const CLIENT_WORK_FOR = "My clients";
-
-export const CLIENT_WEBSITE_COUNT_OPTIONS = [
- "1–3",
- "4–10",
- "11–25",
- "25+",
-] as const;
-
-// Display order. Keep persisted values stable for attribution metrics.
-export const SOURCE_OPTIONS = [
- "Google",
- "X / Twitter",
- "GitHub",
- "Instagram",
- "YouTube",
- "Friend or colleague",
- "AI (Claude, ChatGPT, etc)",
- "Product Hunt",
- "Other",
-] as const;
-
-/** In-progress form state. Step is tracked separately in the URL. */
-export type OnboardingAnswers = {
- selectedInterests: string[];
- interestOther: string;
- workFor: string;
- workForOther: string;
- clientWebsiteCount: string;
- source: string;
- sourceOther: string;
-};
-
-/** Answers as persisted in the DB (read back via getOnboardingAnswers). */
-type SavedOnboardingAnswers = {
- interestedFeatures: string[];
- workFor: string | null;
- clientWebsiteCount: string | null;
- foundVia: string | null;
-};
export const onboardingAnswersQueryOptions = () =>
queryOptions({
queryKey: ["onboardingAnswers"],
queryFn: () => getOnboardingAnswers(),
});
-
-// Saved answers normalize "Other" selections into free text, so restoring the
-// UI means mapping any value that isn't a known option back onto "Other".
-function restoreSingleChoice(
- saved: string | null,
- options: readonly string[],
-): { value: string; other: string } {
- if (!saved) return { value: "", other: "" };
- if (options.includes(saved)) return { value: saved, other: "" };
- return { value: "Other", other: saved };
-}
-
-export function restoreOnboardingAnswers(
- saved: SavedOnboardingAnswers,
-): OnboardingAnswers {
- const known = saved.interestedFeatures.filter((value) =>
- (INTEREST_OPTIONS as readonly string[]).includes(value),
- );
- const custom = saved.interestedFeatures.filter(
- (value) => !(INTEREST_OPTIONS as readonly string[]).includes(value),
- );
- const work = restoreSingleChoice(saved.workFor, WORK_FOR_OPTIONS);
- const found = restoreSingleChoice(saved.foundVia, SOURCE_OPTIONS);
-
- return {
- selectedInterests: custom.length > 0 ? [...known, "Other"] : known,
- interestOther: custom[0] ?? "",
- workFor: work.value,
- workForOther: work.other,
- clientWebsiteCount:
- work.value === CLIENT_WORK_FOR ? (saved.clientWebsiteCount ?? "") : "",
- source: found.value,
- sourceOther: found.other,
- };
-}
-
-/**
- * Convert the in-progress form into the persisted payload. `step` decides which
- * fields are mature enough to write so we don't clobber later answers on save.
- */
-export function buildOnboardingPayload(
- answers: OnboardingAnswers,
- step: number,
- extra: { completed?: boolean } = {},
-) {
- const interestedFeatures = answers.selectedInterests.map((value) =>
- value === "Other" && answers.interestOther.trim()
- ? answers.interestOther.trim()
- : value,
- );
- const workFor =
- answers.workFor === "Other" && answers.workForOther.trim()
- ? answers.workForOther.trim()
- : answers.workFor || undefined;
- // Only persist a client-site estimate when "My clients" is selected; clear it
- // otherwise so a stale value from an earlier pass doesn't linger.
- const clientWebsiteCount =
- answers.workFor === CLIENT_WORK_FOR ? answers.clientWebsiteCount : "";
- const foundVia =
- answers.source === "Other" && answers.sourceOther.trim()
- ? answers.sourceOther.trim()
- : answers.source || undefined;
-
- return {
- ...(step >= INTERESTS_STEP ? { interestedFeatures } : {}),
- ...(step >= INTERESTS_STEP + 1 ? { workFor, clientWebsiteCount } : {}),
- ...(step >= INTERESTS_STEP + 2 ? { foundVia } : {}),
- ...extra,
- };
-}
diff --git a/src/routes/_auth.sign-up.tsx b/src/routes/_auth.sign-up.tsx
index d27dd757..9d87898a 100644
--- a/src/routes/_auth.sign-up.tsx
+++ b/src/routes/_auth.sign-up.tsx
@@ -25,7 +25,6 @@ import { z } from "zod";
const signUpSchema = z
.object({
- name: z.string().trim(),
email: z.string().trim().email("Enter a valid email address."),
password: passwordSchema,
confirmPassword: z.string(),
@@ -63,7 +62,6 @@ function SignUpPage() {
const form = useAppForm({
defaultValues: {
- name: "",
email: "",
password: "",
confirmPassword: "",
@@ -78,8 +76,6 @@ function SignUpPage() {
captureClientEvent("auth:sign_up_submit", {
redirect_to: redirectTo,
});
- const resolvedName =
- value.name.trim() || email.split("@")[0] || "OpenSEO User";
const verificationCallbackURL = new URL(
"/verify-email",
window.location.origin,
@@ -95,7 +91,7 @@ function SignUpPage() {
);
}
const result = await authClient.signUp.email({
- name: resolvedName,
+ name: email.split("@")[0] || "OpenSEO User",
email,
password: value.password,
callbackURL: verificationCallbackURL.toString(),
@@ -216,17 +212,6 @@ function SignUpPage() {
) : (
<form.AppForm>
<form.Form className="space-y-4">
- <form.AppField name="name">
- {(field) => (
- <field.TextField
- label="Name (optional)"
- hideLabel
- className={authInputClassName}
- placeholder="Name (optional)..."
- autoComplete="name"
- />
- )}
- </form.AppField>
<form.AppField name="email">
{(field) => (
<field.TextField
diff --git a/src/routes/_authenticated.onboarding.index.tsx b/src/routes/_authenticated.onboarding.index.tsx
index 5871d7ae..00be971a 100644
--- a/src/routes/_authenticated.onboarding.index.tsx
+++ b/src/routes/_authenticated.onboarding.index.tsx
@@ -1,16 +1,12 @@
-import { useMutation, useSuspenseQuery } from "@tanstack/react-query";
+import { useMutation } from "@tanstack/react-query";
import { createFileRoute, redirect, useNavigate } from "@tanstack/react-router";
-import { useState } from "react";
import { PlanPageAccountMenu } from "@/client/features/billing/PlanPageAccountMenu";
import { PostSignupOnboarding } from "@/client/features/onboarding/PostSignupOnboarding";
import { projectsQueryOptions } from "@/client/features/projects/projectQueries";
import {
- buildOnboardingPayload,
- ONBOARDING_LAST_STEP,
ONBOARDING_STEPS,
- type OnboardingAnswers,
+ ONBOARDING_LAST_STEP,
onboardingAnswersQueryOptions,
- restoreOnboardingAnswers,
} from "@/client/features/onboarding/onboardingModel";
import { captureClientEvent } from "@/client/lib/posthog";
import { queryClient } from "@/client/tanstack-db";
@@ -53,32 +49,13 @@ export const Route = createFileRoute("/_authenticated/onboarding/")({
function OnboardingPage() {
const { data: session } = useSession();
- // beforeLoad seeded this query with ensureQueryData, so data is ready.
- const { data } = useSuspenseQuery(onboardingAnswersQueryOptions());
-
- return (
- <OnboardingFlow
- initialAnswers={restoreOnboardingAnswers(data.answers)}
- email={session?.user?.email}
- />
- );
-}
-
-function OnboardingFlow({
- initialAnswers,
- email,
-}: {
- initialAnswers: OnboardingAnswers;
- email: string | undefined;
-}) {
const navigate = useNavigate();
const { step, domain } = Route.useSearch();
- const [answers, setAnswers] = useState<OnboardingAnswers>(initialAnswers);
const saveMutation = useMutation({
mutationFn: (extra: { completed?: boolean }) =>
saveOnboardingAnswers({
- data: buildOnboardingPayload(answers, step, extra),
+ data: extra,
}),
});
@@ -88,29 +65,9 @@ function OnboardingFlow({
search: { step: clampStep(next), domain },
});
- // Wait for the save before moving on, so a failure toast shows on the step
- // the user can retry instead of on the next one.
- const handleNext = async () => {
- try {
- await saveMutation.mutateAsync({});
- } catch {
- return;
- }
- if (ONBOARDING_STEPS[step] === "interests") {
- captureClientEvent("onboarding:interests_selected", {
- interests: answers.selectedInterests,
- interest_other: answers.interestOther.trim() || undefined,
- });
- }
- goToStep(step + 1);
- };
+ const handleNext = () => goToStep(step + 1);
- const handleSkip = async () => {
- try {
- await saveMutation.mutateAsync({});
- } catch {
- return;
- }
+ const handleSkip = () => {
captureClientEvent("onboarding:step_skipped", {
step,
step_name: ONBOARDING_STEPS[step],
@@ -121,17 +78,20 @@ function OnboardingFlow({
const handleFinish = async () => {
try {
await saveMutation.mutateAsync({ completed: true });
- // Refresh the shared cache so the destination's onboarding-redirect guard
- // sees the completed state and doesn't bounce the user back here.
- await queryClient.invalidateQueries({ queryKey: ["onboardingAnswers"] });
+ // The route guard fetched this query without a mounted observer. Refetch
+ // inactive queries too, before the dashboard reads the cached completion.
+ await queryClient.invalidateQueries(
+ {
+ queryKey: ["onboardingAnswers"],
+ refetchType: "all",
+ },
+ { throwOnError: true },
+ );
} catch {
// Keep the user here to retry; an unsaved completion would redirect back.
return;
}
captureClientEvent("onboarding:completed", {
- interests: answers.selectedInterests,
- work_for: answers.workFor,
- source: answers.source,
from_free_check: Boolean(domain),
});
// Visitors who signed up from the free keyword check came to see the rest
@@ -162,15 +122,14 @@ function OnboardingFlow({
return (
<PostSignupOnboarding
step={step}
- answers={answers}
- onAnswersChange={setAnswers}
onNext={handleNext}
onBack={() => goToStep(step - 1)}
+ onStepChange={goToStep}
onSkip={handleSkip}
onFinish={handleFinish}
suggestedDomain={domain}
isSaving={saveMutation.isPending}
- accountMenu={<PlanPageAccountMenu email={email} />}
+ accountMenu={<PlanPageAccountMenu email={session?.user?.email} />}
/>
);
}
diff --git a/src/server/features/dashboard/services/DashboardFirstAuditService.ts b/src/server/features/dashboard/services/DashboardFirstAuditService.ts
index 55bfd815..ec2c627d 100644
--- a/src/server/features/dashboard/services/DashboardFirstAuditService.ts
+++ b/src/server/features/dashboard/services/DashboardFirstAuditService.ts
@@ -43,7 +43,7 @@ async function start(
startUrl: `https://${domain}`,
maxPages: 50,
renderJavaScript: true,
- lighthouseStrategy: "auto",
+ lighthouseStrategy: "none",
limitTier,
});
auditStarted = true;
diff --git a/src/server/features/dashboard/services/DashboardService.test.ts b/src/server/features/dashboard/services/DashboardService.test.ts
index 585ad049..fc0e8803 100644
--- a/src/server/features/dashboard/services/DashboardService.test.ts
+++ b/src/server/features/dashboard/services/DashboardService.test.ts
@@ -56,6 +56,30 @@ it("shows the newest audit matching the saved website instead of a newer competi
expect(result.audit?.id).toBe("own-site");
});
+it("includes the active performance-check phase after the page crawl finishes", async () => {
+ repository.audits.mockResolvedValue([
+ {
+ ...ownAudit,
+ status: "running",
+ pagesTotal: 50,
+ currentPhase: "lighthouse",
+ lighthouseCompleted: 9,
+ lighthouseFailed: 1,
+ lighthouseTotal: 20,
+ },
+ ]);
+ const result = await DashboardService.getOverview({
+ projectId: "project",
+ domain: "example.com",
+ });
+ expect(result.audit).toMatchObject({
+ currentPhase: "lighthouse",
+ lighthouseCompleted: 9,
+ lighthouseFailed: 1,
+ lighthouseTotal: 20,
+ });
+});
+
it.each([null, "other.example.com", "example.net"])(
"shows no audit when the saved website is %s",
async (domain) => {
diff --git a/src/server/features/dashboard/services/DashboardService.ts b/src/server/features/dashboard/services/DashboardService.ts
index 81f1d5e3..2c6b9cf7 100644
--- a/src/server/features/dashboard/services/DashboardService.ts
+++ b/src/server/features/dashboard/services/DashboardService.ts
@@ -34,6 +34,10 @@ export type DashboardAuditSummary = {
pagesCrawled: number;
// The crawl's page limit; small sites finish below it.
pagesTotal: number;
+ currentPhase: string | null;
+ lighthouseCompleted: number;
+ lighthouseFailed: number;
+ lighthouseTotal: number;
startedAt: string;
// Top issue types by severity then affected-page count, for the card's list.
topIssues: {
@@ -131,6 +135,10 @@ async function getAuditSummary(
status: audit.status,
pagesCrawled: audit.pagesCrawled,
pagesTotal: audit.pagesTotal,
+ currentPhase: audit.currentPhase,
+ lighthouseCompleted: audit.lighthouseCompleted,
+ lighthouseFailed: audit.lighthouseFailed,
+ lighthouseTotal: audit.lighthouseTotal,
startedAt: audit.startedAt,
topIssues: sorted.slice(0, 3),
};
diff --git a/web/content/blogs/google-search-console-setup.md b/web/content/blogs/google-search-console-setup.md
new file mode 100644
index 00000000..e7f6985e
--- /dev/null
+++ b/web/content/blogs/google-search-console-setup.md
@@ -0,0 +1,77 @@
+---
+title: "How to Set Up Google Search Console"
+description: "What Google Search Console is, why it matters for SEO, and how to set it up and connect it to OpenSEO."
+author: "OpenSEO Team"
+date: "2026-10-11"
+---
+
+Google Search Console is a free tool from Google that shows how your website performs in Google Search. This guide explains what it tells you, then walks you through setting it up and connecting it to OpenSEO.
+
+## What Search Console tells you
+
+Search Console shows Google's own data about your site:
+
+- **Queries:** what people searched for before your site appeared.
+- **Impressions:** how often your pages showed up in results.
+- **Clicks:** how often people clicked through to your site.
+- **Average position:** roughly where you rank for each query.
+- **Indexing:** whether Google has added a page to its search results.
+
+SEO tools estimate traffic from outside your site. Search Console reports what actually happened. [Google's overview](https://support.google.com/webmasters/answer/9128668) covers every report.
+
+## Why connect it to OpenSEO
+
+Keyword research tells you what to go after. Search Console tells you whether it worked. Once it's connected, your OpenSEO dashboard shows:
+
+- **New keywords** your site has just started appearing for.
+- **Top keywords** that bring you the most clicks.
+- **Striking distance:** queries where you sit at positions 5–20, close enough that a better page can move you up.
+
+Your AI agent can read the same data through OpenSEO, so you can ask it what's working and what to fix next.
+
+Connecting is optional. Keyword research and competitor research work without it.
+
+## Step 1: Check whether your site is already set up
+
+1. Open [Search Console](https://search.google.com/search-console) and sign in.
+2. Open the website menu in the top left. Google calls each website a **property**.
+3. If your website is listed, note which Google account you're signed in with and skip to Step 3.
+
+If a colleague, agency, or client already manages your site in Search Console, ask them to add you:
+
+1. Select the website in Search Console.
+2. Go to **Settings → Users and permissions → Add user**.
+3. Enter your Google email address and choose **Full** permission.
+
+See [Google's guide to users and permissions](https://support.google.com/webmasters/answer/7687615).
+
+## Step 2: Add your website
+
+If your site isn't in Search Console yet:
+
+1. Open the website menu and click **Add property**.
+2. Pick a property type:
+ - **Domain** (`example.com`) covers your whole site, including `www` and other subdomains. You'll need access to your domain's DNS settings. Use this if you can.
+ - **URL prefix** (`https://www.example.com/`) covers only that address. This is often easier if your website builder has a Search Console setting.
+3. Prove you own the site:
+ - **Domain:** Google gives you a TXT record. Add it in the DNS settings wherever you bought your domain, then click **Verify**. DNS changes can take a while, so if it fails, wait and try again.
+ - **URL prefix:** pick one of Google's methods, such as pasting an HTML tag into your website builder.
+4. Leave the verification record in place afterward. Google keeps checking it.
+
+Google's guides: [add a property](https://support.google.com/webmasters/answer/34592) and [verify ownership](https://support.google.com/webmasters/answer/9008080).
+
+## Step 3: Connect it to OpenSEO
+
+1. Start the connection in OpenSEO. You'll find it during signup, on the Search Console card on your dashboard, or under **Project settings → Integrations**.
+2. Sign in with the Google account that has access to your site.
+3. Choose your website from the list and save.
+
+## If your website doesn't show up
+
+- **We couldn’t find your website:** the Google account you connected doesn't have access. Check the email address shown. Click **Use a different Google account**, or get access (Step 1) and click **Refresh**.
+- **Connection expired:** reconnect your Google account.
+- **Couldn't load properties:** a temporary error. Try again.
+
+## When you'll see data
+
+A newly added site can take a few days to show data in Search Console. You can keep using OpenSEO while you wait.