fix: refine community icon logic to only show when an account is actively shared with others

This commit is contained in:
2026-02-21 02:56:45 +01:00
parent 1f5d2e08e5
commit f0740997d0

View File

@@ -414,15 +414,21 @@ const AccountRow: React.FC<{
}; };
const isBanned = account?.vacBanned || (account?.gameBans && account.gameBans > 0); const isBanned = account?.vacBanned || (account?.gameBans && account.gameBans > 0);
const isShared = account?._id.startsWith('shared_');
// Refined Shared Logic:
// 1. It was shared WITH you (starts with shared_)
// 2. OR you are the owner but you have shared it with at least one person
const isSharedWithYou = account?._id.startsWith('shared_');
const hasSharedMembers = (account as any).sharedWith && (account as any).sharedWith.length > 0;
const showCommunityIcon = isSharedWithYou || hasSharedMembers;
return ( return (
<TableRow sx={{ '&:hover': { background: 'action.hover' }, borderBottom: '1px solid', borderColor: 'divider' }}> <TableRow sx={{ '&:hover': { background: 'action.hover' }, borderBottom: '1px solid', borderColor: 'divider' }}>
<TableCell> <TableCell>
<Box sx={{ position: 'relative' }}> <Box sx={{ position: 'relative' }}>
<Avatar src={imgSrc} variant="square" sx={{ width: 32, height: 32, border: '1px solid', borderColor: 'divider' }} /> <Avatar src={imgSrc} variant="square" sx={{ width: 32, height: 32, border: '1px solid', borderColor: 'divider' }} />
{isShared && ( {showCommunityIcon && (
<Tooltip title="Community Shared Account"> <Tooltip title={isSharedWithYou ? "Remote Shared Account" : "Actively Shared with Community"}>
<PeopleIcon sx={{ position: 'absolute', bottom: -4, right: -4, fontSize: 14, color: 'primary.main', bgcolor: 'background.default', borderRadius: '50%', border: '1px solid', borderColor: 'divider', p: 0.2 }} /> <PeopleIcon sx={{ position: 'absolute', bottom: -4, right: -4, fontSize: 14, color: 'primary.main', bgcolor: 'background.default', borderRadius: '50%', border: '1px solid', borderColor: 'divider', p: 0.2 }} />
</Tooltip> </Tooltip>
)} )}