memaar92 / transcendence

MIT License
3 stars 0 forks source link

Live chatv2 giga super mega merge #76

Open Pommfritz0308 opened 1 week ago

Pommfritz0308 commented 1 week ago

Backend Changes:

  1. ASGI Configuration (asgi.py):

    • Added WebSocket routes for the live_chat app, ensuring chat WebSockets are handled correctly by adding live_chat.routing.websocket_urlpatterns.
  2. Settings (settings.py):

    • Added live_chat to INSTALLED_APPS for managing chat functionality.
  3. URL Routing (urls.py):

    • Added a new API route for chat: /api/chat/, connecting chat views and WebSocket routing to the application.
  4. Live Chat App:

    • Models (models.py):
      • Message: Handles chat messages with fields for sender, receiver, timestamp, and content.
      • Relationship: Manages friend requests and chat relationships between users.
    • Admin (admin.py): Registered Message and Relationship models.
    • Views (views.py):
      • Added views to manage relationships between users (RelationshipStatusView).
      • API endpoints for retrieving and updating relationship status between two users.
    • WebSocket (consumers.py):
      • Implemented ChatConsumer to manage WebSocket connections, sending and receiving messages, and updating the frontend dynamically.
    • Routing (routing.py): Defined WebSocket URL patterns for live chat.
  5. Django Admin:

    • Registered Message and Relationship models for Django admin interface.
  6. New User Management API (views.py in usermanagement):

    • Added endpoint /users// to retrieve a user’s ID by their display name, used for user search input.

Frontend Changes:

  1. New Live Chat Interface (live_chat.html):

    • HTML Structure: A responsive chat interface with a chat window, user search field, user list, and message display area.
    • CSS Styling: Defined styles for chat messages, including separate styles for sent (.message-sender) and received (.message-receiver) messages, and timestamp styling.
  2. Frontend JavaScript (live-chat.js and chatHandler.js):

    • WebSocket Initialization: Dynamically sets up a WebSocket connection when the chat page is loaded.
    • Real-Time Updates: Handles real-time message sending, receiving, and updating the chat interface with the latest info.
    • User Management: Includes a dynamic user list and allows users to send friend requests, accept, or block requests in real-time + manage game invitations with befriended users + user blocking mechanism to hide your online status from blocked user's active user list and block all of their messages
    • Chat and game notifications across all pages (except unregistered paths and /game)
  3. Chat Room (chat_room.html):

    • Introduced a separate chat room page with message history, input handling, and dynamic user interaction through WebSockets.
  4. Frontend Routing (app.js and router.js):

    • Added routes for the new chat and chat room pages.
    • Integrated chat-specific logic into the existing frontend router, ensuring chat functionality is properly initialized.
  5. CSS Changes:

    • Chat-Specific Styles (chat.css): Added styles for the chat interface, including the chat window, message items, and user list layout.
wrottger commented 17 hours ago

89 should be fixed now