1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
"use client"
import { Textarea } from "@ui/components/textarea"
import { useOnboarding } from "./onboarding-context"
import { useState } from "react"
import { Button } from "@ui/components/button"
import { AnimatePresence, motion } from "motion/react"
import { NavMenu } from "./nav-menu"
import { $fetch } from "@lib/api"
export function BioForm() {
const [bio, setBio] = useState("")
const { totalSteps, nextStep, getStepNumberFor } = useOnboarding()
function handleNext() {
const trimmed = bio.trim()
if (!trimmed) {
nextStep()
return
}
nextStep()
void $fetch("@post/documents", {
body: {
content: trimmed,
containerTags: ["sm_project_default"],
metadata: { sm_source: "consumer" },
},
}).catch((error) => {
console.error("Failed to save onboarding bio memory:", error)
})
}
return (
<div className="relative w-full">
<div className="space-y-4 relative">
<div className="absolute top-0 right-0">
<AnimatePresence mode="sync">
{bio ? (
<motion.div
key="save"
initial={{ opacity: 0, filter: "blur(10px)", scale: 0.95 }}
animate={{ opacity: 1, filter: "blur(0px)", scale: 1 }}
exit={{ opacity: 0, filter: "blur(10px)", scale: 0.95 }}
transition={{ duration: 0.2, ease: "easeOut" }}
>
<Button
variant="link"
size="lg"
className="text-white/60 font-medium! text-base md:text-lg w-fit px-0! cursor-pointer"
onClick={handleNext}
>
Save & Continue
</Button>
</motion.div>
) : (
<motion.div
key="skip"
initial={{ opacity: 0, filter: "blur(5px)" }}
animate={{ opacity: 1, filter: "blur(0px)" }}
exit={{ opacity: 0, filter: "blur(5px)" }}
transition={{ duration: 0.2, ease: "easeOut" }}
>
<Button
variant="link"
size="lg"
className="text-white/60 font-medium! text-base md:text-lg w-fit px-0! cursor-pointer"
onClick={handleNext}
>
Skip For Now
</Button>
</motion.div>
)}
</AnimatePresence>
</div>
<NavMenu>
<p className="text-base text-white/60">
Step {getStepNumberFor("bio")} of {totalSteps}
</p>
</NavMenu>
<h1 className="text-2xl md:text-4xl text-white font-medium">
Tell Supermemory about yourself
</h1>
<p className="text-lg md:text-xl text-white/80">
share with Supermemory what you do, who you are, and what you're
interested in
</p>
</div>
<Textarea
autoFocus
className="font-sans mt-6 text-base! placeholder:text-white/80 text-white tracking-normal font-medium border bg-white/30 border-zinc-200 rounded-lg !field-sizing-normal !min-h-[calc(3*1.5rem+1rem)] w-full"
placeholder="I'm a software engineer from San Francisco..."
rows={3}
value={bio}
onChange={(e) => setBio(e.target.value)}
/>
</div>
)
}
|