Skip to content

Commit d5b4d60

Browse files
committed
feat: remove plugin icon from header tabs
1 parent 808861c commit d5b4d60

File tree

3 files changed

+94
-55
lines changed

3 files changed

+94
-55
lines changed

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

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<script lang="ts">
2-
import PluginSourceIcon from '@front/features/plugin/PluginSourceIcon.vue'
32
import AppHeaderLogo from './AppHeaderLogo.vue'
43
import AppHistoryNav from './AppHistoryNav.vue'
54
import AppSelect from '../apps/AppSelect.vue'
65
import AppHeaderSelect from './AppHeaderSelect.vue'
6+
import PluginSourceIcon from '@front/features/plugin/PluginSourceIcon.vue'
7+
import PluginSourceDescription from '../plugin/PluginSourceDescription.vue'
78
89
import { computed, ref, watch, defineComponent } from 'vue'
910
import type { RawLocation, Route } from 'vue-router'
@@ -30,6 +31,7 @@ export default defineComponent({
3031
AppSelect,
3132
AppHeaderSelect,
3233
PluginSourceIcon,
34+
PluginSourceDescription,
3335
},
3436
3537
setup () {
@@ -132,22 +134,26 @@ export default defineComponent({
132134
indicator
133135
@update="route => $router.push(route.targetRoute)"
134136
>
135-
<VueGroupButton
137+
<VTooltip
136138
v-for="(item, index) of headerRoutes"
137139
:key="index"
138-
:value="item"
139-
:icon-left="item.icon"
140-
class="flat"
140+
:disabled="!item.pluginId"
141+
class="leading-none"
141142
>
142-
<div class="flex items-center space-x-2">
143-
<span class="flex-1">{{ item.label }}</span>
144-
<PluginSourceIcon
145-
v-if="item.pluginId"
143+
<VueGroupButton
144+
:value="item"
145+
:icon-left="item.icon"
146+
class="flat"
147+
>
148+
{{ item.label }}
149+
</VueGroupButton>
150+
151+
<template #popper>
152+
<PluginSourceDescription
146153
:plugin-id="item.pluginId"
147-
class="flex-none"
148154
/>
149-
</div>
150-
</VueGroupButton>
155+
</template>
156+
</VTooltip>
151157
</VueGroup>
152158
</template>
153159

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<script lang="ts">
2+
import { computed, defineComponent } from 'vue'
3+
import { useRouter } from '@front/util/router'
4+
import { usePlugins } from '.'
5+
6+
export default defineComponent({
7+
props: {
8+
pluginId: {
9+
type: String,
10+
required: true,
11+
},
12+
},
13+
14+
setup (props) {
15+
const {
16+
plugins,
17+
} = usePlugins()
18+
19+
const plugin = computed(() => plugins.value.find(p => p.id === props.pluginId))
20+
21+
const router = useRouter()
22+
function go () {
23+
router.push({
24+
name: 'plugin-details',
25+
params: {
26+
pluginId: props.pluginId,
27+
},
28+
})
29+
}
30+
31+
return {
32+
plugin,
33+
go,
34+
}
35+
},
36+
})
37+
</script>
38+
39+
<template>
40+
<div
41+
v-if="plugin"
42+
class="flex space-x-3 items-center"
43+
>
44+
<div class="flex items-center justify-center w-8 h-8 bg-gray-700 dark:bg-gray-200 rounded">
45+
<img
46+
v-if="plugin.logo"
47+
:src="plugin.logo"
48+
alt="Plugin logo"
49+
class="max-w-[24px] max-h-[24px]"
50+
>
51+
<VueIcon
52+
v-else
53+
icon="extension"
54+
/>
55+
</div>
56+
<div>
57+
<div>Provided by <b>{{ plugin ? plugin.label : pluginId }}</b></div>
58+
<div
59+
v-if="plugin"
60+
class="opacity-50"
61+
>
62+
<div>Plugin ID: {{ plugin.id }}</div>
63+
</div>
64+
</div>
65+
</div>
66+
</template>
Lines changed: 10 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
<script lang="ts">
2-
import { computed, defineComponent } from 'vue'
2+
import { defineComponent } from 'vue'
33
import { useRouter } from '@front/util/router'
4-
import { usePlugins } from '.'
4+
import PluginSourceDescription from './PluginSourceDescription.vue'
55
66
export default defineComponent({
7+
components: {
8+
PluginSourceDescription,
9+
},
10+
711
props: {
812
pluginId: {
913
type: String,
@@ -12,12 +16,6 @@ export default defineComponent({
1216
},
1317
1418
setup (props) {
15-
const {
16-
plugins,
17-
} = usePlugins()
18-
19-
const plugin = computed(() => plugins.value.find(p => p.id === props.pluginId))
20-
2119
const router = useRouter()
2220
function go () {
2321
router.push({
@@ -29,7 +27,6 @@ export default defineComponent({
2927
}
3028
3129
return {
32-
plugin,
3330
go,
3431
}
3532
},
@@ -46,40 +43,10 @@ export default defineComponent({
4643
@click.stop="go()"
4744
/>
4845

49-
<template
50-
v-if="plugin"
51-
#popper
52-
>
53-
<div class="flex space-x-3 items-center">
54-
<div class="flex items-center justify-center w-8 h-8 bg-gray-700 dark:bg-gray-200 rounded">
55-
<img
56-
v-if="plugin.logo"
57-
:src="plugin.logo"
58-
alt="Plugin logo"
59-
class="logo"
60-
>
61-
<VueIcon
62-
v-else
63-
icon="extension"
64-
/>
65-
</div>
66-
<div>
67-
<div>Provided by <b>{{ plugin ? plugin.label : pluginId }}</b></div>
68-
<div
69-
v-if="plugin"
70-
class="opacity-50"
71-
>
72-
<div>ID: {{ plugin.id }}</div>
73-
</div>
74-
</div>
75-
</div>
46+
<template #popper>
47+
<PluginSourceDescription
48+
:plugin-id="pluginId"
49+
/>
7650
</template>
7751
</VTooltip>
7852
</template>
79-
80-
<style lang="postcss" scoped>
81-
.logo {
82-
max-width: 24px;
83-
max-height: 24px;
84-
}
85-
</style>

0 commit comments

Comments
 (0)