From b20673d5523445beff3970a9832ecb9b474cf1c0 Mon Sep 17 00:00:00 2001 From: ciregenz Date: Sun, 14 Jun 2026 03:44:32 -0700 Subject: [PATCH] [eric] onboarding: pin the welcome chat to exact viewport center (placeCard grid-snap was shoving it off-center) --- .../pages/Dashboard/hooks/lifecycle/useWelcomeDraft.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/frontend/src/app/pages/Dashboard/hooks/lifecycle/useWelcomeDraft.ts b/frontend/src/app/pages/Dashboard/hooks/lifecycle/useWelcomeDraft.ts index 1c783e54..e1b755f5 100644 --- a/frontend/src/app/pages/Dashboard/hooks/lifecycle/useWelcomeDraft.ts +++ b/frontend/src/app/pages/Dashboard/hooks/lifecycle/useWelcomeDraft.ts @@ -1,7 +1,7 @@ import { useCallback, type RefObject } from 'react'; import { useAppDispatch, useAppSelector } from '@/shared/hooks'; import { createDraftSession, expandSession } from '@/shared/state/agentsSlice'; -import { placeCard, DEFAULT_CARD_W, EXPANDED_CARD_MIN_H } from '@/shared/state/dashboardLayoutSlice'; +import { placeCard, setCardPosition, DEFAULT_CARD_W, EXPANDED_CARD_MIN_H } from '@/shared/state/dashboardLayoutSlice'; import { markWelcomeShown } from '@/shared/state/onboardingProgressSlice'; import { hasFreeTrialActive, hasModelConnected } from '@/app/components/Onboarding/steps/skipPredicates'; @@ -49,15 +49,19 @@ export function useWelcomeDraft({ const vr = vp.getBoundingClientRect(); const cx = (vr.width / 2 - cs.panX) / cs.zoom; const cy = (vr.height / 2 - cs.panY) / cs.zoom; + const x = cx - DEFAULT_CARD_W / 2; + const y = cy - EXPANDED_CARD_MIN_H / 2; if (spawnOriginsRef.current) spawnOriginsRef.current[draftId] = { x: cx, y: cy }; dispatch(placeCard({ sessionId: draftId, - x: cx - DEFAULT_CARD_W / 2, - y: cy - EXPANDED_CARD_MIN_H / 2, + x, y, width: DEFAULT_CARD_W, height: EXPANDED_CARD_MIN_H, expandedSessionIds, })); + // placeCard grid-snaps + dodges collisions; the welcome chat is the only thing on a + // fresh dashboard, so pin it to the EXACT viewport center instead of a grid cell. + dispatch(setCardPosition({ sessionId: draftId, x, y })); } dispatch(expandSession(draftId)); dispatch(markWelcomeShown());