Skip to content

Commit

Permalink
Update displayName
Browse files Browse the repository at this point in the history
  • Loading branch information
jwm0 committed Aug 9, 2021
1 parent cc0b3b8 commit 33570c0
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ const TranslationsAttributesPage: React.FC<TranslationsAttributesPageProps> = ({
onSubmit={onSubmit}
/>
<CardSpacer />
{withChoices && (
{data?.attribute?.choices.edges.length > 0 && withChoices && (
<TranslationFields
activeField={activeField}
disabled={disabled}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,26 +127,39 @@ const TranslationsPagesPage: React.FC<TranslationsPagesPageProps> = ({
onSubmit={onSubmit}
/>
<CardSpacer />
<TranslationFields
activeField={activeField}
disabled={disabled}
initialState={true}
title={intl.formatMessage(commonMessages.translationAttributes)}
fields={
data?.attributeValues?.map(attrVal => ({
id: attrVal.attributeValue.id,
displayName: attrVal.name,
name: attrVal?.name,
translation: attrVal?.translation?.richText || null,
type: "rich" as "rich",
value: attrVal?.richText
})) || []
}
saveButtonState={saveButtonState}
onEdit={onEdit}
onDiscard={onDiscard}
onSubmit={onAttributeValueSubmit}
/>
{data?.attributeValues?.length > 0 && (
<>
<TranslationFields
activeField={activeField}
disabled={disabled}
initialState={true}
title={intl.formatMessage(commonMessages.translationAttributes)}
fields={
data.attributeValues.map((attrVal, i) => ({
id: attrVal.attributeValue.id,
displayName: intl.formatMessage(
{
defaultMessage: "Attribute {number}",
description: "attribute list"
},
{
number: i + 1
}
),
name: attrVal?.name,
translation: attrVal?.translation?.richText || null,
type: "rich" as "rich",
value: attrVal?.richText
})) || []
}
saveButtonState={saveButtonState}
onEdit={onEdit}
onDiscard={onDiscard}
onSubmit={onAttributeValueSubmit}
/>
<CardSpacer />
</>
)}
</Container>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,27 +126,39 @@ const TranslationsProductsPage: React.FC<TranslationsProductsPageProps> = ({
onSubmit={onSubmit}
/>
<CardSpacer />
<TranslationFields
activeField={activeField}
disabled={disabled}
initialState={true}
title={intl.formatMessage(commonMessages.translationAttributes)}
fields={
data?.attributeValues?.map(attrVal => ({
id: attrVal.attributeValue.id,
displayName: attrVal.name,
name: attrVal?.name,
translation: attrVal?.translation?.richText || null,
type: "rich" as "rich",
value: attrVal?.richText
})) || []
}
saveButtonState={saveButtonState}
onEdit={onEdit}
onDiscard={onDiscard}
onSubmit={onAttributeValueSubmit}
/>
<CardSpacer />
{data?.attributeValues?.length > 0 && (
<>
<TranslationFields
activeField={activeField}
disabled={disabled}
initialState={true}
title={intl.formatMessage(commonMessages.translationAttributes)}
fields={
data.attributeValues.map((attrVal, i) => ({
id: attrVal.attributeValue.id,
displayName: intl.formatMessage(
{
defaultMessage: "Attribute {number}",
description: "attribute list"
},
{
number: i + 1
}
),
name: attrVal?.name,
translation: attrVal?.translation?.richText || null,
type: "rich" as "rich",
value: attrVal?.richText
})) || []
}
saveButtonState={saveButtonState}
onEdit={onEdit}
onDiscard={onDiscard}
onSubmit={onAttributeValueSubmit}
/>
<CardSpacer />
</>
)}
</Container>
);
};
Expand Down

0 comments on commit 33570c0

Please sign in to comment.