Skip to content

Commit 476d8ba

Browse files
Shaun Mahonyclaude
andcommitted
Add collection labels to DatabaseSelector for multi-db sources
When a source has multiple databases (e.g. HOCOMOCO CORE + Clustered), show the collection name and motif count above each group picker, and a combined summary in the header. Co-Authored-By: Claude Opus 4.6 <[email protected]>
1 parent 03230aa commit 476d8ba

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

web/src/components/job/DatabaseSelector.tsx

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -286,12 +286,17 @@ function SourceBlock({
286286
{expanded ? "\u25BC" : "\u25B6"}
287287
</span>
288288
<span className="text-sm font-medium text-gray-900">{label}</span>
289-
{databases.map((db) => (
290-
<span key={db.slug} className="text-xs text-gray-500">
291-
{db.version && `v${db.version}`} &middot;{" "}
292-
{db.motifCount.toLocaleString()} motifs
289+
{databases.length === 1 ? (
290+
<span className="text-xs text-gray-500">
291+
{databases[0].version && `v${databases[0].version}`} &middot;{" "}
292+
{databases[0].motifCount.toLocaleString()} motifs
293293
</span>
294-
))}
294+
) : (
295+
<span className="text-xs text-gray-500">
296+
{databases.reduce((sum, db) => sum + db.motifCount, 0).toLocaleString()} motifs
297+
{" "}across {databases.length} collections
298+
</span>
299+
)}
295300
</div>
296301
{selectedDatabases.some((d) =>
297302
databases.some((db) => db.slug === d.slug)
@@ -309,6 +314,7 @@ function SourceBlock({
309314
key={db.slug}
310315
db={db}
311316
source={source}
317+
showDbLabel={databases.length > 1}
312318
showAll={showAll}
313319
onToggleShowAll={onToggleShowAll}
314320
searchText={searchText}
@@ -329,6 +335,7 @@ function SourceBlock({
329335
interface GroupPickerProps {
330336
db: DatabaseInfo;
331337
source: string;
338+
showDbLabel: boolean;
332339
showAll: boolean;
333340
onToggleShowAll: () => void;
334341
searchText: string;
@@ -341,6 +348,7 @@ interface GroupPickerProps {
341348
function GroupPicker({
342349
db,
343350
source,
351+
showDbLabel,
344352
showAll,
345353
onToggleShowAll,
346354
searchText,
@@ -389,6 +397,14 @@ function GroupPicker({
389397

390398
return (
391399
<div>
400+
{showDbLabel && (
401+
<div className="flex items-center gap-2 mb-1">
402+
<span className="text-xs font-semibold text-gray-700">{db.name}</span>
403+
<span className="text-xs text-gray-400">
404+
{db.motifCount.toLocaleString()} motifs
405+
</span>
406+
</div>
407+
)}
392408
<div className="flex items-center justify-between mb-1 gap-2">
393409
<p className="text-xs text-gray-500 flex-shrink-0">
394410
Select groups to match against:

0 commit comments

Comments
 (0)