-
Notifications
You must be signed in to change notification settings - Fork 63
Expand file tree
/
Copy pathChartBrowser.tsx
More file actions
600 lines (566 loc) · 25.4 KB
/
ChartBrowser.tsx
File metadata and controls
600 lines (566 loc) · 25.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
import { useState, useMemo } from 'react'
import { Search, RefreshCw, Package, Database, AlertCircle, ExternalLink, ChevronDown, Star, Shield, BadgeCheck, Building2, Globe, ArrowUpDown, FileJson, PenTool } from 'lucide-react'
import { PaneLoader } from '@skyhook-io/k8s-ui'
import { clsx } from 'clsx'
import { useHelmRepositories, useSearchCharts, useUpdateRepository, useArtifactHubSearch, type ArtifactHubSortOption } from '../../api/client'
import { useCanHelmWrite } from '../../contexts/CapabilitiesContext'
import type { ChartInfo, HelmRepository, ArtifactHubChart, ChartSource } from '../../types'
import { formatAge } from './helm-utils'
import { SEVERITY_BADGE } from '../../utils/badge-colors'
import { Tooltip } from '../ui/Tooltip'
interface ChartBrowserProps {
onChartSelect: (repo: string, chart: string, version: string, source: ChartSource) => void
}
export function ChartBrowser({ onChartSelect }: ChartBrowserProps) {
const [chartSource, setChartSource] = useState<ChartSource>('local')
const [searchTerm, setSearchTerm] = useState('')
const [selectedRepo, setSelectedRepo] = useState<string>('all')
const [showAllVersions, setShowAllVersions] = useState(false)
const [repoDropdownOpen, setRepoDropdownOpen] = useState(false)
// ArtifactHub filters
const [showOfficialOnly, setShowOfficialOnly] = useState(false)
const [showVerifiedOnly, setShowVerifiedOnly] = useState(false)
const [artifactHubSort, setArtifactHubSort] = useState<ArtifactHubSortOption>('relevance')
// Repo refresh is gated only by `requireHelmWrite` on the backend
// (handleUpdateRepository deliberately skips requireCloudRole — it
// mutates pod-local chart cache, not cluster state). So the SPA gate
// here must NOT include the Cloud role check, or Cloud viewers with
// rbac.helm=true would be blocked from a refresh the backend allows.
const canHelmWrite = useCanHelmWrite()
const helmWriteReason = canHelmWrite ? '' : 'Helm write permissions required. Set rbac.helm=true in the Radar Helm chart values.'
// Local repo hooks
const { data: repositories, isLoading: reposLoading } = useHelmRepositories()
const { data: searchResult, isLoading: chartsLoading, refetch: refetchCharts } = useSearchCharts(
searchTerm,
showAllVersions,
chartSource === 'local'
)
const updateRepoMutation = useUpdateRepository()
// ArtifactHub hook - only search when there's a search term
const { data: artifactHubResult, isLoading: artifactHubLoading } = useArtifactHubSearch(
searchTerm,
{ official: showOfficialOnly, verified: showVerifiedOnly, limit: 60, sort: artifactHubSort },
chartSource === 'artifacthub' && searchTerm.length > 0
)
// Filter local charts by selected repository
const filteredLocalCharts = useMemo(() => {
if (!searchResult?.charts) return []
if (selectedRepo === 'all') return searchResult.charts
return searchResult.charts.filter(c => c.repository === selectedRepo)
}, [searchResult?.charts, selectedRepo])
// Group local charts by repository for display
const chartsByRepo = useMemo(() => {
const groups = new Map<string, ChartInfo[]>()
for (const chart of filteredLocalCharts) {
const existing = groups.get(chart.repository) || []
existing.push(chart)
groups.set(chart.repository, existing)
}
return groups
}, [filteredLocalCharts])
const handleUpdateRepo = async (repoName: string) => {
await updateRepoMutation.mutateAsync(repoName)
refetchCharts()
}
const handleUpdateAllRepos = async () => {
if (!repositories) return
for (const repo of repositories) {
try {
await updateRepoMutation.mutateAsync(repo.name)
} catch {
// Continue with other repos
}
}
refetchCharts()
}
const isLoading = chartSource === 'local' ? chartsLoading : artifactHubLoading
const totalCount = chartSource === 'local'
? filteredLocalCharts.length
: (artifactHubResult?.charts.length ?? 0)
return (
<div className="flex flex-col h-full">
{/* Toolbar */}
<div className="flex items-center gap-4 px-4 py-3 border-b border-theme-border bg-theme-surface/50 shrink-0">
<div className="flex items-center gap-2 text-theme-text-secondary">
<Package className="w-5 h-5" />
<span className="font-medium">Charts</span>
{!isLoading && (
<span className="badge bg-theme-elevated">
{totalCount}
</span>
)}
</div>
{/* Source toggle */}
<div className="flex items-center bg-theme-elevated rounded-lg p-0.5 border border-theme-border-light">
<button
onClick={() => setChartSource('local')}
className={clsx(
'flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-md transition-colors',
chartSource === 'local'
? `${SEVERITY_BADGE.info} font-medium`
: 'text-theme-text-secondary hover:text-theme-text-primary'
)}
>
<Database className="w-3.5 h-3.5" />
My Repos
</button>
<button
onClick={() => setChartSource('artifacthub')}
className={clsx(
'flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-md transition-colors',
chartSource === 'artifacthub'
? `${SEVERITY_BADGE.info} font-medium`
: 'text-theme-text-secondary hover:text-theme-text-primary'
)}
>
<Globe className="w-3.5 h-3.5" />
ArtifactHub
</button>
</div>
{/* Repository filter dropdown (only for local) */}
{chartSource === 'local' && (
<div className="relative">
<button
onClick={() => setRepoDropdownOpen(!repoDropdownOpen)}
className="flex items-center gap-2 px-3 py-2 bg-theme-elevated border border-theme-border-light rounded-lg text-sm text-theme-text-primary hover:bg-theme-hover transition-colors"
>
<Database className="w-4 h-4 text-theme-text-tertiary" />
<span>{selectedRepo === 'all' ? 'All Repositories' : selectedRepo}</span>
<ChevronDown className={clsx('w-4 h-4 text-theme-text-tertiary transition-transform', repoDropdownOpen && 'rotate-180')} />
</button>
{repoDropdownOpen && (
<div className="absolute top-full left-0 mt-1 w-64 bg-theme-surface border border-theme-border rounded-lg shadow-xl z-50 py-1 max-h-64 overflow-auto">
<button
onClick={() => { setSelectedRepo('all'); setRepoDropdownOpen(false) }}
className={clsx(
'w-full px-3 py-2 text-left text-sm hover:bg-theme-hover flex items-center justify-between',
selectedRepo === 'all' ? 'text-blue-400' : 'text-theme-text-primary'
)}
>
<span>All Repositories</span>
{selectedRepo === 'all' && <span className="text-xs">✓</span>}
</button>
<div className="border-t border-theme-border my-1" />
{reposLoading ? (
<div className="px-3 py-2 text-sm text-theme-text-tertiary">Loading...</div>
) : repositories?.length === 0 ? (
<div className="px-3 py-2 text-sm text-theme-text-tertiary">No repositories configured</div>
) : (
repositories?.map(repo => (
<RepoDropdownItem
key={repo.name}
repo={repo}
isSelected={selectedRepo === repo.name}
onSelect={() => { setSelectedRepo(repo.name); setRepoDropdownOpen(false) }}
onUpdate={() => handleUpdateRepo(repo.name)}
isUpdating={updateRepoMutation.isPending}
canUpdate={canHelmWrite}
cantUpdateReason={helmWriteReason}
/>
))
)}
</div>
)}
</div>
)}
{/* ArtifactHub filters */}
{chartSource === 'artifacthub' && (
<div className="flex items-center gap-3">
<label className="flex items-center gap-1.5 text-sm text-theme-text-secondary">
<input
type="checkbox"
checked={showOfficialOnly}
onChange={(e) => setShowOfficialOnly(e.target.checked)}
className="rounded border-theme-border text-blue-500 focus:ring-blue-500"
/>
<BadgeCheck className="w-3.5 h-3.5 text-blue-400" />
Official
</label>
<label className="flex items-center gap-1.5 text-sm text-theme-text-secondary">
<input
type="checkbox"
checked={showVerifiedOnly}
onChange={(e) => setShowVerifiedOnly(e.target.checked)}
className="rounded border-theme-border text-blue-500 focus:ring-blue-500"
/>
<Shield className="w-3.5 h-3.5 text-green-400" />
Verified
</label>
{/* Sort dropdown */}
<div className="flex items-center gap-1.5">
<ArrowUpDown className="w-3.5 h-3.5 text-theme-text-tertiary" />
<select
value={artifactHubSort}
onChange={(e) => setArtifactHubSort(e.target.value as ArtifactHubSortOption)}
className="bg-theme-elevated border border-theme-border-light rounded px-2 py-1 text-sm text-theme-text-primary focus:outline-none focus:ring-2 focus:ring-blue-500"
>
<option value="relevance">Relevance</option>
<option value="stars">Stars</option>
<option value="last_updated">Last Updated</option>
</select>
</div>
</div>
)}
{/* Search */}
<div className="flex-1 relative">
<Search className="absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-theme-text-tertiary" />
<input
type="text"
placeholder={chartSource === 'local' ? "Search charts..." : "Search ArtifactHub..."}
value={searchTerm}
onChange={(e) => setSearchTerm(e.target.value)}
className="w-full max-w-md pl-10 pr-4 py-2 bg-theme-elevated border border-theme-border-light rounded-lg text-sm text-theme-text-primary placeholder-theme-text-disabled focus:outline-none focus:ring-2 focus:ring-blue-500"
/>
</div>
{/* Options (only for local) */}
{chartSource === 'local' && (
<>
<label className="flex items-center gap-2 text-sm text-theme-text-secondary">
<input
type="checkbox"
checked={showAllVersions}
onChange={(e) => setShowAllVersions(e.target.checked)}
className="rounded border-theme-border text-blue-500 focus:ring-blue-500"
/>
All versions
</label>
{/* Refresh button */}
<Tooltip content={canHelmWrite ? "Update all repositories" : helmWriteReason}>
<button
onClick={handleUpdateAllRepos}
disabled={updateRepoMutation.isPending || !canHelmWrite}
className="p-2 text-theme-text-secondary hover:text-theme-text-primary hover:bg-theme-elevated rounded-lg disabled:opacity-50"
>
<RefreshCw className={clsx('w-4 h-4', updateRepoMutation.isPending && 'animate-spin')} />
</button>
</Tooltip>
</>
)}
</div>
{/* Chart grid */}
<div className="flex-1 overflow-auto p-4">
{isLoading ? (
<PaneLoader label="Loading charts…" className="h-32" />
) : chartSource === 'local' ? (
// Local charts view
filteredLocalCharts.length === 0 ? (
<div className="flex flex-col items-center justify-center h-64 text-theme-text-tertiary gap-3">
<AlertCircle className="w-12 h-12 text-theme-text-disabled" />
<div className="text-center">
<p className="text-lg font-medium text-theme-text-secondary">No charts found</p>
{searchTerm ? (
<p className="text-sm mt-1">Try a different search term</p>
) : repositories?.length === 0 ? (
<div className="text-sm mt-1">
<p>No Helm repositories configured.</p>
<p className="mt-1">
Add repositories using <code className="bg-theme-elevated px-1 rounded">helm repo add</code>
</p>
<p className="mt-2">
Or try searching on <button onClick={() => setChartSource('artifacthub')} className="text-blue-400 hover:underline">ArtifactHub</button>
</p>
</div>
) : (
<p className="text-sm mt-1">Try updating your repositories</p>
)}
</div>
</div>
) : selectedRepo === 'all' ? (
// Grouped by repository
<div className="space-y-6">
{Array.from(chartsByRepo.entries()).map(([repoName, charts]) => (
<div key={repoName}>
<div className="flex items-center gap-2 mb-3">
<Database className="w-4 h-4 text-theme-text-tertiary" />
<h3 className="text-sm font-medium text-theme-text-secondary">{repoName}</h3>
<span className="text-xs text-theme-text-tertiary">({charts.length})</span>
</div>
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3">
{charts.map((chart, idx) => (
<LocalChartCard
key={`${chart.repository}-${chart.name}-${chart.version}-${idx}`}
chart={chart}
onSelect={() => onChartSelect(chart.repository, chart.name, chart.version, 'local')}
/>
))}
</div>
</div>
))}
</div>
) : (
// Single repository view
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3">
{filteredLocalCharts.map((chart, idx) => (
<LocalChartCard
key={`${chart.repository}-${chart.name}-${chart.version}-${idx}`}
chart={chart}
onSelect={() => onChartSelect(chart.repository, chart.name, chart.version, 'local')}
/>
))}
</div>
)
) : (
// ArtifactHub view
!searchTerm ? (
// No search term yet - show prompt
<div className="flex flex-col items-center justify-center h-64 text-theme-text-tertiary gap-3">
<Globe className="w-12 h-12 text-theme-text-disabled" />
<div className="text-center">
<p className="text-lg font-medium text-theme-text-secondary">Search ArtifactHub</p>
<p className="text-sm mt-1">Enter a search term to find charts from the community</p>
</div>
</div>
) : !artifactHubResult?.charts.length ? (
// Searched but no results
<div className="flex flex-col items-center justify-center h-64 text-theme-text-tertiary gap-3">
<AlertCircle className="w-12 h-12 text-theme-text-disabled" />
<div className="text-center">
<p className="text-lg font-medium text-theme-text-secondary">No charts found</p>
<p className="text-sm mt-1">Try a different search term or adjust filters</p>
</div>
</div>
) : (
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3">
{artifactHubResult.charts.map((chart, idx) => (
<ArtifactHubChartCard
key={`${chart.repository.name}-${chart.name}-${chart.version}-${idx}`}
chart={chart}
onSelect={() => onChartSelect(chart.repository.name, chart.name, chart.version, 'artifacthub')}
/>
))}
</div>
)
)}
</div>
</div>
)
}
interface RepoDropdownItemProps {
repo: HelmRepository
isSelected: boolean
onSelect: () => void
onUpdate: () => void
isUpdating: boolean
canUpdate: boolean
/** Reason rendered in the disabled button's tooltip when canUpdate
* is false — only the rbac.helm capability is relevant here, since
* repo refresh is not Cloud-role-gated on the backend. */
cantUpdateReason?: string
}
function RepoDropdownItem({ repo, isSelected, onSelect, onUpdate, isUpdating, canUpdate, cantUpdateReason }: RepoDropdownItemProps) {
return (
<div className="flex items-center justify-between px-3 py-2 hover:bg-theme-hover group">
<button
onClick={onSelect}
className={clsx(
'flex-1 text-left text-sm truncate',
isSelected ? 'text-blue-400' : 'text-theme-text-primary'
)}
>
{repo.name}
{repo.lastUpdated && (
<span className="text-xs text-theme-text-tertiary ml-2">
{formatAge(repo.lastUpdated)}
</span>
)}
</button>
<button
onClick={(e) => { e.stopPropagation(); onUpdate() }}
disabled={isUpdating || !canUpdate}
className="p-1 text-theme-text-tertiary hover:text-theme-text-primary opacity-0 group-hover:opacity-100 transition-opacity disabled:opacity-50"
title={canUpdate ? "Update repository" : (cantUpdateReason ?? "Helm write permissions required")}
>
<RefreshCw className={clsx('w-3.5 h-3.5', isUpdating && 'animate-spin')} />
</button>
</div>
)
}
interface LocalChartCardProps {
chart: ChartInfo
onSelect: () => void
}
function LocalChartCard({ chart, onSelect }: LocalChartCardProps) {
return (
<button
onClick={onSelect}
className="flex flex-col p-3 bg-theme-elevated/30 hover:bg-theme-elevated/50 border border-theme-border-light rounded-lg text-left transition-colors group"
>
<div className="flex items-start gap-3">
{chart.icon ? (
<img
src={chart.icon}
alt=""
className="w-10 h-10 rounded object-contain bg-white/10 p-1"
onError={(e) => {
(e.target as HTMLImageElement).style.display = 'none'
}}
/>
) : (
<div className="w-10 h-10 rounded bg-theme-hover flex items-center justify-center">
<Package className="w-5 h-5 text-theme-text-tertiary" />
</div>
)}
<div className="flex-1 min-w-0">
<div className="flex items-center gap-2">
{/* Long chart names truncate with no way to reveal the
full string. Wrap in a Tooltip so the user can hover
for the unabbreviated name. (SKY-825 bug 43) */}
<Tooltip content={chart.name} wrapperClassName="min-w-0 flex-1">
<h4 className="text-sm font-medium text-theme-text-primary truncate">{chart.name}</h4>
</Tooltip>
{chart.deprecated && (
<span className={clsx('px-1 py-0.5 text-[10px] rounded', SEVERITY_BADGE.warning)}>
deprecated
</span>
)}
</div>
<div className="flex items-center gap-2 mt-0.5">
<span className="text-xs text-theme-text-tertiary">{chart.version}</span>
{chart.appVersion && (
<>
<span className="text-xs text-theme-text-disabled">|</span>
<span className="text-xs text-theme-text-tertiary">App: {chart.appVersion}</span>
</>
)}
</div>
</div>
<ExternalLink className="w-4 h-4 text-theme-text-tertiary opacity-0 group-hover:opacity-100 shrink-0" />
</div>
{chart.description && (
<p className="mt-2 text-xs text-theme-text-secondary line-clamp-2">
{chart.description}
</p>
)}
</button>
)
}
interface ArtifactHubChartCardProps {
chart: ArtifactHubChart
onSelect: () => void
}
function ArtifactHubChartCard({ chart, onSelect }: ArtifactHubChartCardProps) {
// Format Unix timestamp to relative age
const lastUpdated = chart.updatedAt
? formatAge(new Date(chart.updatedAt * 1000).toISOString())
: null
return (
<button
onClick={onSelect}
className="flex flex-col p-4 bg-theme-elevated/30 hover:bg-theme-elevated/50 border border-theme-border-light rounded-lg text-left transition-colors group"
>
{/* Header row */}
<div className="flex items-start gap-3">
{/* Logo */}
{chart.logoUrl ? (
<img
src={chart.logoUrl}
alt=""
className="w-12 h-12 rounded object-contain bg-white/10 p-1 shrink-0"
onError={(e) => {
(e.target as HTMLImageElement).style.display = 'none'
}}
/>
) : (
<div className="w-12 h-12 rounded bg-theme-hover flex items-center justify-center shrink-0">
<Package className="w-6 h-6 text-theme-text-tertiary" />
</div>
)}
{/* Name and org */}
<div className="flex-1 min-w-0">
{/* Tooltip on the truncated name so users can read the
full chart name without resizing the panel.
(SKY-825 bug 43) */}
<Tooltip content={chart.name} wrapperClassName="block">
<h4 className="text-sm font-medium text-theme-text-primary truncate">{chart.name}</h4>
</Tooltip>
<div className="flex items-center gap-2 mt-0.5 text-xs text-theme-text-tertiary">
<span className="flex items-center gap-1">
<Building2 className="w-3 h-3" />
{chart.repository.organizationName || chart.repository.name}
</span>
<span className="flex items-center gap-1">
<Globe className="w-3 h-3" />
{chart.repository.name}
</span>
</div>
</div>
{/* Stats - top right */}
<div className="text-right shrink-0">
<div className="flex items-center justify-end gap-2">
{chart.stars > 0 && (
<span className="flex items-center gap-1 px-2 py-0.5 text-xs border border-theme-border rounded">
<Star className="w-3 h-3" />
{chart.stars}
</span>
)}
</div>
{lastUpdated && (
<p className="text-xs text-theme-text-tertiary mt-1">Updated {lastUpdated}</p>
)}
<p className="text-xs text-theme-text-secondary mt-0.5">Version {chart.version}</p>
</div>
</div>
{/* Description */}
{chart.description && (
<p className="mt-3 text-xs text-theme-text-secondary line-clamp-2">
{chart.description}
</p>
)}
{/* Footer - badges row */}
<div className="flex items-center justify-between mt-3 pt-3 border-t border-theme-border-light/50">
{/* Keywords/category */}
<div className="flex items-center gap-2">
{chart.deprecated && (
<span className={clsx('px-2 py-0.5 text-[10px] rounded', SEVERITY_BADGE.warning)}>
deprecated
</span>
)}
{chart.keywords && chart.keywords.length > 0 && (
<span className="px-2 py-0.5 text-[10px] rounded bg-theme-elevated text-theme-text-tertiary border border-theme-border-light truncate max-w-[150px]">
{chart.keywords[0]}
</span>
)}
</div>
{/* Feature badges */}
<div className="flex items-center gap-1">
{/* Values Schema */}
<Tooltip content={chart.hasValuesSchema ? 'Has values schema' : 'No values schema'}>
<span className={clsx(
'p-1.5 rounded',
chart.hasValuesSchema ? SEVERITY_BADGE.warning : 'bg-theme-elevated/50 text-theme-text-disabled'
)}>
<FileJson className="w-4 h-4" />
</span>
</Tooltip>
{/* Signed */}
<Tooltip content={chart.signed ? 'Signed package' : 'Not signed'}>
<span className={clsx(
'p-1.5 rounded',
chart.signed ? SEVERITY_BADGE.info : 'bg-theme-elevated/50 text-theme-text-disabled'
)}>
<PenTool className="w-4 h-4" />
</span>
</Tooltip>
{/* Verified Publisher */}
<Tooltip content={chart.repository.verifiedPublisher ? 'Verified publisher' : 'Not verified'}>
<span className={clsx(
'p-1.5 rounded',
chart.repository.verifiedPublisher ? SEVERITY_BADGE.success : 'bg-theme-elevated/50 text-theme-text-disabled'
)}>
<Shield className="w-4 h-4" />
</span>
</Tooltip>
{/* Official */}
<Tooltip content={chart.repository.official ? 'Official package' : 'Community package'}>
<span className={clsx(
'p-1.5 rounded',
chart.repository.official ? SEVERITY_BADGE.success : 'bg-theme-elevated/50 text-theme-text-disabled'
)}>
<Star className={clsx('w-4 h-4', chart.repository.official && 'fill-current')} />
</span>
</Tooltip>
</div>
</div>
</button>
)
}