chat messages styling

This commit is contained in:
Nathaniel Tampus
2023-03-06 18:42:47 +08:00
parent 4e3e77e014
commit 19880c0818
2 changed files with 18 additions and 3 deletions

View File

@@ -447,7 +447,22 @@ export default function GamePage({ initialLobby }: { initialLobby: Game }) {
>
{chatMessages.map((m, i) => (
<li className="max-w-[30rem]" key={i}>
{m.author.name}: {m.message}
<span
className={
!m.author.id && m.author.name === "server" ? "bg-base-content p-2" : ""
}
>
{m.author.id && (
<span>
<span className="font-bold">{m.author.name}</span>:{" "}
</span>
)}
<span
className={!m.author.id && m.author.name === "server" ? "text-base-300" : ""}
>
{m.message}
</span>
</span>
</li>
))}
</ul>

View File

@@ -123,7 +123,7 @@ export function initSocket(
winnerSide?: string;
}) => {
const m = {
author: { name: "game" }
author: { name: "server" }
} as Message;
if (reason === "checkmate") {