Skip to content
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
51 changes: 34 additions & 17 deletions packages/app/src/app/graphql/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4807,6 +4807,37 @@ export type _SearchTeamSandboxesQuery = {
} | null;
};

export type RecentlyAccessedSandboxFragment = {
__typename?: 'Sandbox';
id: string;
alias: string | null;
title: string | null;
lastAccessedAt: any;
privacy: number;
restricted: boolean;
draft: boolean;
isV2: boolean;
screenshotUrl: string | null;
source: { __typename?: 'Source'; template: string | null };
customTemplate: {
__typename?: 'Template';
id: any | null;
iconUrl: string | null;
} | null;
forkedTemplate: {
__typename?: 'Template';
id: any | null;
color: string | null;
iconUrl: string | null;
} | null;
collection: {
__typename?: 'Collection';
path: string;
id: any | null;
} | null;
author: { __typename?: 'User'; username: string } | null;
};

export type RecentlyAccessedSandboxesLegacyQueryVariables = Exact<{
limit: Scalars['Int'];
teamId: InputMaybe<Scalars['UUID4']>;
Expand All @@ -4822,21 +4853,12 @@ export type RecentlyAccessedSandboxesLegacyQuery = {
id: string;
alias: string | null;
title: string | null;
description: string | null;
lastAccessedAt: any;
insertedAt: string;
updatedAt: string;
removedAt: string | null;
privacy: number;
isFrozen: boolean;
screenshotUrl: string | null;
viewCount: number;
likeCount: number;
isV2: boolean;
draft: boolean;
restricted: boolean;
authorId: any | null;
teamId: any | null;
draft: boolean;
isV2: boolean;
screenshotUrl: string | null;
source: { __typename?: 'Source'; template: string | null };
customTemplate: {
__typename?: 'Template';
Expand All @@ -4855,11 +4877,6 @@ export type RecentlyAccessedSandboxesLegacyQuery = {
id: any | null;
} | null;
author: { __typename?: 'User'; username: string } | null;
permissions: {
__typename?: 'SandboxProtectionSettings';
preventSandboxLeaving: boolean;
preventSandboxExport: boolean;
} | null;
}>;
} | null;
};
Expand Down
53 changes: 40 additions & 13 deletions packages/app/src/app/overmind/effects/gql/dashboard/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ import {
import { gql, Query } from 'overmind-graphql';

import {
sandboxFragmentDashboard,
sidebarCollectionDashboard,
templateFragmentDashboard,
repoFragmentDashboard,
Expand Down Expand Up @@ -355,11 +354,44 @@ export const searchTeamSandboxes: Query<
${SEARCH_TEAM_SANDBOX_FRAGMENT}
`;

/**
* @deprecated This query is being replaced by Apollo queries in the Recent page.
* Will be removed once migration is complete.
* See: packages/app/src/app/pages/Dashboard/Content/routes/Recent/queries.ts
*/
const RECENTLY_ACCESSED_SANDBOX_FRAGMENT = gql`
fragment recentlyAccessedSandbox on Sandbox {
id
alias
title
lastAccessedAt
privacy
restricted
draft
isV2
screenshotUrl

source {
template
}

customTemplate {
id
iconUrl
}

forkedTemplate {
id
color
iconUrl
}

collection {
path
id
}

author {
username
}
}
`;

export const recentlyAccessedSandboxes: Query<
RecentlyAccessedSandboxesLegacyQuery,
RecentlyAccessedSandboxesLegacyQueryVariables
Expand All @@ -369,18 +401,13 @@ export const recentlyAccessedSandboxes: Query<
id

recentlyAccessedSandboxes(limit: $limit, teamId: $teamId) {
...sandboxFragmentDashboard
...recentlyAccessedSandbox
}
}
}
${sandboxFragmentDashboard}
${RECENTLY_ACCESSED_SANDBOX_FRAGMENT}
`;

/**
* @deprecated This query is being replaced by Apollo queries in the Recent page.
* Will be removed once migration is complete.
* See: packages/app/src/app/pages/Dashboard/Content/routes/Recent/queries.ts
*/
export const recentlyAccessedBranches: Query<
RecentlyAccessedBranchesLegacyQuery,
RecentlyAccessedBranchesLegacyQueryVariables
Expand Down
3 changes: 2 additions & 1 deletion packages/app/src/app/overmind/namespaces/dashboard/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
RecentlyDeletedTeamSandboxesFragment,
SearchTeamSandboxFragment,
CollaboratorSandboxFragment,
RecentlyAccessedSandboxFragment,
} from 'app/graphql/types';
import isSameWeek from 'date-fns/isSameWeek';
import { sortBy } from 'lodash-es';
Expand All @@ -23,7 +24,7 @@ export type DashboardSandboxStructure = {
DRAFTS: DraftSandboxFragment[] | null;
TEMPLATES: Template[] | null;
DELETED: RecentlyDeletedTeamSandboxesFragment[] | null;
RECENT_SANDBOXES: (Sandbox | DraftSandboxFragment)[] | null;
RECENT_SANDBOXES: (RecentlyAccessedSandboxFragment | DraftSandboxFragment)[] | null;
RECENT_BRANCHES: Branch[] | null;
SEARCH: (Sandbox | DraftSandboxFragment | SearchTeamSandboxFragment)[] | null;
TEMPLATE_HOME: Template[] | null;
Expand Down
4 changes: 3 additions & 1 deletion packages/app/src/app/overmind/namespaces/dashboard/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ import {
DraftSandboxFragment,
SearchTeamSandboxFragment,
CollaboratorSandboxFragment,
RecentlyAccessedSandboxFragment,
} from 'app/graphql/types';

export type DashboardSandboxFragment =
| SandboxFragmentDashboardFragment
| SandboxByPathFragment
| DraftSandboxFragment
| SearchTeamSandboxFragment
| CollaboratorSandboxFragment;
| CollaboratorSandboxFragment
| RecentlyAccessedSandboxFragment;

export type PageTypes =
| 'search'
Expand Down
4 changes: 3 additions & 1 deletion packages/app/src/app/pages/Dashboard/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
ProjectFragment as Repository,
RecentlyDeletedTeamSandboxesFragment,
DraftSandboxFragment,
RecentlyAccessedSandboxFragment,
} from 'app/graphql/types';
import { Context } from 'app/overmind';
import {
Expand All @@ -29,7 +30,8 @@ export type DashboardSandbox = {
originalGit?: RepoFragmentDashboardFragment['originalGit'];
})
| RecentlyDeletedTeamSandboxesFragment
| DraftSandboxFragment;
| DraftSandboxFragment
| RecentlyAccessedSandboxFragment;
noDrag?: boolean;
};

Expand Down
Loading