Skip to content

Commit

Permalink
hide edit if anime is not released yet
Browse files Browse the repository at this point in the history
  • Loading branch information
DatL4g committed Mar 28, 2024
1 parent 7243848 commit 55e8a01
Showing 1 changed file with 18 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import dev.chrisbanes.haze.materials.HazeMaterials
import dev.datlag.aniflow.LocalHaze
import dev.datlag.aniflow.LocalPaddingValues
import dev.datlag.aniflow.SharedRes
import dev.datlag.aniflow.anilist.type.MediaStatus
import dev.datlag.aniflow.common.*
import dev.datlag.aniflow.other.StateSaver
import dev.datlag.aniflow.ui.custom.EditFAB
Expand All @@ -48,6 +49,7 @@ import dev.datlag.aniflow.ui.navigation.screen.medium.component.CharacterCard
import dev.datlag.tooling.compose.onClick
import dev.datlag.tooling.decompose.lifecycle.collectAsStateWithLifecycle
import dev.icerock.moko.resources.compose.stringResource
import kotlinx.coroutines.flow.map
import kotlin.math.max

@OptIn(ExperimentalMaterial3Api::class, ExperimentalHazeMaterialsApi::class)
Expand Down Expand Up @@ -165,14 +167,23 @@ fun MediumScreen(component: MediumComponent) {
}
},
floatingActionButton = {
EditFAB(
onRate = {
component.login()
},
onProgress = {

}
val notReleased by component.status.map {
it == MediaStatus.UNKNOWN__ || it == MediaStatus.NOT_YET_RELEASED
}.collectAsStateWithLifecycle(
initialValue = component.status.value == MediaStatus.UNKNOWN__
|| component.status.value == MediaStatus.NOT_YET_RELEASED
)

if (!notReleased) {
EditFAB(
onRate = {
component.login()
},
onProgress = {

}
)
}
}
) {
CompositionLocalProvider(
Expand Down

0 comments on commit 55e8a01

Please sign in to comment.