diff --git a/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/component/HidingNavigationBar.kt b/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/component/HidingNavigationBar.kt index 8bd588b..dce5c30 100644 --- a/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/component/HidingNavigationBar.kt +++ b/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/component/HidingNavigationBar.kt @@ -44,9 +44,10 @@ fun HidingNavigationBar( visible: Boolean, selected: NavigationBarState, loggedIn: Flow, + listClickable: Boolean = false, onDiscover: () -> Unit, onHome: () -> Unit, - onFavorites: () -> Unit + onList: (isLoggedIn: Boolean) -> Unit ) { val density = LocalDensity.current @@ -83,7 +84,7 @@ fun HidingNavigationBar( val isHome = remember(selected) { selected is NavigationBarState.Home } - val isFavorites = remember(selected) { + val isList = remember(selected) { selected is NavigationBarState.Favorite } val isLoggedIn by loggedIn.collectAsStateWithLifecycle(false) @@ -124,12 +125,12 @@ fun HidingNavigationBar( ) NavigationBarItem( onClick = { - if (!isFavorites) { - onFavorites() + if (!isList) { + onList(isLoggedIn) } }, - selected = isFavorites, - enabled = isLoggedIn, + selected = isList, + enabled = isLoggedIn || listClickable, icon = { Icon( imageVector = selected.favoriteIcon, diff --git a/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/discover/DiscoverScreen.kt b/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/discover/DiscoverScreen.kt index 727504e..0f8b46e 100644 --- a/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/discover/DiscoverScreen.kt +++ b/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/discover/DiscoverScreen.kt @@ -130,7 +130,9 @@ fun DiscoverScreen(component: DiscoverComponent) { loggedIn = component.loggedIn, onDiscover = { }, onHome = component::viewHome, - onFavorites = component::viewList + onList = { + component.viewList() + } ) } ) { targetPadding -> diff --git a/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/favorites/FavoritesScreen.kt b/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/favorites/FavoritesScreen.kt index ae4c89d..2415aed 100644 --- a/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/favorites/FavoritesScreen.kt +++ b/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/favorites/FavoritesScreen.kt @@ -152,7 +152,7 @@ fun FavoritesScreen(component: FavoritesComponent) { loggedIn = flowOf(true), onDiscover = component::viewDiscover, onHome = component::viewHome, - onFavorites = { } + onList = { } ) } ) { padding -> diff --git a/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/home/HomeScreen.kt b/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/home/HomeScreen.kt index 15f4361..64148a4 100644 --- a/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/home/HomeScreen.kt +++ b/composeApp/src/commonMain/kotlin/dev/datlag/aniflow/ui/navigation/screen/home/HomeScreen.kt @@ -170,9 +170,16 @@ fun HomeScreen(component: HomeComponent) { visible = listState.scrollUpVisible(), selected = NavigationBarState.Home, loggedIn = component.loggedIn, + listClickable = true, onDiscover = component::viewDiscover, onHome = { }, - onFavorites = component::viewFavorites + onList = { loggedIn -> + if (loggedIn) { + component.viewFavorites() + } else { + component.viewProfile() + } + }, ) } ) { targetPadding ->