Skip to content

Commit

Permalink
update contributors image for unauth user (#7410)
Browse files Browse the repository at this point in the history
  • Loading branch information
reactoholic authored Jan 9, 2025
1 parent f55420c commit afe2800
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 16 deletions.
19 changes: 12 additions & 7 deletions src/core/ui/content/PageContentBlockHeaderWithDialogAction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ interface PageContentBlockHeaderWithDialogActionProps extends PageContentBlockHe
onDialogOpen?: () => void;
onDialogClose?: () => void;
expanded?: boolean;
showExpand?: boolean;
}

const iconSize = (theme: Theme) => theme.spacing(2);
Expand All @@ -19,19 +20,23 @@ const PageContentBlockHeaderWithDialogAction = ({
onDialogOpen,
onDialogClose,
actions,
showExpand = true,
...headerProps
}: PropsWithChildren<PageContentBlockHeaderWithDialogActionProps>) => {
const { t } = useTranslation();
const dialogAction = (
<>
{actions}
<IconButton
onClick={expanded ? onDialogClose : onDialogOpen}
sx={{ svg: { width: iconSize, height: iconSize } }}
aria-label={t('buttons.expandWindow')}
>
{expanded ? <Close /> : <ExpandContentIcon />}
</IconButton>

{showExpand && (
<IconButton
onClick={expanded ? onDialogClose : onDialogOpen}
sx={{ svg: { width: iconSize, height: iconSize } }}
aria-label={t('buttons.expandWindow')}
>
{expanded ? <Close /> : <ExpandContentIcon />}
</IconButton>
)}
</>
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,17 @@ import { Theme } from '@mui/material/styles';
import { gutters } from '@/core/ui/grid/utils';
import PageContentBlockHeader from '@/core/ui/content/PageContentBlockHeader';
import Loading from '@/core/ui/loading/Loading';
import ImageBackdrop from '@/domain/shared/components/Backdrops/ImageBackdrop';
import Gutters from '@/core/ui/grid/Gutters';

const grayedOutUsersImgSrc = '/contributors/users-grayed.png';

type CommunityContributorsBlockWideProps = {
users: ContributorCardSquareProps[] | undefined;
organizations: ContributorCardSquareProps[] | undefined;
isDialogView?: boolean;
isLoading?: boolean;
showUsers: boolean;
};

const config = [
Expand All @@ -37,6 +42,7 @@ const config = [

const CommunityContributorsBlockWide = ({
users,
showUsers,
organizations,
isDialogView = false,
isLoading = false,
Expand Down Expand Up @@ -105,6 +111,7 @@ const CommunityContributorsBlockWide = ({
<>
<PageContentBlock>
<PageContentBlockHeaderWithDialogAction
showExpand={false}
title={t('pages.generic.sections.community.contributors')}
onDialogOpen={() => setIsDialogOpen(true)}
actions={
Expand All @@ -122,14 +129,31 @@ const CommunityContributorsBlockWide = ({
>
{contributorTypeToggle()}
</PageContentBlockHeaderWithDialogAction>
<CommunityContributorsBlockWideContent
users={users}
organizations={organizations}
contributorType={contributorType}
filter={filter}
nested
compactView
/>

{showUsers ? (
<CommunityContributorsBlockWideContent
users={users}
organizations={organizations}
contributorType={contributorType}
filter={filter}
nested
compactView
/>
) : (
<Gutters disablePadding>
<ImageBackdrop
src={grayedOutUsersImgSrc}
backdropMessage="login"
blockName="all-contributing-users"
messageSx={theme => ({
[theme.breakpoints.up('sm')]: {
fontWeight: 'bold',
},
})}
/>
</Gutters>
)}

<Actions justifyContent="end">
<ButtonBase component={CaptionSmall} onClick={() => setIsDialogOpen(true)}>
{t('common.show-all')}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,12 @@ const SpaceCommunityPage = () => {
<CommunityGuidelinesBlock communityId={communityId} journeyUrl={data?.space.profile.url} />
</InfoColumn>
<ContentColumn>
<CommunityContributorsBlockWide users={memberUsers} organizations={memberOrganizations} />
<CommunityContributorsBlockWide
users={memberUsers}
showUsers={isAuthenticated}
organizations={memberOrganizations}
/>

<CalloutsGroupView
journeyId={spaceId}
calloutsSetId={calloutsSetId}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ const ContributorsToggleDialog = ({ open = false, journeyId, onClose }: Contribu
{isAuthenticated && (
<Gutters disablePadding>
<CommunityContributorsBlockWide
showUsers
users={users}
organizations={organizations}
isLoading={loading}
Expand Down

0 comments on commit afe2800

Please sign in to comment.