Skip to content

Commit

Permalink
MBL-1255: [UI] Create Checkout Screen (#1982)
Browse files Browse the repository at this point in the history
  • Loading branch information
leighdouglas authored Mar 20, 2024
1 parent 8230263 commit 121efab
Show file tree
Hide file tree
Showing 10 changed files with 1,061 additions and 163 deletions.
149 changes: 134 additions & 15 deletions app/src/main/assets/json/server-config.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -332,147 +332,17 @@ fun ConfirmPledgeDetailsScreen(
}
} else {
item {
Column(
modifier = Modifier
.fillMaxWidth()
.background(color = colors.backgroundSurfacePrimary)
.padding(
start = dimensions.paddingMedium,
end = dimensions.paddingMedium,
bottom = dimensions.paddingLarge,
top = dimensions.paddingMediumLarge
)
) {
Text(
text = stringResource(id = R.string.Your_pledge),
style = typography.headline,
color = colors.textPrimary
)

if (deliveryDateString.isNotEmpty()) {
Spacer(modifier = Modifier.height(dimensions.paddingXSmall))

Text(
text = deliveryDateString,
style = typography.caption1,
color = colors.textSecondary
)
}

Spacer(modifier = Modifier.height(dimensions.paddingMedium))

KSDividerLineGrey()

rewardsList.forEach {
Spacer(modifier = Modifier.height(dimensions.paddingMedium))

Row {
Text(
text = it.first,
style = typography.subheadlineMedium,
color = colors.textSecondary
)

Spacer(modifier = Modifier.weight(1f))

Text(
text = it.second,
style = typography.subheadlineMedium,
color = colors.textSecondary
)
}

Spacer(modifier = Modifier.height(dimensions.paddingMedium))

KSDividerLineGrey()
}

if (shippingAmount.isNotEmpty()) {
Spacer(modifier = Modifier.height(dimensions.paddingMedium))

Row {
Text(
text = ksString?.format(
stringResource(id = R.string.Shipping_to_country),
"country",
totalAmount
) ?: "Shipping: $initialShippingLocation",
style = typography.subheadlineMedium,
color = colors.textSecondary
)

Spacer(modifier = Modifier.weight(1f))

Text(
text = shippingAmount,
style = typography.subheadlineMedium,
color = colors.textSecondary
)
}

Spacer(modifier = Modifier.height(dimensions.paddingMedium))

KSDividerLineGrey()
}

if (totalBonusSupport != initialBonusSupport) {
Spacer(modifier = Modifier.height(dimensions.paddingMedium))

Row {
Text(
text = stringResource(id = R.string.Bonus_support),
style = typography.subheadlineMedium,
color = colors.textSecondary
)

Spacer(modifier = Modifier.weight(1f))

Text(
text = totalBonusSupport,
style = typography.subheadlineMedium,
color = colors.textSecondary
)
}

Spacer(modifier = Modifier.height(dimensions.paddingMedium))

KSDividerLineGrey()
}

Spacer(modifier = Modifier.height(dimensions.paddingMedium))

Row {
Text(
text = stringResource(id = R.string.Total_amount),
style = typography.calloutMedium,
color = colors.textPrimary
)

Spacer(modifier = Modifier.weight(1f))

Column(horizontalAlignment = Alignment.End) {
Text(
text = totalAmount,
style = typography.subheadlineMedium,
color = colors.textPrimary
)

if (totalAmountCurrencyConverted.isNotEmpty()) {
Spacer(modifier = Modifier.height(dimensions.paddingXSmall))

Text(
text = ksString?.format(
stringResource(id = R.string.About_reward_amount),
"reward_amount",
totalAmount
) ?: "About $totalAmount",
style = typography.footnote,
color = colors.textPrimary
)
}
}
}
}
ItemizedRewardListContainer(
ksString = ksString,
rewardsList = rewardsList,
shippingAmount = shippingAmount,
initialShippingLocation = initialShippingLocation,
totalAmount = totalAmount,
totalAmountCurrencyConverted = totalAmountCurrencyConverted,
initialBonusSupport = initialBonusSupport,
totalBonusSupport = totalBonusSupport,
deliveryDateString = deliveryDateString
)
}
}
}
Expand Down Expand Up @@ -547,3 +417,159 @@ fun BonusSupportContainer(
}
}
}

