[READ-ONLY] Mirror of https://github.com/probablykasper/ferrum. Music library app for Mac, Linux and Windows ferrum.kasper.space
electron linux macos music music-library music-player napi windows
0

Configure Feed

Select the types of activity you want to include in your feed.

Improve column width typing

Kasper (May 28, 2025, 5:53 AM +0200) 3923f92c 278f50f2

+18 -3
+18 -3
src/components/TrackList.svelte
··· 265 265 // virtual_list.refresh() 266 266 // } 267 267 268 - const all_columns: ColumnRegular[] = [ 268 + type ColumnDef = ColumnRegular & 269 + ( 270 + | { 271 + width_px: number 272 + width_pct?: undefined 273 + } 274 + | { 275 + width_pct: number 276 + width_px?: undefined 277 + } 278 + ) 279 + const all_columns: ColumnDef[] = [ 269 280 // sorted alphabetically 270 281 { name: '#', prop: 'index', width_px: 46 }, 271 282 // { name: 'Size', prop: 'size' }, ··· 334 345 const container_width = container_el?.clientWidth ?? total_fixed_width 335 346 const total_percent_width = container_width - total_fixed_width 336 347 return columns.map((col) => { 337 - const size_pct = col.width_pct / total_percent_pct 338 - const size = (col.width_px ?? size_pct * total_percent_width) || 0 348 + let size: number 349 + if (col.width_px !== undefined) { 350 + size = col.width_px 351 + } else { 352 + size = (col.width_pct / total_percent_pct) * total_percent_width 353 + } 339 354 return { 340 355 ...col, 341 356 name: col.name === 'Image' ? '' : col.name,