diff --git a/Cable/Loads/ComponentLibraryView.swift b/Cable/Loads/ComponentLibraryView.swift index cbd7ce7..ad50eab 100644 --- a/Cable/Loads/ComponentLibraryView.swift +++ b/Cable/Loads/ComponentLibraryView.swift @@ -24,7 +24,7 @@ struct ComponentLibraryItem: Identifiable, Equatable { let iconURL: URL? var displayVoltage: Double? { - voltageIn ?? voltageOut + [voltageIn, voltageOut].compactMap({ $0 }).first(where: { $0 > 0 }) } var current: Double? { diff --git a/android/app/src/main/java/app/voltplan/cable/library/ComponentLibraryItem.kt b/android/app/src/main/java/app/voltplan/cable/library/ComponentLibraryItem.kt index c0c5617..7741245 100644 --- a/android/app/src/main/java/app/voltplan/cable/library/ComponentLibraryItem.kt +++ b/android/app/src/main/java/app/voltplan/cable/library/ComponentLibraryItem.kt @@ -24,7 +24,7 @@ data class ComponentLibraryItem( val iconURL: String?, val affiliateLinks: List, ) { - val displayVoltage: Double? get() = voltageIn ?: voltageOut + val displayVoltage: Double? get() = voltageIn?.takeIf { it > 0 } ?: voltageOut?.takeIf { it > 0 } val current: Double? get() {