-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding community sidebars. Fixes #44
- Loading branch information
1 parent
f55288b
commit dcb18e7
Showing
9 changed files
with
217 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
app/src/main/java/com/jerboa/ui/components/community/sidebar/CommunitySidebar.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.jerboa.ui.components.community.sidebar | ||
|
||
import androidx.compose.runtime.Composable | ||
import com.jerboa.datatypes.CommunityView | ||
import com.jerboa.ui.components.common.Sidebar | ||
|
||
@Composable | ||
fun CommunitySidebar(communityView: CommunityView) { | ||
val community = communityView.community | ||
val counts = communityView.counts | ||
Sidebar( | ||
title = community.title, | ||
content = community.description, | ||
banner = community.banner, | ||
icon = community.icon, | ||
published = community.published, | ||
usersActiveMonth = counts.users_active_month, | ||
postCount = counts.posts, | ||
commentCount = counts.comments, | ||
) | ||
} |
37 changes: 37 additions & 0 deletions
37
app/src/main/java/com/jerboa/ui/components/community/sidebar/CommunitySidebarActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.jerboa.ui.components.community.sidebar | ||
|
||
import android.util.Log | ||
import androidx.compose.material.MaterialTheme | ||
import androidx.compose.material.Scaffold | ||
import androidx.compose.material.Surface | ||
import androidx.compose.runtime.Composable | ||
import androidx.navigation.NavController | ||
import com.jerboa.ui.components.common.SimpleTopAppBar | ||
import com.jerboa.ui.components.community.CommunityViewModel | ||
|
||
@Composable | ||
fun CommunitySidebarActivity( | ||
communityViewModel: CommunityViewModel, | ||
navController: NavController, | ||
) { | ||
|
||
Log.d("jerboa", "got to community sidebar activity") | ||
|
||
val title = "${communityViewModel.communityView?.community?.name} Sidebar" | ||
|
||
Surface(color = MaterialTheme.colors.background) { | ||
Scaffold( | ||
topBar = { | ||
SimpleTopAppBar( | ||
text = title, | ||
navController = navController | ||
) | ||
}, | ||
content = { | ||
communityViewModel.communityView?.also { | ||
CommunitySidebar(it) | ||
} | ||
} | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 0 additions & 85 deletions
85
app/src/main/java/com/jerboa/ui/components/home/Sidebar.kt
This file was deleted.
Oops, something went wrong.
29 changes: 29 additions & 0 deletions
29
app/src/main/java/com/jerboa/ui/components/home/sidebar/SiteSidebar.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.jerboa.ui.components.home.sidebar | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import com.jerboa.datatypes.SiteView | ||
import com.jerboa.datatypes.sampleSiteView | ||
import com.jerboa.ui.components.common.Sidebar | ||
|
||
@Composable | ||
fun SiteSidebar(siteView: SiteView) { | ||
val site = siteView.site | ||
val counts = siteView.counts | ||
Sidebar( | ||
title = site.description, | ||
content = site.sidebar, | ||
banner = site.banner, | ||
icon = site.icon, | ||
published = site.published, | ||
usersActiveMonth = counts.users_active_month, | ||
postCount = counts.posts, | ||
commentCount = counts.comments, | ||
) | ||
} | ||
|
||
@Preview | ||
@Composable | ||
fun SiteSidebarPreview() { | ||
SiteSidebar(siteView = sampleSiteView) | ||
} |
Oops, something went wrong.