Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 27 additions & 2 deletions apps/web/app/(app)/onboarding/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import {
CheckCircle2,
Loader2,
} from "lucide-react"
import { analytics } from "@/lib/analytics"
import { analytics, type OnboardingStep } from "@/lib/analytics"
import { consumePendingConnectUrl } from "@/lib/constants"

type DetectedSource = "x" | "linkedin" | "resume" | null
Expand Down Expand Up @@ -378,6 +378,13 @@ function isAccountSource(source: DetectedSource): source is "x" | "linkedin" {
return source === "x" || source === "linkedin"
}

const STATUS_TO_STEP: Record<Status, OnboardingStep> = {
idle: "profile_input",
processing: "processing",
done: "done",
error: "error",
}

function useSpotlightAutoRotation(
status: Status,
pauseSpotlight: boolean,
Expand Down Expand Up @@ -555,6 +562,7 @@ export default function OnboardingPage() {
const fileRef = useRef<HTMLInputElement>(null)
const pollingRef = useRef<ReturnType<typeof setInterval> | null>(null)
const skippingRef = useRef(false)
const completedTrackedRef = useRef(false)
const [isSkipping, setIsSkipping] = useState(false)
const [spotlightCategory, setSpotlightCategory] =
useState<SpotlightCategoryId>("productivity")
Expand Down Expand Up @@ -591,6 +599,21 @@ export default function OnboardingPage() {
usePollingCleanup(pollingRef)
useDoneAnimation(status, setStampLanded, setVisibleSnippets)

// biome-ignore lint/correctness/useExhaustiveDependencies: fire per status transition only
useEffect(() => {
analytics.onboardingStepViewed({
step: STATUS_TO_STEP[status],
trigger: "auto",
})
if (status === "done" && !completedTrackedRef.current) {
completedTrackedRef.current = true
analytics.onboardingCompleted({
source: isAccountSource(detected) ? detected : undefined,
memories_count: memoriesCount,
})
}
}, [status])

const handleChange = (v: string) => {
setValue(v)
setDetected(detectSource(v))
Expand Down Expand Up @@ -619,6 +642,7 @@ export default function OnboardingPage() {
if (skippingRef.current) return
skippingRef.current = true
setIsSkipping(true)
analytics.onboardingSkipped({ from_step: STATUS_TO_STEP[status] })
try {
await ensureOrg()
const pendingPath = consumePendingConnectUrl()
Expand All @@ -628,7 +652,7 @@ export default function OnboardingPage() {
skippingRef.current = false
setIsSkipping(false)
}
}, [ensureOrg, router])
}, [ensureOrg, router, status])

const pollDocument = useCallback((docId: string) => {
const maxAttempts = 60
Expand Down Expand Up @@ -688,6 +712,7 @@ export default function OnboardingPage() {

const handleSubmit = useCallback(
async (source: "x" | "linkedin" | "resume", resumeFileOverride?: File) => {
analytics.onboardingProfileSubmitted({ source })
setStatus("processing")
setSpotlightCategory("productivity")
setPauseSpotlight(false)
Expand Down
7 changes: 6 additions & 1 deletion apps/web/components/document-modal/graph-list-memories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,11 @@ function VersionStatus({
export function GraphListMemories({
memoryEntries,
documentId,
className,
}: {
memoryEntries: MemoryEntry[]
documentId?: string
className?: string
}) {
const { effectiveContainerTags } = useProject()
const [expandedMemories, setExpandedMemories] = useState<Set<string>>(
Expand All @@ -193,7 +195,10 @@ export function GraphListMemories({
return (
<div
id="document-memories"
className="relative flex-1 px-3 pt-3 rounded-[14px] flex flex-col overflow-hidden shadow-[inset_0_2px_4px_rgba(0,0,0,0.3),inset_0_1px_2px_rgba(0,0,0,0.1)]"
className={cn(
"relative h-[360px] shrink-0 px-3 pt-3 rounded-[14px] flex flex-col overflow-hidden shadow-[inset_0_2px_4px_rgba(0,0,0,0.3),inset_0_1px_2px_rgba(0,0,0,0.1)] md:h-auto md:min-h-0 md:flex-1 md:shrink",
className,
)}
style={{
backgroundImage: "url('/dot-pattern.svg')",
backgroundRepeat: "repeat",
Expand Down
Loading
Loading