Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
3763e37
First pass at design update
backwardstruck Jul 29, 2024
7cf0eaa
Use string resource
backwardstruck Jul 29, 2024
b68c08d
Clean up background
backwardstruck Jul 29, 2024
6354e71
Use new copy
backwardstruck Jul 29, 2024
c0e68d3
Update background color
backwardstruck Jul 29, 2024
a5c4c6f
Use adaptive padding
backwardstruck Jul 29, 2024
aa18288
Merge branch 'trunk' into 11828-woo-pos-m2-match-design-for-success-s…
backwardstruck Jul 30, 2024
b50eea9
Merge branch 'trunk' into 11828-woo-pos-m2-match-design-for-success-s…
backwardstruck Jul 30, 2024
77a0e15
Merge branch 'trunk' into 11828-woo-pos-m2-match-design-for-success-s…
backwardstruck Jul 31, 2024
957e4a5
Update text color
backwardstruck Jul 31, 2024
fcbcd3a
Update icon color
backwardstruck Jul 31, 2024
426024a
Merge branch 'trunk' into 11828-woo-pos-m2-match-design-for-success-s…
backwardstruck Jul 31, 2024
80053dd
Adapt to dark mode
backwardstruck Jul 31, 2024
9fd61ac
Detekt
backwardstruck Jul 31, 2024
91065e7
Set button width
backwardstruck Jul 31, 2024
2cacece
Set icon size
backwardstruck Jul 31, 2024
26ee5cc
Merge branch 'trunk' into 11828-woo-pos-m2-match-design-for-success-s…
backwardstruck Jul 31, 2024
5010eda
Merge branch 'trunk' into 11828-woo-pos-m2-match-design-for-success-s…
backwardstruck Jul 31, 2024
dfede7c
Merge branch 'trunk' into 11828-woo-pos-m2-match-design-for-success-s…
backwardstruck Aug 1, 2024
c785335
Merge branch 'trunk' into 11828-woo-pos-m2-match-design-for-success-s…
backwardstruck Aug 1, 2024
1b6f5b7
Merge branch 'trunk' into 11828-woo-pos-m2-match-design-for-success-s…
backwardstruck Aug 1, 2024
c4789e2
Looks like we no longer need this padding
backwardstruck Aug 1, 2024
4578e7d
Bump up text size
backwardstruck Aug 1, 2024
e48872b
Adjust button height
backwardstruck Aug 1, 2024
336623b
Merge branch 'trunk' into 11828-woo-pos-m2-match-design-for-success-s…
backwardstruck Aug 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -128,17 +128,6 @@ private fun WooPosHomeScreen(
label = "cartOverlayAnimated"
)

val totalsStartPaddingAnimatedDp by animateDpAsState(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was added here but as far as I can tell, we don't need it anymore. If that's not the case I will put it back. FYI @kidinov

when (state.screenPositionState) {
is WooPosHomeState.ScreenPositionState.Cart,
WooPosHomeState.ScreenPositionState.Checkout.NotPaid ->
0.dp.toAdaptivePadding()

WooPosHomeState.ScreenPositionState.Checkout.Paid -> 24.dp.toAdaptivePadding()
},
label = "totalsStartPaddingAnimatedDp"
)

