mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 06:20:11 +00:00
* feat: Adding download count badge to sidebar * Fixing lint * Updating electronDownloadStore to handle missing DownloadManager * PR comments --------- Co-authored-by: Oto Ciulis <oto.ciulis@gmail.com>
30 lines
936 B
TypeScript
30 lines
936 B
TypeScript
import { markRaw } from 'vue'
|
|
import { useI18n } from 'vue-i18n'
|
|
import ModelLibrarySidebarTab from '@/components/sidebar/tabs/ModelLibrarySidebarTab.vue'
|
|
import type { SidebarTabExtension } from '@/types/extensionTypes'
|
|
import { useElectronDownloadStore } from '@/stores/electronDownloadStore'
|
|
import { isElectron } from '@/utils/envUtil'
|
|
|
|
export const useModelLibrarySidebarTab = (): SidebarTabExtension => {
|
|
const { t } = useI18n()
|
|
|
|
return {
|
|
id: 'model-library',
|
|
icon: 'pi pi-box',
|
|
title: t('sideToolbar.modelLibrary'),
|
|
tooltip: t('sideToolbar.modelLibrary'),
|
|
component: markRaw(ModelLibrarySidebarTab),
|
|
type: 'vue',
|
|
iconBadge: () => {
|
|
if (isElectron()) {
|
|
const electronDownloadStore = useElectronDownloadStore()
|
|
if (electronDownloadStore.downloads.length > 0) {
|
|
return electronDownloadStore.downloads.length.toString()
|
|
}
|
|
}
|
|
|
|
return null
|
|
}
|
|
}
|
|
}
|