Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/lopatoj/hackrice14
Browse files Browse the repository at this point in the history
  • Loading branch information
Allen-Mikhailov committed Sep 22, 2024
2 parents d4b40c9 + ff5ee9c commit e20dc82
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
Binary file added client/src/assets/5dots.webp
Binary file not shown.
4 changes: 2 additions & 2 deletions client/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
width: 100%;
height: 100%;

background-color: rgb(21, 21, 21);
background-color: rgba(21, 21, 21,.7);
background-size: cover;

}
Expand All @@ -36,7 +36,7 @@ body {
margin: 0;
display: flex;
overflow-y: scroll;
background-image:'./assets/wallpaper.jpg';
background-image: url('./assets/5dots.webp');
color: rgb(255,255,255)

}
Expand Down
12 changes: 4 additions & 8 deletions client/src/pages/Chat/Chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { auth } from "../../modules/firebase";

function Chat() {
const input = useRef<HTMLInputElement>(null);
const [chat, setChat] = useState<ChatType | null>(null);
const [messages, setMessages] = useState<Message[]>([]);
const id = useParams().id;
const send = useRef((message: Message) => { console.log(message.message)})
Expand All @@ -23,16 +22,14 @@ function Chat() {
return;
}

const _chat = await getChat(user, id)
const chat = await getChat(user, id);

setChat(_chat);

if (!_chat) {
if (!chat) {
nav("/");
return;
}

setMessages(_chat.messages || []);
setMessages(chat.messages || []);
const token = await user.getIdToken();
console.log(token);

Expand All @@ -41,13 +38,12 @@ function Chat() {
});
socket.connect();
socket.on("connect", () => {
socket.emit("join", _chat._id);
socket.emit("join", chat._id);
});
socket.on("message", (message: Message) => {
setMessages([...messages, message]);
});
send.current = (message: Message) => {
console.log(message)
socket.emit("message", message);
}
});
Expand Down

0 comments on commit e20dc82

Please sign in to comment.