fix: save onboarding answers

This commit is contained in:
Harshith Mullapudi 2025-09-08 19:12:48 +05:30
parent 3329f4751f
commit 7119120570
7 changed files with 49 additions and 25 deletions

View File

@ -130,7 +130,7 @@ export default function OnboardingQuestionComponent({
</div> </div>
)} )}
<div className="flex justify-between pt-4"> <div className="flex justify-end gap-2 pt-4">
{!isFirst && ( {!isFirst && (
<Button <Button
type="button" type="button"
@ -143,8 +143,6 @@ export default function OnboardingQuestionComponent({
</Button> </Button>
)} )}
<div className="flex-1" />
<Button <Button
type="button" type="button"
variant="secondary" variant="secondary"

View File

@ -83,19 +83,24 @@ export const ONBOARDING_QUESTIONS: OnboardingQuestion[] = [
value: "Power an AI assistant / agent with context", value: "Power an AI assistant / agent with context",
}, },
{ {
id: "explore-graphs", id: "explore-core",
label: "Explore / learn about reified graphs", label: "Explore core",
value: "Explore / learn about reified graphs", value: "Explore core",
}, },
], ],
required: true, required: true,
}, },
{ {
id: "tools", id: "tools",
title: "Which tools or data sources do you care about most?", title: "Which tools do you care about most?",
description: "Context → lets you connect integration nodes live", description: "Context → lets you connect integration nodes live",
type: "multi-select", type: "multi-select",
options: [ options: [
{ id: "claude", label: "Claude", value: "Claude" },
{ id: "claude-code", label: "Claude Code", value: "Claude Code" },
{ id: "cursor", label: "Cursor", value: "Cursor" },
{ id: "windsurf", label: "Windsurf", value: "Windsurf" },
{ id: "zed", label: "Zed", value: "Zed" },
{ id: "github", label: "GitHub", value: "GitHub" }, { id: "github", label: "GitHub", value: "GitHub" },
{ id: "slack", label: "Slack", value: "Slack" }, { id: "slack", label: "Slack", value: "Slack" },
{ id: "notion", label: "Notion", value: "Notion" }, { id: "notion", label: "Notion", value: "Notion" },

View File

@ -6,6 +6,7 @@ import { useState } from "react";
import { Dialog, DialogContent, DialogHeader, DialogTitle } from "../ui/dialog"; import { Dialog, DialogContent, DialogHeader, DialogTitle } from "../ui/dialog";
import { Button } from "../ui"; import { Button } from "../ui";
import { useFetcher } from "@remix-run/react"; import { useFetcher } from "@remix-run/react";
import { getTailwindColor, getTeamColor } from "../ui/color-utils";
interface SpacePatternCardProps { interface SpacePatternCardProps {
pattern: SpacePattern; pattern: SpacePattern;
@ -46,10 +47,22 @@ export function SpacePatternCard({ pattern }: SpacePatternCardProps) {
<div className={cn("truncate text-left")}>{displayText}</div> <div className={cn("truncate text-left")}>{displayText}</div>
</div> </div>
<div className="text-muted-foreground flex shrink-0 items-center justify-end gap-2 text-xs"> <div className="text-muted-foreground flex shrink-0 items-center justify-end gap-2 text-xs">
<Badge variant="secondary" className="rounded text-xs"> <Badge
variant="secondary"
className="rounded text-xs"
style={{
color: getTailwindColor(pattern.type),
}}
>
{pattern.type} {pattern.type}
</Badge> </Badge>
<Badge variant="secondary" className="rounded text-xs"> <Badge
variant="secondary"
className="rounded text-xs"
style={{
color: getTailwindColor(pattern.name),
}}
>
{pattern.name} {pattern.name}
</Badge> </Badge>
</div> </div>
@ -66,10 +79,22 @@ export function SpacePatternCard({ pattern }: SpacePatternCardProps) {
<div className="flex flex-col gap-2"> <div className="flex flex-col gap-2">
<div className="flex gap-2"> <div className="flex gap-2">
<Badge variant="secondary" className="rounded text-xs"> <Badge
variant="secondary"
className="rounded text-xs"
style={{
color: getTailwindColor(pattern.type),
}}
>
{pattern.type} {pattern.type}
</Badge> </Badge>
<Badge variant="secondary" className="rounded text-xs"> <Badge
variant="secondary"
className="rounded text-xs"
style={{
color: getTailwindColor(pattern.name),
}}
>
{pattern.name} {pattern.name}
</Badge> </Badge>
</div> </div>

View File

@ -203,7 +203,8 @@ export function updateUser({
marketingEmails, marketingEmails,
referralSource, referralSource,
onboardingComplete, onboardingComplete,
}: Pick<User, "id" | "onboardingComplete"> & { metadata,
}: Pick<User, "id" | "onboardingComplete" | "metadata"> & {
marketingEmails?: boolean; marketingEmails?: boolean;
referralSource?: string; referralSource?: string;
}) { }) {
@ -214,6 +215,7 @@ export function updateUser({
referralSource, referralSource,
confirmedBasicDetails: true, confirmedBasicDetails: true,
onboardingComplete, onboardingComplete,
metadata: metadata ? metadata : {},
}, },
}); });
} }

View File

@ -61,6 +61,9 @@ export async function action({ request }: ActionFunctionArgs) {
await updateUser({ await updateUser({
id: userId, id: userId,
onboardingComplete: true, onboardingComplete: true,
metadata: {
answers,
},
}); });
await addToQueue( await addToQueue(

View File

@ -531,6 +531,8 @@ model User {
referralSource String? referralSource String?
metadata Json @default("{}")
personalAccessTokens PersonalAccessToken[] personalAccessTokens PersonalAccessToken[]
InvitationCode InvitationCode? @relation(fields: [invitationCodeId], references: [id]) InvitationCode InvitationCode? @relation(fields: [invitationCodeId], references: [id])
invitationCodeId String? invitationCodeId String?

View File

@ -210,18 +210,6 @@ model InvitationCode {
createdAt DateTime @default(now()) createdAt DateTime @default(now())
} }
model MCPSession {
id String @id @default(cuid())
source String
integrations String[]
workspace Workspace? @relation(references: [id], fields: [workspaceId])
workspaceId String?
createdAt DateTime @default(now())
deleted DateTime?
}
model OAuthAuthorizationCode { model OAuthAuthorizationCode {
id String @id @default(cuid()) id String @id @default(cuid())
@ -543,6 +531,8 @@ model User {
referralSource String? referralSource String?
metadata Json @default("{}")
personalAccessTokens PersonalAccessToken[] personalAccessTokens PersonalAccessToken[]
InvitationCode InvitationCode? @relation(fields: [invitationCodeId], references: [id]) InvitationCode InvitationCode? @relation(fields: [invitationCodeId], references: [id])
invitationCodeId String? invitationCodeId String?
@ -638,7 +628,6 @@ model Workspace {
OAuthRefreshToken OAuthRefreshToken[] OAuthRefreshToken OAuthRefreshToken[]
RecallLog RecallLog[] RecallLog RecallLog[]
Space Space[] Space Space[]
MCPSession MCPSession[]
} }
enum AuthenticationMethod { enum AuthenticationMethod {