@@ -4,7 +4,6 @@ import AppHeaderLogo from './AppHeaderLogo.vue'
4
4
import AppHistoryNav from ' ./AppHistoryNav.vue'
5
5
import AppSelect from ' ../apps/AppSelect.vue'
6
6
import AppHeaderSelect from ' ./AppHeaderSelect.vue'
7
- import AppMainMenu from ' ./AppMainMenu.vue'
8
7
9
8
import { computed , ref , watch , defineComponent } from ' vue'
10
9
import type { RawLocation , Route } from ' vue-router'
@@ -16,7 +15,7 @@ import { useTabs } from './tabs'
16
15
import { showAppsSelector } from ' ./header'
17
16
import { useOrientation } from ' ../layout/orientation'
18
17
19
- interface InspectorRoute {
18
+ interface HeaderRoute {
20
19
icon: string
21
20
label: string
22
21
targetRoute: RawLocation
@@ -30,7 +29,6 @@ export default defineComponent({
30
29
AppHistoryNav ,
31
30
AppSelect ,
32
31
AppHeaderSelect ,
33
- AppMainMenu ,
34
32
PluginSourceIcon ,
35
33
},
36
34
@@ -41,27 +39,33 @@ export default defineComponent({
41
39
42
40
const { inspectors : customInspectors } = useInspectors ()
43
41
44
- const inspectorRoutes = computed (() => ([
42
+ const headerRoutes = computed (() => ([
45
43
{
46
44
icon: ' device_hub' ,
47
45
label: ' Components' ,
48
46
targetRoute: { name: ' inspector-components' },
49
47
matchRoute : route => route .matched .some (m => m .name === ' inspector-components' ),
50
48
},
51
- ] as InspectorRoute []).concat (customInspectors .value .map (i => ({
49
+ {
50
+ icon: ' line_style' ,
51
+ label: ' Timeline' ,
52
+ targetRoute: { name: ' timeline' },
53
+ matchRoute : route => route .matched .some (m => m .name === ' timeline' ),
54
+ },
55
+ ] as HeaderRoute []).concat (customInspectors .value .map (i => ({
52
56
icon: i .icon || ' tab' ,
53
57
label: i .label ,
54
58
pluginId: i .pluginId ,
55
59
targetRoute: { name: ' custom-inspector' , params: { inspectorId: i .id } },
56
60
matchRoute : route => route .params .inspectorId === i .id ,
57
61
}))))
58
62
59
- const currentInspectorRoute = computed (() => inspectorRoutes .value .find (r => r .matchRoute (route .value )))
63
+ const currentHeaderRoute = computed (() => headerRoutes .value .find (r => r .matchRoute (route .value )))
60
64
61
- const lastInspectorRoute = ref (null )
62
- watch (currentInspectorRoute , value => {
65
+ const lastHeaderRoute = ref (null )
66
+ watch (currentHeaderRoute , value => {
63
67
if (value ) {
64
- lastInspectorRoute .value = value
68
+ lastHeaderRoute .value = value
65
69
}
66
70
})
67
71
@@ -80,9 +84,9 @@ export default defineComponent({
80
84
const { orientation } = useOrientation ()
81
85
82
86
return {
83
- inspectorRoutes ,
84
- currentInspectorRoute ,
85
- lastInspectorRoute ,
87
+ headerRoutes ,
88
+ currentHeaderRoute ,
89
+ lastHeaderRoute ,
86
90
showAppsSelector ,
87
91
orientation ,
88
92
}
@@ -102,58 +106,49 @@ export default defineComponent({
102
106
<img src =" ~@front/assets/breadcrumb-separator.svg" >
103
107
</template >
104
108
105
- <AppMainMenu
106
- :last-inspector-route =" lastInspectorRoute"
107
- :label-shown =" !showAppsSelector && inspectorRoutes.length * 200 < $responsive.width - 420"
108
- />
109
-
110
- <template v-if =" currentInspectorRoute " >
111
- <img src =" ~@front/assets/breadcrumb-separator.svg" >
109
+ <template v-if =" orientation === ' portrait' || headerRoutes .length * 200 > $responsive .width - 250 " >
110
+ <AppHeaderSelect
111
+ :items =" headerRoutes"
112
+ :selected-item =" currentHeaderRoute"
113
+ @select =" route => $router.push(route.targetRoute)"
114
+ >
115
+ <template #default =" { item } " >
116
+ <div class =" flex items-center space-x-2" >
117
+ <span class =" flex-1" >{{ item.label }}</span >
118
+ <PluginSourceIcon
119
+ v-if =" item.pluginId"
120
+ :plugin-id =" item.pluginId"
121
+ class =" flex-none"
122
+ />
123
+ </div >
124
+ </template >
125
+ </AppHeaderSelect >
126
+ </template >
112
127
113
- <template v-if =" orientation === ' portrait' || inspectorRoutes .length * 200 > $responsive .width - 420 " >
114
- <AppHeaderSelect
115
- :items =" inspectorRoutes"
116
- :selected-item =" currentInspectorRoute"
117
- @select =" route => $router.push(route.targetRoute)"
118
- >
119
- <template #default =" { item } " >
120
- <div class =" flex items-center space-x-2" >
121
- <span class =" flex-1" >{{ item.label }}</span >
122
- <PluginSourceIcon
123
- v-if =" item.pluginId"
124
- :plugin-id =" item.pluginId"
125
- class =" flex-none"
126
- />
127
- </div >
128
- </template >
129
- </AppHeaderSelect >
130
- </template >
131
-
132
- <template v-else >
133
- <VueGroup
134
- :value =" currentInspectorRoute"
135
- class =" primary"
136
- indicator
137
- @update =" route => $router.push(route.targetRoute)"
128
+ <template v-else >
129
+ <VueGroup
130
+ :value =" currentHeaderRoute"
131
+ class =" primary"
132
+ indicator
133
+ @update =" route => $router.push(route.targetRoute)"
134
+ >
135
+ <VueGroupButton
136
+ v-for =" (item, index) of headerRoutes"
137
+ :key =" index"
138
+ :value =" item"
139
+ :icon-left =" item.icon"
140
+ class =" flat"
138
141
>
139
- <VueGroupButton
140
- v-for =" (item, index) of inspectorRoutes"
141
- :key =" index"
142
- :value =" item"
143
- :icon-left =" item.icon"
144
- class =" flat"
145
- >
146
- <div class =" flex items-center space-x-2" >
147
- <span class =" flex-1" >{{ item.label }}</span >
148
- <PluginSourceIcon
149
- v-if =" item.pluginId"
150
- :plugin-id =" item.pluginId"
151
- class =" flex-none"
152
- />
153
- </div >
154
- </VueGroupButton >
155
- </VueGroup >
156
- </template >
142
+ <div class =" flex items-center space-x-2" >
143
+ <span class =" flex-1" >{{ item.label }}</span >
144
+ <PluginSourceIcon
145
+ v-if =" item.pluginId"
146
+ :plugin-id =" item.pluginId"
147
+ class =" flex-none"
148
+ />
149
+ </div >
150
+ </VueGroupButton >
151
+ </VueGroup >
157
152
</template >
158
153
159
154
<div class =" flex-1" />
0 commit comments