@@ -10,10 +10,9 @@ import { EmptyState } from './components/EmptyState';
1010import { GlobalSessionItem } from './components/GlobalSessionItem' ;
1111import { IssueItem } from './components/IssueItem' ;
1212import { LoadingState } from './components/LoadingState' ;
13- import { RecentProjects } from './components/RecentProjects' ;
1413import { SessionItem } from './components/SessionItem' ;
1514import { SortDropdown } from './components/SortDropdown' ;
16- import { DashboardState , extractMilestoneFromQuery , IssueData , SessionData , vscode } from './types' ;
15+ import { DashboardState , extractMilestoneFromQuery , IssueData , ProjectData , SessionData , vscode } from './types' ;
1716
1817export function main ( ) {
1918 render ( < Dashboard /> , document . getElementById ( 'app' ) ) ;
@@ -147,20 +146,54 @@ function Dashboard() {
147146 const activeSessions = dashboardState ?. state === 'ready' ? dashboardState . activeSessions : [ ] ;
148147 const recentProjects = isGlobal && dashboardState ?. state === 'ready' ? ( dashboardState as any ) . recentProjects : [ ] ;
149148
149+ // For global dashboards, create a mixed array of sessions and projects
150+ const mixedItems = isGlobal ? ( ( ) => {
151+ const mixed : Array < { type : 'session' , data : SessionData , index : number } | { type : 'project' , data : ProjectData } > = [ ] ;
152+
153+ // Add sessions
154+ activeSessions . forEach ( ( session , index ) => {
155+ mixed . push ( { type : 'session' , data : session , index } ) ;
156+ } ) ;
157+
158+ // Add projects
159+ recentProjects . forEach ( ( project : ProjectData ) => {
160+ mixed . push ( { type : 'project' , data : project } ) ;
161+ } ) ;
162+
163+ function shuffle < T > ( array : T [ ] ) : T [ ] {
164+ for ( let i = array . length - 1 ; i > 0 ; i -- ) {
165+ const j = Math . floor ( Math . random ( ) * ( i + 1 ) ) ;
166+ const tmp = array [ i ] ;
167+ array [ i ] = array [ j ] ;
168+ array [ j ] = tmp ;
169+ }
170+ return array ;
171+ }
172+
173+ shuffle ( mixed ) ;
174+
175+ // Sort by recency - sessions first, then projects, but could be enhanced with actual timestamps
176+ return mixed ;
177+ } ) ( ) : [ ] ;
178+
150179 return (
151180 < div className = { `dashboard-container${ isGlobal ? ' global-dashboard' : '' } ` } >
152- < div className = "dashboard-header" >
153- < h1 className = "dashboard-title" > My Tasks</ h1 >
154- < button className = "refresh-button" onClick = { handleRefresh } disabled = { refreshing } title = "Refresh dashboard" >
155- { refreshing ? (
156- < span className = "codicon codicon-sync codicon-modifier-spin" > </ span >
157- ) : (
158- < span className = "codicon codicon-refresh" > </ span >
159- ) }
160- </ button >
161- </ div >
181+ { ! isGlobal && (
182+ < div className = { `dashboard-header${ isGlobal ? ' global-header' : '' } ` } >
183+ < h1 className = "dashboard-title" >
184+ { isGlobal ? 'Visual Studio Code - Insiders' : 'My Tasks' }
185+ </ h1 >
186+ < button className = "refresh-button" onClick = { handleRefresh } disabled = { refreshing } title = "Refresh dashboard" >
187+ { refreshing ? (
188+ < span className = "codicon codicon-sync codicon-modifier-spin" > </ span >
189+ ) : (
190+ < span className = "codicon codicon-refresh" > </ span >
191+ ) }
192+ </ button >
193+ </ div >
194+ ) }
162195
163- < div className = " dashboard-content" >
196+ < div className = { ` dashboard-content${ isGlobal ? ' global-dashboard' : '' } ` } >
164197 { /* Input Area */ }
165198 < div className = "input-area" >
166199 < h2 className = "area-header" > Start new task</ h2 >
@@ -172,7 +205,7 @@ function Dashboard() {
172205 < div className = "issues-area" >
173206 { isGlobal ? (
174207 < >
175- < RecentProjects projects = { recentProjects } />
208+ { /* Empty for now, everything moved to tasks area */ }
176209 </ >
177210 ) : (
178211 < >
@@ -224,7 +257,7 @@ function Dashboard() {
224257
225258 { /* Tasks Area */ }
226259 < div className = "tasks-area" >
227- < h2 className = "area-header" > Active tasks</ h2 >
260+ < h2 className = "area-header" > { isGlobal ? 'Continue working on...' : ' Active tasks' } </ h2 >
228261 { dashboardState ?. state === 'ready' && (
229262 < div className = "section-count" >
230263 { activeSessions . length || 0 } task{ activeSessions . length !== 1 ? 's' : '' }
@@ -233,29 +266,56 @@ function Dashboard() {
233266 < div className = "area-content" >
234267 { dashboardState ?. state === 'loading' ? (
235268 < LoadingState message = "Loading tasks..." />
236- ) : dashboardState ?. state === 'ready' && ! activeSessions . length ? (
269+ ) : dashboardState ?. state === 'ready' && ! activeSessions . length && ( ! isGlobal || ! recentProjects . length ) ? (
237270 < EmptyState message = "No active tasks found" />
238271 ) : dashboardState ?. state === 'ready' ? (
239- activeSessions . map ( ( session , index ) =>
240- isGlobal ? (
241- < GlobalSessionItem
242- key = { session . id }
243- session = { session }
244- index = { index }
245- onSessionClick = { ( ) => handleSessionClick ( session ) }
246- onPullRequestClick = { handlePullRequestClick }
247- />
272+ < >
273+ { isGlobal ? (
274+ // Render mixed items for global dashboard
275+ mixedItems . map ( ( item ) =>
276+ item . type === 'session' ? (
277+ < GlobalSessionItem
278+ key = { item . data . id }
279+ session = { item . data }
280+ index = { item . index }
281+ onSessionClick = { ( ) => handleSessionClick ( item . data ) }
282+ onPullRequestClick = { handlePullRequestClick }
283+ />
284+ ) : (
285+ < div
286+ key = { `project-${ item . data . path } ` }
287+ className = "session-item project-item"
288+ onClick = { ( ) => vscode . postMessage ( { command : 'open-project' , args : { path : item . data . path } } ) }
289+ title = { `Click to open project: ${ item . data . name } ` }
290+ >
291+ < div className = "item-title" >
292+ < span className = "task-type-indicator project" title = "Recent project" >
293+ < span className = "codicon codicon-folder-opened" > </ span >
294+ </ span >
295+ < span className = "item-title-text" > { item . data . name } </ span >
296+ </ div >
297+ < div className = "item-metadata" >
298+ < div className = "metadata-item" >
299+ < span className = "project-path-text" > { item . data . path } </ span >
300+ </ div >
301+ </ div >
302+ </ div >
303+ )
304+ )
248305 ) : (
249- < SessionItem
250- key = { session . id }
251- session = { session }
252- index = { index }
253- onSessionClick = { ( ) => handleSessionClick ( session ) }
254- onPullRequestClick = { handlePullRequestClick }
255- isHighlighted = { hoveredIssue !== null && isSessionAssociatedWithIssue ( session , hoveredIssue ) }
256- />
257- )
258- )
306+ // Render sessions only for regular dashboard
307+ activeSessions . map ( ( session , index ) => (
308+ < SessionItem
309+ key = { session . id }
310+ session = { session }
311+ index = { index }
312+ onSessionClick = { ( ) => handleSessionClick ( session ) }
313+ onPullRequestClick = { handlePullRequestClick }
314+ isHighlighted = { hoveredIssue !== null && isSessionAssociatedWithIssue ( session , hoveredIssue ) }
315+ />
316+ ) )
317+ ) }
318+ </ >
259319 ) : null }
260320 </ div >
261321 </ div >
0 commit comments