Skip to content

Commit

Permalink
Add communities list to sidebar (#512)
Browse files Browse the repository at this point in the history
Co-authored-by: Dessalines <[email protected]>
  • Loading branch information
twizmwazin and dessalines authored Jun 13, 2023
1 parent 89325fc commit d578540
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
14 changes: 14 additions & 0 deletions app/src/main/java/com/jerboa/ui/components/home/Home.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -106,6 +107,7 @@ fun Drawer(
onClickInbox: () -> Unit,
onClickSaved: () -> Unit,
onClickSettings: () -> Unit,
onClickCommunities: () -> Unit,
unreadCounts: GetUnreadCountResponse?,
isOpen: Boolean,
) {
Expand Down Expand Up @@ -135,6 +137,7 @@ fun Drawer(
onClickInbox = onClickInbox,
onClickSaved = onClickSaved,
onClickSettings = onClickSettings,
onClickCommunities = onClickCommunities,
)
}

Expand All @@ -151,6 +154,7 @@ fun DrawerContent(
onClickInbox: () -> Unit,
onClickSaved: () -> Unit,
onClickSettings: () -> Unit,
onClickCommunities: () -> Unit,
myUserInfo: MyUserInfo?,
unreadCounts: GetUnreadCountResponse?,
) {
Expand All @@ -177,6 +181,7 @@ fun DrawerContent(
onClickSaved = onClickSaved,
unreadCounts = unreadCounts,
onClickSettings = onClickSettings,
onClickCommunities = onClickCommunities,
)
}
}
Expand All @@ -188,6 +193,7 @@ fun DrawerItemsMain(
onClickProfile: () -> Unit,
onClickInbox: () -> Unit,
onClickSettings: () -> Unit,
onClickCommunities: () -> Unit,
onClickListingType: (ListingType) -> Unit,
onCommunityClick: (community: CommunitySafe) -> Unit,
unreadCounts: GetUnreadCountResponse? = null,
Expand Down Expand Up @@ -233,6 +239,13 @@ fun DrawerItemsMain(
)
}
}
item {
IconAndTextDrawerItem(
text = stringResource(R.string.home_communities),
icon = Icons.Outlined.List,
onClick = onClickCommunities,
)
}
item {
Divider()
}
Expand Down Expand Up @@ -301,6 +314,7 @@ fun DrawerItemsMainPreview() {
onCommunityClick = {},
onClickSaved = {},
onClickSettings = {},
onClickCommunities = {},
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,10 @@ fun MainDrawer(
navController.navigate(route = "settings")
closeDrawer(scope, drawerState)
},
onClickCommunities = {
navController.navigate(route = "communityList")
closeDrawer(scope, drawerState)
},
)
}

Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
<string name="home_local">Local</string>
<string name="home_all">All</string>
<string name="home_saved">Saved</string>
<string name="home_communities">Communities</string>
<string name="home_profile">Profile</string>
<string name="home_inbox">Inbox</string>
<string name="home_settings">Settings</string>
Expand Down

0 comments on commit d578540

Please sign in to comment.