<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="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-product-cards">
    {{#if this.isEmptyList}}
    <div class="gh-main-content-card gh-product-card-empty-state">
        <p>You have no {{this.selectedType.value}} tiers.</p>
    </div>
    {{/if}}

    {{#each this.products as |product|}}
        <GhProductCard
            @product={{product}}
            @openEditProduct={{this.openEditProduct}}
            @onUnarchive={{this.onUnarchive}}
            @onArchive={{this.onArchive}}
        />
    {{/each}}
    {{#if (eq this.type "active" )}}
        <div class="gh-product-cards-footer">
            <button class="gh-btn gh-btn-link gh-btn-text gh-btn-icon gh-btn-add-product green" type="button" {{action "openNewProduct" this.product}}>
                <span>{{svg-jar "add-stroke" class="stroke-green"}}Add tier</span>
            </button>
        </div>
    {{/if}}
</div>

{{#if this.showProductModal}}
    <GhFullscreenModal
        @modal="product"
        @model={{hash
            product=this.productModel
        }}
        @confirm={{this.confirmProductSave}}
        @close={{this.closeProductModal}}
        @modifier="edit-product action wide" />
{{/if}}
