MCPcopy Create free account
hub / github.com/TanStack/devtools / getBadgeClass

Function getBadgeClass

packages/devtools/src/tabs/marketplace/card-utils.ts:44–65  ·  view source on GitHub ↗
(card: PluginCard, styles: any)

Source from the content-addressed store, hash-verified

42}
43
44export const getBadgeClass = (card: PluginCard, styles: any): string => {
45 const s = styles()
46 const base = s.pluginMarketplaceCardBadge
47 switch (card.actionType) {
48 case 'install':
49 case 'install-devtools':
50 return `${base} ${s.pluginMarketplaceCardBadgeInstall}`
51 case 'add-to-devtools':
52 return `${base} ${s.pluginMarketplaceCardBadgeAdd}`
53 // Active matches the green rule down the card's leading edge, so the two
54 // signals for "this one is running" agree instead of using two colours.
55 case 'already-installed':
56 return `${base} ${s.pluginMarketplaceCardBadgeActive}`
57 case 'bump-version':
58 case 'version-mismatch':
59 return `${base} ${s.pluginMarketplaceCardBadgeBlocked}`
60 case 'requires-package':
61 case 'wrong-framework':
62 return `${base} ${s.pluginMarketplaceCardBadgeRequires}`
63 default:
64 return base
65 }
66}
67
68export const getBadgeText = (card: PluginCard): string => {

Callers 2

card-utils.test.tsFile · 0.90
PluginCardComponentFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected