package com.suno.android.common_ui.components.dialogs import androidx.compose.foundation.Image import androidx.compose.foundation.background import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.width import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.Text import androidx.compose.material3.TextButton import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.Brush import androidx.compose.ui.graphics.Color import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.res.painterResource import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import com.suno.android.common_ui.R import com.suno.android.common_ui.components.buttons.RoundedPillContainer import com.suno.android.common_ui.theme.ExtendedTheme import com.suno.android.common_ui.theme.SunoTheme @Composable fun InAppReviewDialog( modifier: Modifier = Modifier, leftActionTitle: String, onLeftActionClick: () -> Unit, rightActionTitle: String, onRightActionClick: () -> Unit, topDisplayContent: @Composable () -> Unit, ) { Box( modifier = Modifier .width(310.dp) .height(410.dp) .clip( RoundedCornerShape( 8.dp, ), ), ) { Image( modifier = Modifier.fillMaxSize(), painter = painterResource(id = R.drawable.bg_review_prompt), contentDescription = null, contentScale = ContentScale.Crop, ) Column( modifier = Modifier .fillMaxSize() .background( brush = Brush.verticalGradient( colors = listOf( Color(0x00000000), Color(0xAA000000), ), ), ), ) { Box( modifier = Modifier .weight(1f) .fillMaxWidth(), contentAlignment = Alignment.Center, ) { topDisplayContent.invoke() } Row( modifier = Modifier .height(64.dp) .fillMaxWidth() .padding(horizontal = 16.dp), horizontalArrangement = Arrangement.SpaceBetween, ) { TextButton( onClick = { onLeftActionClick.invoke() }, ) { Text( text = leftActionTitle, color = Color.White, style = ExtendedTheme.typography.body, ) } RoundedPillContainer( backgroundColorOverride = Color.White, onClick = { onRightActionClick.invoke() }, ) { Text( text = rightActionTitle, style = ExtendedTheme.typography.body, color = Color.Black, ) } } } } } @Preview @Composable private fun InAppReviewDialog_Preview() { SunoTheme { InAppReviewDialog( leftActionTitle = "Meh", rightActionTitle = "Yes! \u2764\uFE0F", onLeftActionClick = {}, onRightActionClick = {}, topDisplayContent = {}, ) } } @Preview @Composable private fun InAppReviewDialog_Preview_With_Content() { SunoTheme { InAppReviewDialog( leftActionTitle = "Meh", rightActionTitle = "Yes! \u2764\uFE0F", onLeftActionClick = {}, onRightActionClick = {}, topDisplayContent = { Column( horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.Center, ) { Text( modifier = Modifier.width(250.dp), text = "Is Suno rocking your world?", style = ExtendedTheme.typography.categoryHeadline.copy( fontSize = 40.sp, lineHeight = 40.sp, ), color = Color.White, textAlign = TextAlign.Center, ) Text( modifier = Modifier .padding(top = 20.dp) .width(180.dp), text = "We noticed you've been using the app a lot!", style = ExtendedTheme.typography.smallBody, color = Color.White, textAlign = TextAlign.Center, ) } }, ) } }