Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typing Feature #6

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Typing Feature #6

wants to merge 4 commits into from

Conversation

e1vjss
Copy link
Contributor

@e1vjss e1vjss commented Mar 31, 2024

I attempted to make some changes to prepare the server side for the typing feature. Im having a hard time understanding why we have two of each chatRoomController.ts and .js and same for the ChatRoom.js/ts and maybe some insight on what part of the docs I should look at. Thanks

@types/enums.ts Outdated

typing = 'typing',

notTyping = 'notTyping',
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
notTyping = 'notTyping',
stoppedTyping= 'stoppedTyping',


return () => {
socket.off(IOEvents.newMessage, newMessageHandler);
socket.off(IOEvents.joinedRoom, leftRoomHandler);
socket.off(IOEvents.leftRoom, joinedRoomHandler);
socket.off(IOEvents.typing, typingStartedHandler);
socket.off(IOEvents.notTyping, typingStoppedHandler)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep consistent formatting. You can install prettier extension in your IDE to help with this

@coltonehrman
Copy link
Owner

@e1vjss We need to add an input handler to the text box on the client.

@coltonehrman
Copy link
Owner

I attempted to make some changes to prepare the server side for the typing feature. Im having a hard time understanding why we have two of each chatRoomController.ts and .js and same for the ChatRoom.js/ts and maybe some insight on what part of the docs I should look at. Thanks

The .js files are output from the build/compile steps. You don't need to worry about them, they should be ignored from git and not committed. .ts (aka TypeScript) is a compiled language which outputs .js (aka JavaScript) code to run.

@e1vjss e1vjss closed this Apr 3, 2024
@e1vjss e1vjss reopened this Apr 3, 2024

let typingTimer: NodeJS.Timeout | null = null;

const typingStartedHandler = () => {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The formatting is way off, can you please keep it consistent. You can use a plugin called prettier to format

if (value.trim() !== "") {
typingStartedHandler();
} else {

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird extra spacing here

@@ -9,6 +9,27 @@ function ChatInterface() {
const [textMessage, setTextMessage] = useState("");
const [messages, setMessages] = useState<any[]>([]);
const [notification, setNotification] = useState<string | null>(null);
const [isTyping, setIsTyping] = useState(false);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we using the isTyping to render a UI component?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants