mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-03 23:15:31 +00:00
Bug 1846480 - Add adjusted rating card for review quality check
This commit is contained in:
parent
809e8af66a
commit
1b1ce07590
@ -6,9 +6,12 @@ package org.mozilla.fenix.shopping.ui
|
||||
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.ExperimentalLayoutApi
|
||||
import androidx.compose.foundation.layout.FlowRow
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
@ -52,6 +55,11 @@ fun ProductAnalysis(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
)
|
||||
|
||||
AdjustedProductRatingCard(
|
||||
rating = productAnalysis.adjustedRating,
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
)
|
||||
|
||||
SettingsCard(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
productRecommendationsEnabled = productRecommendationsEnabled,
|
||||
@ -79,6 +87,40 @@ private fun ReviewGradeCard(
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalLayoutApi::class)
|
||||
@Composable
|
||||
private fun AdjustedProductRatingCard(
|
||||
rating: Float,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
ReviewQualityCheckCard(modifier = modifier.semantics(mergeDescendants = true) {}) {
|
||||
FlowRow(
|
||||
horizontalArrangement = Arrangement.SpaceBetween,
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
) {
|
||||
Text(
|
||||
text = stringResource(R.string.review_quality_check_adjusted_rating_title),
|
||||
color = FirefoxTheme.colors.textPrimary,
|
||||
style = FirefoxTheme.typography.headline8,
|
||||
modifier = Modifier.padding(
|
||||
end = 16.dp,
|
||||
bottom = 8.dp,
|
||||
),
|
||||
)
|
||||
|
||||
StarRating(value = rating)
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.height(8.dp))
|
||||
|
||||
Text(
|
||||
text = stringResource(R.string.review_quality_check_adjusted_rating_description),
|
||||
color = FirefoxTheme.colors.textPrimary,
|
||||
style = FirefoxTheme.typography.caption,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun SettingsCard(
|
||||
productRecommendationsEnabled: Boolean,
|
||||
|
@ -128,4 +128,6 @@
|
||||
<string name="review_quality_check_settings_title" translatable="false">Settings</string>
|
||||
<string name="review_quality_check_settings_recommended_products" translatable="false">Show products recommended by Firefox</string>
|
||||
<string name="review_quality_check_settings_turn_off" translatable="false">Turn off review quality check</string>
|
||||
<string name="review_quality_check_adjusted_rating_title" translatable="false">Adjusted rating</string>
|
||||
<string name="review_quality_check_adjusted_rating_description" translatable="false">Unreliable reviews removed</string>
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user