diff --git a/components/dashboard/src/workspaces/Workspaces.tsx b/components/dashboard/src/workspaces/Workspaces.tsx index 9bf6613fc9f346..96d6c68bbec9a2 100644 --- a/components/dashboard/src/workspaces/Workspaces.tsx +++ b/components/dashboard/src/workspaces/Workspaces.tsx @@ -41,6 +41,7 @@ import { VideoCarousel } from "./VideoCarousel"; import { WorkspaceEntry } from "./WorkspaceEntry"; import { WorkspacesSearchBar } from "./WorkspacesSearchBar"; import { useInstallationConfiguration } from "../data/installation/installation-config-query"; +import { SkeletonBlock } from "@podkit/loading/Skeleton"; export const GETTING_STARTED_DISMISSAL_KEY = "workspace-list-getting-started"; @@ -133,8 +134,10 @@ const WorkspacesPage: FunctionComponent = () => { } }, [user?.profile?.coachmarksDismissals]); - const { data: userSuggestedRepos } = useSuggestedRepositories({ excludeConfigurations: false }); - const { data: orgSuggestedRepos } = useOrgSuggestedRepos(); + const { data: userSuggestedRepos, isLoading: isUserSuggestedReposLoading } = useSuggestedRepositories({ + excludeConfigurations: false, + }); + const { data: orgSuggestedRepos, isLoading: isOrgSuggestedReposLoading } = useOrgSuggestedRepos(); const suggestedRepos = useMemo(() => { const userSuggestions = @@ -151,7 +154,9 @@ const WorkspacesPage: FunctionComponent = () => { }); return [...userSuggestions, ...orgSuggestions].slice(0, 3); - }, [userSuggestedRepos, user, orgSuggestedRepos]); + }, [userSuggestedRepos, orgSuggestedRepos, user?.workspaceAutostartOptions]); + + const suggestedReposLoading = isUserSuggestedReposLoading || isOrgSuggestedReposLoading; const toggleGettingStarted = useCallback( (show: boolean) => { @@ -264,225 +269,259 @@ const WorkspacesPage: FunctionComponent = () => { - {suggestedRepos.length > 0 && ( - <> - - Suggested - - -
- {suggestedRepos.map((repo) => { - const isOrgSuggested = - (repo as SuggestedOrgRepository).orgSuggested ?? false; - - return ( + <> + + Suggested + + +
+ {suggestedReposLoading ? ( + <> + + + + + ) : ( + <> + {suggestedRepos.map((repo) => { + const isOrgSuggested = + (repo as SuggestedOrgRepository).orgSuggested ?? false; + + return ( + +
+ + + {repo.configurationName || repo.repoName} + + {isOrgSuggested && ( + + Recommended + + )} + + + {repo.url} + +
+
+ ); + })} + {suggestedRepos.length === 0 && (
- {repo.configurationName || repo.repoName} + No suggestions yet - {isOrgSuggested && ( - - Recommended - - )} - {repo.url} + Start some workspaces to start seeing suggestions here.
- ); - })} + )} + + )} +
+ + + + Demo video + +
+
- - )} +
+ + + +
)} - - Demo video - -
- -
-
- - - -
- - )} - {deleteModalVisible && ( - setDeleteModalVisible(false)} - onConfirm={handleDeleteInactiveWorkspacesConfirmation} - visible - /> - )} + {deleteModalVisible && ( + setDeleteModalVisible(false)} + onConfirm={handleDeleteInactiveWorkspacesConfirmation} + visible + /> + )} - {!isLoading && - (activeWorkspaces.length > 0 || inactiveWorkspaces.length > 0 || searchTerm ? ( - <> -
-
- - -
- {filteredActiveWorkspaces.map((info) => { - return ; - })} - {filteredActiveWorkspaces.length > 0 &&
} - {filteredInactiveWorkspaces.length > 0 && ( -
-
setShowInactive(!showInactive)} - className="flex cursor-pointer p-6 flex-row bg-pk-surface-secondary hover:bg-pk-surface-tertiary text-pk-content-tertiary rounded-xl mb-2" - > -
- -
-
-
- Inactive Workspaces  - - {filteredInactiveWorkspaces.length} - -
-
- Workspaces that have been stopped for more than 24 hours. - Inactive workspaces are automatically deleted after 14 days.{" "} - evt.stopPropagation()} - > - Learn more - + {!isLoading && + (activeWorkspaces.length > 0 || inactiveWorkspaces.length > 0 || searchTerm ? ( + <> +
+
+ + +
+ {filteredActiveWorkspaces.map((info) => { + return ; + })} + {filteredActiveWorkspaces.length > 0 &&
} + {filteredInactiveWorkspaces.length > 0 && ( +
+
setShowInactive(!showInactive)} + className="flex cursor-pointer p-6 flex-row bg-pk-surface-secondary hover:bg-pk-surface-tertiary text-pk-content-tertiary rounded-xl mb-2" + > +
+ +
+
+
+ Inactive Workspaces  + + {filteredInactiveWorkspaces.length} + +
+
+ Workspaces that have been stopped for more than 24 + hours. Inactive workspaces are automatically deleted + after 14 days.{" "} + evt.stopPropagation()} + > + Learn more + +
+
+
+ {showInactive ? ( + + ) : null} +
-
-
{showInactive ? ( - + <> + {filteredInactiveWorkspaces.map((info) => { + return ; + })} + ) : null}
+ )} +
+
+ {/* Show Educational if user is in gitpodIo */} + {!isDedicatedInstallation && ( +
+ + - {showInactive ? ( - <> - {filteredInactiveWorkspaces.map((info) => { - return ; - })} - - ) : null} + +
)} - -
- {/* Show Educational if user is in gitpodIo */} - {!isDedicatedInstallation && ( - - )} -
- - ) : ( - - ))} - - {isEnterpriseOnboardingEnabled && isDedicatedInstallation && welcomeMessage && user && ( - + + ) : ( + + ))} + + {isEnterpriseOnboardingEnabled && isDedicatedInstallation && welcomeMessage && user && ( + + )} + )} );