Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
dc30964
feat: create global drawer state
jvsena42 Nov 26, 2025
59624a0
feat: create DrawerNavIcon
jvsena42 Nov 26, 2025
2555c83
chore: inject drawer state
jvsena42 Nov 26, 2025
5e3e70d
feat: elevate DrawerState to ContentView.kt
jvsena42 Nov 26, 2025
abb451c
feat: elevate DrawerState to ContentView.kt
jvsena42 Nov 26, 2025
928cc0e
feat: replace close button with drawer
jvsena42 Nov 26, 2025
9847059
chore: remove unused component
jvsena42 Nov 26, 2025
d9a7795
feat: move drawer up to ContentView.kt
jvsena42 Nov 26, 2025
379654c
chore: lint
jvsena42 Nov 26, 2025
ecfe28a
feat: drawer icon visibility
jvsena42 Nov 26, 2025
13df5e0
feat: drawer icon visibility
jvsena42 Nov 26, 2025
7bb4f3e
chore: clean imports
jvsena42 Nov 26, 2025
535ddd6
chore: preview visibility
jvsena42 Nov 26, 2025
f7f3bc1
chore: remove close action
jvsena42 Nov 26, 2025
7ecaf22
chore: remove close action
jvsena42 Nov 26, 2025
8737102
chore: remove close action
jvsena42 Nov 26, 2025
53bc55f
chore: remove close action
jvsena42 Nov 26, 2025
71b4d70
chore: remove close action
jvsena42 Nov 26, 2025
d64f43d
chore: remove close action
jvsena42 Nov 26, 2025
960c751
feat: wallet nav controller
jvsena42 Nov 26, 2025
b2d79bd
refactor: extract nav method
jvsena42 Nov 26, 2025
265ed4e
feat: activity screen nav drawer
jvsena42 Nov 26, 2025
bd4295c
fix: move AllActivities to top navigation graph
jvsena42 Nov 27, 2025
6d18ad5
fix: move TabBar to top layer
jvsena42 Nov 27, 2025
80cde89
chore: remove unused code
jvsena42 Nov 27, 2025
f214491
chore: remove unused code
jvsena42 Nov 27, 2025
b61dfed
chore: remove unused code
jvsena42 Nov 27, 2025
ed92a70
chore: return walletNavController to inner composable
jvsena42 Nov 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
295 changes: 190 additions & 105 deletions app/src/main/java/to/bitkit/ui/ContentView.kt

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions app/src/main/java/to/bitkit/ui/Locals.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package to.bitkit.ui

import androidx.compose.material3.DrawerState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.compositionLocalOf
import androidx.compose.runtime.staticCompositionLocalOf
Expand All @@ -19,6 +20,7 @@ val LocalBalances = compositionLocalOf { BalanceState() }
val LocalCurrencies = compositionLocalOf { CurrencyState() }

// Statics
val LocalDrawerState = staticCompositionLocalOf<DrawerState?> { null }
val LocalAppViewModel = staticCompositionLocalOf<AppViewModel?> { null }
val LocalWalletViewModel = staticCompositionLocalOf<WalletViewModel?> { null }
val LocalBlocktankViewModel = staticCompositionLocalOf<BlocktankViewModel?> { null }
Expand Down Expand Up @@ -51,3 +53,6 @@ val settingsViewModel: SettingsViewModel?

val backupsViewModel: BackupsViewModel?
@Composable get() = LocalBackupsViewModel.current

