mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-30 11:11:53 +00:00
[refactor] simplify redundant check in cloud badge extension (#6106)
Simplifies code with tautological condition. The extension is only
loaded when `isCloud` is true due to
38f188759d/src/extensions/core/index.ts (L27-L29)
┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-6106-refactor-simplify-redundant-check-in-cloud-badge-extension-28f6d73d365081d69903f5a985fdc8be)
by [Unito](https://www.unito.io)
This commit is contained in:
@@ -1,16 +1,12 @@
|
|||||||
import { t } from '@/i18n'
|
import { t } from '@/i18n'
|
||||||
import { isCloud } from '@/platform/distribution/types'
|
|
||||||
import { useExtensionService } from '@/services/extensionService'
|
import { useExtensionService } from '@/services/extensionService'
|
||||||
|
|
||||||
useExtensionService().registerExtension({
|
useExtensionService().registerExtension({
|
||||||
name: 'Comfy.CloudBadge',
|
name: 'Comfy.CloudBadge',
|
||||||
// Only show badge when running in cloud environment
|
topbarBadges: [
|
||||||
topbarBadges: isCloud
|
{
|
||||||
? [
|
label: t('g.beta'),
|
||||||
{
|
text: 'Comfy Cloud'
|
||||||
label: t('g.beta'),
|
}
|
||||||
text: 'Comfy Cloud'
|
]
|
||||||
}
|
|
||||||
]
|
|
||||||
: undefined
|
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -17,4 +17,4 @@ const DISTRIBUTION: Distribution = __DISTRIBUTION__
|
|||||||
/** Distribution type checks */
|
/** Distribution type checks */
|
||||||
export const isDesktop = DISTRIBUTION === 'desktop' || isElectron() // TODO: replace with build var
|
export const isDesktop = DISTRIBUTION === 'desktop' || isElectron() // TODO: replace with build var
|
||||||
export const isCloud = DISTRIBUTION === 'cloud'
|
export const isCloud = DISTRIBUTION === 'cloud'
|
||||||
// export const isLocalhost = !isDesktop && !isCloud
|
// export const isLocalhost = DISTRIBUTION === 'localhost' || (!isDesktop && !isCloud)
|
||||||
|
|||||||
Reference in New Issue
Block a user