diff --git a/components/dashboard/src/workspaces/Workspaces.tsx b/components/dashboard/src/workspaces/Workspaces.tsx index 2ca855c2187b9c..c4920677fc2f92 100644 --- a/components/dashboard/src/workspaces/Workspaces.tsx +++ b/components/dashboard/src/workspaces/Workspaces.tsx @@ -35,7 +35,8 @@ export default function () { const [activeWorkspaces, setActiveWorkspaces] = useState([]); const [inactiveWorkspaces, setInactiveWorkspaces] = useState([]); const [workspaceModel, setWorkspaceModel] = useState(); - const { setIsStartWorkspaceModalVisible } = useContext(StartWorkspaceModalContext); + const [hasWorkspaces, setHasWorkspaces] = useState(false); + const { setIsStartWorkspaceModalVisible, isStartWorkspaceModalVisible } = useContext(StartWorkspaceModalContext); useEffect(() => { (async () => { @@ -44,139 +45,147 @@ export default function () { })(); }, [teams, location]); + useEffect(() => { + setHasWorkspaces(!!activeWorkspaces.length || !!inactiveWorkspaces.length); + }, [activeWorkspaces, inactiveWorkspaces]); + const isOnboardingUser = user && User.isOnboardingUser(user); return ( <>
- {isOnboardingUser && } - - {workspaceModel?.initialized && - (activeWorkspaces.length > 0 || inactiveWorkspaces.length > 0 || workspaceModel.searchTerm ? ( - <> -
-
-
- - - + {workspaceModel?.initialized && ( + <> + {isOnboardingUser && !hasWorkspaces && !isStartWorkspaceModalVisible && } + {hasWorkspaces || workspaceModel?.searchTerm ? ( + <> +
+
+
+ + + +
+ { + if (workspaceModel) workspaceModel.setSearch(v.target.value); + }} + />
- { - if (workspaceModel) workspaceModel.setSearch(v.target.value); - }} - /> -
-
-
-
- { - if (workspaceModel) workspaceModel.limit = 50; +
+
+
+ { + if (workspaceModel) workspaceModel.limit = 50; + }, }, - }, - { - title: "100", - onClick: () => { - if (workspaceModel) workspaceModel.limit = 100; + { + title: "100", + onClick: () => { + if (workspaceModel) workspaceModel.limit = 100; + }, }, - }, - { - title: "200", - onClick: () => { - if (workspaceModel) workspaceModel.limit = 200; + { + title: "200", + onClick: () => { + if (workspaceModel) workspaceModel.limit = 200; + }, }, - }, - ]} - /> -
- -
- -
- {activeWorkspaces.map((e) => { - return ( - getGitpodService().server.stopWorkspace(wsId)} + ]} /> - ); - })} - {activeWorkspaces.length > 0 &&
} - {inactiveWorkspaces.length > 0 && ( -
- Unpinned workspaces that have been inactive for more than 14 days will be - automatically deleted.{" "} - - Learn more -
- )} - {inactiveWorkspaces.map((e) => { - return ( - getGitpodService().server.stopWorkspace(wsId)} - /> - ); - })} -
- - ) : ( -
-
-
- <> -

No Workspaces

-
- Prefix any Git repository URL with {window.location.host}/# or create a new - workspace for a recently used project.{" "} - + +
+ +
+ {activeWorkspaces.map((e) => { + return ( + getGitpodService().server.stopWorkspace(wsId)} + /> + ); + })} + {activeWorkspaces.length > 0 &&
} + {inactiveWorkspaces.length > 0 && ( +
- - - - + )} + {inactiveWorkspaces.map((e) => { + return ( + getGitpodService().server.stopWorkspace(wsId)} + /> + ); + })} + + + ) : ( +
+
+
+ <> +

+ No Workspaces +

+
+ Prefix any Git repository URL with {window.location.host}/# or create a new + workspace for a recently used project.{" "} + + Learn more + +
+ + + + +
-
- ))} + )} + + )} ); }