Skip to content

Fix/chat sidebar navigation links#308

Open
abhinav160791 wants to merge 4 commits into
QuoteVote:mainfrom
abhinav160791:fix/chat-sidebar-navigation-links
Open

Fix/chat sidebar navigation links#308
abhinav160791 wants to merge 4 commits into
QuoteVote:mainfrom
abhinav160791:fix/chat-sidebar-navigation-links

Conversation

@abhinav160791
Copy link
Copy Markdown

@abhinav160791 abhinav160791 commented Apr 3, 2026

Description

Chat sidebar items (usernames and post titles) were not clickable. Users could not navigate to a profile or post page from the chat. This PR adds navigation links to user and post items across the chat sidebar, buddy list, conversation header, and message avatars/names. The chat drawer also closes automatically on navigation.

DM profile navigation uses an on-click lazy query (GET_USER_BY_ID) to fetch the username, avoiding any deploy-order dependency between client and server.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Chore (refactoring, documentation, or other non-functional changes)

Related Issue

Fixes: Chat Sidebar Items Do Not Link to Profile or Post

Changes

Client (5 files)

  • client/src/graphql/query.jsx — Added GET_USER_BY_ID query to fetch a user's username by their ID on-click.
  • client/src/components/Chat/ChatList.jsx — DM names fetch the username via lazy query on-click and navigate to /Profile/:username/. Group names link to the post URL. Click on the name navigates; click elsewhere on the item opens the chat. Drawer closes on navigation.
  • client/src/components/BuddyList/BuddyItemList.jsx — Buddy names are clickable links to profile pages. Post items link to the post page. Drawer closes on navigation.
  • client/src/components/Chat/MessageBox.jsx — Conversation header title and avatar are clickable, navigating to the profile (DMs via lazy query) or post page (groups). Drawer closes on navigation.
  • client/src/components/Chat/MessageItem.jsx — Message sender avatars and names inside conversations link to the sender's profile page. Drawer closes on navigation.

Verification

  • DM → Profile: Clicked username in Chats tab → navigated to /Profile/<username>/. Drawer closed.
  • Group → Post: Clicked post title in Groups tab → navigated to post page. Drawer closed.
  • Conversation Header: Clicked title/avatar in open conversation → navigated correctly.
  • Message Avatars: Clicked sender avatar/name in group chat → navigated to sender's profile.
  • Hover states: Underline + color change on names, opacity change on avatars — clear clickable affordance.
  • Non-navigation clicks: Clicking the list item area (not the name) still opens the chat as before.
  • Keyboard accessibility: Enter key triggers navigation on focused links.
  • Deploy preview: No server-side schema changes required — client works against existing production API.

Checklist:

  • I have read the Contributing Guidelines.
  • My code follows the Code Style of this project.
  • I have added tests that prove my fix is effective or that my feature works. See Testing Guidelines.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.

@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 3, 2026

Deploy Preview for quotevote ready!

Name Link
🔨 Latest commit e53958e
🔍 Latest deploy log https://app.netlify.com/projects/quotevote/deploys/69d34ef79e787a000851a230
😎 Deploy Preview https://deploy-preview-308--quotevote.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@flyblackbox
Copy link
Copy Markdown
Contributor

Hello @abhinav160791 this did not work for me. When I opened a chat with someone on my buddy list and I tap their avatar or name, nothing happens.

@abhinav160791
Copy link
Copy Markdown
Author

abhinav160791 commented Apr 3, 2026 via email

@flyblackbox
Copy link
Copy Markdown
Contributor

For some reason my bookmarked posts didn’t appear in my buddy list via the deploy preview link. The do appear in production. @abhinav160791

@abhinav160791
Copy link
Copy Markdown
Author

Hi @flyblackbox, Thanks for testing! Here's what happened and what I've done to fix it:

Why the previous version didn't work on the deploy preview:

The initial implementation added a new otherUsername field to the server's GraphQL schema (MessageRoom type) and queried it in GET_CHAT_ROOMS. The deploy preview only deploys the client to Netlify, but the client still talks to the production API server (api.quote.vote). Since the production server doesn't have the otherUsername field in its schema, the entire GET_CHAT_ROOMS query was rejected by the server. This caused:

  1. No chat rooms loading at all (including bookmarked posts disappearing from the buddy list)
  2. Navigation links not working since the data they depended on was never fetched

What I changed to fix it:

I removed the otherUsername field entirely from the server schema and the GET_CHAT_ROOMS query. Instead, DM profile navigation now uses an on-click lazy query (GET_USER_BY_ID) — when you click a username, it fetches their username by ID using the existing user query (which already exists on the production server), then navigates to their profile. Post links use the postDetails.url that was already available in the response.

This means:

  • No new server-side fields are needed
  • The client works against any server version (production or dev)
  • Bookmarked posts and buddy list should load normally again
  • Navigation works on both deploy previews and production

I've pushed the fix — could you try the latest deploy preview again?

@flyblackbox
Copy link
Copy Markdown
Contributor

This is working great @abhinav160791! Nice work. I want to get a pull review from a dev before we merge. Stay tuned 📺

@flyblackbox
Copy link
Copy Markdown
Contributor

Thank you @abhinav160791 for your contributions and sorry for the delay! @Om7035 will review and provide feedback or merge

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.

🐛 Bug: Chat Sidebar Items Do Not Link to Profile or Post

3 participants