diff --git a/surfsense_web/app/preview/chat-comments/page.tsx b/surfsense_web/app/preview/chat-comments/page.tsx index d5611202c..a99040b77 100644 --- a/surfsense_web/app/preview/chat-comments/page.tsx +++ b/surfsense_web/app/preview/chat-comments/page.tsx @@ -7,6 +7,7 @@ import type { CommentData } from "@/components/chat-comments/comment-item/types" import { CommentPanel } from "@/components/chat-comments/comment-panel/comment-panel"; import { CommentThread } from "@/components/chat-comments/comment-thread/comment-thread"; import type { CommentThreadData } from "@/components/chat-comments/comment-thread/types"; +import { CommentTrigger } from "@/components/chat-comments/comment-trigger/comment-trigger"; import { MemberMentionPicker } from "@/components/chat-comments/member-mention-picker/member-mention-picker"; import type { MemberOption } from "@/components/chat-comments/member-mention-picker/types"; @@ -328,10 +329,12 @@ export default function ChatCommentsPreviewPage() { const [highlightedIndex, setHighlightedIndex] = useState(0); const [selectedMember, setSelectedMember] = useState(null); const [submittedContent, setSubmittedContent] = useState(null); + const [isPanelOpen, setIsPanelOpen] = useState(false); + const [isEmptyPanelOpen, setIsEmptyPanelOpen] = useState(false); return (
-
+

Chat Comments UI Preview

@@ -339,6 +342,88 @@ export default function ChatCommentsPreviewPage() {

+ {/* Full Integration Simulation */} +
+
+

🎯 Full Integration Simulation

+

+ Two scenarios: no comments (hover to see trigger) and with comments (always visible). +

+
+ + {/* Scenario 1: No comments yet */} +
+

No comments yet — hover to see trigger, click to add first comment

+
+
+
+
+
+ AI Assistant +
+

+ This is an AI response with no comments yet. Hover over this message to reveal the comment trigger icon on the right. Click to open the panel and add the first comment. +

+
+
+ setIsEmptyPanelOpen(!isEmptyPanelOpen)} + /> + {isEmptyPanelOpen && ( + alert(`Create first comment: ${content}`)} + onCreateReply={() => {}} + onEditComment={() => {}} + onDeleteComment={() => {}} + maxHeight={300} + /> + )} +
+
+ + {/* Scenario 2: Has comments */} +
+

Has comments — trigger always visible, click to toggle panel

+
+
+
+
+
+ AI Assistant +
+

+ Based on my analysis, the quarterly revenue increased by 15% compared to the previous period. + The main drivers were the expansion into new markets and improved customer retention rates. + I recommend focusing on the following areas for continued growth... +

+
+
+ setIsPanelOpen(!isPanelOpen)} + /> + {isPanelOpen && ( + alert(`Create comment: ${content}`)} + onCreateReply={(id, content) => alert(`Reply to ${id}: ${content}`)} + onEditComment={(id) => alert(`Edit ${id}`)} + onDeleteComment={(id) => alert(`Delete ${id}`)} + maxHeight={350} + /> + )} +
+
+
+ {/* Comment Composer Section */}

Comment Composer

@@ -367,6 +452,43 @@ export default function ChatCommentsPreviewPage() { )}
+ {/* Comment Trigger Section */} +
+

Comment Trigger

+

+ Toggle button on AI messages. Clicking opens/closes the comment panel. +

+ +
+
+

No comments yet

+

Hidden until hover

+
+ AI response... + {}} /> +
+
+ +
+

5 comments exist

+

Always visible with count

+
+ AI response... + {}} /> +
+
+ +
+

Panel is open

+

Active/pressed state

+
+ AI response... + {}} /> +
+
+
+
+ {/* Comment Panel Section */}

Comment Panel

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 140197908..c09968d54 100644 --- a/surfsense_web/components/chat-comments/comment-panel/comment-panel.tsx +++ b/surfsense_web/components/chat-comments/comment-panel/comment-panel.tsx @@ -42,10 +42,11 @@ export function CommentPanel({ } const hasThreads = threads.length > 0; + const showEmptyState = !hasThreads && !isComposerOpen; return (
- {hasThreads ? ( + {hasThreads && (
- ) : ( + )} + + {showEmptyState && (

No comments yet

@@ -75,7 +78,7 @@ export function CommentPanel({
)} -
+
{isComposerOpen ? ( 0; + + return ( + + ); +} + diff --git a/surfsense_web/components/chat-comments/comment-trigger/types.ts b/surfsense_web/components/chat-comments/comment-trigger/types.ts new file mode 100644 index 000000000..b9c33b2e9 --- /dev/null +++ b/surfsense_web/components/chat-comments/comment-trigger/types.ts @@ -0,0 +1,6 @@ +export interface CommentTriggerProps { + commentCount: number; + isOpen: boolean; + onClick: () => void; +} +