Skip to content

Commit e974321

Browse files
committed
feat(onboarding): adjust transitions
1 parent 26cbf62 commit e974321

1 file changed

Lines changed: 20 additions & 12 deletions

File tree

packages/webapp/components/onboarding/OnboardingV2.tsx

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,9 @@ type ImportBodyPhase = 'checklist' | 'seniority' | 'default';
172172

173173
const AI_IMPORT_STEPS = [
174174
{ label: 'Analyzing your profile', threshold: 12 },
175-
{ label: 'Matching interests', threshold: 30 },
176-
{ label: 'Mapping your stack', threshold: 46 },
177-
{ label: 'Inferring seniority', threshold: 68 },
175+
{ label: 'Matching interests', threshold: 28 },
176+
{ label: 'Mapping your stack', threshold: 48 },
177+
{ label: 'Inferring seniority', threshold: 78 },
178178
{ label: 'Building your feed', threshold: 95 },
179179
];
180180

@@ -205,13 +205,13 @@ const ONBOARDING_EXTENSION_SEEN_KEY = 'onboarding:extension_seen';
205205

206206
const GITHUB_IMPORT_STEPS = [
207207
{ label: 'Connecting account', threshold: 12 },
208-
{ label: 'Scanning repositories', threshold: 30 },
209-
{ label: 'Matching interests', threshold: 46 },
210-
{ label: 'Inferring seniority', threshold: 68 },
211-
{ label: 'Building your feed', threshold: 96 },
208+
{ label: 'Scanning repositories', threshold: 28 },
209+
{ label: 'Matching interests', threshold: 48 },
210+
{ label: 'Inferring seniority', threshold: 78 },
211+
{ label: 'Building your feed', threshold: 95 },
212212
];
213213

214-
const IMPORT_ANIMATION_MS = 2000;
214+
const IMPORT_ANIMATION_MS = 4000;
215215
const FINISHING_ANIMATION_MS = 1500;
216216

217217
export const OnboardingV2 = (): ReactElement => {
@@ -325,8 +325,13 @@ export const OnboardingV2 = (): ReactElement => {
325325
? requestGitHubProfileTags()
326326
: requestOnboardingProfileTags(aiPrompt);
327327

328-
// Animate progress bar to 65% via CSS transition
329-
requestAnimationFrame(() => setImportProgress(65));
328+
// Step progress through thresholds that complete during import
329+
const steps = source === 'github' ? GITHUB_IMPORT_STEPS : AI_IMPORT_STEPS;
330+
const preSteps = steps.filter((s) => s.threshold < 65);
331+
const stepDelay = IMPORT_ANIMATION_MS / (preSteps.length + 1);
332+
preSteps.forEach((s, i) => {
333+
trackTimer(() => setImportProgress(s.threshold), stepDelay * (i + 1));
334+
});
330335

331336
// Wait for both API response AND minimum animation time
332337
const [apiResult] = await Promise.allSettled([
@@ -365,6 +370,7 @@ export const OnboardingV2 = (): ReactElement => {
365370
logEvent,
366371
clearImportTimers,
367372
aiPrompt,
373+
trackTimer,
368374
setAiPrompt,
369375
setSignupContext,
370376
router,
@@ -413,7 +419,7 @@ export const OnboardingV2 = (): ReactElement => {
413419
});
414420
clearImportTimers();
415421
setSelectedExperienceLevel(level);
416-
setImportProgress((prev) => Math.max(prev, 72));
422+
setImportProgress((prev) => Math.max(prev, 80));
417423
setImportPhase('confirmingSeniority');
418424

419425
await gqlClient
@@ -436,7 +442,9 @@ export const OnboardingV2 = (): ReactElement => {
436442

437443
trackTimer(() => {
438444
setImportPhase('finishing');
439-
setImportProgress(100);
445+
trackTimer(() => {
446+
setImportProgress(100);
447+
}, 800);
440448
trackTimer(() => {
441449
setImportPhase('complete');
442450
trackTimer(() => {

0 commit comments

Comments
 (0)