File tree Expand file tree Collapse file tree 8 files changed +32
-23
lines changed Expand file tree Collapse file tree 8 files changed +32
-23
lines changed Original file line number Diff line number Diff line change 66 :key =" tab.id"
77 :icon =" tab.icon"
88 :icon-badge =" tab.iconBadge"
9- :tooltip =" tab.tooltip + getTabTooltipSuffix(tab)"
9+ :tooltip =" tab.tooltip"
10+ :tooltip-suffix =" getTabTooltipSuffix(tab)"
1011 :selected =" tab.id === selectedTab?.id"
1112 :class =" tab.id + '-tab-button'"
1213 @click =" onTabClick(tab)"
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import PrimeVue from 'primevue/config'
44import OverlayBadge from 'primevue/overlaybadge'
55import Tooltip from 'primevue/tooltip'
66import { describe , expect , it } from 'vitest'
7+ import { createI18n } from 'vue-i18n'
78
89import SidebarIcon from './SidebarIcon.vue'
910
@@ -15,6 +16,14 @@ type SidebarIconProps = {
1516 iconBadge ?: string | ( ( ) => string | null )
1617}
1718
19+ const i18n = createI18n ( {
20+ legacy : false ,
21+ locale : 'en' ,
22+ messages : {
23+ en : { }
24+ }
25+ } )
26+
1827describe ( 'SidebarIcon' , ( ) => {
1928 const exampleProps : SidebarIconProps = {
2029 icon : 'pi pi-cog' ,
@@ -24,7 +33,7 @@ describe('SidebarIcon', () => {
2433 const mountSidebarIcon = ( props : Partial < SidebarIconProps > , options = { } ) => {
2534 return mount ( SidebarIcon , {
2635 global : {
27- plugins : [ PrimeVue ] ,
36+ plugins : [ PrimeVue , i18n ] ,
2837 directives : { tooltip : Tooltip } ,
2938 components : { OverlayBadge, Button }
3039 } ,
Original file line number Diff line number Diff line change 11<template >
22 <Button
3- v-tooltip =" { value: tooltip, showDelay: 300, hideDelay: 300 }"
3+ v-tooltip =" {
4+ value: computedTooltip,
5+ showDelay: 300,
6+ hideDelay: 300
7+ }"
48 text
59 :pt =" {
610 root: {
913 ? 'p-button-primary side-bar-button-selected'
1014 : 'p-button-secondary'
1115 }`,
12- 'aria-label': tooltip
16+ 'aria-label': computedTooltip
1317 }
1418 }"
1519 @click =" emit('click', $event)"
2731import Button from ' primevue/button'
2832import OverlayBadge from ' primevue/overlaybadge'
2933import { computed } from ' vue'
34+ import { useI18n } from ' vue-i18n'
3035
36+ const { t } = useI18n ()
3137const {
3238 icon = ' ' ,
3339 selected = false ,
3440 tooltip = ' ' ,
41+ tooltipSuffix = ' ' ,
3542 iconBadge = ' '
3643} = defineProps <{
3744 icon? : string
3845 selected? : boolean
3946 tooltip? : string
47+ tooltipSuffix? : string
4048 iconBadge? : string | (() => string | null )
4149}>()
4250
@@ -47,6 +55,7 @@ const overlayValue = computed(() =>
4755 typeof iconBadge === ' function' ? iconBadge () ?? ' ' : iconBadge
4856)
4957const shouldShowBadge = computed (() => !! overlayValue .value )
58+ const computedTooltip = computed (() => t (tooltip ) + tooltipSuffix )
5059 </script >
5160
5261<style >
Original file line number Diff line number Diff line change 11import { markRaw } from 'vue'
2- import { useI18n } from 'vue-i18n'
32
43import ModelLibrarySidebarTab from '@/components/sidebar/tabs/ModelLibrarySidebarTab.vue'
54import { useElectronDownloadStore } from '@/stores/electronDownloadStore'
65import type { SidebarTabExtension } from '@/types/extensionTypes'
76import { isElectron } from '@/utils/envUtil'
87
98export const useModelLibrarySidebarTab = ( ) : SidebarTabExtension => {
10- const { t } = useI18n ( )
11-
129 return {
1310 id : 'model-library' ,
1411 icon : 'pi pi-box' ,
15- title : t ( 'sideToolbar.modelLibrary' ) ,
16- tooltip : t ( 'sideToolbar.modelLibrary' ) ,
12+ title : 'sideToolbar.modelLibrary' ,
13+ tooltip : 'sideToolbar.modelLibrary' ,
1714 component : markRaw ( ModelLibrarySidebarTab ) ,
1815 type : 'vue' ,
1916 iconBadge : ( ) => {
Original file line number Diff line number Diff line change 11import { markRaw } from 'vue'
2- import { useI18n } from 'vue-i18n'
32
43import NodeLibrarySidebarTab from '@/components/sidebar/tabs/NodeLibrarySidebarTab.vue'
54import type { SidebarTabExtension } from '@/types/extensionTypes'
65
76export const useNodeLibrarySidebarTab = ( ) : SidebarTabExtension => {
8- const { t } = useI18n ( )
97 return {
108 id : 'node-library' ,
119 icon : 'pi pi-book' ,
12- title : t ( 'sideToolbar.nodeLibrary' ) ,
13- tooltip : t ( 'sideToolbar.nodeLibrary' ) ,
10+ title : 'sideToolbar.nodeLibrary' ,
11+ tooltip : 'sideToolbar.nodeLibrary' ,
1412 component : markRaw ( NodeLibrarySidebarTab ) ,
1513 type : 'vue'
1614 }
Original file line number Diff line number Diff line change 11import { markRaw } from 'vue'
2- import { useI18n } from 'vue-i18n'
32
43import QueueSidebarTab from '@/components/sidebar/tabs/QueueSidebarTab.vue'
54import { useQueuePendingTaskCountStore } from '@/stores/queueStore'
65import type { SidebarTabExtension } from '@/types/extensionTypes'
76
87export const useQueueSidebarTab = ( ) : SidebarTabExtension => {
9- const { t } = useI18n ( )
108 const queuePendingTaskCountStore = useQueuePendingTaskCountStore ( )
119 return {
1210 id : 'queue' ,
@@ -15,8 +13,8 @@ export const useQueueSidebarTab = (): SidebarTabExtension => {
1513 const value = queuePendingTaskCountStore . count . toString ( )
1614 return value === '0' ? null : value
1715 } ,
18- title : t ( 'sideToolbar.queue' ) ,
19- tooltip : t ( 'sideToolbar.queue' ) ,
16+ title : 'sideToolbar.queue' ,
17+ tooltip : 'sideToolbar.queue' ,
2018 component : markRaw ( QueueSidebarTab ) ,
2119 type : 'vue'
2220 }
Original file line number Diff line number Diff line change 11import { markRaw } from 'vue'
2- import { useI18n } from 'vue-i18n'
32
43import WorkflowsSidebarTab from '@/components/sidebar/tabs/WorkflowsSidebarTab.vue'
54import { useSettingStore } from '@/stores/settingStore'
65import { useWorkflowStore } from '@/stores/workflowStore'
76import type { SidebarTabExtension } from '@/types/extensionTypes'
87
98export const useWorkflowsSidebarTab = ( ) : SidebarTabExtension => {
10- const { t } = useI18n ( )
119 const settingStore = useSettingStore ( )
1210 const workflowStore = useWorkflowStore ( )
13-
1411 return {
1512 id : 'workflows' ,
1613 icon : 'pi pi-folder-open' ,
@@ -23,8 +20,8 @@ export const useWorkflowsSidebarTab = (): SidebarTabExtension => {
2320 const value = workflowStore . openWorkflows . length . toString ( )
2421 return value === '0' ? null : value
2522 } ,
26- title : t ( 'sideToolbar.workflows' ) ,
27- tooltip : t ( 'sideToolbar.workflows' ) ,
23+ title : 'sideToolbar.workflows' ,
24+ tooltip : 'sideToolbar.workflows' ,
2825 component : markRaw ( WorkflowsSidebarTab ) ,
2926 type : 'vue'
3027 }
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ export const useSidebarTabStore = defineStore('sidebarTab', () => {
2828 useCommandStore ( ) . registerCommand ( {
2929 id : `Workspace.ToggleSidebarTab.${ tab . id } ` ,
3030 icon : tab . icon ,
31- label : `Toggle ${ tab . title } Sidebar` ,
31+ label : tab . title ,
3232 tooltip : tab . tooltip ,
3333 versionAdded : '1.3.9' ,
3434 function : ( ) => {
You can’t perform that action at this time.
0 commit comments