Skip to content

Commit

Permalink
[no-jira] Update raw strings to fpo and remove alert composables (#2123)
Browse files Browse the repository at this point in the history
  • Loading branch information
leighdouglas authored Sep 6, 2024
1 parent 209c7d1 commit 91aec71
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ import coil.compose.AsyncImage
import coil.request.ImageRequest
import com.kickstarter.R
import com.kickstarter.features.pledgedprojectsoverview.data.Flag
import com.kickstarter.libs.utils.extensions.format
import com.kickstarter.ui.compose.designsystem.KSAlertBadge
import com.kickstarter.ui.compose.designsystem.KSCoralBadge
import com.kickstarter.ui.compose.designsystem.KSDividerLineGrey
import com.kickstarter.ui.compose.designsystem.KSPrimaryBlackButton
import com.kickstarter.ui.compose.designsystem.KSPrimaryGreenButton
Expand Down Expand Up @@ -264,7 +264,7 @@ fun ProjectPledgeSummaryView(

// TODO: Replace with translated string
Text(
text = "$pledgeAmount pledged",
text = stringResource(id = R.string.pledge_amount_pledged_fpo).format("pledge_amount", pledgeAmount),
color = colors.textSecondary,
style = typography.caption2
)
Expand Down Expand Up @@ -321,7 +321,7 @@ fun CreatorNameSendMessageView(
) {
// TODO: Replace with translated string
Text(
text = "Send a message",
text = stringResource(id = R.string.send_a_message_fpo),
color = colors.textAccentGreen,
style = typography.caption2
)
Expand Down Expand Up @@ -349,7 +349,7 @@ fun ShippingAddressView(
.testTag(PPOCardViewTestTag.SHIPPING_ADDRESS_VIEW.name),
) {
Text(
text = "Shipping address",
text = stringResource(id = R.string.shipping_address_fpo),
modifier = Modifier
.weight(0.25f)
.height(dimensions.clickableButtonHeight)
Expand Down Expand Up @@ -380,7 +380,11 @@ fun AlertFlagsView(flags: List<Flag?>) {
modifier = Modifier
.fillMaxWidth()
.testTag(PPOCardViewTestTag.FlAG_LIST_VIEW.name)
.padding(top = dimensions.paddingMediumSmall, start = dimensions.paddingMediumSmall, end = dimensions.paddingMediumSmall),
.padding(
top = dimensions.paddingMediumSmall,
start = dimensions.paddingMediumSmall,
end = dimensions.paddingMediumSmall
),
horizontalArrangement = Arrangement.spacedBy(6.dp),
verticalArrangement = Arrangement.spacedBy(6.dp),
) {
Expand Down Expand Up @@ -414,7 +418,7 @@ fun ConfirmAddressButtonsView(isConfirmButtonEnabled: Boolean, onEditAddressClic
modifier = Modifier
.weight(0.5f),
onClickAction = { onEditAddressClicked.invoke() },
text = "Edit",
text = stringResource(id = R.string.edit_fpo),
isEnabled = true,
textStyle = typography.buttonText
)
Expand All @@ -424,7 +428,7 @@ fun ConfirmAddressButtonsView(isConfirmButtonEnabled: Boolean, onEditAddressClic
modifier = Modifier
.weight(0.5f),
onClickAction = { onConfirmAddressClicked.invoke() },
text = "Confirm",
text = stringResource(id = R.string.Confirm),
isEnabled = isConfirmButtonEnabled,
textStyle = typography.buttonText
)
Expand All @@ -437,7 +441,7 @@ fun FixPaymentButtonView(onFixPaymentClicked: () -> Unit) {
KSSecondaryRedButton(
modifier = Modifier.padding(dimensions.paddingMediumSmall),
onClickAction = { onFixPaymentClicked.invoke() },
text = "Fix Payment",
text = stringResource(id = R.string.fix_payment_fpo),
isEnabled = true,
textStyle = typography.buttonText
)
Expand All @@ -449,7 +453,7 @@ fun AuthenticateCardButtonView(onAuthenticateCardClicked: () -> Unit) {
KSSecondaryRedButton(
modifier = Modifier.padding(dimensions.paddingMediumSmall),
onClickAction = { onAuthenticateCardClicked.invoke() },
text = "Authenticate Card",
text = stringResource(id = R.string.authenticate_card_fpo),
isEnabled = true,
textStyle = typography.buttonText
)
Expand All @@ -461,50 +465,12 @@ fun TakeSurveyButtonView(onAuthenticateCardClicked: () -> Unit) {
KSPrimaryGreenButton(
modifier = Modifier.padding(dimensions.paddingMediumSmall),
onClickAction = { onAuthenticateCardClicked.invoke() },
text = "Take Survey",
text = stringResource(id = R.string.take_survey_fpo),
isEnabled = true,
textStyle = typography.buttonText
)
}

@Composable
fun AddressLocksAlertView(hoursRemaining: Int = -1) {
KSCoralBadge(
leadingIcon = {
// TODO: Replace with translated string
Image(
modifier = Modifier
.padding(end = dimensions.paddingXSmall)
.size(dimensions.alertIconSize),
imageVector = ImageVector.vectorResource(id = R.drawable.ic_clock),
contentDescription = "Address locks in $hoursRemaining hours",
colorFilter = ColorFilter.tint(colors.textSecondary)
)
},
// TODO: Replace with translated string
text = "Address locks in $hoursRemaining hours",
)
}
@Composable
fun PledgeWillBeDroppedAlert(daysRemaining: Int = -1) {
KSCoralBadge(
leadingIcon = {
// TODO: Replace with translated string
Image(
modifier = Modifier
.padding(end = dimensions.paddingXSmall)
.size(dimensions.alertIconSize),
imageVector = ImageVector.vectorResource(id = R.drawable.ic_clock),
contentDescription = "Pledge will be dropped in $daysRemaining days",
colorFilter = ColorFilter.tint(colors.textAccentRedBold)
)
},
// TODO: Replace with translated string
text = "Pledge will be dropped in $daysRemaining days",
textColor = colors.textAccentRedBold
)
}

fun isTier1Alert(viewType: PPOCardViewType): Boolean {
return when (viewType) {
PPOCardViewType.CONFIRM_ADDRESS, PPOCardViewType.AUTHENTICATE_CARD, PPOCardViewType.OPEN_SURVEY, PPOCardViewType.FIX_PAYMENT -> true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ fun PledgedProjectsOverviewScreen(
openConfirmAddressAlertDialog.value -> {
KSAlertDialog(
setShowDialog = { openConfirmAddressAlertDialog.value = it },
headlineText = "Confirm your address",
headlineText = stringResource(id = R.string.confirm_your_address_fpo),
bodyText = confirmedAddress,
leftButtonText = stringResource(id = R.string.Cancel),
leftButtonAction = { openConfirmAddressAlertDialog.value = false },
Expand Down
11 changes: 11 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,17 @@
<string name="match_system">Match System</string>
<string name="light">Light</string>
<string name="dark">Dark</string>

<!-- PPO Strings -->
<string name="authenticate_card_fpo">Authenticate Card</string>
<string name="shipping_address_fpo">Shipping address</string>
<string name="edit_fpo">Edit</string>
<string name="fix_payment_fpo">Fix Payment</string>
<string name="take_survey_fpo">Take Survey</string>
<string name="send_a_message_fpo">Send a message</string>
<string name="confirm_your_address_fpo">Confirm your address</string>
<string name="pledge_amount_pledged_fpo">%{pledge_amount} pledged</string>

<!-- TODO: Get translations for this and put it in i18n, then remove -->
<string name="project_status_project_was_successfully_funded_on_deadline_but_you_can_still_pledge_for_available_rewards" formatted="false">This project was successfully funded on %{deadline}, but you can still pledge for available rewards.</string>

Expand Down

0 comments on commit 91aec71

Please sign in to comment.