Skip to content

Commit

Permalink
fix enteroom modal
Browse files Browse the repository at this point in the history
  • Loading branch information
Assisneto committed Nov 6, 2023
1 parent f49d9a5 commit 2e0c97a
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion coverage/badge-branches.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion coverage/badge-functions.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion coverage/badge-lines.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion coverage/badge-statements.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion src/screen/home/components/modalRoomIcons/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React, { useContext } from "react";

import { Circle, Icons } from "../../styles";
import { SocketContext } from "../../../../socket/socket";
import { saveRoomID } from "../../../../storage/room";

interface ModalRoomProps {
handlerRoomModal: () => void;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import React, { useContext, useState } from "react";
import { InputRoomContainer, InputRoomName, InputRoomText } from "../../styles";

import { SocketContext } from "../../../../../../socket/socket";
import { saveRoomID } from "../../../../../../storage/room";

interface EnterRoomProps {
hideModal: () => void;
Expand All @@ -13,13 +14,15 @@ export const EnterRoom: React.FC<EnterRoomProps> = ({ hideModal }) => {
const { setRoomID } = useContext(SocketContext);
const handleRoomCodeChange = (text: string) => {
setRoomCode(text);

if (text.length === 5) {
handleRoomCodeSubmit();
handleRoomCodeSubmit(text);
}
};

const handleRoomCodeSubmit = async () => {
setRoomID(roomCode);
const handleRoomCodeSubmit = async (roomID: string) => {
setRoomID(roomID);
saveRoomID(roomID);
hideModal();
};

Expand Down

0 comments on commit 2e0c97a

Please sign in to comment.