File tree Expand file tree Collapse file tree 5 files changed +37
-0
lines changed Expand file tree Collapse file tree 5 files changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -383,6 +383,11 @@ async function open (id, context) {
383
383
// Load plugins
384
384
plugins . list ( project . path , context )
385
385
386
+ // Date
387
+ context . db . get ( 'projects' ) . find ( { id } ) . assign ( {
388
+ openDate : Date . now ( )
389
+ } ) . write ( )
390
+
386
391
// Save for next time
387
392
context . db . set ( 'config.lastOpenProject' , id ) . write ( )
388
393
Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ type Project {
33
33
plugins: [Plugin]
34
34
tasks: [Task]
35
35
homepage: String
36
+ openDate: JSON
36
37
}
37
38
38
39
enum ProjectType {
Original file line number Diff line number Diff line change 163
163
"top-bar" : {
164
164
"no-favorites" : " No favorite projects" ,
165
165
"favorite-projects" : " Favorite projects" ,
166
+ "recent-projects" : " Recent projects" ,
166
167
"homepage" : " Home page"
167
168
},
168
169
"view-badge" : {
Original file line number Diff line number Diff line change 7
7
icon-right =" arrow_drop_down"
8
8
button-class =" flat round"
9
9
>
10
+ <!-- Current project options -->
11
+
10
12
<template v-if =" projectCurrent " >
11
13
<VueSwitch
12
14
:value =" projectCurrent.favorite"
34
36
35
37
<div class =" dropdown-separator" />
36
38
39
+ <!-- Favorites -->
40
+
37
41
<div v-if =" !favoriteProjects.length" class =" vue-ui-empty" >{{ $t('org.vue.components.top-bar.no-favorites') }}</div >
38
42
39
43
<template v-else >
50
54
/>
51
55
</template >
52
56
57
+ <!-- Recents -->
58
+
59
+ <template v-if =" recentProjects .length " >
60
+ <div class =" dropdown-separator" />
61
+
62
+ <div class =" section-title" >
63
+ {{ $t('org.vue.components.top-bar.recent-projects') }}
64
+ </div >
65
+
66
+ <VueDropdownButton
67
+ v-for =" project of recentProjects"
68
+ :key =" project.id"
69
+ :label =" project.name"
70
+ icon-left =" restore"
71
+ @click =" openProject(project)"
72
+ />
73
+ </template >
74
+
53
75
<div class =" dropdown-separator" />
54
76
55
77
<VueDropdownButton
@@ -92,6 +114,13 @@ export default {
92
114
return this .projects .filter (
93
115
p => p .favorite && (! this .projectCurrent || this .projectCurrent .id !== p .id )
94
116
)
117
+ },
118
+
119
+ recentProjects () {
120
+ if (! this .projects ) return []
121
+ return this .projects .filter (
122
+ p => ! p .favorite && (! this .projectCurrent || this .projectCurrent .id !== p .id )
123
+ ).sort ((a , b ) => b .openDate - a .openDate ).slice (0 , 3 )
95
124
}
96
125
},
97
126
Original file line number Diff line number Diff line change @@ -5,4 +5,5 @@ fragment project on Project {
5
5
path
6
6
favorite
7
7
homepage
8
+ openDate
8
9
}
You can’t perform that action at this time.
0 commit comments