package com.servicebook.ui.components import androidx.compose.foundation.layout.PaddingValues import androidx.compose.material3.Scaffold import androidx.compose.material3.SnackbarHost import androidx.compose.material3.SnackbarHostState import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier /** * A specialized [Scaffold] that manages the visibility of the [PaywallInfoSheet]. * * If [showPaywallSheet] is true, the sheet is displayed. The content of the sheet * is determined by [isPremiumPending]: if true, it shows a "pending purchase" * message; if false, it shows the standard "upgrade required" message. * * @param showPaywallSheet Whether the paywall info sheet is currently displayed. * @param isPremiumPending Whether a purchase is currently pending, changing the sheet content. * @param onDismissPaywallSheet Callback when the sheet is dismissed by the user. * @param snackbarHostState State for the snackbar host, passed to the sheet for purchase results. * @param topBar Top app bar of the screen. * @param modifier Modifier for the scaffold. * @param floatingActionButton Optional floating action button. * @param snackbarHost Optional snackbar host. * @param content Screen content. */ @Composable fun PaywallScaffold( snackbarHostState: SnackbarHostState, topBar: @Composable () -> Unit, modifier: Modifier = Modifier, showPaywallSheet: Boolean = false, isPremiumPending: Boolean = false, onDismissPaywallSheet: () -> Unit = {}, floatingActionButton: @Composable () -> Unit = {}, snackbarHost: @Composable () -> Unit = { SnackbarHost(snackbarHostState) }, content: @Composable (PaddingValues) -> Unit, ) { if (showPaywallSheet) { PaywallInfoSheet( isPendingPurchase = isPremiumPending, onDismiss = onDismissPaywallSheet, snackbarHostState = snackbarHostState, ) } Scaffold( topBar = topBar, floatingActionButton = floatingActionButton, snackbarHost = snackbarHost, modifier = modifier, ) { innerPadding -> content(innerPadding) } }