val scrollState = buildScrollStateForNavigationBetweenState(state.screenPositionState)
WooPosHomeScreen(
state = state,
Expand All @@ -147,7 +136,6 @@ private fun WooPosHomeScreen(
cartWidthDp = cartWidthDp,
cartOverlayIntensity = cartOverlayIntensityAnimated,
totalsWidthDp = totalsWidthAnimatedDp,
totalsStartPaddingDp = totalsStartPaddingAnimatedDp,
onHomeUIEvent,
)
}
Expand All @@ -160,7 +148,6 @@ private fun WooPosHomeScreen(
cartWidthDp: Dp,
cartOverlayIntensity: Float,
totalsWidthDp: Dp,
totalsStartPaddingDp: Dp,
onHomeUIEvent: (WooPosHomeUIEvent) -> Unit,
) {
Box(modifier = Modifier.fillMaxSize()) {
Expand Down Expand Up @@ -201,7 +188,7 @@ private fun WooPosHomeScreen(
) {
WooPosHomeScreenTotals(
modifier = Modifier
.width(totalsWidthDp - 24.dp.toAdaptivePadding() - totalsStartPaddingDp)
.width(totalsWidthDp)
)
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package com.woocommerce.android.ui.woopos.home.totals.payment.success

import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
Expand All @@ -13,18 +11,15 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.ButtonDefaults
import androidx.compose.material.Divider
import androidx.compose.material.Icon
import androidx.compose.material.MaterialTheme
import androidx.compose.material.OutlinedButton
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
Expand All @@ -43,33 +38,17 @@ fun WooPosPaymentSuccessScreen(
onNewTransactionClicked: () -> Unit,
) {
Column(
modifier = Modifier.fillMaxSize(),
modifier = Modifier
.fillMaxSize()
.background(Color(0xFF98F179)),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@backwardstruck I think we should not use hardcoded colors at this stage as it won't work in the dark mode

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. I'll start adding them to the xml file instead.

horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center,
) {
Column(
modifier = Modifier
.padding(
top = 24.dp.toAdaptivePadding(),
start = 24.dp.toAdaptivePadding(),
end = 24.dp.toAdaptivePadding(),
bottom = 0.dp
)
.padding(24.dp.toAdaptivePadding())
.weight(1f)
.fillMaxWidth()
.background(
color = MaterialTheme.colors.background,
shape = RoundedCornerShape(16.dp),
)
.background(
brush = Brush.verticalGradient(
colors = listOf(
Color(152, 241, 121, 0),
Color(152, 241, 121, 0x1A)
)
),
shape = RoundedCornerShape(16.dp),
)
.verticalScroll(rememberScrollState()),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center,
Expand All @@ -81,18 +60,22 @@ fun WooPosPaymentSuccessScreen(
tint = Color.Unspecified,
contentDescription = null,
)
Spacer(modifier = Modifier.height(32.dp.toAdaptivePadding()))
Spacer(modifier = Modifier.height(16.dp.toAdaptivePadding()))
Text(
text = stringResource(R.string.woopos_payment_successful_label),
style = MaterialTheme.typography.h4,
fontWeight = FontWeight.Bold,
textAlign = TextAlign.Center,
color = Color(0xFF004D40)
color = MaterialTheme.colors.onSurface
)

Spacer(modifier = Modifier.height(32.dp.toAdaptivePadding()))

TotalsSummary(state)
Text(
text = stringResource(R.string.woopos_success_screen_total, state.orderTotalText),
style = MaterialTheme.typography.subtitle1,
textAlign = TextAlign.Center,
color = MaterialTheme.colors.onSurface,
modifier = Modifier.padding(24.dp.toAdaptivePadding())
)

Spacer(modifier = Modifier.weight(1f))
}
Expand All @@ -101,109 +84,26 @@ fun WooPosPaymentSuccessScreen(

OutlinedButton(
modifier = Modifier
.padding(
top = 0.dp.toAdaptivePadding(),
start = 24.dp.toAdaptivePadding(),
end = 24.dp.toAdaptivePadding(),
bottom = 24.dp.toAdaptivePadding(),
)
.fillMaxWidth(),
.padding(24.dp.toAdaptivePadding())
.height(80.dp.toAdaptivePadding())
.width(600.dp.toAdaptivePadding()),
colors = ButtonDefaults.outlinedButtonColors(
contentColor = MaterialTheme.colors.onSurface,
contentColor = MaterialTheme.colors.onSurface
),
onClick = onNewTransactionClicked
) {
Row(
modifier = Modifier.padding(8.dp.toAdaptivePadding()),
verticalAlignment = Alignment.CenterVertically,
) {
Icon(
modifier = Modifier.size(24.dp),
painter = painterResource(id = R.drawable.woo_pos_ic_return_home),
contentDescription = null
)
Spacer(modifier = Modifier.width(12.dp.toAdaptivePadding()))
Text(
text = stringResource(R.string.woopos_new_transaction_button),
style = MaterialTheme.typography.h4,
fontWeight = FontWeight.SemiBold,
textAlign = TextAlign.Center,
)
}
}
}
}

@Composable
private fun TotalsSummary(state: WooPosTotalsViewState.PaymentSuccess) {
Column(
modifier = Modifier
.border(
width = (0.5).dp,
color = WooPosTheme.colors.border,
shape = RoundedCornerShape(8.dp)
)
.padding(24.dp.toAdaptivePadding())
.width(380.dp)
) {
Row(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.SpaceBetween
) {
Text(
text = stringResource(R.string.woopos_payment_subtotal_label),
style = MaterialTheme.typography.h6,
fontWeight = FontWeight.Normal
)
Text(
text = state.orderSubtotalText,
style = MaterialTheme.typography.h6,
fontWeight = FontWeight.Normal
)
}

Spacer(modifier = Modifier.height(16.dp.toAdaptivePadding()))

Divider(color = WooPosTheme.colors.border, thickness = 0.5.dp)

Spacer(modifier = Modifier.height(16.dp.toAdaptivePadding()))

Row(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.SpaceBetween
) {
Text(
text = stringResource(R.string.woopos_payment_tax_label),
style = MaterialTheme.typography.h6,
fontWeight = FontWeight.Normal
Icon(
modifier = Modifier.size(20.dp.toAdaptivePadding()),
painter = painterResource(id = R.drawable.woo_pos_ic_return_home),
contentDescription = null
)
Spacer(modifier = Modifier.width(8.dp.toAdaptivePadding()))
Text(
text = state.orderTaxText,
text = stringResource(R.string.woopos_new_order_button),
style = MaterialTheme.typography.h6,
fontWeight = FontWeight.Normal
)
}

Spacer(modifier = Modifier.height(16.dp.toAdaptivePadding()))

Divider(color = WooPosTheme.colors.border, thickness = 0.5.dp)

Spacer(modifier = Modifier.height(16.dp.toAdaptivePadding()))

Row(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.SpaceBetween
) {
Text(
text = stringResource(R.string.woopos_payment_total_label),
style = MaterialTheme.typography.h6,
fontWeight = FontWeight.SemiBold
)
Text(
text = state.orderTotalText,
style = MaterialTheme.typography.h4,
fontWeight = FontWeight.Bold,
color = Color(0xFF3C2861)
fontWeight = FontWeight.SemiBold,
color = MaterialTheme.colors.onSurface,
textAlign = TextAlign.Center
)
}
}
Expand Down
4 changes: 3 additions & 1 deletion WooCommerce/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4218,7 +4218,7 @@
<string name="woopos_cart_back_content_description">Cart icon</string>
<string name="woopos_payment_failed_please_try_again">Payment failed. Please try again.</string>
<string name="woopos_payment_successful_label">Payment successful</string>
<string name="woopos_new_transaction_button">New transaction</string>
<string name="woopos_new_order_button">New order</string>
<string name="woopos_payment_subtotal_label">Subtotal</string>
<string name="woopos_payment_tax_label">Tax</string>
<string name="woopos_payment_total_label">Total</string>
Expand All @@ -4239,6 +4239,8 @@
<string name="woopos_error_icon_content_description">Error indication icon</string>
<string name="woopos_products_loading_error_retry_button">Rerty</string>
<string name="woopos_totals_order_creation_error">Couldn\'t create order</string>
<string name="woopos_success_screen_total">A payment of %1$s was successfully made</string>


<string name="customers_details_customer_section">Customer</string>
<string name="customers_details_orders_section">Orders</string>
Expand Down