Jelajahi Sumber

debug: show logged-in user name in chatbot widget header

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Tony T 6 hari lalu
induk
melakukan
3c24f848bb
1 mengubah file dengan 7 tambahan dan 0 penghapusan
  1. 7 0
      client/src/components/ChatbotWidgetLive.tsx

+ 7 - 0
client/src/components/ChatbotWidgetLive.tsx

@@ -4,6 +4,7 @@
  */
 import { useState, useRef, useEffect } from "react";
 import { trpc } from "@/lib/trpc";
+import { useAuth } from "@/_core/hooks/useAuth";
 import { Bot, X, Send, Loader2, User, Headphones, Sparkles, ChevronDown, MoreVertical } from "lucide-react";
 import { Streamdown } from "streamdown";
 
@@ -15,6 +16,7 @@ const QUICK_REPLIES = [
 ];
 
 export default function ChatbotWidgetLive() {
+  const { user } = useAuth();
   const [isOpen, setIsOpen] = useState(false);
   const [inputText, setInputText] = useState("");
   const [sessionId, setSessionId] = useState<string | null>(null);
@@ -153,6 +155,11 @@ export default function ChatbotWidgetLive() {
               </div>
             </div>
             <div className="flex items-center gap-1">
+              {user && (
+                <span className="text-[10px] text-white/60 mr-1">
+                  {user.name || user.email}
+                </span>
+              )}
               <button className="p-1.5 rounded-lg hover:bg-white/10 transition-colors">
                 <MoreVertical className="w-4 h-4 text-white/70" />
               </button>