@@ -13,6 +13,7 @@ function HomeTabFile({ plugin }: HomeTabFileProps) {
13
13
} > ( {
14
14
recentWorkspaces : [ ] ,
15
15
} )
16
+ const [ loadingWorkspace , setLoadingWorkspace ] = useState < string > ( null )
16
17
const theme = useContext ( ThemeContext )
17
18
const isDark = theme . name === 'dark'
18
19
@@ -60,6 +61,7 @@ function HomeTabFile({ plugin }: HomeTabFileProps) {
60
61
61
62
const handleSwitchToRecentWorkspace = async ( e , workspaceName ) => {
62
63
e . preventDefault ( )
64
+ setLoadingWorkspace ( workspaceName )
63
65
plugin . call ( 'sidePanel' , 'showContent' , 'filePanel' )
64
66
plugin . verticalIcons . select ( 'filePanel' )
65
67
_paq . push ( [ 'trackEvent' , 'hometab' , 'filesSection' , 'loadRecentWorkspace' ] )
@@ -89,6 +91,7 @@ function HomeTabFile({ plugin }: HomeTabFileProps) {
89
91
} else if ( workspaceFiles [ 'README.md' ] && ! workspaceFiles [ 'README.md' ] . isDirectory ) {
90
92
await plugin . call ( 'fileManager' , 'open' , '/README.md' )
91
93
}
94
+ setLoadingWorkspace ( null )
92
95
}
93
96
94
97
return (
@@ -103,7 +106,8 @@ function HomeTabFile({ plugin }: HomeTabFileProps) {
103
106
Array . isArray ( state . recentWorkspaces ) && state . recentWorkspaces . map ( ( workspace , index ) => {
104
107
return index < 3 ? (
105
108
< a className = "cursor-pointer mb-1 text-decoration-none" href = "#" onClick = { ( e ) => handleSwitchToRecentWorkspace ( e , workspace ) } >
106
- < i className = "fas fa-folder-tree mr-2" > </ i > < span style = { { color : isDark ? 'white' : 'black' } } > { workspace } </ span >
109
+ { loadingWorkspace === workspace ? < i className = "fad fa-spinner fa-spin mr-2" > </ i > : < i className = "fas fa-folder-tree mr-2" > </ i > }
110
+ < span style = { { color : isDark ? 'white' : 'black' } } > { workspace } </ span >
107
111
</ a >
108
112
) : null
109
113
} )
0 commit comments