diff --git a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/duplicates/DuplicatesScreen.kt b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/duplicates/DuplicatesScreen.kt index bfb17efc..6b972649 100644 --- a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/duplicates/DuplicatesScreen.kt +++ b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/duplicates/DuplicatesScreen.kt @@ -5,6 +5,7 @@ import androidx.compose.runtime.remember import com.artemchep.keyguard.feature.duplicates.list.DuplicatesListRoute import com.artemchep.keyguard.feature.navigation.NavigationRouter import com.artemchep.keyguard.feature.twopane.TwoPaneNavigationContent +import com.artemchep.keyguard.ui.screenMaxWidthCompact @Composable fun DuplicatesScreen( @@ -19,6 +20,9 @@ fun DuplicatesScreen( id = DuplicatesRoute.ROUTER_NAME, initial = initialRoute, ) { backStack -> - TwoPaneNavigationContent(backStack) + TwoPaneNavigationContent( + backStack, + detailPaneMaxWidth = screenMaxWidthCompact, + ) } } diff --git a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/generator/wordlist/WordlistsScreen.kt b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/generator/wordlist/WordlistsScreen.kt index d221a1e7..ef860034 100644 --- a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/generator/wordlist/WordlistsScreen.kt +++ b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/generator/wordlist/WordlistsScreen.kt @@ -4,6 +4,7 @@ import androidx.compose.runtime.Composable import com.artemchep.keyguard.feature.generator.wordlist.list.WordlistListRoute import com.artemchep.keyguard.feature.navigation.NavigationRouter import com.artemchep.keyguard.feature.twopane.TwoPaneNavigationContent +import com.artemchep.keyguard.ui.screenMaxWidthCompact @Composable fun WordlistsScreen() { @@ -11,6 +12,9 @@ fun WordlistsScreen() { id = WordlistsRoute.ROUTER_NAME, initial = WordlistListRoute, ) { backStack -> - TwoPaneNavigationContent(backStack) + TwoPaneNavigationContent( + backStack, + detailPaneMaxWidth = screenMaxWidthCompact, + ) } } diff --git a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/home/settings/SettingsScreen.kt b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/home/settings/SettingsScreen.kt index 22a787e4..ce466c35 100644 --- a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/home/settings/SettingsScreen.kt +++ b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/home/settings/SettingsScreen.kt @@ -5,6 +5,7 @@ import androidx.compose.runtime.CompositionLocalProvider import com.artemchep.keyguard.feature.navigation.LocalNavigationNodeVisualStack import com.artemchep.keyguard.feature.navigation.NavigationRouter import com.artemchep.keyguard.feature.twopane.TwoPaneNavigationContent +import com.artemchep.keyguard.ui.screenMaxWidthCompact @Composable fun SettingsScreen() { @@ -21,7 +22,10 @@ fun SettingsScreen() { id = SettingsRoute.ROUTER_NAME, initial = SettingListRoute, ) { backStack -> - TwoPaneNavigationContent(backStack) + TwoPaneNavigationContent( + backStack, + detailPaneMaxWidth = screenMaxWidthCompact, + ) } } } diff --git a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/home/settings/accounts/AccountsScreen.kt b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/home/settings/accounts/AccountsScreen.kt index 3536dd67..222845d0 100644 --- a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/home/settings/accounts/AccountsScreen.kt +++ b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/home/settings/accounts/AccountsScreen.kt @@ -4,6 +4,7 @@ import androidx.compose.runtime.Composable import com.artemchep.keyguard.feature.navigation.LocalNavigationNodeVisualStack import com.artemchep.keyguard.feature.navigation.NavigationRouter import com.artemchep.keyguard.feature.twopane.TwoPaneNavigationContent +import com.artemchep.keyguard.ui.screenMaxWidthCompact @Composable fun AccountsScreen() { @@ -20,7 +21,10 @@ fun AccountsScreen() { id = "accounts", initial = AccountListRoute, ) { backStack -> - TwoPaneNavigationContent(backStack) + TwoPaneNavigationContent( + backStack, + detailPaneMaxWidth = screenMaxWidthCompact, + ) } // } } diff --git a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/justdeleteme/directory/JustDeleteMeServicesScreen.kt b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/justdeleteme/directory/JustDeleteMeServicesScreen.kt index 3064e315..1ca9693c 100644 --- a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/justdeleteme/directory/JustDeleteMeServicesScreen.kt +++ b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/justdeleteme/directory/JustDeleteMeServicesScreen.kt @@ -3,6 +3,7 @@ package com.artemchep.keyguard.feature.justdeleteme.directory import androidx.compose.runtime.Composable import com.artemchep.keyguard.feature.navigation.NavigationRouter import com.artemchep.keyguard.feature.twopane.TwoPaneNavigationContent +import com.artemchep.keyguard.ui.screenMaxWidthCompact @Composable fun TwoFaServicesScreen() { @@ -10,6 +11,9 @@ fun TwoFaServicesScreen() { id = JustDeleteMeServicesRoute.ROUTER_NAME, initial = JustDeleteMeServiceListRoute, ) { backStack -> - TwoPaneNavigationContent(backStack) + TwoPaneNavigationContent( + backStack, + detailPaneMaxWidth = screenMaxWidthCompact, + ) } } diff --git a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/justgetdata/directory/JustGetMyDataServicesScreen.kt b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/justgetdata/directory/JustGetMyDataServicesScreen.kt index 7624ade4..c1926792 100644 --- a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/justgetdata/directory/JustGetMyDataServicesScreen.kt +++ b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/justgetdata/directory/JustGetMyDataServicesScreen.kt @@ -3,6 +3,7 @@ package com.artemchep.keyguard.feature.justgetdata.directory import androidx.compose.runtime.Composable import com.artemchep.keyguard.feature.navigation.NavigationRouter import com.artemchep.keyguard.feature.twopane.TwoPaneNavigationContent +import com.artemchep.keyguard.ui.screenMaxWidthCompact @Composable fun JustGetMyDataServicesScreen() { @@ -10,6 +11,9 @@ fun JustGetMyDataServicesScreen() { id = JustGetMyDataServicesRoute.ROUTER_NAME, initial = JustGetMyDataListRoute, ) { backStack -> - TwoPaneNavigationContent(backStack) + TwoPaneNavigationContent( + backStack, + detailPaneMaxWidth = screenMaxWidthCompact, + ) } } diff --git a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/passkeys/directory/PasskeysServicesScreen.kt b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/passkeys/directory/PasskeysServicesScreen.kt index 808b5001..cb1424f3 100644 --- a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/passkeys/directory/PasskeysServicesScreen.kt +++ b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/passkeys/directory/PasskeysServicesScreen.kt @@ -3,6 +3,7 @@ package com.artemchep.keyguard.feature.passkeys.directory import androidx.compose.runtime.Composable import com.artemchep.keyguard.feature.navigation.NavigationRouter import com.artemchep.keyguard.feature.twopane.TwoPaneNavigationContent +import com.artemchep.keyguard.ui.screenMaxWidthCompact @Composable fun TwoFaServicesScreen() { @@ -10,6 +11,9 @@ fun TwoFaServicesScreen() { id = PasskeysServicesRoute.ROUTER_NAME, initial = PasskeysServiceListRoute, ) { backStack -> - TwoPaneNavigationContent(backStack) + TwoPaneNavigationContent( + backStack, + detailPaneMaxWidth = screenMaxWidthCompact, + ) } } diff --git a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/tfa/directory/TwoFaServicesScreen.kt b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/tfa/directory/TwoFaServicesScreen.kt index ec2b365f..131f9d1f 100644 --- a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/tfa/directory/TwoFaServicesScreen.kt +++ b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/tfa/directory/TwoFaServicesScreen.kt @@ -3,6 +3,7 @@ package com.artemchep.keyguard.feature.tfa.directory import androidx.compose.runtime.Composable import com.artemchep.keyguard.feature.navigation.NavigationRouter import com.artemchep.keyguard.feature.twopane.TwoPaneNavigationContent +import com.artemchep.keyguard.ui.screenMaxWidthCompact @Composable fun TwoFaServicesScreen() { @@ -10,6 +11,9 @@ fun TwoFaServicesScreen() { id = TwoFaServicesRoute.ROUTER_NAME, initial = TwoFaServiceListRoute, ) { backStack -> - TwoPaneNavigationContent(backStack) + TwoPaneNavigationContent( + backStack, + detailPaneMaxWidth = screenMaxWidthCompact, + ) } } diff --git a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/twopane/TwoPaneNavigation.kt b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/twopane/TwoPaneNavigation.kt index 984776e4..9778406e 100644 --- a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/twopane/TwoPaneNavigation.kt +++ b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/twopane/TwoPaneNavigation.kt @@ -2,17 +2,22 @@ package com.artemchep.keyguard.feature.twopane import androidx.compose.runtime.Composable import androidx.compose.runtime.CompositionLocalProvider +import androidx.compose.ui.unit.Dp import com.artemchep.keyguard.feature.navigation.LocalNavigationNodeVisualStack import com.artemchep.keyguard.feature.navigation.NavigationEntry import com.artemchep.keyguard.feature.navigation.NavigationNode +import com.artemchep.keyguard.ui.screenMaxWidth import kotlinx.collections.immutable.PersistentList import kotlinx.collections.immutable.persistentListOf @Composable fun TwoPaneNavigationContent( backStack: PersistentList, + detailPaneMaxWidth: Dp = screenMaxWidth, ) { - TwoPaneScaffold { + TwoPaneScaffold( + detailPaneMaxWidth = detailPaneMaxWidth, + ) { if (backStack.isEmpty()) { // Nothing to draw, the back stack is empty. return@TwoPaneScaffold diff --git a/common/src/commonMain/kotlin/com/artemchep/keyguard/ui/Scaffold.kt b/common/src/commonMain/kotlin/com/artemchep/keyguard/ui/Scaffold.kt index 835902a5..fb2fe24d 100644 --- a/common/src/commonMain/kotlin/com/artemchep/keyguard/ui/Scaffold.kt +++ b/common/src/commonMain/kotlin/com/artemchep/keyguard/ui/Scaffold.kt @@ -84,6 +84,7 @@ import kotlinx.collections.immutable.ImmutableList import kotlin.math.log10 val screenMaxWidth = 768.dp +val screenMaxWidthCompact = 480.dp private val screenPaddingTop = 8.dp private val screenPaddingBottom = 8.dp