Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Add translated fields counter

dominik-zeglenb4d6e4e0fa4f
diff --git a/saleor/static/dashboard-next/translations/components/TranslationFields/TranslationFields.tsx b/saleor/static/dashboard-next/translations/components/TranslationFields/TranslationFields.tsx
index a89f2ce4ac..4fbbaf3cb3 100644
--- a/saleor/static/dashboard-next/translations/components/TranslationFields/TranslationFields.tsx
+++ b/saleor/static/dashboard-next/translations/components/TranslationFields/TranslationFields.tsx
@@ -44,6 +44,9 @@ export interface TranslationFieldsProps {
const styles = (theme: Theme) =>
createStyles({
+ cardCaption: {
+ fontSize: 14
+ },
cardContent: {
"&:last-child": {
paddingBottom: theme.spacing.unit
@@ -130,7 +133,7 @@ const TranslationFields = withStyles(styles, { name: "TranslationFields" })(
</IconButton>
}
/>
- {expanded && (
+ {expanded ? (
<CardContent className={classes.cardContent}>
<Grid className={classes.grid} variant="uniform">
<Typography className={classes.columnHeader} variant="body1">
@@ -218,6 +221,21 @@ const TranslationFields = withStyles(styles, { name: "TranslationFields" })(
))}
</Grid>
</CardContent>
+ ) : (
+ <CardContent>
+ <Typography className={classes.cardCaption} variant="caption">
+ {i18n.t(
+ "{{ fieldQuantity }} Translations, {{ translatedFieldQuantity }} Completed",
+ {
+ fieldQuantity: fields.length,
+ translatedFieldQuantity: fields.reduce(
+ (acc, field) => acc + +(field.translation !== null),
+ 0
+ )
+ }
+ )}
+ </Typography>
+ </CardContent>
)}
</Card>
);