mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-29 15:12:58 +03:00
Separated tiers group to active and archived
refs https://github.com/TryGhost/Team/issues/1403 - currently, all tiers are grouped together in dropdowns with list of tiers - this separates them into active and archived groups, so that the status of the tiers is clear when making choices
This commit is contained in:
parent
61e5068081
commit
c7b6a72a49
@ -165,21 +165,33 @@ export default class GhMembersRecipientSelect extends Component {
|
||||
const tiers = yield this.store.query('tier', {filter: 'type:paid', limit: 'all'});
|
||||
|
||||
if (tiers.length > 1) {
|
||||
const tiersGroup = {
|
||||
groupName: 'Tiers',
|
||||
const activeTiersGroup = {
|
||||
groupName: 'Active tiers',
|
||||
options: []
|
||||
};
|
||||
|
||||
const archivedTiersGroup = {
|
||||
groupName: 'Archived tiers',
|
||||
options: []
|
||||
};
|
||||
|
||||
tiers.forEach((tier) => {
|
||||
tiersGroup.options.push({
|
||||
const tierData = {
|
||||
name: tier.name,
|
||||
segment: `tier:${tier.slug}`,
|
||||
count: tier.count?.members,
|
||||
class: 'segment-tier'
|
||||
});
|
||||
};
|
||||
|
||||
if (tier.active) {
|
||||
activeTiersGroup.options.push(tierData);
|
||||
} else {
|
||||
archivedTiersGroup.options.push(tierData);
|
||||
}
|
||||
});
|
||||
|
||||
options.push(tiersGroup);
|
||||
options.push(activeTiersGroup);
|
||||
options.push(archivedTiersGroup);
|
||||
}
|
||||
|
||||
this.specificOptions = options;
|
||||
|
@ -78,22 +78,36 @@ export default class GhMembersSegmentSelect extends Component {
|
||||
const tiers = yield this.store.query('tier', {filter: 'type:paid', limit: 'all', include: 'monthly_price,yearly_price,benefits'});
|
||||
|
||||
if (tiers.length > 0) {
|
||||
const tiersGroup = {
|
||||
groupName: 'Tiers',
|
||||
const activeTiersGroup = {
|
||||
groupName: 'Active tiers',
|
||||
options: []
|
||||
};
|
||||
|
||||
const archivedTiersGroup = {
|
||||
groupName: 'Archived tiers',
|
||||
options: []
|
||||
};
|
||||
|
||||
tiers.forEach((tier) => {
|
||||
tiersGroup.options.push({
|
||||
const tierData = {
|
||||
name: tier.name,
|
||||
segment: `${tier.id}`,
|
||||
count: tier.count?.members,
|
||||
class: 'segment-tier'
|
||||
});
|
||||
};
|
||||
|
||||
if (tier.active) {
|
||||
activeTiersGroup.options.push(tierData);
|
||||
} else {
|
||||
archivedTiersGroup.options.push(tierData);
|
||||
}
|
||||
});
|
||||
|
||||
options.push(tiersGroup);
|
||||
options.push(activeTiersGroup);
|
||||
options.push(archivedTiersGroup);
|
||||
|
||||
if (this.args.selectDefaultTier && !this.args.segment) {
|
||||
this.args.onChange?.(tiersGroup.options[0].segment);
|
||||
this.args.onChange?.(activeTiersGroup.options[0].segment);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -75,23 +75,36 @@ export default class VisibilitySegmentSelect extends Component {
|
||||
this.tiers = tiers;
|
||||
|
||||
if (tiers.length > 0) {
|
||||
const tiersGroup = {
|
||||
groupName: 'Tiers',
|
||||
const activeTiersGroup = {
|
||||
groupName: 'Active tiers',
|
||||
options: []
|
||||
};
|
||||
|
||||
const archivedTiersGroup = {
|
||||
groupName: 'Archived tiers',
|
||||
options: []
|
||||
};
|
||||
|
||||
tiers.forEach((tier) => {
|
||||
tiersGroup.options.push({
|
||||
const tierData = {
|
||||
name: tier.name,
|
||||
id: tier.id,
|
||||
count: tier.count?.members,
|
||||
class: 'segment-tier'
|
||||
});
|
||||
};
|
||||
|
||||
if (tier.active) {
|
||||
activeTiersGroup.options.push(tierData);
|
||||
} else {
|
||||
archivedTiersGroup.options.push(tierData);
|
||||
}
|
||||
});
|
||||
|
||||
options.push(tiersGroup);
|
||||
options.push(activeTiersGroup);
|
||||
options.push(archivedTiersGroup);
|
||||
|
||||
if (this.args.selectDefaultTier && !this.args.tiers) {
|
||||
this.setSegment([tiersGroup.options[0]]);
|
||||
this.setSegment([activeTiersGroup.options[0]]);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user