+ {/* Load More */}
+ {hasMore && (
+
+
+
+ )}
+
+ {messages.length === 0 ? (
+
+
+
+
+ Welcome to Support Chat
+
+
+ Send a message to start chatting with our support team
+
+
+
+ ) : (
+ groupedMessages.map((group) => (
+
+ {/* Date Separator */}
+
+
+ {group.messages.map((msg) => {
+ const isOwn = msg.senderId === currentUserId;
+ return (
+
+
+ {!isOwn && (
+
+ Support Team
+
+ )}
+
+ {msg.content}
+
+
+ {formatTime(msg.createdAt)}
+
+
+
+ );
+ })}
+
+ ))
+ )}
+
+ {/* Typing Indicator */}
+ {isTyping && (
+
+ )}
+
+
+
+
+ {/* Input Area */}
+
+ {chat?.status === 'CLOSED' ? (
+
+
+ This chat has been closed. Start a new chat from the FAQ page.
+
+
+ ) : (
+
+
{
+ if (e.key === 'Enter' && !e.shiftKey) {
+ e.preventDefault();
+ handleSend();
+ }
+ }}
+ placeholder="Type your message..."
+ className="flex-1 font-serif text-[14px] text-[#00293d] bg-[#f5f5f5] rounded-[10px] px-4 py-3 outline-none focus:ring-2 focus:ring-[#5ba4a4]/30 placeholder:text-[#00293d]/40"
+ disabled={isSending}
+ />
+
+
+ )}
+
+ >
+ )}
+