@@ -37,6 +37,8 @@ import { useUpdateCurrentUserMutation } from "../data/current-user/update-mutati
3737import { useUserLoader } from "../hooks/use-user-loader" ;
3838import Tooltip from "../components/Tooltip" ;
3939import { useFeatureFlag } from "../data/featureflag-query" ;
40+ import { useSuggestedRepositories } from "../data/git-providers/suggested-repositories-query" ;
41+ import PillLabel from "../components/PillLabel" ;
4042
4143export const GETTING_STARTED_DISMISSAL_KEY = "workspace-list-getting-started" ;
4244
@@ -129,6 +131,21 @@ const WorkspacesPage: FunctionComponent = () => {
129131 }
130132 } , [ user ?. profile ?. coachmarksDismissals ] ) ;
131133
134+ const { data : suggestedRepos } = useSuggestedRepositories ( { excludeConfigurations : false } ) ;
135+
136+ const recentRepos = useMemo ( ( ) => {
137+ return (
138+ suggestedRepos
139+ ?. filter ( ( repo ) => {
140+ const autostartMatch = user ?. workspaceAutostartOptions . find ( ( option ) => {
141+ return option . cloneUrl . includes ( repo . url ) ;
142+ } ) ;
143+ return autostartMatch ;
144+ } )
145+ . slice ( 0 , 3 ) ?? [ ]
146+ ) ;
147+ } , [ suggestedRepos , user ] ) ;
148+
132149 const toggleGettingStarted = useCallback (
133150 ( show : boolean ) => {
134151 setShowGettingStarted ( show ) ;
@@ -169,29 +186,29 @@ const WorkspacesPage: FunctionComponent = () => {
169186
170187 { isEnterpriseOnboardingEnabled && isDedicatedInstallation && (
171188 < >
172- < div className = "app-container flex flex-row items-center justify-between mt-4 mb-2" >
173- < div className = "flex flex-row items-center gap-2" >
174- < Tooltip content = "Toggle helpful resources for getting started with Gitpod" >
175- < Button
176- variant = "ghost"
177- onClick = { ( ) => toggleGettingStarted ( ! showGettingStarted ) }
178- className = "p-2"
179- >
189+ < div className = "app-container flex flex-row items-center justify-end mt-4 mb-2" >
190+ < Tooltip content = "Toggle helpful resources for getting started with Gitpod" >
191+ < Button
192+ variant = "ghost"
193+ onClick = { ( ) => toggleGettingStarted ( ! showGettingStarted ) }
194+ className = "p-2"
195+ >
196+ < div className = "flex flex-row justify-end items-center gap-2" >
197+ < Subheading className = "text-pk-content-primary" > Getting started</ Subheading >
198+
180199 < ChevronRight
181200 className = { `text-gray-400 dark:text-gray-500 transform transition-transform duration-100 ${
182201 showGettingStarted ? "rotate-90" : ""
183202 } `}
184- size = { 24 }
203+ size = { 20 }
185204 />
186- </ Button >
187- </ Tooltip >
188-
189- < Subheading className = "font-semibold text-pk-content-primary" > Getting started</ Subheading >
190- </ div >
205+ </ div >
206+ </ Button >
207+ </ Tooltip >
191208 </ div >
192209
193210 { showGettingStarted && (
194- < div className = "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-5 lg:px-28 px-4" >
211+ < div className = "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-5 lg:px-28 px-4 pb-4 " >
195212 < Card onClick = { ( ) => setVideoModalVisible ( true ) } >
196213 < GraduationCap className = "flex-shrink-0" size = { 24 } />
197214 < div className = "min-w-0" >
@@ -236,6 +253,61 @@ const WorkspacesPage: FunctionComponent = () => {
236253 </ div >
237254 ) }
238255
256+ { ( recentRepos . length || 1 ) > 0 && (
257+ < >
258+ < Subheading className = "font-semibold text-pk-content-primary mb-2 app-container" >
259+ Suggested
260+ </ Subheading >
261+
262+ < div className = "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 lg:px-28 px-4" >
263+ { [
264+ ...recentRepos ,
265+ // todo: add org-selected repos
266+ {
267+ url : "https://github.com/filiptronicek/test" ,
268+ configurationName : "Test" ,
269+ repoName : "test" ,
270+ } ,
271+ {
272+ url : "https://github.com/filiptronicek/test" ,
273+ configurationName : "Test" ,
274+ repoName : "test" ,
275+ } ,
276+ {
277+ url : "https://github.com/filiptronicek/test" ,
278+ configurationName : "Test" ,
279+ repoName : "test" ,
280+ } ,
281+ ]
282+ . slice ( 0 , 3 )
283+ . map ( ( repo ) => (
284+ < Card
285+ key = { repo . url }
286+ href = { `/new#${ repo . url } ` }
287+ className = "border-[#D79A45] border hover:bg-pk-surface-tertiary transition-colors w-full"
288+ >
289+ < div className = "min-w-0 w-full space-y-1.5" >
290+ < CardTitle className = "flex flex-row items-center gap-2 w-full" >
291+ < span className = "truncate block min-w-0 text-base" >
292+ { repo . configurationName || repo . repoName }
293+ </ span >
294+ < PillLabel
295+ className = "capitalize bg-kumquat-light shrink-0 text-sm"
296+ type = "warn"
297+ >
298+ Recommended
299+ </ PillLabel >
300+ </ CardTitle >
301+ < CardDescription className = "truncate text-sm opacity-75" >
302+ { repo . url }
303+ </ CardDescription >
304+ </ div >
305+ </ Card >
306+ ) ) }
307+ </ div >
308+ </ >
309+ ) }
310+
239311 < Modal
240312 visible = { isVideoModalVisible }
241313 onClose = { handleVideoModalClose }
0 commit comments