+
+
+
Current match
+
+ {queueState === "matched"
+ ? "You are connected. Messages are private in this room."
+ : "No match yet. Join the queue to start connecting."}
+
+
+
+ {queueState !== "matched" ? (
+
+ {queueState === "waiting" ? (
+
+ ) : (
+
+ )}
+
+ ) : (
+
+
+
+
+
+
+ )}
+
+
+ {queueState === "matched" ? (
+
+
+

+
+
+
{displayPartner}
+
Anonymous stranger
+
+
+ ) : null}
+
+
+
Chat room
+
{queueState === "waiting" ? "Waiting for match..." : "Type when connected."}
+
+
+
+ {messages.length === 0 ? (
+
+ {queueState === "matched"
+ ? "Start the conversation by sending your first message."
+ : "Join the queue and your stranger chat history will appear here."}
+
+ ) : (
+
+ {messages.map((msg) => (
+
+ {msg.type === "system" ? (
+
+ {msg.text}
+
+ ) : (
+
+ {msg.type === "peer" ? (
+
+ {msg.sender}
+
+ ) : null}
+
{msg.text}
+ {msg.timestamp ? (
+
+ {new Date(msg.timestamp).toLocaleTimeString([], {
+ hour: "2-digit",
+ minute: "2-digit",
+ })}
+
+ ) : null}
+
+ )}
+
+ ))}
+
+ )}
+
+
+
+ setInput(e.target.value)}
+ placeholder={
+ queueState === "matched"
+ ? "Send a private message to your stranger..."
+ : "Join the queue to start chatting."
+ }
+ disabled={queueState !== "matched"}
+ className="flex-1"
+ />
+
+
+
+ {systemNotice ? (
+
+ {systemNotice}
+
+ ) : null}
+ {reportSent ? (
+
+ Thank you. The report has been sent.
+
+ ) : null}
+