Ghost/ghost/admin/app/components/gh-membership-tiers-alpha.hbs
Kevin Ansfield 63b1e4e8ad
Resolved power-select related deprecation warnings for loading components by string (#15466)
no issue

- in many places we were passing a string as an argument to a `<PowerSelect>` related component that referred to a component name, that was throwing deprecation warnings because those strings were used dynamically with `{{component}}` later on which isn't statically analyzable
- switched to passing a component explicitly with `{{component}}`
- https://github.com/embroider-build/embroider/blob/main/REPLACING-COMPONENT-HELPER.md#when-youre-passing-a-component-to-someone-else
2022-09-24 17:00:05 +02:00

55 lines
2.0 KiB
Handlebars

<div class="flex justify-between items-center">
<label>Tiers</label>
<div>
<div class="gh-contentfilter-menu gh-contentfilter-type {{if (not (eq this.selectedType.value "active")) "gh-contentfilter-selected"}}" data-test-type-select="true">
<PowerSelect
@selected={{this.selectedType}}
@options={{this.availableTypes}}
@searchEnabled={{false}}
@onChange={{this.onTypeChange}}
@triggerComponent={{component "gh-power-select/trigger"}}
@triggerClass="gh-contentfilter-menu-trigger gh-contentfilter-menu-trigger-tiers"
@dropdownClass="gh-contentfilter-menu-dropdown"
@matchTriggerWidth={{false}}
as |type|
>
{{#if type.name}}{{type.name}}{{else}}<span class="red">Unknown type</span>{{/if}}
</PowerSelect>
</div>
</div>
</div>
<div class="gh-tier-cards">
{{#if this.isEmptyList}}
<div class="gh-main-content-card gh-tier-card-empty-state">
<p>You have no {{this.selectedType.value}} tiers.</p>
</div>
{{/if}}
{{#each this.tiers as |tier|}}
<GhTierCard
@tier={{tier}}
@openEditTier={{this.openEditTier}}
@onUnarchive={{this.onUnarchive}}
@onArchive={{this.onArchive}}
/>
{{/each}}
{{#if (eq this.type "active" )}}
<div class="gh-tier-cards-footer">
<button class="gh-btn gh-btn-link gh-btn-text gh-btn-icon gh-btn-add-tier green" type="button" {{action "openNewTier" this.tier}}>
<span>{{svg-jar "plus"}}Add tier</span>
</button>
</div>
{{/if}}
</div>
{{#if this.showTierModal}}
<GhFullscreenModal
@modal="tier"
@model={{hash
tier=this.tierModel
}}
@confirm={{this.confirmTierSave}}
@close={{this.closeTierModal}}
@modifier="edit-tier action wide" />
{{/if}}