Skip to content

Commit

Permalink
- i18n update and layout/margin improvements in Trade flow
Browse files Browse the repository at this point in the history
  • Loading branch information
nostrbuddha authored and rodvar committed Dec 4, 2024
1 parent 5992c4b commit 550586e
Show file tree
Hide file tree
Showing 18 changed files with 299 additions and 258 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,16 @@ data class BisqEasyTradeStateStrings(
val bisqEasy_tradeState_info_buyer_phase1a_scanQrCode_webcamState_failed: String,
val bisqEasy_tradeState_info_buyer_phase1b_headline: String,
val bisqEasy_tradeState_info_buyer_phase1b_info: String,
val bisqEasy_tradeState_info_buyer_phase2a_headline: String,
val bisqEasy_tradeState_info_buyer_phase2a_headline: (String) -> String,
val bisqEasy_tradeState_info_buyer_phase2a_quoteAmount: String,
val bisqEasy_tradeState_info_buyer_phase2a_sellersAccount: String,
val bisqEasy_tradeState_info_buyer_phase2a_reasonForPaymentInfo: String,
val bisqEasy_tradeState_info_buyer_phase2a_confirmFiatSent: String,
val bisqEasy_tradeState_info_buyer_phase2a_confirmFiatSent: (String) -> String,
val bisqEasy_tradeState_info_buyer_phase2a_tradeLogMessage: String,
val bisqEasy_tradeState_info_buyer_phase2b_headline: String,
val bisqEasy_tradeState_info_buyer_phase2b_info: String,
val bisqEasy_tradeState_info_buyer_phase2b_info: (String, String) -> String,
val bisqEasy_tradeState_info_buyer_phase3a_headline: String,
val bisqEasy_tradeState_info_buyer_phase3a_info: String,
val bisqEasy_tradeState_info_buyer_phase3a_info: (String) -> String,
val bisqEasy_tradeState_info_buyer_phase3b_headline_ln: String,
val bisqEasy_tradeState_info_buyer_phase3b_info_ln: String,
val bisqEasy_tradeState_info_buyer_phase3b_confirmButton_ln: String,
Expand Down Expand Up @@ -141,4 +141,12 @@ data class BisqEasyTradeStateStrings(
val bisqEasy_mediation_request_feedback_msg: String,
val bisqEasy_mediation_request_feedback_noMediatorAvailable: String,
val bisqEasy_mediation_requester_tradeLogMessage: String,

// Mobile app specific
val bisqEasy_tradeState_info_buyer_phase1a_seller_wait_message: String,
val bisqEasy_tradeState_info_buyer_phase1a_wallet_prompt_prefix: String,
val bisqEasy_tradeState_info_buyer_phase2a_seller_wait_message: String,
val bisqEasy_tradeState_info_buyer_phase3a_seller_wait_message: String,
val bisqEasy_tradeCompleted_body_you_have_receveid: String,
val bisqEasy_tradeCompleted_body_you_have_sold: String,
)
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,16 @@ val EnBisqEasyTradeStateStrings = BisqEasyTradeStateStrings(
bisqEasy_tradeState_info_buyer_phase1a_scanQrCode_webcamState_failed = "Connecting to webcam failed",
bisqEasy_tradeState_info_buyer_phase1b_headline = "Wait for the seller's payment account data",
bisqEasy_tradeState_info_buyer_phase1b_info = "You can use the chat below for getting in touch with the seller.",
bisqEasy_tradeState_info_buyer_phase2a_headline = "Send {0} to the seller''s payment account",
bisqEasy_tradeState_info_buyer_phase2a_headline = { fiat -> "Send $fiat to the seller''s payment account" },
bisqEasy_tradeState_info_buyer_phase2a_quoteAmount = "Amount to transfer",
bisqEasy_tradeState_info_buyer_phase2a_sellersAccount = "Payment account of seller",
bisqEasy_tradeState_info_buyer_phase2a_reasonForPaymentInfo = "Please leave the 'Reason for payment' field empty, in case you make a bank transfer",
bisqEasy_tradeState_info_buyer_phase2a_confirmFiatSent = "Confirm payment of {0}",
bisqEasy_tradeState_info_buyer_phase2a_confirmFiatSent = { fiat -> "Confirm payment of $fiat" },
bisqEasy_tradeState_info_buyer_phase2a_tradeLogMessage = "{0} initiated the {1} payment",
bisqEasy_tradeState_info_buyer_phase2b_headline = "Wait for the seller to confirm receipt of payment",
bisqEasy_tradeState_info_buyer_phase2b_info = "Once the seller has received your payment of {0}, they will start the Bitcoin transfer to your provided {1}.",
bisqEasy_tradeState_info_buyer_phase2b_info = { fiat, settlement -> "Once the seller has received your payment of $fiat, they will start the Bitcoin transfer to your provided $settlement." },
bisqEasy_tradeState_info_buyer_phase3a_headline = "Wait for the seller's Bitcoin settlement",
bisqEasy_tradeState_info_buyer_phase3a_info = "The seller need to start the Bitcoin transfer to your provided {0}.",
bisqEasy_tradeState_info_buyer_phase3a_info = { method -> "The seller need to start the Bitcoin transfer to your provided $method."},
bisqEasy_tradeState_info_buyer_phase3b_headline_ln = "The seller has sent the Bitcoin via Lightning network",
bisqEasy_tradeState_info_buyer_phase3b_info_ln = "Transfers via the Lightning Network are typically near-instant. If you haven't received the payment within one minute, please contact the seller in the trade chat. Occasionally, payments may fail and need to be retried.",
bisqEasy_tradeState_info_buyer_phase3b_confirmButton_ln = "Confirm receipt",
Expand Down Expand Up @@ -139,4 +139,11 @@ val EnBisqEasyTradeStateStrings = BisqEasyTradeStateStrings(
bisqEasy_mediation_request_feedback_msg = "A request to the registered mediators has been sent.\n\n Please have patience until a mediator is online to join the trade chat and help to resolve any problems.",
bisqEasy_mediation_request_feedback_noMediatorAvailable = "There is no mediator available. Please use the support chat instead.",
bisqEasy_mediation_requester_tradeLogMessage = "{0} requested mediation",

bisqEasy_tradeState_info_buyer_phase1a_seller_wait_message= "Waiting for the seller to provide their account information. Meanwhile you can provide your settlement details.",
bisqEasy_tradeState_info_buyer_phase1a_wallet_prompt_prefix = "If you don’t have a wallet yet, refer to our",
bisqEasy_tradeState_info_buyer_phase2a_seller_wait_message = "Waiting for the seller to confirm receipt of payment",
bisqEasy_tradeState_info_buyer_phase3a_seller_wait_message = "Waiting for the seller’s Bitcoin settlement",
bisqEasy_tradeCompleted_body_you_have_receveid = "You have received",
bisqEasy_tradeCompleted_body_you_have_sold = "You have sold",
)
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,16 @@ val FrBisqEasyTradeStateStrings = BisqEasyTradeStateStrings(
bisqEasy_tradeState_info_buyer_phase1a_scanQrCode_webcamState_failed = "[FR] Connecting to webcam failed",
bisqEasy_tradeState_info_buyer_phase1b_headline = "[FR] Wait for the seller's payment account data",
bisqEasy_tradeState_info_buyer_phase1b_info = "[FR] You can use the chat below for getting in touch with the seller.",
bisqEasy_tradeState_info_buyer_phase2a_headline = "[FR] Send {0} to the seller''s payment account",
bisqEasy_tradeState_info_buyer_phase2a_headline = { fiat -> "[FR] Send $fiat to the seller''s payment account" },
bisqEasy_tradeState_info_buyer_phase2a_quoteAmount = "[FR] Amount to transfer",
bisqEasy_tradeState_info_buyer_phase2a_sellersAccount = "[FR] Payment account of seller",
bisqEasy_tradeState_info_buyer_phase2a_reasonForPaymentInfo = "[FR] Please leave the 'Reason for payment' field empty, in case you make a bank transfer",
bisqEasy_tradeState_info_buyer_phase2a_confirmFiatSent = "[FR] Confirm payment of {0}",
bisqEasy_tradeState_info_buyer_phase2a_confirmFiatSent = { fiat -> "[FR] Confirm payment of $fiat" },
bisqEasy_tradeState_info_buyer_phase2a_tradeLogMessage = "[FR] {0} initiated the {1} payment",
bisqEasy_tradeState_info_buyer_phase2b_headline = "[FR] Wait for the seller to confirm receipt of payment",
bisqEasy_tradeState_info_buyer_phase2b_info = "[FR] Once the seller has received your payment of {0}, they will start the Bitcoin transfer to your provided {1}.",
bisqEasy_tradeState_info_buyer_phase2b_info = { fiat, settlement -> "[FR] Once the seller has received your payment of $fiat, they will start the Bitcoin transfer to your provided $settlement." },
bisqEasy_tradeState_info_buyer_phase3a_headline = "[FR] Wait for the seller's Bitcoin settlement",
bisqEasy_tradeState_info_buyer_phase3a_info = "[FR] The seller need to start the Bitcoin transfer to your provided {0}.",
bisqEasy_tradeState_info_buyer_phase3a_info = { method -> "[FR] The seller need to start the Bitcoin transfer to your provided $method."},
bisqEasy_tradeState_info_buyer_phase3b_headline_ln = "[FR] The seller has sent the Bitcoin via Lightning network",
bisqEasy_tradeState_info_buyer_phase3b_info_ln = "[FR] Transfers via the Lightning Network are typically near-instant. If you haven't received the payment within one minute, please contact the seller in the trade chat. Occasionally, payments may fail and need to be retried.",
bisqEasy_tradeState_info_buyer_phase3b_confirmButton_ln = "[FR] Confirm receipt",
Expand Down Expand Up @@ -139,4 +139,11 @@ val FrBisqEasyTradeStateStrings = BisqEasyTradeStateStrings(
bisqEasy_mediation_request_feedback_msg = "[FR] A request to the registered mediators has been sent.\n\n Please have patience until a mediator is online to join the trade chat and help to resolve any problems.",
bisqEasy_mediation_request_feedback_noMediatorAvailable = "[FR] There is no mediator available. Please use the support chat instead.",
bisqEasy_mediation_requester_tradeLogMessage = "[FR] {0} requested mediation",

bisqEasy_tradeState_info_buyer_phase1a_seller_wait_message= "[FR] Waiting for the seller to provide their account information. Meanwhile you can provide your settlement details.",
bisqEasy_tradeState_info_buyer_phase1a_wallet_prompt_prefix = "[FR] If you don’t have a wallet yet, refer to our",
bisqEasy_tradeState_info_buyer_phase2a_seller_wait_message= "[FR] Waiting for the seller to confirm receipt of payment",
bisqEasy_tradeState_info_buyer_phase3a_seller_wait_message = "[FR] Waiting for the seller’s Bitcoin settlement",
bisqEasy_tradeCompleted_body_you_have_receveid = "[FR] You have received",
bisqEasy_tradeCompleted_body_you_have_sold = "[FR] You have sold",
)
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ val EnCommonStrings = CommonStrings(
offers_list_buy_from = "Buy from",
offers_list_sell_to = "Sell to",

take_offer = "Take offer"
take_offer = "Take offer",

)
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ fun BisqTextField(
onValueChanged: (String) -> Unit,
placeholder: String? = null,
labelRightSuffix: (@Composable () -> Unit)? = null,
disabled: Boolean = false,
modifier: Modifier = Modifier,
) {
) {
var isFocused by remember { mutableStateOf(false) }
Column(modifier = modifier) {
if (label.isNotEmpty()) {
Expand All @@ -41,7 +42,7 @@ fun BisqTextField(
BisqText.baseRegular(
text = label,
color = BisqTheme.colors.light2,
)
)
if (labelRightSuffix != null) {
labelRightSuffix()
}
Expand All @@ -59,7 +60,7 @@ fun BisqTextField(
modifier = Modifier.fillMaxWidth().clickable { isFocused = true }
.onFocusChanged { focusState ->
isFocused = focusState.isFocused
},
},
textStyle = TextStyle(fontSize = 22.sp),
onValueChange = onValueChanged,
colors = TextFieldDefaults.colors(
Expand All @@ -76,9 +77,10 @@ fun BisqTextField(
BisqText.h5Regular(
text = placeholder,
color = BisqTheme.colors.secondaryHover,
)
)
}
}
},
enabled = !disabled,
)
if (isFocused) {
Box(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package network.bisq.mobile.presentation.ui.components.molecules.info
import androidx.compose.foundation.layout.*
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import network.bisq.mobile.presentation.ui.components.atoms.BisqText
import network.bisq.mobile.presentation.ui.theme.BisqTheme
Expand Down Expand Up @@ -31,7 +32,7 @@ fun InfoBox(
val valueWidget: @Composable () -> Unit = if (value != null) {
{
when (valueType) {
InfoBoxValueType.BoldValue -> BisqText.h6Regular(text = value)
InfoBoxValueType.BoldValue -> if (style == InfoBoxStyle.Style1) BisqText.h6Regular(text = value) else (BisqText.baseRegular(text = value))
InfoBoxValueType.SmallValue -> BisqText.baseRegular(text = value)
InfoBoxValueType.TitleSmall -> BisqText.h4Regular(text = value)
}
Expand Down Expand Up @@ -59,10 +60,10 @@ fun InfoBox(
InfoBoxStyle.Style2 -> {
Column(
horizontalAlignment = if (rightAlign) Alignment.End else Alignment.Start,
verticalArrangement = Arrangement.spacedBy(2.dp)
verticalArrangement = Arrangement.spacedBy(0.dp)
) {
valueWidget()
BisqText.baseRegular(text = label, color = BisqTheme.colors.grey2)
BisqText.smallRegular(text = label, color = BisqTheme.colors.grey2, modifier = Modifier.offset(y = (-4).dp))
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package network.bisq.mobile.presentation.ui.components.organisms.trades

import androidx.compose.animation.*
import androidx.compose.foundation.layout.*
import androidx.compose.runtime.*
import androidx.compose.ui.Modifier
Expand Down Expand Up @@ -67,7 +66,7 @@ fun StepperSection(
BisqText.xsmallRegular(
textAlign = TextAlign.Center,
text = stepNumber.toString(),
modifier = Modifier.padding(start = 8.dp)
modifier = Modifier.padding(start = 8.dp).offset(x = 1.dp, y = (-4).dp)
)
}
content(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,56 +1,53 @@
package network.bisq.mobile.presentation.ui.components.organisms.trades

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.runtime.collectAsState
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.unit.dp
import cafe.adriel.lyricist.LocalStrings
import network.bisq.mobile.presentation.ui.components.atoms.BisqButton
import network.bisq.mobile.presentation.ui.components.atoms.BisqText
import network.bisq.mobile.presentation.ui.components.atoms.BisqTextField
import network.bisq.mobile.presentation.ui.theme.BisqTheme
import network.bisq.mobile.presentation.ui.theme.BisqUIConstants
import network.bisq.mobile.presentation.ui.uicases.trades.ITradeFlowPresenter
import org.koin.compose.koinInject

@Composable
fun TradeFlow01AccountDetails(
onNext: () -> Unit
) {
val strings = LocalStrings.current.bisqEasyTradeState
val stringsBisqEasy = LocalStrings.current.bisqEasy
val presenter: ITradeFlowPresenter = koinInject()

Column {
BisqText.smallRegular(
text = "Waiting for the seller to provide their account information. Meanwhile you can provide your settlement details."
)
Spacer(modifier = Modifier.height(BisqUIConstants.ScreenPadding))
BisqText.baseRegular(text = strings.bisqEasy_tradeState_info_buyer_phase1a_seller_wait_message)
Spacer(modifier = Modifier.height(BisqUIConstants.ScreenPadding2X))
BisqText.h6Regular(
text = "Fill in your Lightning invoice"
text = strings.bisqEasy_tradeState_info_buyer_phase1a_bitcoinPayment_headline_LN
)
Spacer(modifier = Modifier.height(BisqUIConstants.ScreenPadding))
BisqTextField(
placeholder = "",
value = "lncb21h345t34io",
onValueChanged = {},
label = "Lightning Invoice"
label = strings.bisqEasy_tradeState_info_buyer_phase1a_bitcoinPayment_description_LN,
value = presenter.receiveAddress.collectAsState().value,
onValueChanged = { presenter.setReceiveAddress(it) },
)
Spacer(modifier = Modifier.height(BisqUIConstants.ScreenPadding))
BisqButton(
text = "Send to seller",
text = strings.bisqEasy_tradeState_info_buyer_phase1a_send,
onClick = onNext,
padding = PaddingValues(
horizontal = 18.dp,
vertical = 6.dp
)
)
Row(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(8.dp)
) {
BisqText.xsmallMedium(
text = "If you don’t have a wallet yet, refer to our"
)
BisqText.xsmallMedium(
text = "Wallet guide",
modifier = Modifier.clip(shape = RoundedCornerShape(4.dp))
.background(color = BisqTheme.colors.primary)
.padding(vertical = 2.dp, horizontal = 8.dp)
)
}
Spacer(modifier = Modifier.height(BisqUIConstants.ScreenPadding))
BisqText.smallMedium(
text = strings.bisqEasy_tradeState_info_buyer_phase1a_wallet_prompt_prefix
)
// TODO: Make a small variation of the button
BisqButton(text = stringsBisqEasy.bisqEasy_walletGuide_tabs_headline, onClick = {})
}
}
Loading

0 comments on commit 550586e

Please sign in to comment.