MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / getAdDisplayLabel

Function getAdDisplayLabel

cli/src/components/choice-ad-banner.tsx:44–53  ·  view source on GitHub ↗
(
  ad: Pick<AdResponse, 'title' | 'url'>,
)

Source from the content-addressed store, hash-verified

42}
43
44export function getAdDisplayLabel(
45 ad: Pick<AdResponse, 'title' | 'url'>,
46): { text: string; variant: 'domain' | 'title' } {
47 const url = ad.url.trim()
48 if (url) {
49 return { text: extractDomain(url), variant: 'domain' }
50 }
51
52 return { text: ad.title.trim() || 'Sponsored', variant: 'title' }
53}
54
55/**
56 * Calculate evenly distributed column widths that sum exactly to availableWidth.

Callers 2

ChoiceAdBannerFunction · 0.85

Calls 1

extractDomainFunction · 0.85

Tested by

no test coverage detected