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

[frontend] Add online status to user avatar #214

Merged
merged 13 commits into from
Jan 30, 2024
Merged

Conversation

usatie
Copy link
Owner

@usatie usatie commented Jan 17, 2024

Screenshot 2024-01-18 at 0 53 35 Screenshot 2024-01-18 at 0 53 48 Screenshot 2024-01-18 at 0 53 54 Screenshot 2024-01-18 at 0 54 11 Screenshot 2024-01-18 at 0 54 26

Copy link
Contributor

coderabbitai bot commented Jan 17, 2024

Warning

Rate Limit Exceeded

@kotto5 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 22 minutes and 23 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.
Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.
Please see our FAQ for further information.

Commits Files that changed from the base of the PR and between 6c701a4 and 830281a.

Walkthrough

The recent updates have streamlined the avatar rendering across the application. A unified Avatar component is now used throughout, featuring new properties like size, href, and online status. This component now also includes tooltips and visual indicators for user presence. Redundant code like the truncateString function has been removed or relocated, and direct links to user profiles have been incorporated into the avatar component, simplifying the UI structure. Additionally, changes related to OAuth configuration and user authentication have been introduced, along with the implementation of muting functionality within specific rooms.

Changes

File Path Change Summary
.../room/[id]/sidebar-item.tsx Updated SidebarItem component to use new Avatar from @/app/ui/user/avatar with size prop; removed truncateString function; adjusted user avatar and name rendering logic.
.../ui/user/avatar.tsx Refactored Avatar to include href and online props; updated avatar rendering logic with tooltips and online status indicators.
.../ui/user/match-history.tsx Modified MatchDetailItem to directly render Avatar with user profile link, removing use of next/link.
.../ui/user/user-list.tsx Updated to use new Avatar component for user avatars, handling avatar URL, size, link, alt text, and online status.
.../env.template OAuth configuration changes, including removal and modification of client ID and client secret declarations.
.../prisma/migrations/20240118204714... Introduces functionality to create a table for muting users in specific rooms.
.../prisma/migrations/20240121041719... Alters the "User" table by adding a new column for OAuth enablement and modifying the "password" column.
.../prisma/schema.prisma Updates to User and Room models, introduction of MutedUsers field, and addition of MuteUserOnRoom model.
.../app.module.ts Modification to include the MuteModule in the application.
.../auth/auth.controller.ts Replaces signupWith42 endpoint with new OAuth2 signup and login endpoints, sets cookie and redirects upon successful OAuth2 login.
.../auth/auth.service.ts Addition of methods for OAuth authentication with 42 API and removal of UserEntity dependency in signupWith42 method.
.../chat/chat.controller.ts Addition of isUserOnline method to handle a GET request to check if a user is online.
.../chat/chat.gateway.ts Integration of the MuteService into the ChatGateway constructor and introduction of new message handling methods.
.../chat/chat.module.ts Addition of the MuteService from src/room/mute/mute.service to the providers in the ChatModule.
.../chat/chat.service.ts Use of PublicUserEntity instead of User, addition of methods for managing invitations and retrieving blocked users.
.../chat/entities/message.entity.ts Renaming of PrivateUserEntity to PublicUserEntity and its usage update in the MessageEntity class constructor.
.../room/guards/enter-room.guard.ts Validation of room password using compare function from bcrypt library asynchronously.
.../room/mute/... Introduction of mute-related files including controller, service, module, entities, and DTOs.
.../room/room.service.ts Inclusion of hashPassword method to securely hash passwords.
.../user/entities/public-user.entity.ts Addition of oauthEnabled property of type boolean to the PublicUserEntity class.
.../user/entities/user.entity.ts Addition of oauthEnabled property to the UserEntity class and decoration with @Exclude.
.../test/room.e2e-spec.ts Significant alterations to accommodate changes in muting logic.
.../test/user.e2e-spec.ts Addition of test for creating a user with an empty password, expecting 400 Bad Request.
.../test/utils/app.ts Addition of methods for muting users, getting muted users, and checking user online status.
.../app/(guest-only)/login/page.tsx Update of LoginPage function to include a link for OAuth2 login with the value of process.env.NEXT_PUBLIC_API_URL.
.../app/(guest-only)/signup/page.tsx Update of SignUp function to include a link for signing up with a specific OAuth provider.
.../app/lib/... Updates to async functions, SocketProvider, and introduction of new types in dtos.ts.
.../app/pong/GameCard.tsx Replacement of UserTooltip component with the Avatar component from @/app/ui/user/avatar.
.../app/room/[id]/room-detail.tsx Addition of logic for fetching and displaying user online status using React's useState and useEffect hooks.
.../app/ui/room/message-item.tsx Addition of logic for fetching and displaying user online status using React's useState and useEffect hooks.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

@usatie usatie force-pushed the feat/frontend/online-status branch from 463a464 to 6c701a4 Compare January 17, 2024 15:33
@kotto5 kotto5 force-pushed the feat/frontend/online-status branch from bd98b87 to 830281a Compare January 30, 2024 06:09
@kotto5 kotto5 linked an issue Jan 30, 2024 that may be closed by this pull request
@kotto5 kotto5 merged commit a58a418 into main Jan 30, 2024
4 checks passed
@kotto5 kotto5 deleted the feat/frontend/online-status branch January 30, 2024 06:16
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.

online status
2 participants