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

Optimize the Contributor Account Tab and VC flow #7444

Merged
merged 8 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 70 additions & 28 deletions src/core/apollo/generated/apollo-hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3732,10 +3732,9 @@ export const ShortAccountItemFragmentDoc = gql`
}
${VisualUriFragmentDoc}
`;
export const VcSelectableSpaceFragmentDoc = gql`
fragment VCSelectableSpace on Space {
export const SpaceProfileCommunityDetailsFragmentDoc = gql`
fragment spaceProfileCommunityDetails on Space {
id
type
profile {
id
displayName
Expand All @@ -3745,10 +3744,6 @@ export const VcSelectableSpaceFragmentDoc = gql`
id
roleSet {
id
authorization {
id
myPrivileges
}
}
}
}
Expand Down Expand Up @@ -5195,19 +5190,6 @@ export const AccountInformationDocument = gql`
}
}
}
subspaces {
id
profile {
...AccountItemProfile
}
type
community {
id
roleSet {
id
}
}
}
}
virtualContributors {
id
Expand Down Expand Up @@ -24385,19 +24367,13 @@ export const NewVirtualContributorMySpacesDocument = gql`
id
myPrivileges
}
...VCSelectableSpace
subspaces {
...VCSelectableSpace
subspaces {
...VCSelectableSpace
}
}
...spaceProfileCommunityDetails
}
}
}
}
}
${VcSelectableSpaceFragmentDoc}
${SpaceProfileCommunityDetailsFragmentDoc}
`;

/**
Expand Down Expand Up @@ -24455,6 +24431,72 @@ export function refetchNewVirtualContributorMySpacesQuery(
return { query: NewVirtualContributorMySpacesDocument, variables: variables };
}

export const AccountSpacesDocument = gql`
query AccountSpaces($accountId: UUID!) {
lookup {
account(ID: $accountId) {
id
spaces {
...spaceProfileCommunityDetails
subspaces {
...spaceProfileCommunityDetails
subspaces {
...spaceProfileCommunityDetails
}
}
}
}
}
}
${SpaceProfileCommunityDetailsFragmentDoc}
`;

/**
* __useAccountSpacesQuery__
*
* To run a query within a React component, call `useAccountSpacesQuery` and pass it any options that fit your needs.
* When your component renders, `useAccountSpacesQuery` 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 } = useAccountSpacesQuery({
* variables: {
* accountId: // value for 'accountId'
* },
* });
*/
export function useAccountSpacesQuery(
baseOptions: Apollo.QueryHookOptions<SchemaTypes.AccountSpacesQuery, SchemaTypes.AccountSpacesQueryVariables>
) {
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useQuery<SchemaTypes.AccountSpacesQuery, SchemaTypes.AccountSpacesQueryVariables>(
AccountSpacesDocument,
options
);
}

export function useAccountSpacesLazyQuery(
baseOptions?: Apollo.LazyQueryHookOptions<SchemaTypes.AccountSpacesQuery, SchemaTypes.AccountSpacesQueryVariables>
) {
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useLazyQuery<SchemaTypes.AccountSpacesQuery, SchemaTypes.AccountSpacesQueryVariables>(
AccountSpacesDocument,
options
);
}

export type AccountSpacesQueryHookResult = ReturnType<typeof useAccountSpacesQuery>;
export type AccountSpacesLazyQueryHookResult = ReturnType<typeof useAccountSpacesLazyQuery>;
export type AccountSpacesQueryResult = Apollo.QueryResult<
SchemaTypes.AccountSpacesQuery,
SchemaTypes.AccountSpacesQueryVariables
>;
export function refetchAccountSpacesQuery(variables: SchemaTypes.AccountSpacesQueryVariables) {
return { query: AccountSpacesDocument, variables: variables };
}

export const RecentSpacesDocument = gql`
query RecentSpaces($limit: Float) {
me {
Expand Down
123 changes: 38 additions & 85 deletions src/core/apollo/generated/graphql-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8528,20 +8528,6 @@ export type AccountInformationQuery = {
| undefined;
};
};
subspaces: Array<{
__typename?: 'Space';
id: string;
type: SpaceType;
profile: {
__typename?: 'Profile';
id: string;
displayName: string;
description?: string | undefined;
url: string;
avatar?: { __typename?: 'Visual'; id: string; uri: string; name: string } | undefined;
};
community: { __typename?: 'Community'; id: string; roleSet: { __typename?: 'RoleSet'; id: string } };
}>;
}>;
virtualContributors: Array<{
__typename?: 'VirtualContributor';
Expand Down Expand Up @@ -31576,7 +31562,6 @@ export type NewVirtualContributorMySpacesQuery = {
spaces: Array<{
__typename?: 'Space';
id: string;
type: SpaceType;
license: {
__typename?: 'License';
id: string;
Expand All @@ -31589,64 +31574,8 @@ export type NewVirtualContributorMySpacesQuery = {
myPrivileges?: Array<AuthorizationPrivilege> | undefined;
}
| undefined;
subspaces: Array<{
__typename?: 'Space';
id: string;
type: SpaceType;
subspaces: Array<{
__typename?: 'Space';
id: string;
type: SpaceType;
profile: { __typename?: 'Profile'; id: string; displayName: string; url: string };
community: {
__typename?: 'Community';
id: string;
roleSet: {
__typename?: 'RoleSet';
id: string;
authorization?:
| {
__typename?: 'Authorization';
id: string;
myPrivileges?: Array<AuthorizationPrivilege> | undefined;
}
| undefined;
};
};
}>;
profile: { __typename?: 'Profile'; id: string; displayName: string; url: string };
community: {
__typename?: 'Community';
id: string;
roleSet: {
__typename?: 'RoleSet';
id: string;
authorization?:
| {
__typename?: 'Authorization';
id: string;
myPrivileges?: Array<AuthorizationPrivilege> | undefined;
}
| undefined;
};
};
}>;
profile: { __typename?: 'Profile'; id: string; displayName: string; url: string };
community: {
__typename?: 'Community';
id: string;
roleSet: {
__typename?: 'RoleSet';
id: string;
authorization?:
| {
__typename?: 'Authorization';
id: string;
myPrivileges?: Array<AuthorizationPrivilege> | undefined;
}
| undefined;
};
};
community: { __typename?: 'Community'; id: string; roleSet: { __typename?: 'RoleSet'; id: string } };
}>;
}
| undefined;
Expand All @@ -31655,22 +31584,46 @@ export type NewVirtualContributorMySpacesQuery = {
};
};

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

export type AccountSpacesQuery = {
__typename?: 'Query';
lookup: {
__typename?: 'LookupQueryResults';
account?:
| {
__typename?: 'Account';
id: string;
spaces: Array<{
__typename?: 'Space';
id: string;
subspaces: Array<{
__typename?: 'Space';
id: string;
subspaces: Array<{
__typename?: 'Space';
id: string;
profile: { __typename?: 'Profile'; id: string; displayName: string; url: string };
community: { __typename?: 'Community'; id: string; roleSet: { __typename?: 'RoleSet'; id: string } };
}>;
profile: { __typename?: 'Profile'; id: string; displayName: string; url: string };
community: { __typename?: 'Community'; id: string; roleSet: { __typename?: 'RoleSet'; id: string } };
}>;
profile: { __typename?: 'Profile'; id: string; displayName: string; url: string };
community: { __typename?: 'Community'; id: string; roleSet: { __typename?: 'RoleSet'; id: string } };
}>;
}
| undefined;
};
};

export type SpaceProfileCommunityDetailsFragment = {
__typename?: 'Space';
id: string;
type: SpaceType;
profile: { __typename?: 'Profile'; id: string; displayName: string; url: string };
community: {
__typename?: 'Community';
id: string;
roleSet: {
__typename?: 'RoleSet';
id: string;
authorization?:
| { __typename?: 'Authorization'; id: string; myPrivileges?: Array<AuthorizationPrivilege> | undefined }
| undefined;
};
};
community: { __typename?: 'Community'; id: string; roleSet: { __typename?: 'RoleSet'; id: string } };
};

export type RecentSpacesQueryVariables = Exact<{
Expand Down
6 changes: 1 addition & 5 deletions src/core/i18n/en/translation.en.json
Original file line number Diff line number Diff line change
Expand Up @@ -3155,8 +3155,7 @@
"externalAI": "External AI"
},
"loadingInfo": {
"subspaceCreation": "A Subspace for adding the knowledge for your Virtual Contributor is being built. This process may take a few moments to complete.",
"spaceAndSubspaceCreation": "A Space and Subspace for adding the knowledge for your Virtual Contributor are being built. This process may take a few moments to complete.",
"vcSpaceCreation": "A Space for interaction with your Virtual Contributor is being built. This process may take a few moments to complete.",
"vcCreation": "Your Virtual Contributor is being created. This process may take a few moments to complete."
},
"cancel": {
Expand Down Expand Up @@ -3237,9 +3236,6 @@
"insufficientPrivileges": {
"title": "Insufficient Privileges",
"description": "You don't have the necessary privileges to complete the creation. Please contact the owners of this account."
},
"errors": {
"spaceNotSelected": "Unable to find selected spaceId"
}
}
}
13 changes: 0 additions & 13 deletions src/domain/account/queries/AccountInformation.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,6 @@ query AccountInformation($accountId: UUID!) {
}
}
}
subspaces {
id
profile {
...AccountItemProfile
}
type
community {
id
roleSet {
id
}
}
}
}
virtualContributors {
id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import {
LicenseEntitlement,
LicenseEntitlementType,
SpaceLevel,
SpaceType,
SpaceVisibility,
} from '@/core/apollo/generated/graphql-schema';
import MenuItemWithIcon from '@/core/ui/menu/MenuItemWithIcon';
Expand Down Expand Up @@ -84,19 +83,6 @@ export interface AccountTabResourcesProps {
id: string;
availableEntitlements?: LicenseEntitlementType[];
};
subspaces: {
id: string;
profile: AccountProfile & {
cardBanner?: { uri: string };
};
community: {
id: string;
roleSet: {
id: string;
};
};
type: SpaceType;
}[];
}[];
virtualContributors: {
id: string;
Expand Down
14 changes: 8 additions & 6 deletions src/main/routing/urlBuilders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@ import { _AUTH_LOGIN_PATH } from '@/core/auth/authentication/constants/authentic
import { EntityPageSection } from '@/domain/shared/layout/EntityPageSection';
import { ROUTE_HOME } from '@/domain/platform/routes/constants';
import { isAbsoluteUrl } from '@/core/utils/links';
import { TopLevelRoutePath } from './TopLevelRoutePath';

export const buildOrganizationUrl = (organizationNameId: string) => `/organization/${organizationNameId}`;

export const buildVirtualContributorUrl = (virtualContributorNameId: string) => `/vc/${virtualContributorNameId}`;

export const buildSettingsUrl = (entityUrl: string) => {
return `${entityUrl}/settings`;
};
Expand Down Expand Up @@ -43,9 +40,6 @@ export const buildAboutUrl = (journeyLocation: string | undefined) => {
return journeyLocation && `${journeyLocation}/about`;
};

export const buildInnovationPackUrl = (innovationPackNameId: string) =>
`/${TopLevelRoutePath.InnovationPacks}/${innovationPackNameId}`;

export const buildInnovationPackSettingsUrl = buildSettingsUrl;

export const buildInnovationHubUrl = (subdomain: string): string => {
Expand Down Expand Up @@ -77,3 +71,11 @@ export const getAccountLink = (profileUrl?: string) => {
};

export const buildWelcomeSpaceUrl = () => '/welcome-space';

export const getSpaceUrlFromSubSpace = (subSpaceUrl: string) => {
const url = new URL(subSpaceUrl, window.location.origin);
const urlSegments = url.pathname.split('/challenges');

url.pathname = urlSegments[0];
return url.href;
};
Loading