From df3fcd669d3c9707e0a993c077b88dddefde77fa Mon Sep 17 00:00:00 2001 From: Atridad Lahiji Date: Mon, 28 Apr 2025 03:44:24 -0600 Subject: [PATCH] Mobile fixes --- islands/Chat.tsx | 14 +++++++------- routes/chat.tsx | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/islands/Chat.tsx b/islands/Chat.tsx index 3723016..3e01c7f 100644 --- a/islands/Chat.tsx +++ b/islands/Chat.tsx @@ -17,10 +17,12 @@ export default function Chat() { useEffect(() => { if (!username) { const randomNum = Math.floor(Math.random() * 10000); - setUsername(`User${randomNum}`); + setUsername(`HumanGuest${randomNum}`); } - const wsProtocol = window.location.protocol === "https:" ? "wss:" : "ws:"; + const wsProtocol = globalThis.location.protocol === "https:" + ? "wss:" + : "ws:"; const ws = new WebSocket( `${wsProtocol}//${globalThis.location.host}/api/chat`, ); @@ -77,7 +79,7 @@ export default function Chat() { }; return ( -
+
{/* Header */}

Live Chat

@@ -88,7 +90,6 @@ export default function Chat() {

- {/* Chat messages area */}
- No messages yet. Be the first to chat! + No messages yet.

) : ( @@ -132,7 +133,6 @@ export default function Chat() { )}
- {/* Input area */}

- You are chatting as{" "} + You are connected as{" "} {username}

diff --git a/routes/chat.tsx b/routes/chat.tsx index 00348e4..cf79446 100644 --- a/routes/chat.tsx +++ b/routes/chat.tsx @@ -14,7 +14,7 @@ export default function ChatPage() {
-
+

This is an ephemeral chat room. Messages are only visible to users currently online and aren't stored after you leave.