Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resources on profile page (User & Org) #6983

Merged
merged 10 commits into from
Oct 8, 2024
123 changes: 123 additions & 0 deletions src/core/apollo/generated/apollo-hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1451,6 +1451,17 @@ export const OrganizationProfileInfoFragmentDoc = gql`
${VisualFullFragmentDoc}
${TagsetDetailsFragmentDoc}
`;
export const AccountResourceProfileFragmentDoc = gql`
fragment AccountResourceProfile on Profile {
id
displayName
url
avatar: visual(type: AVATAR) {
...VisualUri
}
}
${VisualUriFragmentDoc}
`;
export const PendingMembershipsJourneyProfileFragmentDoc = gql`
fragment PendingMembershipsJourneyProfile on Profile {
id
Expand Down Expand Up @@ -11906,6 +11917,118 @@ export function refetchOrganizationsListQuery(variables?: SchemaTypes.Organizati
return { query: OrganizationsListDocument, variables: variables };
}

export const AccountResourcesInfoDocument = gql`
query AccountResourcesInfo($accountId: UUID!) {
lookup {
account(ID: $accountId) {
id
spaces {
id
profile {
...AccountResourceProfile
cardBanner: visual(type: CARD) {
...VisualUri
}
}
}
virtualContributors {
id
profile {
...AccountResourceProfile
tagline
}
}
innovationPacks {
id
profile {
...AccountResourceProfile
}
templatesSet {
id
calloutTemplatesCount
communityGuidelinesTemplatesCount
innovationFlowTemplatesCount
postTemplatesCount
whiteboardTemplatesCount
}
}
innovationHubs {
id
profile {
...AccountResourceProfile
banner: visual(type: BANNER_WIDE) {
...VisualUri
}
}
spaceVisibilityFilter
spaceListFilter {
id
profile {
id
displayName
}
}
subdomain
}
}
}
}
${AccountResourceProfileFragmentDoc}
${VisualUriFragmentDoc}
`;

/**
* __useAccountResourcesInfoQuery__
*
* To run a query within a React component, call `useAccountResourcesInfoQuery` and pass it any options that fit your needs.
* When your component renders, `useAccountResourcesInfoQuery` returns an object from Apollo Client that contains loading, error, and data properties
* you can use to render your UI.
*
* @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
*
* @example
* const { data, loading, error } = useAccountResourcesInfoQuery({
* variables: {
* accountId: // value for 'accountId'
* },
* });
*/
export function useAccountResourcesInfoQuery(
baseOptions: Apollo.QueryHookOptions<
SchemaTypes.AccountResourcesInfoQuery,
SchemaTypes.AccountResourcesInfoQueryVariables
>
) {
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useQuery<SchemaTypes.AccountResourcesInfoQuery, SchemaTypes.AccountResourcesInfoQueryVariables>(
AccountResourcesInfoDocument,
options
);
}

export function useAccountResourcesInfoLazyQuery(
baseOptions?: Apollo.LazyQueryHookOptions<
SchemaTypes.AccountResourcesInfoQuery,
SchemaTypes.AccountResourcesInfoQueryVariables
>
) {
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useLazyQuery<SchemaTypes.AccountResourcesInfoQuery, SchemaTypes.AccountResourcesInfoQueryVariables>(
AccountResourcesInfoDocument,
options
);
}

export type AccountResourcesInfoQueryHookResult = ReturnType<typeof useAccountResourcesInfoQuery>;
export type AccountResourcesInfoLazyQueryHookResult = ReturnType<typeof useAccountResourcesInfoLazyQuery>;
export type AccountResourcesInfoQueryResult = Apollo.QueryResult<
SchemaTypes.AccountResourcesInfoQuery,
SchemaTypes.AccountResourcesInfoQueryVariables
>;
export function refetchAccountResourcesInfoQuery(variables: SchemaTypes.AccountResourcesInfoQueryVariables) {
return { query: AccountResourcesInfoDocument, variables: variables };
}

export const DeleteInvitationDocument = gql`
mutation DeleteInvitation($invitationId: UUID!) {
deleteInvitation(deleteData: { ID: $invitationId }) {
Expand Down
92 changes: 92 additions & 0 deletions src/core/apollo/generated/graphql-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16931,6 +16931,98 @@ export type OrganizationsListQuery = {
}>;
};

export type AccountResourcesInfoQueryVariables = Exact<{
accountId: Scalars['UUID'];
}>;

export type AccountResourcesInfoQuery = {
__typename?: 'Query';
lookup: {
__typename?: 'LookupQueryResults';
account?:
| {
__typename?: 'Account';
id: string;
spaces: Array<{
__typename?: 'Space';
id: string;
profile: {
__typename?: 'Profile';
id: string;
displayName: string;
url: string;
cardBanner?: { __typename?: 'Visual'; id: string; uri: string; name: string } | undefined;
avatar?: { __typename?: 'Visual'; id: string; uri: string; name: string } | undefined;
};
}>;
virtualContributors: Array<{
__typename?: 'VirtualContributor';
id: string;
profile: {
__typename?: 'Profile';
tagline?: string | undefined;
id: string;
displayName: string;
url: string;
avatar?: { __typename?: 'Visual'; id: string; uri: string; name: string } | undefined;
};
}>;
innovationPacks: Array<{
__typename?: 'InnovationPack';
id: string;
profile: {
__typename?: 'Profile';
id: string;
displayName: string;
url: string;
avatar?: { __typename?: 'Visual'; id: string; uri: string; name: string } | undefined;
};
templatesSet?:
| {
__typename?: 'TemplatesSet';
id: string;
calloutTemplatesCount: number;
communityGuidelinesTemplatesCount: number;
innovationFlowTemplatesCount: number;
postTemplatesCount: number;
whiteboardTemplatesCount: number;
}
| undefined;
}>;
innovationHubs: Array<{
__typename?: 'InnovationHub';
id: string;
spaceVisibilityFilter?: SpaceVisibility | undefined;
subdomain: string;
profile: {
__typename?: 'Profile';
id: string;
displayName: string;
url: string;
banner?: { __typename?: 'Visual'; id: string; uri: string; name: string } | undefined;
avatar?: { __typename?: 'Visual'; id: string; uri: string; name: string } | undefined;
};
spaceListFilter?:
| Array<{
__typename?: 'Space';
id: string;
profile: { __typename?: 'Profile'; id: string; displayName: string };
}>
| undefined;
}>;
}
| undefined;
};
};

export type AccountResourceProfileFragment = {
__typename?: 'Profile';
id: string;
displayName: string;
url: string;
avatar?: { __typename?: 'Visual'; id: string; uri: string; name: string } | undefined;
};

export type DeleteInvitationMutationVariables = Exact<{
invitationId: Scalars['UUID'];
}>;
Expand Down
2 changes: 1 addition & 1 deletion src/core/i18n/en/translation.en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1853,7 +1853,7 @@
"virtualContributors": "Virtual Contributors",
"innovationPacks": "$t(common.innovation-packs)",
"noTemplates": "This Innovation Pack doesn't have any template yet",
"customHomepages": "Your Custom Homepages",
"customHomepages": "Custom Homepages",
"hostTitle": "Host",
"contactsLink": "If you want to change any of these settings, please contact the Alkemio team here.",
"freeTrialNotice": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,60 +77,62 @@ const InnovationPackCardHorizontal = ({
<OneLineMarkdown>{description ?? ''}</OneLineMarkdown>
</Box>
</Box>
<Box display="flex" gap={gutters(0.5)} height={gutters(2)} alignItems="center" justifyContent="start">
{!!calloutTemplatesCount && (
<CardFooterCountWithBadge
iconComponent={DesignServicesIcon}
tooltip={t(`common.enums.templateType.${TemplateType.Callout}_plural`)}
>
<Caption>{calloutTemplatesCount}</Caption>
</CardFooterCountWithBadge>
)}
{!!whiteboardTemplatesCount && (
<CardFooterCountWithBadge
iconComponent={WhiteboardIcon}
tooltip={t(`common.enums.templateType.${TemplateType.Whiteboard}_plural`)}
>
<Caption>{whiteboardTemplatesCount}</Caption>
</CardFooterCountWithBadge>
)}
{!!communityGuidelinesTemplatesCount && (
<CardFooterCountWithBadge
iconComponent={CommunityGuidelinesIcon}
tooltip={t(`common.enums.templateType.${TemplateType.CommunityGuidelines}_plural`)}
>
<Caption>{communityGuidelinesTemplatesCount}</Caption>
</CardFooterCountWithBadge>
)}
{!!postTemplatesCount && (
<CardFooterCountWithBadge
iconComponent={PostIcon}
tooltip={t(`common.enums.templateType.${TemplateType.Post}_plural`)}
>
<Caption>{postTemplatesCount}</Caption>
</CardFooterCountWithBadge>
)}
{!!innovationFlowTemplatesCount && (
<CardFooterCountWithBadge
tooltip={t(`common.enums.templateType.${TemplateType.InnovationFlow}_plural`)}
icon={
// TODO Try to redraw InnovationFlowIcon in the same way as MUI icons are done
<Box
width={theme => theme.spacing(1.5)}
sx={{ svg: { width: '100%' } }}
display="flex"
justifyContent="center"
alignItems="center"
>
<InnovationFlowIcon />
</Box>
}
>
<Caption>{innovationFlowTemplatesCount}</Caption>
</CardFooterCountWithBadge>
)}
{totalTemplatesCount === 0 && <Caption>{t('pages.admin.generic.sections.account.noTemplates')}</Caption>}
</Box>
{totalTemplatesCount > 0 && (
<Box display="flex" gap={gutters(0.5)} height={gutters(2)} alignItems="center" justifyContent="start">
{!!calloutTemplatesCount && (
<CardFooterCountWithBadge
iconComponent={DesignServicesIcon}
tooltip={t(`common.enums.templateType.${TemplateType.Callout}_plural`)}
>
<Caption>{calloutTemplatesCount}</Caption>
</CardFooterCountWithBadge>
)}
{!!whiteboardTemplatesCount && (
<CardFooterCountWithBadge
iconComponent={WhiteboardIcon}
tooltip={t(`common.enums.templateType.${TemplateType.Whiteboard}_plural`)}
>
<Caption>{whiteboardTemplatesCount}</Caption>
</CardFooterCountWithBadge>
)}
{!!communityGuidelinesTemplatesCount && (
<CardFooterCountWithBadge
iconComponent={CommunityGuidelinesIcon}
tooltip={t(`common.enums.templateType.${TemplateType.CommunityGuidelines}_plural`)}
>
<Caption>{communityGuidelinesTemplatesCount}</Caption>
</CardFooterCountWithBadge>
)}
{!!postTemplatesCount && (
<CardFooterCountWithBadge
iconComponent={PostIcon}
tooltip={t(`common.enums.templateType.${TemplateType.Post}_plural`)}
>
<Caption>{postTemplatesCount}</Caption>
</CardFooterCountWithBadge>
)}
{!!innovationFlowTemplatesCount && (
<CardFooterCountWithBadge
tooltip={t(`common.enums.templateType.${TemplateType.InnovationFlow}_plural`)}
icon={
// TODO Try to redraw InnovationFlowIcon in the same way as MUI icons are done
<Box
width={theme => theme.spacing(1.5)}
sx={{ svg: { width: '100%' } }}
display="flex"
justifyContent="center"
alignItems="center"
>
<InnovationFlowIcon />
</Box>
}
>
<Caption>{innovationFlowTemplatesCount}</Caption>
</CardFooterCountWithBadge>
)}
{/* {totalTemplatesCount === 0 && <Caption>{t('pages.admin.generic.sections.account.noTemplates')}</Caption>} */}
</Box>
)}
</BadgeCardView>
);
};
Expand Down
Loading