diff --git a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/appskeleton/BottomBar.kt b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/appskeleton/BottomBar.kt index a363d6c..bf30cc0 100644 --- a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/appskeleton/BottomBar.kt +++ b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/appskeleton/BottomBar.kt @@ -1,16 +1,18 @@ package net.codinux.banking.ui.appskeleton import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.width -import androidx.compose.material.BottomAppBar -import androidx.compose.material.Icon -import androidx.compose.material.IconButton +import androidx.compose.material.* import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Menu import androidx.compose.runtime.Composable +import androidx.compose.runtime.collectAsState +import androidx.compose.runtime.getValue import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Modifier +import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp import kotlinx.coroutines.launch import net.codinux.banking.ui.config.Colors @@ -21,6 +23,8 @@ private val uiState = DI.uiState @Composable fun BottomBar() { + val accountFilter by uiState.accountFilter.collectAsState() + val coroutineScope = rememberCoroutineScope() @@ -33,6 +37,21 @@ fun BottomBar() { Icon(Icons.Filled.Menu, contentDescription = "Open Navigation Drawer with sidebar menu") } + Column { + val title = if (accountFilter.isEmpty()) { + "Bankmeister" + } else { + val filter = accountFilter.first() + if (filter.bankAccount != null) { + filter.bankAccount.productName ?: filter.bankAccount.identifier + } else { + filter.userAccount.bankName + } + } + + Text(title, color = LocalContentColor.current.copy(alpha = LocalContentAlpha.current), maxLines = 1, overflow = TextOverflow.Ellipsis) + } + Spacer(Modifier.weight(1f)) Spacer(Modifier.width(72.dp)) // space for Floating Action Button