supermemory/apps/web/components/onboarding-brain/onboarding-confetti.tsx
MaheshtheDev 170133cf83 feat(web): make brain onboarding the default flow (#1067)
feat(web): make brain onboarding the default flow

- Replace legacy /onboarding with the brain onboarding flow (about -> sources -> ingest -> team -> done)
- Add brain-home dashboard page and widgets
- Old /onboarding/brain deep links fall through to the existing catch-all redirect

feat(onboarding): create org on About step + remove skip

- Create the organization on About -> Continue (authClient.organization.create + setActiveOrg), persisting brain context to org metadata; fixes the no-org redirect loop
- Show a Creating… state on Continue while the org is created
- Remove Skip on the required About step (name + workspace)
- Add generateOrgSlug/generateUsername helpers to onboarding-brain/types
2026-06-09 17:13:32 +00:00

53 lines
1.2 KiB
TypeScript

"use client"
import { useEffect, useRef } from "react"
import { useQueryState } from "nuqs"
const COLORS = ["#4BA0FA", "#FF8A47", "#B19CFF", "#10A37F", "#fafafa"]
export function OnboardingConfetti() {
const [onboarded, setOnboarded] = useQueryState("onboarded")
const fired = useRef(false)
useEffect(() => {
if (onboarded !== "1" || fired.current) return
fired.current = true
setOnboarded(null)
const reduceMotion = window.matchMedia?.(
"(prefers-reduced-motion: reduce)",
).matches
if (reduceMotion) return
let raf = 0
const run = async () => {
const confetti = (await import("canvas-confetti")).default
const end = Date.now() + 1400
const frame = () => {
confetti({
particleCount: 4,
angle: 60,
spread: 70,
startVelocity: 55,
origin: { x: 0, y: 0.7 },
colors: COLORS,
})
confetti({
particleCount: 4,
angle: 120,
spread: 70,
startVelocity: 55,
origin: { x: 1, y: 0.7 },
colors: COLORS,
})
if (Date.now() < end) raf = requestAnimationFrame(frame)
}
frame()
}
run()
return () => cancelAnimationFrame(raf)
}, [onboarded, setOnboarded])
return null
}