Merge pull request #1709 from appsmithorg/fix/user-icon-numbers

Fix: Max 5 user icons to show for each organization on homepage
This commit is contained in:
Nikhil Nandagopal 2020-11-12 15:33:24 +05:30 committed by GitHub
commit 8d9ae41069
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View File

@ -554,6 +554,7 @@ const ApplicationsSection = (props: any) => {
organizationsListComponent = updatedOrgs.map(
(organizationObject: any, index: number) => {
const { organization, applications, userRoles } = organizationObject;
const userProfiles = userRoles && userRoles.splice(5);
const hasManageOrgPermissions = isPermitted(
organization.userPermissions,
PERMISSION_TYPE.MANAGE_ORGANIZATION,
@ -598,6 +599,12 @@ const ApplicationsSection = (props: any) => {
key={el.username}
/>
))}
{userProfiles && userProfiles.length > 0 ? (
<ProfileImage
className="org-share-user-icons"
commonName={`+${userProfiles.length}`}
/>
) : null}
</UserImageContainer>
<FormDialogComponent
trigger={

View File

@ -19,11 +19,12 @@ export const Profile = styled.div<{ backgroundColor?: string }>`
export default function ProfileImage(props: {
userName?: string;
className?: string;
commonName?: string;
}) {
const themeDetails = useSelector(getThemeDetails);
const initialsAndColorCode = getInitialsAndColorCode(
props.userName,
props.commonName || props.userName,
themeDetails.theme.colors.appCardColors,
);
@ -33,7 +34,7 @@ export default function ProfileImage(props: {
className={props.className}
>
<Text type={TextType.H6} highlight>
{initialsAndColorCode[0]}
{props.commonName || initialsAndColorCode[0]}
</Text>
</Profile>
);