@Composable
fun ItemizedRewardListContainer(
ksString: KSString? = null,
rewardsList: List<Pair<String, String>> = listOf(),
shippingAmount: String = "",
initialShippingLocation: String? = null,
totalAmount: String,
totalAmountCurrencyConverted: String = "",
initialBonusSupport: String,
totalBonusSupport: String,
deliveryDateString: String = ""

) {
Column(
modifier = Modifier
.fillMaxWidth()
.background(color = colors.backgroundSurfacePrimary)
.padding(
start = dimensions.paddingMedium,
end = dimensions.paddingMedium,
bottom = dimensions.paddingLarge,
top = dimensions.paddingMediumLarge
)
) {
Text(
text = stringResource(id = R.string.Your_pledge),
style = typography.headline,
color = colors.textPrimary
)

if (deliveryDateString.isNotEmpty()) {
Spacer(modifier = Modifier.height(dimensions.paddingXSmall))

Text(
text = deliveryDateString,
style = typography.caption1,
color = colors.textSecondary
)
}

Spacer(modifier = Modifier.height(dimensions.paddingMedium))

KSDividerLineGrey()

rewardsList.forEach {
Spacer(modifier = Modifier.height(dimensions.paddingMedium))

Row {
Text(
text = it.first,
style = typography.subheadlineMedium,
color = colors.textSecondary
)

Spacer(modifier = Modifier.weight(1f))

Text(
text = it.second,
style = typography.subheadlineMedium,
color = colors.textSecondary
)
}

Spacer(modifier = Modifier.height(dimensions.paddingMedium))

KSDividerLineGrey()
}

if (shippingAmount.isNotEmpty()) {
Spacer(modifier = Modifier.height(dimensions.paddingMedium))

Row {
Text(
text = ksString?.format(
stringResource(id = R.string.Shipping_to_country),
"country",
totalAmount
) ?: "Shipping: $initialShippingLocation",
style = typography.subheadlineMedium,
color = colors.textSecondary
)

Spacer(modifier = Modifier.weight(1f))

Text(
text = shippingAmount,
style = typography.subheadlineMedium,
color = colors.textSecondary
)
}

Spacer(modifier = Modifier.height(dimensions.paddingMedium))

KSDividerLineGrey()
}

if (totalBonusSupport != initialBonusSupport) {
Spacer(modifier = Modifier.height(dimensions.paddingMedium))

Row {
Text(
text = stringResource(id = R.string.Bonus_support),
style = typography.subheadlineMedium,
color = colors.textSecondary
)

Spacer(modifier = Modifier.weight(1f))

Text(
text = totalBonusSupport,
style = typography.subheadlineMedium,
color = colors.textSecondary
)
}

Spacer(modifier = Modifier.height(dimensions.paddingMedium))

KSDividerLineGrey()
}

Spacer(modifier = Modifier.height(dimensions.paddingMedium))

Row {
Text(
text = stringResource(id = R.string.Total_amount),
style = typography.calloutMedium,
color = colors.textPrimary
)

Spacer(modifier = Modifier.weight(1f))

Column(horizontalAlignment = Alignment.End) {
Text(
text = totalAmount,
style = typography.subheadlineMedium,
color = colors.textPrimary
)

if (totalAmountCurrencyConverted.isNotEmpty()) {
Spacer(modifier = Modifier.height(dimensions.paddingXSmall))

Text(
text = ksString?.format(
stringResource(id = R.string.About_reward_amount),
"reward_amount",
totalAmount
) ?: "About $totalAmount",
style = typography.footnote,
color = colors.textPrimary
)
}
}
}
}
}
8 changes: 8 additions & 0 deletions app/src/main/java/com/kickstarter/ui/compose/KSRewardCard.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.kickstarter.R
import com.kickstarter.ui.activities.compose.login.LogInSignUpClickableDisclaimerText
import com.kickstarter.ui.compose.designsystem.KSGreenBadge
import com.kickstarter.ui.compose.designsystem.KSPrimaryGreenButton
import com.kickstarter.ui.compose.designsystem.KSTheme
Expand Down Expand Up @@ -228,6 +229,13 @@ fun KSRewardCard(
Spacer(modifier = Modifier.height(dimensions.paddingMediumLarge))
}

LogInSignUpClickableDisclaimerText(
onPrivacyPolicyClicked = {},
onCookiePolicyClicked = {},
onTermsOfUseClicked = {}

)

FlowRow(
horizontalArrangement = Arrangement.spacedBy(6.dp),
verticalArrangement = Arrangement.spacedBy(6.dp),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ data class KSDimensions(
val appBarSearchPadding: Dp = Dp.Unspecified,
val clickableButtonHeight: Dp = Dp.Unspecified,
val dottedListDotSize: Dp = Dp.Unspecified,
val countryInputWidth: Dp = Dp.Unspecified
val countryInputWidth: Dp = Dp.Unspecified,
val storedCardImageHeight: Dp = Dp.Unspecified,
val storedCardImageWidth: Dp = Dp.Unspecified
)

val LocalKSCustomDimensions = staticCompositionLocalOf {
Expand Down Expand Up @@ -108,5 +110,7 @@ val KSStandardDimensions = KSDimensions(
appBarSearchPadding = 6.dp,
clickableButtonHeight = 48.dp,
dottedListDotSize = 2.dp,
countryInputWidth = 164.dp
countryInputWidth = 164.dp,
storedCardImageHeight = 40.dp,
storedCardImageWidth = 64.dp
)
Loading

0 comments on commit 121efab

Please sign in to comment.