From d57854001e2431a61ea716f1befa7889399eac03 Mon Sep 17 00:00:00 2001 From: Kevin Phoenix Date: Tue, 13 Jun 2023 03:19:11 -0700 Subject: [PATCH] Add communities list to sidebar (#512) Co-authored-by: Dessalines --- .../java/com/jerboa/ui/components/home/Home.kt | 14 ++++++++++++++ .../com/jerboa/ui/components/home/HomeActivity.kt | 4 ++++ app/src/main/res/values/strings.xml | 1 + 3 files changed, 19 insertions(+) diff --git a/app/src/main/java/com/jerboa/ui/components/home/Home.kt b/app/src/main/java/com/jerboa/ui/components/home/Home.kt index 9e88184b9..9ff50865d 100644 --- a/app/src/main/java/com/jerboa/ui/components/home/Home.kt +++ b/app/src/main/java/com/jerboa/ui/components/home/Home.kt @@ -25,6 +25,7 @@ import androidx.compose.material.icons.outlined.ExpandLess import androidx.compose.material.icons.outlined.ExpandMore import androidx.compose.material.icons.outlined.FilterList import androidx.compose.material.icons.outlined.Info +import androidx.compose.material.icons.outlined.List import androidx.compose.material.icons.outlined.LocationCity import androidx.compose.material.icons.outlined.Login import androidx.compose.material.icons.outlined.Menu @@ -106,6 +107,7 @@ fun Drawer( onClickInbox: () -> Unit, onClickSaved: () -> Unit, onClickSettings: () -> Unit, + onClickCommunities: () -> Unit, unreadCounts: GetUnreadCountResponse?, isOpen: Boolean, ) { @@ -135,6 +137,7 @@ fun Drawer( onClickInbox = onClickInbox, onClickSaved = onClickSaved, onClickSettings = onClickSettings, + onClickCommunities = onClickCommunities, ) } @@ -151,6 +154,7 @@ fun DrawerContent( onClickInbox: () -> Unit, onClickSaved: () -> Unit, onClickSettings: () -> Unit, + onClickCommunities: () -> Unit, myUserInfo: MyUserInfo?, unreadCounts: GetUnreadCountResponse?, ) { @@ -177,6 +181,7 @@ fun DrawerContent( onClickSaved = onClickSaved, unreadCounts = unreadCounts, onClickSettings = onClickSettings, + onClickCommunities = onClickCommunities, ) } } @@ -188,6 +193,7 @@ fun DrawerItemsMain( onClickProfile: () -> Unit, onClickInbox: () -> Unit, onClickSettings: () -> Unit, + onClickCommunities: () -> Unit, onClickListingType: (ListingType) -> Unit, onCommunityClick: (community: CommunitySafe) -> Unit, unreadCounts: GetUnreadCountResponse? = null, @@ -233,6 +239,13 @@ fun DrawerItemsMain( ) } } + item { + IconAndTextDrawerItem( + text = stringResource(R.string.home_communities), + icon = Icons.Outlined.List, + onClick = onClickCommunities, + ) + } item { Divider() } @@ -301,6 +314,7 @@ fun DrawerItemsMainPreview() { onCommunityClick = {}, onClickSaved = {}, onClickSettings = {}, + onClickCommunities = {}, ) } diff --git a/app/src/main/java/com/jerboa/ui/components/home/HomeActivity.kt b/app/src/main/java/com/jerboa/ui/components/home/HomeActivity.kt index 249aa799c..13331ac5b 100644 --- a/app/src/main/java/com/jerboa/ui/components/home/HomeActivity.kt +++ b/app/src/main/java/com/jerboa/ui/components/home/HomeActivity.kt @@ -375,6 +375,10 @@ fun MainDrawer( navController.navigate(route = "settings") closeDrawer(scope, drawerState) }, + onClickCommunities = { + navController.navigate(route = "communityList") + closeDrawer(scope, drawerState) + }, ) } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 6c1a4e30d..6d732c1cf 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -73,6 +73,7 @@ Local All Saved + Communities Profile Inbox Settings