feat: update public preview UI with adjustable sidebar height, layer panel toggle, and synchronized data loading states(mobile UI)
Build and Release / release (push) Successful in 37s
Build and Release / release (push) Successful in 37s
This commit is contained in:
@@ -14,8 +14,10 @@ type Message = {
|
||||
|
||||
export default function ChatbotWidget({
|
||||
projectId = "",
|
||||
hideFloatingButton = false,
|
||||
}: {
|
||||
projectId?: string;
|
||||
hideFloatingButton?: boolean;
|
||||
}) {
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
const [messages, setMessages] = useState<Message[]>([
|
||||
@@ -33,6 +35,14 @@ export default function ChatbotWidget({
|
||||
messagesEndRef.current?.scrollIntoView({ behavior: "smooth" });
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
const handleToggle = () => setIsOpen((prev) => !prev);
|
||||
window.addEventListener("toggle-chatbot", handleToggle);
|
||||
return () => {
|
||||
window.removeEventListener("toggle-chatbot", handleToggle);
|
||||
};
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (isOpen) {
|
||||
scrollToBottom();
|
||||
@@ -93,7 +103,7 @@ export default function ChatbotWidget({
|
||||
|
||||
return (
|
||||
<div className="fixed bottom-8 right-8 z-50">
|
||||
{!isOpen && (
|
||||
{!isOpen && !hideFloatingButton && (
|
||||
<button
|
||||
name="AI chat"
|
||||
onClick={() => setIsOpen(true)}
|
||||
|
||||
Reference in New Issue
Block a user