{% if user.user_metadata.app_access %}
    <tr class="app-access-title">
        <td>
            <h3>{{ body_yourAccess }}</h3>
        </td>
    </tr>
    {% for app in user.user_metadata.app_access %}
        {% if app.id == 'settings' %}
            {% continue %}
        {% endif %}

        {% comment %} placeholder for description just as a fallback {% endcomment %}
        {% assign app_description = app.name %}
        {% comment %}
            some cdn icons have different names than the default "{id}_app" format
            for those will override in each of the case-when below
        {% endcomment %}
        {% assign app_icon_src = '##CDN_URL##/assets/'
            | append: orgName
            | append: '/icons/'
            | append: app.id
            | append: '_app.png'
        %}

        {% case app.id %}
            {% when 'audience-development' %}
                {% assign app_description = app_description_id_audience %}
                {% assign app_icon_src = app_icon_src
                    | replace: 'audience-development_app',
                        'audience_development_app'
                %}
            {% when 'help-center' %}
                {% assign app_description = app_description_id_helpcenter %}
                {% assign app_icon_src = app_icon_src
                    | replace: 'help-center_app', 'help_center_app'
                %}
            {% when 'collaborators' %}
                {% assign app_description = app_description_id_collaborators %}
            {% when 'content' %}
                {% assign app_description = app_description_id_content %}
            {% when 'distribution' %}
                {% assign app_description = app_description_id_distribution %}
            {% when 'documents' %}
                {% assign app_description = app_description_id_documents %}
            {% when 'insights' %}
                {% assign app_description = app_description_id_insights %}
            {% when 'moneyhub' %}
                {% assign app_description = app_description_id_moneyhub %}
            {% when 'publishing' %}
                {% assign app_description = app_description_id_publishing %}
            {% when 'abacus' %}
                {% assign app_description = app_description_id_abacus %}
            {% when 'settings' %}
                {% assign app_description = app_description_id_settings %}
            {% when 'songwhip' %}
                {% assign app_description = app_description_id_songwhip %}
                {% assign app_icon_src = '##CDN_URL##/assets/unbranded/icons/songwhip_app.png' %}
            {% when 'workstation' %}
                {% assign app_description = app_description_id_workstation %}
        {% endcase %}

        <tr>
            <td>
                {% comment %} better way to email-compatible vertical align is... table-hell {% endcomment %}
                <table cellpadding="0" cellspacing="0" style="width: 100%;">
                    <tr>
                        <td valign="middle" style="width: 20px;">
                            <img
                                src="{{ app_icon_src }}"
                                alt="{{ app.id }}"
                                width="16"
                                height="16"
                            >
                        </td>
                        <td valign="middle">
                            <span class="app-name">{{ app.name }}</span>
                        </td>
                    </tr>
                </table>
                <p class="app-description">
                    {{ app_description }}
                </p>
            </td>
        </tr>
    {% endfor %}
{% endif %}
