package com.suno.android.ui.screens.hooks.home.component import androidx.annotation.OptIn import androidx.compose.foundation.background import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.alpha import androidx.compose.ui.graphics.Brush import androidx.compose.ui.graphics.Color import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.SpanStyle import androidx.compose.ui.text.buildAnnotatedString import androidx.compose.ui.text.font.FontStyle import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp import androidx.media3.common.Player import androidx.media3.common.util.UnstableApi import androidx.media3.ui.compose.PlayerSurface import androidx.media3.ui.compose.SURFACE_TYPE_TEXTURE_VIEW import androidx.media3.ui.compose.modifiers.resizeWithContentScale import androidx.media3.ui.compose.state.rememberPresentationState import com.suno.android.common_res.R import com.suno.android.common_ui.components.buttons.SunoMediumButton import com.suno.android.common_ui.theme.ExtendedTheme private const val GRADIENT_TOP_PERCENT = .073f private const val GRADIENT_BOTTOM_PERCENT = .5582f private const val GRADIENT_BLACK_COLOR = 0xFF191919 @OptIn(UnstableApi::class) @Composable fun HooksOnboardingContent( player: Player, onExploreClick: () -> Unit, modifier: Modifier = Modifier, ) { val playerPresentationState = rememberPresentationState(player) Box(modifier = modifier) { PlayerSurface( player = player, surfaceType = SURFACE_TYPE_TEXTURE_VIEW, modifier = Modifier .matchParentSize() .resizeWithContentScale(contentScale = ContentScale.Crop, playerPresentationState.videoSizeDp) .alpha( if (playerPresentationState.coverSurface) 0f else 1f, ), ) Column( horizontalAlignment = Alignment.CenterHorizontally, modifier = Modifier .align(Alignment.BottomCenter) .fillMaxWidth() .background( brush = Brush.verticalGradient( GRADIENT_TOP_PERCENT to Color.Transparent, GRADIENT_BOTTOM_PERCENT to Color(GRADIENT_BLACK_COLOR), ), ) .padding( top = 163.dp, // space for gradient to fade out start = 16.dp, end = 16.dp, bottom = 50.dp, ), ) { Text( text = buildAnnotatedString { append(stringResource(R.string.hooks_onboarding_title_prefix)) append(" ") pushStyle(SpanStyle(fontStyle = FontStyle.Italic)) append(stringResource(R.string.hooks_onboarding_title_italicized)) }, style = ExtendedTheme.typography.mediumHeadline, textAlign = TextAlign.Center, color = ExtendedTheme.colors.textPrimary, ) Spacer(Modifier.height(16.dp)) Text( text = stringResource(R.string.hooks_onboarding_body), style = ExtendedTheme.typography.largeSubtitle, textAlign = TextAlign.Center, color = ExtendedTheme.colors.textPrimary, ) Spacer(Modifier.height(24.dp)) SunoMediumButton( text = stringResource(R.string.hooks_onboarding_button), onClick = onExploreClick, ) } } }