Disable export until a system has components

The Overview share menu offered a wiring diagram and a full report even
for an empty system. Gate it on loads, batteries or chargers being
present (iOS + Android) and add UI tests for both states.
This commit is contained in:
2026-08-12 11:26:03 +02:00
parent 345c8b3ac7
commit ab50728f07
4 changed files with 80 additions and 1 deletions

View File

@@ -157,7 +157,7 @@ fun SystemDetailScreen(
strokeWidth = 2.dp,
)
} else {
IconButton(onClick = { showOverviewMenu = true }) {
IconButton(onClick = { showOverviewMenu = true }, enabled = state.hasComponents) {
Icon(Icons.Outlined.IosShare, contentDescription = stringResource(R.string.overview_share_pdf))
}
}

View File

@@ -22,6 +22,9 @@ data class DetailState(
val chargers: List<SavedCharger> = emptyList(),
) {
val metrics: SystemMetrics get() = SystemMetrics(loads, batteries, chargers)
val hasComponents: Boolean
get() = loads.isNotEmpty() || batteries.isNotEmpty() || chargers.isNotEmpty()
}
class SystemDetailViewModel(