From c733d7e1f1f6261a1baacbe1c538e72312f674f4 Mon Sep 17 00:00:00 2001 From: SrashtiChauhan Date: Thu, 7 May 2026 22:30:25 +0530 Subject: [PATCH] feat: improve chat page ui consistency [NSOC'26] --- frontend/app/chat/page.tsx | 90 ++++++++++++++++++++++---------------- 1 file changed, 53 insertions(+), 37 deletions(-) diff --git a/frontend/app/chat/page.tsx b/frontend/app/chat/page.tsx index fcebb4e..748111d 100644 --- a/frontend/app/chat/page.tsx +++ b/frontend/app/chat/page.tsx @@ -163,25 +163,41 @@ socket.on("newMessage", (msg) => { - return ( -
-

Team Chat

- - {/* USERNAME */} - setUsername(e.target.value)} - placeholder="Enter name" - className="mb-3 p-2 border rounded w-full" - /> - - {/* ONLINE USERS */} -
- Online: {onlineUsers.join(", ")} -
+return ( +
+ +
+

+ Team Chat +

+ +

+ Collaborate and communicate with your team in real time. +

+
- {/* MESSAGES */} -
setUsername(e.target.value)} + placeholder="Enter name" + className="w-full rounded-2xl border border-(--line) bg-white px-4 py-3 text-sm shadow-sm outline-none transition focus:border-slate-400" + /> + + {/* ONLINE USERS */} +
+
+ + + Online: + + + {onlineUsers.join(", ")} + +
+ + {/* MESSAGES */} +
{ const el = containerRef.current; @@ -199,7 +215,7 @@ socket.on("newMessage", (msg) => { setUnreadCount(0); } }} - className="h-[400px] overflow-y-auto space-y-2 border p-3" + className="h-[500px] overflow-y-auto rounded-3xl border border-(--line) bg-white p-5 shadow-sm" > {messages.map((msg, i) => { const prevMsg = messages[i - 1]; @@ -214,20 +230,20 @@ socket.on("newMessage", (msg) => { }`} >
+ className={`max-w-sm rounded-2xl p-4 shadow-sm ${ + isMe + ? `bg-teal-700 text-white ${ + isSameUser + ? "rounded-lg rounded-tr-2xl" + : "rounded-2xl rounded-br-md" + }` + : `bg-slate-100 text-slate-800 ${ + isSameUser + ? "rounded-lg rounded-tl-2xl" + : "rounded-2xl rounded-bl-md" + }` + }`} +> {/* Show name only for others */} {!isMe && !isSameUser && (

{msg.user}

@@ -256,7 +272,7 @@ socket.on("newMessage", (msg) => { ))}
-

+

{msg.time} {msg.status === "seen" ? "✓✓" : "✓"}

@@ -288,16 +304,16 @@ socket.on("newMessage", (msg) => { )} {/* INPUT */} -
+