val drawerState: DrawerState?
@Composable get() = LocalDrawerState.current
6 changes: 2 additions & 4 deletions app/src/main/java/to/bitkit/ui/NodeInfoScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ import to.bitkit.ui.components.rememberMoneyText
import to.bitkit.ui.components.settings.SectionHeader
import to.bitkit.ui.components.settings.SettingsTextButtonRow
import to.bitkit.ui.scaffold.AppTopBar
import to.bitkit.ui.scaffold.CloseNavIcon
import to.bitkit.ui.scaffold.DrawerNavIcon
import to.bitkit.ui.scaffold.ScreenColumn
import to.bitkit.ui.shared.util.clickableAlpha
import to.bitkit.ui.theme.AppThemeSurface
Expand Down Expand Up @@ -88,7 +88,6 @@ fun NodeInfoScreen(
isDevModeEnabled = isDevModeEnabled,
balanceDetails = lightningState.balances,
onBack = { navController.popBackStack() },
onClose = { navController.navigateToHome() },
onRefresh = { wallet.onPullToRefresh() },
onDisconnectPeer = { wallet.disconnectPeer(it) },
onCopy = { text ->
Expand All @@ -108,7 +107,6 @@ private fun Content(
isDevModeEnabled: Boolean,
balanceDetails: BalanceDetails? = null,
onBack: () -> Unit = {},
onClose: () -> Unit = {},
onRefresh: () -> Unit = {},
onDisconnectPeer: (PeerDetails) -> Unit = {},
onCopy: (String) -> Unit = {},
Expand All @@ -117,7 +115,7 @@ private fun Content(
AppTopBar(
titleText = stringResource(R.string.lightning__node_info),
onBackClick = onBack,
actions = { CloseNavIcon(onClose) },
actions = { DrawerNavIcon() },
)
PullToRefreshBox(
isRefreshing = uiState.isRefreshing,
Expand Down
32 changes: 18 additions & 14 deletions app/src/main/java/to/bitkit/ui/components/DrawerMenu.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,13 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.compose.ui.zIndex
import androidx.navigation.NavController
import androidx.navigation.NavDestination.Companion.hasRoute
import androidx.navigation.compose.rememberNavController
import kotlinx.coroutines.launch
import to.bitkit.R
import to.bitkit.ui.Routes
import to.bitkit.ui.navigateToSettings
import to.bitkit.ui.screens.wallets.HomeRoutes
import to.bitkit.ui.navigateIfNotCurrent
import to.bitkit.ui.navigateToHome
import to.bitkit.ui.shared.util.blockPointerInputPassthrough
import to.bitkit.ui.shared.util.clickableAlpha
import to.bitkit.ui.theme.AppThemeSurface
Expand All @@ -60,7 +61,6 @@ private val drawerWidth = 200.dp
@Composable
fun DrawerMenu(
drawerState: DrawerState,
walletNavController: NavController,
rootNavController: NavController,
hasSeenWidgetsIntro: Boolean,
hasSeenShopIntro: Boolean,
Expand Down Expand Up @@ -96,21 +96,20 @@ fun DrawerMenu(
)
) {
Menu(
walletNavController = walletNavController,
rootNavController = rootNavController,
drawerState = drawerState,
onClickAddWidget = {
if (!hasSeenWidgetsIntro) {
rootNavController.navigate(Routes.WidgetsIntro)
rootNavController.navigateIfNotCurrent(Routes.WidgetsIntro)
} else {
rootNavController.navigate(Routes.AddWidget)
rootNavController.navigateIfNotCurrent(Routes.AddWidget)
}
},
onClickShop = {
if (!hasSeenShopIntro) {
rootNavController.navigate(Routes.ShopIntro)
rootNavController.navigateIfNotCurrent(Routes.ShopIntro)
} else {
rootNavController.navigate(Routes.ShopDiscover)
rootNavController.navigateIfNotCurrent(Routes.ShopDiscover)
}
},
)
Expand All @@ -119,7 +118,6 @@ fun DrawerMenu(

@Composable
private fun Menu(
walletNavController: NavController,
rootNavController: NavController,
drawerState: DrawerState,
onClickAddWidget: () -> Unit,
Expand All @@ -140,6 +138,11 @@ private fun Menu(
label = stringResource(R.string.wallet__drawer__wallet),
iconRes = R.drawable.ic_coins,
onClick = {
val isOnHome = rootNavController.currentBackStackEntry
?.destination?.hasRoute<Routes.Home>() ?: false
if (!isOnHome) {
rootNavController.navigateToHome()
}
scope.launch { drawerState.close() }
},
modifier = Modifier.testTag("DrawerWallet")
Expand All @@ -149,7 +152,7 @@ private fun Menu(
label = stringResource(R.string.wallet__drawer__activity),
iconRes = R.drawable.ic_heartbeat,
onClick = {
walletNavController.navigate(HomeRoutes.AllActivity)
rootNavController.navigateIfNotCurrent(Routes.AllActivity)
scope.launch { drawerState.close() }
},
modifier = Modifier.testTag("DrawerActivity")
Expand Down Expand Up @@ -193,7 +196,7 @@ private fun Menu(
label = stringResource(R.string.wallet__drawer__settings),
iconRes = R.drawable.ic_settings,
onClick = {
rootNavController.navigateToSettings()
rootNavController.navigateIfNotCurrent(Routes.Settings)
scope.launch { drawerState.close() }
},
modifier = Modifier.testTag("DrawerSettings")
Expand All @@ -206,15 +209,17 @@ private fun Menu(
modifier = Modifier
.fillMaxWidth()
.clickableAlpha {
rootNavController.navigate(Routes.AppStatus)
rootNavController.navigateIfNotCurrent(Routes.AppStatus)
scope.launch { drawerState.close() }
}
) {
AppStatus(
showText = true,
showReady = true,
color = Colors.Black,
modifier = Modifier.padding(vertical = 16.dp).testTag("DrawerAppStatus")
modifier = Modifier
.padding(vertical = 16.dp)
.testTag("DrawerAppStatus")
)
}
}
Expand Down Expand Up @@ -298,7 +303,6 @@ private fun Preview() {
val navController = rememberNavController()
Box {
DrawerMenu(
walletNavController = navController,
rootNavController = navController,
drawerState = rememberDrawerState(initialValue = DrawerValue.Open),
hasSeenWidgetsIntro = false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import to.bitkit.R
import to.bitkit.ui.scaffold.AppTopBar
import to.bitkit.ui.scaffold.CloseNavIcon
import to.bitkit.ui.scaffold.DrawerNavIcon
import to.bitkit.ui.scaffold.ScreenColumn
import to.bitkit.ui.theme.AppThemeSurface
import to.bitkit.ui.theme.Colors
Expand All @@ -37,7 +37,6 @@ fun InfoScreenContent(
showCloseButton: Boolean = true,
buttonText: String,
onButtonClick: () -> Unit,
onCloseClick: () -> Unit,
testTag: String,
) {
ScreenColumn {
Expand All @@ -46,7 +45,7 @@ fun InfoScreenContent(
onBackClick = null,
actions = {
if (showCloseButton) {
CloseNavIcon(onCloseClick)
DrawerNavIcon()
}
},
)
Expand Down Expand Up @@ -100,7 +99,6 @@ private fun Preview() {
image = painterResource(R.drawable.check),
buttonText = stringResource(R.string.common__ok),
onButtonClick = {},
onCloseClick = {},
testTag = "",
)
}
Expand Down
33 changes: 20 additions & 13 deletions app/src/main/java/to/bitkit/ui/scaffold/AppTopBar.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.ArrowBack
import androidx.compose.material.icons.filled.Close
import androidx.compose.material3.CenterAlignedTopAppBar
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
Expand All @@ -18,12 +17,15 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.painter.Painter
import androidx.compose.ui.platform.LocalInspectionMode
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import kotlinx.coroutines.launch
import to.bitkit.R
import to.bitkit.ui.LocalDrawerState
import to.bitkit.ui.components.Title
import to.bitkit.ui.theme.AppThemeSurface

Expand Down Expand Up @@ -89,19 +91,24 @@ fun BackNavIcon(
}

@Composable
fun CloseNavIcon(
onClick: () -> Unit,
fun DrawerNavIcon(
modifier: Modifier = Modifier,
) {
IconButton(
onClick = onClick,
modifier = modifier.testTag("NavigationClose")
) {
Icon(
imageVector = Icons.Default.Close,
contentDescription = stringResource(R.string.common__close),
modifier = Modifier.size(24.dp)
)
val isPreview = LocalInspectionMode.current
val drawerState = LocalDrawerState.current
val scope = androidx.compose.runtime.rememberCoroutineScope()

if (drawerState != null || isPreview) {
IconButton(
onClick = { scope.launch { drawerState?.open() } },
modifier = modifier.testTag("HeaderMenu")
) {
Icon(
painter = painterResource(id = R.drawable.ic_list),
contentDescription = stringResource(R.string.settings__settings),
modifier = Modifier.size(24.dp)
)
}
}
}

Expand Down Expand Up @@ -153,7 +160,7 @@ private fun Preview3() {
titleText = "Title and Action",
onBackClick = {},
actions = {
CloseNavIcon(onClick = {})
DrawerNavIcon()
}
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,20 @@ import androidx.compose.ui.unit.dp
import to.bitkit.R
import to.bitkit.ui.components.Display
import to.bitkit.ui.scaffold.AppTopBar
import to.bitkit.ui.scaffold.CloseNavIcon
import to.bitkit.ui.scaffold.DrawerNavIcon
import to.bitkit.ui.scaffold.ScreenColumn
import to.bitkit.ui.theme.AppThemeSurface
import to.bitkit.ui.theme.Colors

@Composable
fun CreateProfileScreen(
onClose: () -> Unit,
onBack: () -> Unit,
) { // TODO IMPLEMENT
ScreenColumn {
AppTopBar(
titleText = stringResource(R.string.slashtags__profile_create),
onBackClick = onBack,
actions = { CloseNavIcon(onClick = onClose) },
actions = { DrawerNavIcon() },
)

Column(
Expand All @@ -47,7 +46,6 @@ fun CreateProfileScreen(
private fun Preview() {
AppThemeSurface {
CreateProfileScreen(
onClose = {},
onBack = {},
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,21 @@ import to.bitkit.ui.components.BodyM
import to.bitkit.ui.components.Display
import to.bitkit.ui.components.PrimaryButton
import to.bitkit.ui.scaffold.AppTopBar
import to.bitkit.ui.scaffold.CloseNavIcon
import to.bitkit.ui.scaffold.DrawerNavIcon
import to.bitkit.ui.scaffold.ScreenColumn
import to.bitkit.ui.theme.AppThemeSurface
import to.bitkit.ui.theme.Colors
import to.bitkit.ui.utils.withAccent

@Composable
fun ProfileIntroScreen(
onClose: () -> Unit,
onContinue: () -> Unit,
) {
ScreenColumn {
AppTopBar(
titleText = stringResource(R.string.slashtags__profile),
onBackClick = null,
actions = { CloseNavIcon(onClick = onClose) },
actions = { DrawerNavIcon() },
)

Column(
Expand Down Expand Up @@ -69,7 +68,6 @@ fun ProfileIntroScreen(
private fun Preview() {
AppThemeSurface {
ProfileIntroScreen(
onClose = {},
onContinue = {}
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ import to.bitkit.ui.appViewModel
import to.bitkit.ui.components.settings.SectionHeader
import to.bitkit.ui.components.settings.SettingsButtonRow
import to.bitkit.ui.components.settings.SettingsTextButtonRow
import to.bitkit.ui.navigateToHome
import to.bitkit.ui.scaffold.AppTopBar
import to.bitkit.ui.scaffold.CloseNavIcon
import to.bitkit.ui.scaffold.DrawerNavIcon
import to.bitkit.ui.scaffold.ScreenColumn
import to.bitkit.ui.settingsViewModel
import to.bitkit.ui.shared.util.shareZipFile
Expand All @@ -43,7 +42,7 @@ fun DevSettingsScreen(
AppTopBar(
titleText = stringResource(R.string.settings__dev_title),
onBackClick = { navController.popBackStack() },
actions = { CloseNavIcon(onClick = { navController.navigateToHome() }) },
actions = { DrawerNavIcon() },
)
Column(
modifier = Modifier
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ import com.synonym.bitkitcore.FeeRates
import to.bitkit.R
import to.bitkit.ui.components.settings.SectionHeader
import to.bitkit.ui.components.settings.SettingsTextButtonRow
import to.bitkit.ui.navigateToHome
import to.bitkit.ui.scaffold.AppTopBar
import to.bitkit.ui.scaffold.CloseNavIcon
import to.bitkit.ui.scaffold.DrawerNavIcon
import to.bitkit.ui.scaffold.ScreenColumn
import to.bitkit.ui.theme.AppThemeSurface
import to.bitkit.viewmodels.FeeSettingsUiState
Expand All @@ -40,21 +39,19 @@ fun FeeSettingsScreen(
Content(
uiState = uiState,
onBack = { navController.popBackStack() },
onClose = { navController.navigateToHome() },
)
}

@Composable
private fun Content(
uiState: FeeSettingsUiState,
onBack: () -> Unit = {},
onClose: () -> Unit = {},
) {
ScreenColumn {
AppTopBar(
titleText = "Fee Settings",
onBackClick = onBack,
actions = { CloseNavIcon(onClick = onClose) },
actions = { DrawerNavIcon() },
)

Column(
Expand Down
Loading
Loading