Skip to content

Commit

Permalink
Add communities list to sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
twizmwazin committed Jun 11, 2023
1 parent 4b330ba commit 12443b9
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 @@ -134,6 +136,7 @@ fun Drawer(
onClickInbox = onClickInbox,
onClickSaved = onClickSaved,
onClickSettings = onClickSettings,
onClickCommunities = onClickCommunities,
)
}

Expand All @@ -150,6 +153,7 @@ fun DrawerContent(
onClickInbox: () -> Unit,
onClickSaved: () -> Unit,
onClickSettings: () -> Unit,
onClickCommunities: () -> Unit,
myUserInfo: MyUserInfo?,
unreadCounts: GetUnreadCountResponse?,
) {
Expand All @@ -176,6 +180,7 @@ fun DrawerContent(
onClickSaved = onClickSaved,
unreadCounts = unreadCounts,
onClickSettings = onClickSettings,
onClickCommunities = onClickCommunities,
)
}
}
Expand All @@ -187,6 +192,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 @@ -232,6 +238,13 @@ fun DrawerItemsMain(
)
}
}
item {
IconAndTextDrawerItem(
text = stringResource(R.string.home_communities),
icon = Icons.Outlined.List,
onClick = onClickCommunities,
)
}
item {
Divider()
}
Expand Down Expand Up @@ -299,6 +312,7 @@ fun DrawerItemsMainPreview() {
onCommunityClick = {},
onClickSaved = {},
onClickSettings = {},
onClickCommunities = {},
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,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 @@ -69,6 +69,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 12443b9

Please sign in to comment.