@@ -245,23 +245,52 @@ export class UIUtils {
245245 }
246246
247247 /**
248- * Calculate and format total file size for datasets
248+ * Calculate and format total file size and episodes for datasets
249249 * @param {Dataset[] } datasets - Array of datasets
250- * @returns {string } Formatted size string (e.g., " repos, 1.5GB")
250+ * @returns {string } Formatted HTML string (e.g., " repos, <strong style='color: var(--color-primary-light)'>1234 eps</strong>, <strong style='color: var(--color-primary-light)'> 1.5GB</strong> ")
251251 */
252252 calculateTotalSize ( datasets ) {
253253 if ( ! datasets || datasets . length === 0 ) {
254254 return ' repos' ;
255255 }
256256
257+ // Calculate total episodes
258+ let totalEpisodes = 0 ;
259+ datasets . forEach ( ds => {
260+ if ( ds && ds . statistics && typeof ds . statistics . total_episodes === 'number' ) {
261+ totalEpisodes += ds . statistics . total_episodes ;
262+ }
263+ } ) ;
264+
257265 const totalBytes = ConfigManager . calculateTotalSizeFromDatasets ( datasets ) ;
258266
259267 if ( totalBytes === null ) {
268+ // If no size info, still show episodes if available
269+ if ( totalEpisodes > 0 ) {
270+ const epsNum = `<strong style="color: var(--color-primary-light); font-weight: 600;">${ totalEpisodes . toLocaleString ( ) } </strong>` ;
271+ return ` repos, ${ epsNum } eps` ;
272+ }
260273 return ' repos' ;
261274 }
262275
263276 const formattedSize = ConfigManager . formatFileSize ( totalBytes ) ;
264- return ` repos, ${ formattedSize } ` ;
277+ // Extract number and unit from formatted size (e.g., "3.7TB" -> "3.7" and "TB")
278+ const sizeMatch = formattedSize . match ( / ^ ( [ \d . ] + ) ( [ A - Z ] + ) $ / ) ;
279+ let sizeHtml ;
280+ if ( sizeMatch ) {
281+ const sizeNum = `<strong style="color: var(--color-primary-light); font-weight: 600;">${ sizeMatch [ 1 ] } </strong>` ;
282+ sizeHtml = `${ sizeNum } ${ sizeMatch [ 2 ] } ` ;
283+ } else {
284+ // Fallback if format doesn't match expected pattern
285+ sizeHtml = formattedSize ;
286+ }
287+
288+ // Format: " repos, <num> eps, <file size>"
289+ if ( totalEpisodes > 0 ) {
290+ const epsNum = `<strong style="color: var(--color-primary-light); font-weight: 600;">${ totalEpisodes . toLocaleString ( ) } </strong>` ;
291+ return ` repos, ${ epsNum } eps, ${ sizeHtml } ` ;
292+ }
293+ return ` repos, ${ sizeHtml } ` ;
265294 }
266295
267296 /**
@@ -280,14 +309,14 @@ export class UIUtils {
280309 if ( filteredEl ) filteredEl . textContent = filteredCount ;
281310 if ( selectedEl ) selectedEl . textContent = selectedCount ;
282311
283- // Calculate and display total file size for filtered datasets
312+ // Calculate and display total file size and episodes for filtered datasets
284313 if ( filteredInfoEl ) {
285- filteredInfoEl . textContent = this . calculateTotalSize ( filteredDatasets ) ;
314+ filteredInfoEl . innerHTML = this . calculateTotalSize ( filteredDatasets ) ;
286315 }
287316
288- // Calculate and display total file size for selected datasets
317+ // Calculate and display total file size and episodes for selected datasets
289318 if ( selectedInfoEl ) {
290- selectedInfoEl . textContent = this . calculateTotalSize ( selectedDatasets ) ;
319+ selectedInfoEl . innerHTML = this . calculateTotalSize ( selectedDatasets ) ;
291320 }
292321 }
293322
0 commit comments