aboutsummaryrefslogtreecommitdiff
path: root/apps/web/components/new/onboarding/setup/integrations-step.tsx
blob: 951f26c037f3da7915a49fc8b374e69895688ec4 (plain) (blame)
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
"use client"

import { useState } from "react"
import { Button } from "@ui/components/button"
import { MCPDetailView } from "@/components/new/mcp-modal/mcp-detail-view"
import { XBookmarksDetailView } from "@/components/new/onboarding/x-bookmarks-detail-view"
import { useRouter } from "next/navigation"
import { cn } from "@lib/utils"
import { dmSansClassName } from "@/lib/fonts"
import { useOrgOnboarding } from "@hooks/use-org-onboarding"
import { analytics } from "@/lib/analytics"

const integrationCards = [
	{
		title: "Capture",
		description: "Add the Chrome extension for one-click saves",
		icon: (
			<div className="rounded-full flex items-center justify-center">
				<img
					src="/onboarding/chrome.png"
					alt="Chrome"
					className="w-20 h-auto"
				/>
			</div>
		),
	},
	{
		title: "Connect to AI",
		description: "Set up once and use your memory in Cursor, Claude, etc",
		icon: (
			<div className="rounded flex items-center justify-center">
				<img src="/onboarding/mcp.png" alt="MCP" className="size-28 h-auto" />
			</div>
		),
	},
	{
		title: "Connect",
		description: "Link Notion, Google Drive, or OneDrive to import your docs",
		icon: (
			<div className="rounded flex items-center justify-center">
				<img
					src="/onboarding/connectors.png"
					alt="Connectors"
					className="w-20 h-auto"
				/>
			</div>
		),
	},
	{
		title: "Import",
		description:
			"Bring in X/Twitter bookmarks, and turn them into useful memories",
		icon: (
			<div className="rounded flex items-center justify-center">
				<img src="/onboarding/x.png" alt="X" className="size-14" />
			</div>
		),
	},
]

export function IntegrationsStep() {
	const router = useRouter()
	const [selectedCard, setSelectedCard] = useState<string | null>(null)
	const { markOrgOnboarded } = useOrgOnboarding()

	const handleContinue = () => {
		markOrgOnboarded()
		analytics.onboardingCompleted()
		router.push("/new")
	}

	if (selectedCard === "Connect to AI") {
		return <MCPDetailView onBack={() => setSelectedCard(null)} />
	}
	if (selectedCard === "Import") {
		return <XBookmarksDetailView onBack={() => setSelectedCard(null)} />
	}
	return (
		<div className="flex flex-col items-center justify-center h-full p-8">
			<div className="text-center mb-6 flex flex-col items-center justify-center space-y-2">
				<h1 className="text-white text-[32px] font-medium">
					Build your personal memory
				</h1>
				<p
					className={cn(
						"text-white text-sm opacity-60 max-w-xs",
						dmSansClassName(),
					)}
				>
					Your supermemory comes alive when you <br /> capture and connect
					what's important
				</p>
			</div>

			<div className="grid grid-cols-2 gap-3 max-w-lg w-full mb-12">
				{integrationCards.map((card) => {
					const isClickable =
						card.title === "Connect to AI" ||
						card.title === "Capture" ||
						card.title === "Import"

					if (isClickable) {
						return (
							<button
								key={card.title}
								type="button"
								className={cn(
									"bg-[#080B0F] relative rounded-lg p-3 hover:border-[#3374FF] hover:border-[0.1px] transition-colors duration-300 border-[0.1px] border-[#0D121A] cursor-pointer text-left w-full hover:bg-[url('/onboarding/bg-gradient-1.png')] hover:bg-[length:175%_auto] hover:bg-[center_top_2rem] hover:bg-no-repeat",
									"hover:border-b-0 border-b-0",
								)}
								onClick={() => {
									if (card.title === "Capture") {
										analytics.onboardingChromeExtensionClicked({
											source: "onboarding",
										})
										window.open(
											"https://chromewebstore.google.com/detail/supermemory/afpgkkipfdpeaflnpoaffkcankadgjfc",
											"_blank",
										)
									} else {
										analytics.onboardingIntegrationClicked({
											integration: card.title,
										})
										if (card.title === "Connect to AI") {
											analytics.onboardingMcpDetailOpened()
										} else if (card.title === "Import") {
											analytics.onboardingXBookmarksDetailOpened()
										}
										setSelectedCard(card.title)
									}
								}}
							>
								<div className="flex-1 mt-10">
									<h3 className="text-white text-sm font-medium">
										{card.title}
									</h3>
									<p
										className={cn(
											"text-[#8B8B8B] text-xs leading-relaxed",
											dmSansClassName(),
										)}
									>
										{card.description}
									</p>
								</div>
								<div className="absolute top-0 right-0">{card.icon}</div>
							</button>
						)
					}

					return (
						<div
							key={card.title}
							className={cn(
								"bg-[#080B0F] relative rounded-lg p-3 hover:border-[#3374FF] hover:border-[0.1px] transition-colors duration-300 border-[0.1px] border-[#0D121A] hover:bg-[url('/onboarding/bg-gradient-1.png')] hover:bg-[length:175%_auto] hover:bg-[center_top_2rem] hover:bg-no-repeat",
								"hover:border-b-0 border-b-0",
							)}
						>
							<div className="flex-1 mt-10">
								<h3 className="text-white text-sm font-medium">{card.title}</h3>
								<p
									className={cn(
										"text-[#8B8B8B] text-xs leading-relaxed",
										dmSansClassName(),
									)}
								>
									{card.description}
								</p>
							</div>
							<div className="absolute top-0 right-0">{card.icon}</div>
						</div>
					)
				})}
			</div>

			<div className="flex justify-between w-full max-w-4xl">
				<Button
					variant="link"
					className="text-white hover:text-gray-300 hover:no-underline cursor-pointer"
					onClick={() => router.push("/new/onboarding/setup?step=relatable")}
				>
					 Back
				</Button>
				<Button
					variant="link"
					className="text-white hover:text-gray-300 hover:no-underline cursor-pointer"
					onClick={handleContinue}
				>
					Continue 
				</Button>
			</div>
		</div>
	)
}