-
Notifications
You must be signed in to change notification settings - Fork 0
Add user profile navigation from names and avatars #294
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
Open
Copilot
wants to merge
56
commits into
main
Choose a base branch
from
copilot/add-navigation-to-user-profile
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,840
−1,061
Open
Changes from all commits
Commits
Show all changes
56 commits
Select commit
Hold shift + click to select a range
08603d6
Initial plan
Copilot 65448ef
Add user profile navigation: routes, components, and GraphQL updates
Copilot 421e2be
Update message thread with clickable avatars and add Storybook stories
Copilot 9c7110f
Add documentation for user profile navigation pattern
Copilot 713735d
Merge branch 'main' into copilot/add-navigation-to-user-profile
dani-vaibhav 7ab4250
fix: address code review feedback for user profile navigation components
Copilot 455f446
feat: add user profile navigation and improve component imports
dani-vaibhav 4223712
fix: update package.json to include node-forge dependency
dani-vaibhav 13158b7
Merge branch 'main' into copilot/add-navigation-to-user-profile
dani-vaibhav c18136a
Merge branch 'main' into copilot/add-navigation-to-user-profile
dani-vaibhav 8a6b7f1
fix: address code review feedback - fix layout component, user names …
Copilot 907cf42
Merge branch 'main' into copilot/add-navigation-to-user-profile
dani-vaibhav af00807
Merge branch 'main' into copilot/add-navigation-to-user-profile
dani-vaibhav aeaeb52
Merge branch 'main' into copilot/add-navigation-to-user-profile
dani-vaibhav ebcf82d
Fix : Build error issue
dani-vaibhav ffdd263
refactor: address code review feedback - add JSDoc, extract shared ut…
Copilot 485ceb4
Merge branch 'main' into copilot/add-navigation-to-user-profile
dani-vaibhav 427e6f8
feat: add MemoryRouter decorator to ListingBanner story
dani-vaibhav ca60e45
fix: reorder import statements in ListingBanner story
dani-vaibhav cc89d8d
test: Add comprehensive test coverage for UI components
dani-vaibhav e5fbc1f
test: cover reservation request pagination logic
dani-vaibhav 6f34240
Merge branch 'main' into copilot/add-navigation-to-user-profile
dani-vaibhav 0a903d9
fix: update type assertions in ListingBanner stories and improve erro…
dani-vaibhav 15b61d8
refactor: simplify type exports in sharer information, user avatar, a…
dani-vaibhav 5bbd98f
feat: add user profile navigation and storybook examples for user pro…
dani-vaibhav 6fa5d35
fix: address sourcery-ai feedback - clarify validation function, fix …
Copilot 3930eed
fix: address final sourcery-ai feedback - clarify comment and add use…
Copilot 599c4d0
refactor: centralize user profile routes and optimize conversation bo…
Copilot 58fe3ba
fix: add fallback for broken avatar images with onError handler
Copilot 9d3e31b
Merge branch 'main' into copilot/add-navigation-to-user-profile
dani-vaibhav f624fec
fix: improve error handling in startServer function and update integr…
dani-vaibhav 7791056
Merge branch 'main' into copilot/add-navigation-to-user-profile
dani-vaibhav ff941e7
refactor: address code review feedback - remove unnecessary utilities…
Copilot a2808c5
refactor: remove unnecessary userId guard in UserProfileViewContainer
Copilot 0e011ad
Merge branch 'main' into copilot/add-navigation-to-user-profile
dani-vaibhav 352f9cc
refactor: clarify required MessageThread props and remove unnecessary…
Copilot 0a6e235
refactor: remove defensive null check for reservation period field
Copilot 2672748
refactor: remove redundant userId defensive checks in listing-banner
Copilot 20ccbfc
feat: add requestedById field to ListingRequestUiShape and update pag…
dani-vaibhav dc250e0
revert: restore original messaging-service-mock test logic (remove un…
dani-vaibhav 1524845
feat: add requestedById field to ListingRequestData and implement use…
dani-vaibhav 0226ec9
feat: enhance user profile link component to handle optional userId a…
dani-vaibhav df878c4
fix: render missing userId message in public profile view
dani-vaibhav 0c27758
refactor: extract SharerInformation container and move query/mutation…
dani-vaibhav 13742b6
feat: add navigation to user profile in UserAvatar component
dani-vaibhav eb4aa96
style: reformat HomeRoutes to match project formatting rules
dani-vaibhav a7b4bce
refactor: remove unused getUserDisplayName and use direct user displa…
dani-vaibhav becccd9
refactor: remove requestedById from ListingRequestData interface and …
dani-vaibhav 91a69d9
refactor: clean up reservation-request resolver responsibilities
dani-vaibhav a090d9c
chore: override qs to 6.14.1 for audit
dani-vaibhav 4983137
Merge branch 'main' into copilot/add-navigation-to-user-profile
dani-vaibhav a1acd49
refactor: simplify ListingRequestPageItem definition and usage
dani-vaibhav 784983b
test: add unit tests for queryListingRequestsBySharerId functionality
dani-vaibhav 48813ae
Merge branch 'main' into copilot/add-navigation-to-user-profile
dani-vaibhav 318813f
feat(env): define ProcessEnv interface for environment variables
dani-vaibhav 92a3a30
Merge branch 'main' into copilot/add-navigation-to-user-profile
dani-vaibhav File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,16 @@ | ||
| import { useQuery } from '@apollo/client/react'; | ||
| import { useMutation, useQuery } from '@apollo/client/react'; | ||
| import { useEffect, useState } from 'react'; | ||
| import { useNavigate } from 'react-router-dom'; | ||
| import { SharerInformation } from './sharer-information.tsx'; | ||
| import { SharerInformationContainerDocument } from '../../../../../../generated.tsx'; | ||
| import { | ||
| CreateConversationDocument, | ||
| HomeConversationListContainerConversationsByUserDocument, | ||
| SharerInformationContainerDocument, | ||
| } from '../../../../../../generated.tsx'; | ||
| import type { | ||
| CreateConversationMutation, | ||
| CreateConversationMutationVariables, | ||
| } from '../../../../../../generated.tsx'; | ||
|
|
||
| interface SharerInformationContainerProps { | ||
| sharerId: string; | ||
|
|
@@ -15,13 +25,74 @@ interface SharerInformationContainerProps { | |
| export const SharerInformationContainer: React.FC< | ||
| SharerInformationContainerProps | ||
| > = ({ sharerId, listingId, isOwner, sharedTimeAgo, className, currentUserId }) => { | ||
| const [isMobile, setIsMobile] = useState(false); | ||
| const navigate = useNavigate(); | ||
|
|
||
| const { data, loading, error } = useQuery( | ||
| SharerInformationContainerDocument, | ||
| { | ||
| variables: { sharerId }, | ||
| }, | ||
| ); | ||
|
|
||
| const [createConversation, { loading: isCreating }] = useMutation< | ||
| CreateConversationMutation, | ||
| CreateConversationMutationVariables | ||
| >(CreateConversationDocument, { | ||
| refetchQueries: [ | ||
| { | ||
| query: HomeConversationListContainerConversationsByUserDocument, | ||
| variables: { userId: currentUserId }, | ||
| }, | ||
| ], | ||
| awaitRefetchQueries: true, | ||
| onCompleted: (data) => { | ||
| if (data.createConversation.status.success) { | ||
| navigate('/messages', { | ||
| state: { | ||
| selectedConversationId: data.createConversation.conversation?.id, | ||
| }, | ||
| replace: false, | ||
| }); | ||
| } else { | ||
| console.log( | ||
| 'Failed to create conversation:', | ||
| data.createConversation.status.errorMessage, | ||
| ); | ||
| } | ||
| }, | ||
| onError: (error) => { | ||
| console.error('Error creating conversation:', error); | ||
| }, | ||
| }); | ||
|
|
||
| const handleMessageSharer = async (resolvedSharerId: string) => { | ||
| if (!currentUserId) { | ||
| return; | ||
| } | ||
|
|
||
| try { | ||
| await createConversation({ | ||
| variables: { | ||
| input: { | ||
| listingId, | ||
| sharerId: resolvedSharerId, | ||
| reserverId: currentUserId, | ||
| }, | ||
| }, | ||
| }); | ||
| } catch (error) { | ||
| console.error('Failed to create conversation:', error); | ||
| } | ||
| }; | ||
|
|
||
| useEffect(() => { | ||
| const checkMobile = () => setIsMobile(window.innerWidth <= 600); | ||
| checkMobile(); | ||
| window.addEventListener('resize', checkMobile); | ||
| return () => window.removeEventListener('resize', checkMobile); | ||
| }, []); | ||
|
|
||
| // If sharerId looks like a name (contains spaces or letters), use it directly | ||
| // Otherwise, try to query for user data | ||
| const isNameOnly = | ||
|
|
@@ -41,6 +112,9 @@ export const SharerInformationContainer: React.FC< | |
| sharedTimeAgo={sharedTimeAgo} | ||
| className={className} | ||
| currentUserId={currentUserId} | ||
| isCreating={isCreating} | ||
| isMobile={isMobile} | ||
| onMessageSharer={() => handleMessageSharer(sharer.id)} | ||
| /> | ||
| ); | ||
| } | ||
|
|
@@ -66,6 +140,9 @@ export const SharerInformationContainer: React.FC< | |
| sharedTimeAgo={sharedTimeAgo} | ||
| className={className} | ||
| currentUserId={currentUserId} | ||
| isCreating={isCreating} | ||
| isMobile={isMobile} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here |
||
| onMessageSharer={() => handleMessageSharer(sharer.id)} | ||
| /> | ||
| ); | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confused on why isMobile is being passed down, can be checked at any level, doesnt seem needed to me.