+ {messages.length === 0 && (
+
+
+
No messages yet
+
Start the conversation!
+
+ )}
+
+ {messages.map((msg) => {
+ const isOwn = msg.sender === address;
+ return (
+
+
+ {!isOwn && (
+
+ {shortenAddress(msg.sender)}
+
+ )}
+
+ {msg.text}
+
+
+
+ {formatTime(msg.timestamp)}
+
+
+ ✓
+
+
+
+
+ );
+ })}
+
+
+ {!isConnected ? (
+
+ Connect wallet to chat
+
+ ) : !isMember ? (
+
+ Join the group to chat
+
+ ) : (
+
+
setInput(e.target.value)}
+ onKeyDown={handleKeyDown}
+ placeholder="Type a message..."
+ maxLength={500}
+ className="flex-1 bg-gray-100 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-full px-4 py-2 text-sm outline-none focus:ring-2 focus:ring-primary-500"
+ />
+
+
+ )}
+