From f7aba38d82d61df613115f9c33d94391e1b589e7 Mon Sep 17 00:00:00 2001 From: Nathaniel Tampus Date: Sun, 12 Mar 2023 20:27:26 +0800 Subject: [PATCH] add initial message and fix server message style --- client/src/components/game/GamePage.tsx | 29 +++++++++++++++---------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/client/src/components/game/GamePage.tsx b/client/src/components/game/GamePage.tsx index 128756b..e9ff4df 100644 --- a/client/src/components/game/GamePage.tsx +++ b/client/src/components/game/GamePage.tsx @@ -56,7 +56,12 @@ export default function GamePage({ initialLobby }: { initialLobby: Game }) { const [playBtnLoading, setPlayBtnLoading] = useState(false); const [copiedLink, setCopiedLink] = useState(false); - const [chatMessages, setChatMessages] = useState([]); + const [chatMessages, setChatMessages] = useState([ + { + author: {}, + message: `Welcome! You can invite friends to watch or play by sharing the link above. Have fun!` + } + ]); const chatListRef = useRef(null); const moveListRef = useRef(null); @@ -578,22 +583,22 @@ export default function GamePage({ initialLobby }: { initialLobby: Game }) { ref={chatListRef} > {chatMessages.map((m, i) => ( -
  • - +
  • + {m.author.id && ( {m.author.name}:{" "} )} - - {m.message} - + {m.message}
  • ))}