fix: User profiles dont open from document collaborator facepile

This commit is contained in:
Tom Moor
2019-07-11 22:32:37 -07:00
parent c9da515d4c
commit b3f847a371

View File

@ -60,56 +60,60 @@ class Collaborators extends React.Component<Props> {
<Avatars> <Avatars>
{overflow > 0 && <More>+{overflow}</More>} {overflow > 0 && <More>+{overflow}</More>}
{mostRecentViewers.map(({ lastViewedAt, user }) => ( {mostRecentViewers.map(({ lastViewedAt, user }) => (
<AvatarPile <React.Fragment>
key={user.id} <AvatarPile
tooltip={ key={user.id}
<TooltipCentered> tooltip={
<strong>{user.name}</strong> <TooltipCentered>
<br /> <strong>{user.name}</strong>
viewed {distanceInWordsToNow(new Date(lastViewedAt))} ago <br />
</TooltipCentered> viewed {distanceInWordsToNow(new Date(lastViewedAt))} ago
} </TooltipCentered>
placement="bottom" }
> placement="bottom"
<Viewer> >
<Avatar <Viewer>
src={user.avatarUrl} <Avatar
onClick={() => this.handleOpenProfile(user.id)} src={user.avatarUrl}
/> onClick={() => this.handleOpenProfile(user.id)}
<UserProfile />
user={user} </Viewer>
isOpen={this.openProfileId === user.id} </AvatarPile>
onRequestClose={this.handleCloseProfile} <UserProfile
/> user={user}
</Viewer> isOpen={this.openProfileId === user.id}
</AvatarPile> onRequestClose={this.handleCloseProfile}
/>
</React.Fragment>
))} ))}
{collaborators.map(user => ( {collaborators.map(user => (
<AvatarPile <React.Fragment>
key={user.id} <AvatarPile
tooltip={ key={user.id}
<TooltipCentered> tooltip={
<strong>{user.name}</strong> <TooltipCentered>
<br /> <strong>{user.name}</strong>
{createdAt === updatedAt ? 'published' : 'updated'}{' '} <br />
{updatedBy.id === user.id && {createdAt === updatedAt ? 'published' : 'updated'}{' '}
`${distanceInWordsToNow(new Date(updatedAt))} ago`} {updatedBy.id === user.id &&
</TooltipCentered> `${distanceInWordsToNow(new Date(updatedAt))} ago`}
} </TooltipCentered>
placement="bottom" }
> placement="bottom"
<Collaborator> >
<Avatar <Collaborator>
src={user.avatarUrl} <Avatar
onClick={() => this.handleOpenProfile(user.id)} src={user.avatarUrl}
/> onClick={() => this.handleOpenProfile(user.id)}
<UserProfile />
user={user} </Collaborator>
isOpen={this.openProfileId === user.id} </AvatarPile>
onRequestClose={this.handleCloseProfile} <UserProfile
/> user={user}
</Collaborator> isOpen={this.openProfileId === user.id}
</AvatarPile> onRequestClose={this.handleCloseProfile}
/>
</React.Fragment>
))} ))}
</Avatars> </Avatars>
); );