Skip to content

Commit f62891a

Browse files
committed
feat: expand inspector tabs if enough space
1 parent 2ee2f79 commit f62891a

File tree

1 file changed

+50
-16
lines changed

1 file changed

+50
-16
lines changed

packages/app-frontend/src/features/header/AppHeader.vue

+50-16
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { useBridge } from '@front/features/bridge'
1313
import { useInspectors } from '@front/features/inspector/custom/composable'
1414
import { useTabs } from './tabs'
1515
import { showAppsSelector } from './header'
16+
import { useOrientation } from '../layout/orientation'
1617
1718
export default defineComponent({
1819
components: {
@@ -65,11 +66,16 @@ export default defineComponent({
6566
immediate: true,
6667
})
6768
69+
// Orientation
70+
71+
const { orientation } = useOrientation()
72+
6873
return {
6974
inspectorRoutes,
7075
currentInspectorRoute,
7176
lastInspectorRoute,
7277
showAppsSelector,
78+
orientation,
7379
}
7480
},
7581
})
@@ -95,22 +101,50 @@ export default defineComponent({
95101
<template v-if="currentInspectorRoute">
96102
<img src="~@front/assets/breadcrumb-separator.svg">
97103

98-
<AppHeaderSelect
99-
:items="inspectorRoutes"
100-
:selected-item="currentInspectorRoute"
101-
@select="route => $router.push(route.targetRoute)"
102-
>
103-
<template #default="{ item }">
104-
<div class="flex items-center space-x-2">
105-
<span class="flex-1">{{ item.label }}</span>
106-
<PluginSourceIcon
107-
v-if="item.pluginId"
108-
:plugin-id="item.pluginId"
109-
class="flex-none"
110-
/>
111-
</div>
112-
</template>
113-
</AppHeaderSelect>
104+
<template v-if="orientation === 'portrait' || inspectorRoutes.length * 200 > $responsive.width - 420">
105+
<AppHeaderSelect
106+
:items="inspectorRoutes"
107+
:selected-item="currentInspectorRoute"
108+
@select="route => $router.push(route.targetRoute)"
109+
>
110+
<template #default="{ item }">
111+
<div class="flex items-center space-x-2">
112+
<span class="flex-1">{{ item.label }}</span>
113+
<PluginSourceIcon
114+
v-if="item.pluginId"
115+
:plugin-id="item.pluginId"
116+
class="flex-none"
117+
/>
118+
</div>
119+
</template>
120+
</AppHeaderSelect>
121+
</template>
122+
123+
<template v-else>
124+
<VueGroup
125+
:value="currentInspectorRoute"
126+
class="primary"
127+
indicator
128+
@update="route => $router.push(route.targetRoute)"
129+
>
130+
<VueGroupButton
131+
v-for="item of inspectorRoutes"
132+
:key="item.id"
133+
:value="item"
134+
:icon-left="item.icon"
135+
class="flat"
136+
>
137+
<div class="flex items-center space-x-2">
138+
<span class="flex-1">{{ item.label }}</span>
139+
<PluginSourceIcon
140+
v-if="item.pluginId"
141+
:plugin-id="item.pluginId"
142+
class="flex-none"
143+
/>
144+
</div>
145+
</VueGroupButton>
146+
</VueGroup>
147+
</template>
114148
</template>
115149

116150
<div class="flex-1" />

0 commit comments

Comments
 (0)