mirror of
https://github.com/openMF/mifos-mobile.git
synced 2026-02-06 11:26:51 +00:00
fix(ui): fix account status is being cut & standardize status color (#3047)
This commit is contained in:
parent
53c766b343
commit
29f5fd3a3c
@ -14,19 +14,21 @@ import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.text.BasicText
|
||||
import androidx.compose.foundation.text.TextAutoSize
|
||||
import androidx.compose.material3.CardDefaults
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.unit.sp
|
||||
import org.jetbrains.compose.ui.tooling.preview.Preview
|
||||
import org.mifos.mobile.core.designsystem.component.CardVariant
|
||||
import org.mifos.mobile.core.designsystem.component.MifosCustomCard
|
||||
import org.mifos.mobile.core.designsystem.theme.AppColors
|
||||
import org.mifos.mobile.core.designsystem.theme.DesignToken
|
||||
import org.mifos.mobile.core.designsystem.theme.MifosMobileTheme
|
||||
import org.mifos.mobile.core.designsystem.theme.MifosTypography
|
||||
import template.core.base.designsystem.theme.KptTheme
|
||||
|
||||
@Composable
|
||||
@ -58,15 +60,19 @@ fun MifosLabelValueCard(
|
||||
) {
|
||||
Text(
|
||||
text = label,
|
||||
style = MifosTypography.bodySmall,
|
||||
style = KptTheme.typography.bodySmall,
|
||||
color = KptTheme.colorScheme.secondary,
|
||||
|
||||
)
|
||||
|
||||
Text(
|
||||
BasicText(
|
||||
text = value,
|
||||
style = MifosTypography.bodyMediumEmphasized,
|
||||
color = color,
|
||||
style = KptTheme.typography.bodyMedium.copy(color = color),
|
||||
autoSize = TextAutoSize.StepBased(
|
||||
minFontSize = 10.sp,
|
||||
maxFontSize = 60.sp,
|
||||
stepSize = 10.sp,
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@ -47,6 +47,7 @@ import org.mifos.mobile.core.designsystem.theme.AppColors
|
||||
import org.mifos.mobile.core.designsystem.theme.DesignToken
|
||||
import org.mifos.mobile.core.designsystem.theme.MifosMobileTheme
|
||||
import org.mifos.mobile.core.designsystem.theme.MifosTypography
|
||||
import org.mifos.mobile.core.model.LoanStatus
|
||||
import template.core.base.designsystem.theme.KptTheme
|
||||
import kotlin.collections.component1
|
||||
import kotlin.collections.component2
|
||||
@ -127,7 +128,13 @@ fun AccountSummaryCard(
|
||||
style = MifosTypography.labelMedium,
|
||||
textAlign = TextAlign.Right,
|
||||
color = if (key == Res.string.feature_loan_account_status_label) {
|
||||
AppColors.customEnable
|
||||
when (value) {
|
||||
LoanStatus.ACTIVE.status -> AppColors.customEnable
|
||||
LoanStatus.SUBMIT_AND_PENDING_APPROVAL.status -> AppColors.customYellow
|
||||
LoanStatus.WITHDRAWN.status, LoanStatus.MATURED.status ->
|
||||
KptTheme.colorScheme.error
|
||||
else -> KptTheme.colorScheme.secondary
|
||||
}
|
||||
} else {
|
||||
KptTheme.colorScheme.secondary
|
||||
},
|
||||
|
||||
@ -46,6 +46,7 @@ import org.mifos.mobile.core.designsystem.theme.AppColors
|
||||
import org.mifos.mobile.core.designsystem.theme.DesignToken
|
||||
import org.mifos.mobile.core.designsystem.theme.MifosMobileTheme
|
||||
import org.mifos.mobile.core.designsystem.theme.MifosTypography
|
||||
import org.mifos.mobile.core.model.SavingStatus
|
||||
import org.mifos.mobile.core.model.enums.ChargeType
|
||||
import org.mifos.mobile.core.ui.component.MifosActionCard
|
||||
import org.mifos.mobile.core.ui.component.MifosErrorComponent
|
||||
@ -191,14 +192,12 @@ internal fun SavingsAccountDetailsContent(
|
||||
|
||||
AccountDetailsGrid(
|
||||
details = state.displayItems,
|
||||
isActive = state.isActive,
|
||||
)
|
||||
|
||||
if (state.transactionList.isNotEmpty()) {
|
||||
AccountDetailsGrid(
|
||||
label = "Last Transactions",
|
||||
details = state.transactionList,
|
||||
isActive = state.isActive,
|
||||
)
|
||||
}
|
||||
|
||||
@ -278,13 +277,11 @@ internal fun ActionBar(
|
||||
*
|
||||
* @param label An optional string for the section's title.
|
||||
* @param details A list of [LabelValueItem]s to display in the grid.
|
||||
* @param isActive A boolean to conditionally color the status field.
|
||||
*/
|
||||
@Composable
|
||||
internal fun AccountDetailsGrid(
|
||||
label: String? = null,
|
||||
details: List<LabelValueItem>? = emptyList(),
|
||||
isActive: Boolean = false,
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
@ -312,12 +309,15 @@ internal fun AccountDetailsGrid(
|
||||
.weight(1f),
|
||||
label = stringResource(item.label),
|
||||
value = item.value,
|
||||
color = if (isActive && item.label == Res.string.feature_savings_status_label) {
|
||||
AppColors
|
||||
.customEnable
|
||||
color = if (item.label == Res.string.feature_savings_status_label) {
|
||||
when (item.value) {
|
||||
SavingStatus.ACTIVE.status -> AppColors.customEnable
|
||||
SavingStatus.SUBMIT_AND_PENDING_APPROVAL.status -> AppColors.customYellow
|
||||
SavingStatus.INACTIVE.status -> KptTheme.colorScheme.error
|
||||
else -> KptTheme.colorScheme.onSurface
|
||||
}
|
||||
} else {
|
||||
KptTheme
|
||||
.colorScheme.onBackground
|
||||
KptTheme.colorScheme.onBackground
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
@ -26,7 +26,6 @@ import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import mifos_mobile.feature.share_account.generated.resources.Res
|
||||
import mifos_mobile.feature.share_account.generated.resources.feature_share_account_details_action
|
||||
@ -40,6 +39,7 @@ import org.mifos.mobile.core.designsystem.component.MifosElevatedScaffold
|
||||
import org.mifos.mobile.core.designsystem.theme.AppColors
|
||||
import org.mifos.mobile.core.designsystem.theme.DesignToken
|
||||
import org.mifos.mobile.core.designsystem.theme.MifosTypography
|
||||
import org.mifos.mobile.core.model.LoanStatus
|
||||
import org.mifos.mobile.core.model.enums.ChargeType
|
||||
import org.mifos.mobile.core.ui.component.MifosActionCard
|
||||
import org.mifos.mobile.core.ui.component.MifosErrorComponent
|
||||
@ -49,6 +49,7 @@ import org.mifos.mobile.core.ui.component.MifosProgressIndicator
|
||||
import org.mifos.mobile.core.ui.utils.EventsEffect
|
||||
import org.mifos.mobile.core.ui.utils.ScreenUiState
|
||||
import org.mifos.mobile.feature.shareaccount.component.ShareActionItems
|
||||
import template.core.base.designsystem.theme.KptTheme
|
||||
|
||||
@Composable
|
||||
internal fun ShareAccountDetailsScreen(
|
||||
@ -130,7 +131,6 @@ internal fun ShareAccountDetailsContent(
|
||||
) {
|
||||
AccountDetailsGrid(
|
||||
details = state.displayItems,
|
||||
isActive = state.isActive,
|
||||
)
|
||||
|
||||
ShareAccountActions(
|
||||
@ -148,7 +148,6 @@ internal fun ShareAccountDetailsContent(
|
||||
internal fun AccountDetailsGrid(
|
||||
label: StringResource? = null,
|
||||
details: List<LabelValueItem>? = emptyList(),
|
||||
isActive: Boolean = false,
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
@ -170,13 +169,21 @@ internal fun AccountDetailsGrid(
|
||||
) {
|
||||
details.forEach { item ->
|
||||
MifosLabelValueCard(
|
||||
modifier = Modifier.height(64.dp).weight(1f),
|
||||
modifier = Modifier
|
||||
.height(DesignToken.sizes.cardDp64)
|
||||
.weight(1f),
|
||||
label = stringResource(item.label),
|
||||
value = item.value,
|
||||
color = if (isActive && item.label == Res.string.feature_share_account_status) {
|
||||
AppColors.customEnable
|
||||
color = if (item.label == Res.string.feature_share_account_status) {
|
||||
when (item.value) {
|
||||
LoanStatus.ACTIVE.status -> AppColors.customEnable
|
||||
LoanStatus.SUBMIT_AND_PENDING_APPROVAL.status -> AppColors.customYellow
|
||||
LoanStatus.WITHDRAWN.status, LoanStatus.MATURED.status ->
|
||||
KptTheme.colorScheme.error
|
||||
else -> KptTheme.colorScheme.secondary
|
||||
}
|
||||
} else {
|
||||
MaterialTheme.colorScheme.onBackground
|
||||
KptTheme.colorScheme.secondary
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user