Add tilde before subscribers count in selects

[MAILPOET-3646]
This commit is contained in:
Jan Lysý
2021-06-28 15:03:36 +02:00
committed by Veljko V
parent adaa004948
commit 96c84009b7
9 changed files with 13 additions and 13 deletions

View File

@@ -108,7 +108,7 @@ const BasicSettingsPanel = ({ onToggle, isOpened }) => {
values: segments,
multiple: true,
placeholder: MailPoet.I18n.t('settingsPleaseSelectList'),
getLabel: (seg) => (`${seg.name} (${parseInt(seg.subscribers, 10).toLocaleString()})`),
getLabel: (seg) => (`${seg.name} (~${parseInt(seg.subscribers, 10).toLocaleString()})`),
filter: (seg) => (!!(!seg.deleted_at && seg.type === 'default')),
}}
/>

View File

@@ -60,7 +60,7 @@ let fields = [
return segment.name;
},
getCount: function getCount(segment) {
return parseInt(segment.subscribers, 10).toLocaleString();
return `~${parseInt(segment.subscribers, 10).toLocaleString()}`;
},
transformChangedValue: function transformChangedValue(segmentIds) {
const allSegments = this.getItems();

View File

@@ -160,7 +160,7 @@ let fields = [
return segment.name;
},
getCount: function getCount(segment) {
return parseInt(segment.subscribers, 10).toLocaleString();
return `~${parseInt(segment.subscribers, 10).toLocaleString()}`;
},
transformChangedValue: function transformChangedValue(segmentIds) {
const allSegments = this.getItems();

View File

@@ -27,7 +27,7 @@ const segmentField = {
placeholder: MailPoet.I18n.t('selectSegmentPlaceholder'),
forceSelect2: true,
values: availableSegments,
getCount: (segment) => parseInt(segment.subscribers, 10).toLocaleString(),
getCount: (segment) => `~${parseInt(segment.subscribers, 10).toLocaleString()}`,
getLabel: (segment) => segment.name,
getValue: (segment) => segment.id,
};

View File

@@ -16,7 +16,7 @@ export default (props: Props) => {
const segments = useSelector(selector)().map((segment) => ({
value: segment.id,
label: segment.name,
count: segment.subscribers,
count: `~${segment.subscribers}`,
}));
const defaultValue = segments.filter((segment) => props.value.includes(segment.value));