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

Feat/virtual joystick #10

Open
wants to merge 2 commits into
base: base-63
Choose a base branch
from
Open

Feat/virtual joystick #10

wants to merge 2 commits into from

Conversation

JWS-aAI
Copy link
Owner

@JWS-aAI JWS-aAI commented Nov 24, 2023

New feature added: Basic Virtual Joystick

Hi, I decide implement this feature because it appears to be in high demand. Hope you find interesting.

Description:

  • Joystick can be activated by button on bottom (see picture)
  • For resolutions less than 650px wide it's active by default
  • When resolution ir less than 650px and chat is active, joystick is hidden because it interferes with the chat

Captura de Pantalla 2023-02-20 a las 1 20 20

For implement this, I use this component: https://github.com/elmarti/react-joystick-component

Note: This feature will conflict with this PR: #.62
I can take care of resolving conflicts

Related issues:

  • #.23
  • #.60

Comment on lines 20 to +21
private chairOnSit?: Chair
public joystickMovement?: JoystickMovement
Copy link
Collaborator

Choose a reason for hiding this comment

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

It's good to see that you've added a new property joystickMovement to handle the virtual joystick input. However, please ensure that the JoystickMovement type is properly defined and imported, and that the handleJoystickMovement method is correctly updating the joystickMovement property.

Comment on lines +27 to +28
let joystickLeft = false
let joystickRight = false
Copy link
Collaborator

Choose a reason for hiding this comment

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

The integration of joystick input into the PlayerSelector update logic is well done. Just ensure that the joystickMovement property is always in a valid state when accessed, and consider adding null checks or default values to prevent any potential runtime errors.

Comment on lines +23 to 24
bottom: 60px;
left: 0;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Adjusting the Backdrop styled component to accommodate the virtual joystick is a good approach. However, please verify that the new bottom and max-width values do not negatively impact the chat component's layout on different screen sizes or resolutions.

Comment on lines +36 to 37
right: 0px;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please ensure that the new position of the close button in the Wrapper styled component does not overlap with any other UI elements or make it difficult for users to interact with the button.

Copy link
Owner Author

Choose a reason for hiding this comment

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

@PR-Review sorry can you clarify

Copy link
Collaborator

Choose a reason for hiding this comment

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

@JWS-aAI Certainly! My comment was regarding the changes you made to the position of the close button within the Wrapper styled component in both ComputerDialog.tsx and WhiteboardDialog.tsx. You've changed the top and right properties to 0px, which moves the close button to the very top-right corner of its container.

Here's what you should check to clarify the impact of this change:

  1. Overlap with Other Elements: Ensure that the new position of the close button does not cause it to overlap with any other elements in the UI, such as headers, borders, or any other interactive components.

  2. Ease of Interaction: Confirm that the button is still easily clickable and that its new position does not hinder the user's ability to interact with it. For example, if the button is too close to the edge of the screen or other UI elements, it might be difficult for users to click on it, especially on touch devices.

  3. Consistent Styling: Check that the styling is consistent with the overall design of the application and that the button's new position looks intentional and well-integrated into the layout.

To address these points, you may need to test the UI on different devices and screen sizes, and possibly adjust padding or margins to ensure the button is both visually pleasing and functionally accessible.

Comment on lines 110 to +111
const [showRoomInfo, setShowRoomInfo] = useState(false)
const showJoystick = useAppSelector((state) => state.user.showJoystick)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Adding toggle buttons for the virtual joystick is a user-friendly feature. Please make sure that the tooltip text is clear and that the icons used are intuitive for the users. Also, verify that the state management for showJoystick is properly synchronized across the application to prevent any inconsistencies.

Comment on lines 29 to +30
flex-direction: column;
min-width: max-content;
Copy link
Collaborator

Choose a reason for hiding this comment

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

The adjustments to the Wrapper and WhiteboardWrapper styled components, including the close button's position and the margin-right value, should be carefully tested to ensure they do not disrupt the layout or usability of the whiteboard dialog on various screen sizes.

Comment on lines 46 to +47
},
setShowJoystick: (state, action: PayloadAction<boolean>) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

The addition of the showJoystick state and the setShowJoystick reducer is a good implementation for managing the joystick visibility. Please ensure that the initial state of showJoystick is set correctly for different screen sizes and that it responds appropriately to window resize events.

@PR-Review
Copy link
Collaborator

Thank you for your contribution to the SkyOffice project. I've finished reviewing the pull request for the virtual joystick feature. Overall, the implementation seems solid, and the feature is a valuable addition to the application. I've left some comments regarding best practices, code safety, and UI considerations. Please take a look at them and make any necessary adjustments.

If you have any questions or need further clarification on any of the comments, feel free to reach out. Once again, great work on this feature, and I look forward to seeing it integrated into the application.

@JWS-aAI
Copy link
Owner Author

JWS-aAI commented Nov 24, 2023

@PR-Review Ok thanks, any suggestions what to start with, real quick

@PR-Review
Copy link
Collaborator

@JWS-aAI Certainly! Here are a few quick suggestions to start with:

  1. Dependency Compatibility: Verify that the newly added react-joystick-component library is fully compatible with the existing codebase and does not introduce any breaking changes.

  2. UI Layout and Responsiveness: Test the changes made to the UI components, such as the Chat.tsx and WhiteboardDialog.tsx, to ensure that the layout is still functional and visually appealing across different screen sizes and resolutions.

  3. TypeScript Consistency: Consider converting the Joystick.jsx component to TypeScript to maintain consistency with the rest of the project and leverage type safety.

  4. State Management: Ensure that the showJoystick state is correctly initialized and responds to window resize events as expected.

  5. Code Cleanliness: Review the useEffect hook in MobileVirtualJoystick.tsx to confirm that it's necessary and remove it if it's not serving a purpose.

Start with these items, and once they're addressed, the rest of the comments can be tackled in order of priority or dependency. If you need further assistance, feel free to ask. Good luck!

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.

3 participants