From 88ca75460b3d8d3d53a87303930c7ce967042a81 Mon Sep 17 00:00:00 2001 From: dankito Date: Thu, 5 Sep 2024 00:01:58 +0200 Subject: [PATCH] =?UTF-8?q?Added=20"Neue=20=C3=9Cberweisung"=20navigation?= =?UTF-8?q?=20menu=20item?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../banking/ui/appskeleton/SideMenu.kt | 30 ++++++++++++++----- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/appskeleton/SideMenu.kt b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/appskeleton/SideMenu.kt index 3d64008..4765392 100644 --- a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/appskeleton/SideMenu.kt +++ b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/appskeleton/SideMenu.kt @@ -53,6 +53,8 @@ private val iconSize = 24.dp fun SideMenu(appContent: @Composable () -> Unit) { val drawerState = uiState.drawerState.collectAsState().value + val accounts = uiState.userAccounts.collectAsState().value + val coroutineScope = rememberCoroutineScope() ModalDrawer( @@ -97,18 +99,32 @@ fun SideMenu(appContent: @Composable () -> Unit) { drawerState.close() } } + + if (accounts.isNotEmpty()) { + Spacer(Modifier.height(12.dp)) + + NavigationMenuItem(itemModifier, "Neue Überweisung", textColor, horizontalPadding = ItemHorizontalPadding, icon = { Icon(Icons.Filled.Add, "Konto hinzufügen", Modifier.size(iconSize)) }) { + uiState.showTransferMoneyDialog.value = true + + coroutineScope.launch { + drawerState.close() + } + } + } } - Divider(color = Colors.DrawerDivider) + if (accounts.isNotEmpty()) { + Divider(color = Colors.DrawerDivider) - Spacer(Modifier.height(12.dp)) + Spacer(Modifier.height(12.dp)) - NavigationMenuItem(itemModifier, "Daten exportieren", textColor, horizontalPadding = ItemHorizontalPadding, icon = { Icon(Icons.AutoMirrored.Filled.Send, "Konto hinzufügen", Modifier.size(iconSize)) }) { - coroutineScope.launch { - drawerState.close() + NavigationMenuItem(itemModifier, "Daten exportieren", textColor, horizontalPadding = ItemHorizontalPadding, icon = { Icon(Icons.AutoMirrored.Filled.Send, "Konto hinzufügen", Modifier.size(iconSize)) }) { + coroutineScope.launch { + drawerState.close() + } + + uiState.showExportScreen.value = true } - - uiState.showExportScreen.value = true } } }