diff --git a/surfsense_web/components/assistant-ui/assistant-message.tsx b/surfsense_web/components/assistant-ui/assistant-message.tsx index 681dc315a..b3cfc4476 100644 --- a/surfsense_web/components/assistant-ui/assistant-message.tsx +++ b/surfsense_web/components/assistant-ui/assistant-message.tsx @@ -191,7 +191,7 @@ export const AssistantMessage: FC = () => { {/* Mobile & Medium screen comment trigger - shown below lg breakpoint */} {showCommentTrigger && !isDesktop && ( -
+
diff --git a/surfsense_web/components/chat-comments/comment-item/comment-item.tsx b/surfsense_web/components/chat-comments/comment-item/comment-item.tsx index 8489bdb4a..ac75eb776 100644 --- a/surfsense_web/components/chat-comments/comment-item/comment-item.tsx +++ b/surfsense_web/components/chat-comments/comment-item/comment-item.tsx @@ -1,8 +1,6 @@ "use client"; -import { useAtom } from "jotai"; import { MessageSquare } from "lucide-react"; -import { currentUserAtom } from "@/atoms/user/user-query.atoms"; import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"; import { Button } from "@/components/ui/button"; import { cn } from "@/lib/utils"; @@ -115,12 +113,7 @@ export function CommentItem({ members = [], membersLoading = false, }: CommentItemProps) { - const [{ data: currentUser }] = useAtom(currentUserAtom); - - const isCurrentUser = currentUser?.id === comment.author?.id; - const displayName = isCurrentUser - ? "Me" - : comment.author?.displayName || comment.author?.email.split("@")[0] || "Unknown"; + const displayName = comment.author?.displayName || comment.author?.email.split("@")[0] || "Unknown"; const email = comment.author?.email || ""; const handleEditSubmit = (content: string) => { diff --git a/surfsense_web/components/chat-comments/comment-panel/comment-panel.tsx b/surfsense_web/components/chat-comments/comment-panel/comment-panel.tsx index 12f336d85..1fbd4863c 100644 --- a/surfsense_web/components/chat-comments/comment-panel/comment-panel.tsx +++ b/surfsense_web/components/chat-comments/comment-panel/comment-panel.tsx @@ -1,13 +1,25 @@ "use client"; -import { MessageSquarePlus } from "lucide-react"; -import { useState } from "react"; -import { Button } from "@/components/ui/button"; +import { useAtom } from "jotai"; +import { currentUserAtom } from "@/atoms/user/user-query.atoms"; +import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"; import { cn } from "@/lib/utils"; import { CommentComposer } from "../comment-composer/comment-composer"; import { CommentThread } from "../comment-thread/comment-thread"; import type { CommentPanelProps } from "./types"; +function getInitials(name: string | null | undefined, email: string): string { + if (name) { + return name + .split(" ") + .map((part) => part[0]) + .join("") + .toUpperCase() + .slice(0, 2); + } + return email[0].toUpperCase(); +} + export function CommentPanel({ threads, members, @@ -21,15 +33,10 @@ export function CommentPanel({ maxHeight, variant = "desktop", }: CommentPanelProps) { - const [isComposerOpen, setIsComposerOpen] = useState(false); + const [{ data: currentUser }] = useAtom(currentUserAtom); const handleCommentSubmit = (content: string) => { onCreateComment(content); - setIsComposerOpen(false); - }; - - const handleComposerCancel = () => { - setIsComposerOpen(false); }; const isMobile = variant === "mobile"; @@ -51,7 +58,6 @@ export function CommentPanel({ } const hasThreads = threads.length > 0; - const showEmptyState = !hasThreads && !isComposerOpen; // Ensure minimum usable height for empty state + composer button const minHeight = 180; @@ -81,38 +87,30 @@ export function CommentPanel({
)} - {showEmptyState && ( -
- -

No comments yet

-

- Start a conversation about this response -

+ {!hasThreads && currentUser && ( +
+ + + + {getInitials(currentUser.display_name, currentUser.email)} + + +
+ {currentUser.display_name ?? currentUser.email} +
)} -
- {isComposerOpen ? ( - - ) : ( - - )} +
+
); diff --git a/surfsense_web/components/chat-comments/comment-sheet/comment-sheet.tsx b/surfsense_web/components/chat-comments/comment-sheet/comment-sheet.tsx index 86597e5dd..f707730b9 100644 --- a/surfsense_web/components/chat-comments/comment-sheet/comment-sheet.tsx +++ b/surfsense_web/components/chat-comments/comment-sheet/comment-sheet.tsx @@ -20,7 +20,7 @@ export function CommentSheet({ @@ -41,7 +41,7 @@ export function CommentSheet({ )} -
+
diff --git a/surfsense_web/components/chat-comments/comment-thread/comment-thread.tsx b/surfsense_web/components/chat-comments/comment-thread/comment-thread.tsx index 1468cee33..64daba83a 100644 --- a/surfsense_web/components/chat-comments/comment-thread/comment-thread.tsx +++ b/surfsense_web/components/chat-comments/comment-thread/comment-thread.tsx @@ -128,23 +128,21 @@ export function CommentThread({ {/* Reply composer or button */} {isReplyComposerOpen ? ( - <> -
- -
- +
+ +
) : ( )} @@ -156,7 +154,7 @@ export function CommentThread({ {!hasReplies && !isReplyComposerOpen && (
diff --git a/surfsense_web/components/chat-comments/comment-trigger/comment-trigger.tsx b/surfsense_web/components/chat-comments/comment-trigger/comment-trigger.tsx index ca6cac186..60ea97ac6 100644 --- a/surfsense_web/components/chat-comments/comment-trigger/comment-trigger.tsx +++ b/surfsense_web/components/chat-comments/comment-trigger/comment-trigger.tsx @@ -1,6 +1,6 @@ "use client"; -import { MessageSquare } from "lucide-react"; +import { MessageSquarePlus } from "lucide-react"; import { Button } from "@/components/ui/button"; import { cn } from "@/lib/utils"; import type { CommentTriggerProps } from "./types"; @@ -25,7 +25,7 @@ export function CommentTrigger({ commentCount, isOpen, onClick, disabled }: Comm )} onClick={onClick} > - + {hasComments && ( {commentCount > 9 ? "9+" : commentCount}