remove textarea for unauthenticated users

This commit is contained in:
MeowcaTheoRange 2024-05-09 18:50:46 -05:00
parent 939c0d8784
commit 24f7f73af2

View file

@ -171,15 +171,15 @@ export default function Home() {
function onConnect() { function onConnect() {
setConnected(true); setConnected(true);
if (token != null) if (token != null) {
socket.emit('SIG_CHAT_JOIN', { token }, joinChatRes); socket.emit('SIG_CHAT_JOIN', { token }, joinChatRes);
else setTextBox(<div className={styles.textBox}>
<textarea rows={2} className={styles.textBoxInput} ref={chatInput}></textarea>
<button className={styles.textBoxButton} onClick={() => socket.emit('SIG_CHAT_MESSAGE', { message: chatInput.current?.value }, messageChatRes)}>Send</button>
</div>)
} else
socket.emit('SIG_CHAT_CHANNELS', {}, channelsChatRes); socket.emit('SIG_CHAT_CHANNELS', {}, channelsChatRes);
setTextBox(<div className={styles.textBox}>
<textarea rows={2} className={styles.textBoxInput} ref={chatInput}></textarea>
<button className={styles.textBoxButton} onClick={() => socket.emit('SIG_CHAT_MESSAGE', { message: chatInput.current?.value }, messageChatRes)}>Send</button>
</div>)
Message.current = (message:MessageType) => { Message.current = (message:MessageType) => {
let user; let user;
user = usersRef.current.find(x => x.id == message.user); user = usersRef.current.find(x => x.id == message.user);