Skip to content

Commit 9746b75

Browse files
authored
Merge pull request #1118 from FaheemOnHub/add/collab/button
add: collaboration panel button in avatar tooltip
2 parents e28c1bc + 2503f83 commit 9746b75

File tree

1 file changed

+27
-3
lines changed

1 file changed

+27
-3
lines changed

src/custom/CollaboratorAvatarGroup/CollaboratorAvatarGroup.tsx

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { ExpandMore } from '@mui/icons-material';
22
import { MouseEvent, useState } from 'react';
3-
import { Avatar, AvatarGroup, Popover, Typography } from '../../base';
3+
import { Avatar, AvatarGroup, Button, Popover, Typography } from '../../base';
44
import { iconSmall } from '../../constants/iconsSizes';
55
import { styled, useTheme } from '../../theme';
66
import { DARK_TEAL_BLUE } from '../../theme/colors/colors';
@@ -57,10 +57,12 @@ interface Users {
5757
* @interface CollaboratorAvatarGroupProps
5858
* @property {Users} users - Object containing user information mapped by client IDs
5959
* @property {string} providerUrl - Base URL of the provider (e.g., 'https://github.com')
60+
* @property {() => void} [onOpenWorkspace] - function to open workspace
6061
*/
6162
interface CollaboratorAvatarGroupProps {
6263
users: Users;
6364
providerUrl: string;
65+
onOpenWorkspace?: () => void;
6466
}
6567

6668
interface StyledAvatarProps {
@@ -114,7 +116,8 @@ const StyledPopover = styled(Popover)(() => ({
114116

115117
const CollaboratorAvatarGroup = ({
116118
users,
117-
providerUrl
119+
providerUrl,
120+
onOpenWorkspace
118121
}: CollaboratorAvatarGroupProps): JSX.Element => {
119122
const [anchorEl, setAnchorEl] = useState<HTMLElement | null>(null);
120123

@@ -139,7 +142,28 @@ const CollaboratorAvatarGroup = ({
139142
.slice(0, visibleAvatars)
140143
.map(([clientID, user]) => {
141144
return (
142-
<CustomTooltip key={clientID} title={user.name} arrow>
145+
<CustomTooltip
146+
key={clientID}
147+
title={
148+
<div style={{ justifyContent: 'center' }}>
149+
<Typography style={{ fontSize: '0.9em' }}>{user.name}</Typography>
150+
<Button
151+
size="small"
152+
variant="outlined"
153+
onClick={onOpenWorkspace}
154+
style={{
155+
fontSize: '0.9em',
156+
padding: '2px 8px',
157+
minWidth: 'auto',
158+
marginTop: '4px'
159+
}}
160+
>
161+
Open Recents
162+
</Button>
163+
</div>
164+
}
165+
arrow
166+
>
143167
<StyledAvatar
144168
key={clientID}
145169
alt={user.name}

0 commit comments

Comments
 (0)