Skip to content

Commit

Permalink
changed series screen
Browse files Browse the repository at this point in the history
  • Loading branch information
DatL4g committed Mar 17, 2024
1 parent bbaeb4f commit 24c4cdd
Show file tree
Hide file tree
Showing 8 changed files with 112 additions and 296 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package dev.datlag.burningseries.shared.ui.screen.initial.favorite

import dev.datlag.burningseries.database.common.mainTitle
import kotlinx.serialization.Serializable
import dev.datlag.burningseries.database.Series as DBSeries

Expand All @@ -11,6 +12,6 @@ sealed class FavoriteConfig {
val href: String,
val coverHref: String?
) : FavoriteConfig() {
constructor(item: DBSeries) : this(item.title, item.href, item.coverHref)
constructor(item: DBSeries) : this(item.mainTitle, item.href, item.coverHref)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,30 +63,15 @@ private fun DefaultView(component: FavoriteComponent) {
@Composable
private fun ExpandedView(component: FavoriteComponent) {
val childState by component.child.subscribeAsState()
var rowWidth by remember { mutableIntStateOf(-1) }

Row(
modifier = Modifier.onSizeChanged {
rowWidth = it.width
},
horizontalArrangement = Arrangement.spacedBy(16.dp)
) {
val colOne = if (rowWidth > 600) {
val third = remember(rowWidth) { rowWidth.toFloat() / 3F }
if (third >= 200F) {
Modifier.widthIn(max = third.dp)
} else {
Modifier.weight(1F)
}
} else {
Modifier.weight(1F)
}

MainView(component, colOne)
MainView(component, Modifier.weight(1F))

childState.child?.also { (_, instance) ->
Box(
modifier = Modifier.defaultMinSize(minWidth = 400.dp)
modifier = Modifier.weight(2F)
) {
instance.render()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ sealed class HomeConfig {
val href: String,
val coverHref: String?,
) : HomeConfig() {
constructor(series: Home.Series) : this(series.title, series.href, series.coverHref)
constructor(series: Home.Series) : this(series.mainTitle, series.href, series.coverHref)
constructor(episode: Home.Episode) : this(episode.series ?: episode.fullTitle, episode.href, episode.coverHref)
constructor(item: Genre.Item) : this(item.title, item.href, null)
constructor(item: Genre.Item) : this(item.mainTitle, item.href, null)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ interface SeriesComponent : Component {
val dialog: Value<ChildSlot<DialogConfig, DialogComponent>>

val title: StateFlow<String>
val subTitle: StateFlow<String?>
val href: StateFlow<String>
val commonHref: StateFlow<String>
val coverHref: StateFlow<String?>
Expand Down
Loading

0 comments on commit 24c4cdd

Please sign in to comment.