From 63630f40f70a5c7e69b49ea7d25b10b1630c3b51 Mon Sep 17 00:00:00 2001 From: Lucas Oliveira Date: Tue, 21 Oct 2025 17:09:59 -0300 Subject: [PATCH] Rendered onboarding with use-stick-to-bottom --- frontend/package-lock.json | 10 + frontend/package.json | 1 + .../components/onboarding-content.tsx | 172 ++++++++++-------- frontend/src/components/chat-renderer.tsx | 2 +- 4 files changed, 106 insertions(+), 79 deletions(-) diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 0c1c2c73..c724fde9 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -52,6 +52,7 @@ "sonner": "^2.0.6", "tailwind-merge": "^3.3.1", "tailwindcss-animate": "^1.0.7", + "use-stick-to-bottom": "^1.1.1", "zustand": "^5.0.8" }, "devDependencies": { @@ -10224,6 +10225,15 @@ } } }, + "node_modules/use-stick-to-bottom": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/use-stick-to-bottom/-/use-stick-to-bottom-1.1.1.tgz", + "integrity": "sha512-JkDp0b0tSmv7HQOOpL1hT7t7QaoUBXkq045WWWOFDTlLGRzgIIyW7vyzOIJzY7L2XVIG7j1yUxeDj2LHm9Vwng==", + "license": "MIT", + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" + } + }, "node_modules/use-sync-external-store": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.5.0.tgz", diff --git a/frontend/package.json b/frontend/package.json index 5347aa8c..fd6fc0cb 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -53,6 +53,7 @@ "sonner": "^2.0.6", "tailwind-merge": "^3.3.1", "tailwindcss-animate": "^1.0.7", + "use-stick-to-bottom": "^1.1.1", "zustand": "^5.0.8" }, "devDependencies": { diff --git a/frontend/src/app/new-onboarding/components/onboarding-content.tsx b/frontend/src/app/new-onboarding/components/onboarding-content.tsx index 23d7e043..46886f47 100644 --- a/frontend/src/app/new-onboarding/components/onboarding-content.tsx +++ b/frontend/src/app/new-onboarding/components/onboarding-content.tsx @@ -1,6 +1,7 @@ "use client"; import { useState } from "react"; +import { StickToBottom } from "use-stick-to-bottom"; import { AssistantMessage } from "@/app/chat/components/assistant-message"; import { UserMessage } from "@/app/chat/components/user-message"; import Nudges from "@/app/chat/nudges"; @@ -46,7 +47,7 @@ export function OnboardingContent({ setSelectedNudge(nudge); setAssistantMessage(null); setTimeout(async () => { - await sendMessage({ + await sendMessage({ prompt: nudge, previousResponseId: responseId || undefined, }); @@ -57,48 +58,81 @@ export function OnboardingContent({ const displayMessage = streamingMessage || assistantMessage; return ( -
- = 0} - isCompleted={currentStep > 0} - text="Let's get started by setting up your model provider." - > - - + + +
+ = 0} + isCompleted={currentStep > 0} + text="Let's get started by setting up your model provider." + > + + - = 1} - isCompleted={currentStep > 1 || !!selectedNudge} - text="Excellent, let's move on to learning the basics." - > -
- -
-
+ = 1} + isCompleted={currentStep > 1 || !!selectedNudge} + text="Excellent, let's move on to learning the basics." + > +
+ +
+
- {/* User message - show when nudge is selected */} - {currentStep >= 1 && !!selectedNudge && ( - 1} /> - )} + {/* User message - show when nudge is selected */} + {currentStep >= 1 && !!selectedNudge && ( + 1} + /> + )} - {/* Assistant message - show streaming or final message */} - {currentStep >= 1 && !!selectedNudge && (displayMessage || isLoading) && ( - <> - {}} - isStreaming={!!streamingMessage} - isCompleted={currentStep > 1} - /> - {!isLoading && displayMessage && currentStep === 1 && ( -
+ {/* Assistant message - show streaming or final message */} + {currentStep >= 1 && + !!selectedNudge && + (displayMessage || isLoading) && ( + <> + {}} + isStreaming={!!streamingMessage} + isCompleted={currentStep > 1} + /> + {!isLoading && displayMessage && currentStep === 1 && ( +
+ +
+ )} + + )} + + = 2} + isCompleted={currentStep > 2} + text="Step 2: Connect your model" + > +
+

+ Choose and connect your preferred AI model provider. +

- )} - )} +
- = 2} - isCompleted={currentStep > 2} - text="Step 2: Connect your model" - > -
-

- Choose and connect your preferred AI model provider. -

- +
+

+ Your account is ready to use. Let's start chatting! +

+ +
+
-
- - = 3} - isCompleted={currentStep > 3} - text="Step 3: You're all set!" - > -
-

- Your account is ready to use. Let's start chatting! -

- -
-
-
+ + ); } diff --git a/frontend/src/components/chat-renderer.tsx b/frontend/src/components/chat-renderer.tsx index 8721aaa1..df39c52d 100644 --- a/frontend/src/components/chat-renderer.tsx +++ b/frontend/src/components/chat-renderer.tsx @@ -156,7 +156,7 @@ export function ChatRenderer({ showLayout && "p-6 container", showLayout && isSmallWidthPath && "max-w-[850px] ml-0", !showLayout && - "w-full bg-card rounded-lg shadow-2xl p-8 overflow-y-auto", + "w-full bg-card rounded-lg shadow-2xl p-0 py-2 overflow-y-auto", )} >