{% comment %}
This file is licensed under the MIT License (MIT) available on
http://opensource.org/licenses/MIT.
{% endcomment %}

{% if page.id == "choose-your-wallet" or page.id == 'wallets-desktop-desktop' or page.id == 'wallets-mobile-mobile' %}
  {% assign walletClass = "" | append: "is-hidden-mobile" %}
{% else %}
  {% assign walletClass = "" | append: "accordion-wallets is-visible" %}
{% endif %}
<div class="accordion {{walletClass}}">
  {% if page.id == "wallets-hardware-hardware" or page.id == "wallets-web-web" %}
    {% assign accordionNumber = "" | append: "accordion-tab-2" %}
  {% else %}
    {% assign accordionNumber = "" | append: "accordion-tab-3" %}
  {% endif %}
  {% for wallet in site.wallets %}
    {% assign id = wallet.id | remove: '/wallets/' %}
    {% if page.id contains id %}
      {% assign walletName = wallet.titleshort %}
    {% endif %}
  {% endfor %}
  <div class="accordion-tab accordion-tab-wallet {{accordionNumber}} js-tab is-expanded">
    <p class="accordion-label">{% translate wallet-select choose-your-wallet %}</p>
    <p class="selected-item selected-wallet">{{walletName}}</p>
  </div>
  <div class="accordion-content accordion-content-wallets">
    <div class="wallet-list" id="wallets">
      {% if page.id == "choose-your-wallet" %}
        {% for wallet in site.wallets %}
         {% assign platformList = "" %}
         {% assign id = wallet.id | remove: '/wallets/' %}
         {% for platform in wallet.platform %}
          {% capture platformList %}{{platformList}}{{platform.name}}{% endcapture %}
         {% endfor %}
          <div class="wallet-list-item allwallets-list-item">
            <div class="wallet-list-item-link">
              <img src="/img/wallet/{{ id }}.png?{{site.time | date: '%s'}}" alt="{{ wallet.title }}" /> {{ wallet.titleshort }}
            </div>
            <p class="wallet-hint">{% translate wallet-select-operating-system choose-your-wallet %}</p>
            <div class="wallet-list-os">
              {% for platform in wallet.platform %}
                {% for os in platform.os%}
                  {% if platform.name == os.name %}
                  <a class="wallet-list-os-link" href="/{{ page.lang}}/wallets/{{platform.name}}/{{ id }}/" data-link-platform={{platform.name}}>
                    <span class="wallet-os-ico {{os.name}}-ico"></span>
                    <span class="wallet-os-ico-dark {{os.name}}-ico-dark" hidden></span>
                    <span class="wallet-os-ico-bright {{os.name}}-ico-bright" hidden></span>
                    <p class="wallet-ico-tooltip">{{os.name}}</p>
                  </a>
                  {% else %}

                  <a class="wallet-list-os-link" href="/{{ page.lang}}/wallets/{{platform.name}}/{{os.name}}/{{ id }}/" data-link-platform={{platform.name}}>
                    <span class="wallet-os-ico {{os.name}}-ico"></span>
                    <span class="wallet-os-ico-dark {{os.name}}-ico-dark" hidden></span>
                    <span class="wallet-os-ico-bright {{os.name}}-ico-bright" hidden></span>
                    <p class="wallet-ico-tooltip">{{os.name}}</p>
                  </a>
                  {% endif %}
                {% endfor %}
              {% endfor %}
            </div>
          </div>
        {% endfor %}



      {% else %}

        <!-- Particular Wallets -->
        {% for wallet in site.wallets %}
        {% assign id = wallet.id | remove: '/wallets/' %}
        {% if page.id contains id %}
          {% continue %}
        {% endif %}
        {% assign platformName = page.platform['name'] %}
        {% assign osName = page.os['name'] %}
        {% if wallet.compat contains platformName and wallet.compat contains osName %}

        {% if osName == 'desktop' or osName == 'mobile' %}

          <div class="wallet-list-item allwallets-list-item">
            <div class="wallet-list-item-link">
              <img src="/img/wallet/{{ id }}.png?{{site.time | date: '%s'}}" alt="{{ wallet.title }}" /> {{ wallet.titleshort }}
            </div>
            <p class="wallet-hint">{% translate wallet-select-operating-system choose-your-wallet %}</p>
            <div class="wallet-list-os">
              {% for platform in wallet.platform %}
                {% for os in platform.os%}
                  {% if platform.name == osName %}
                  <a class="wallet-list-os-link" href="/{{ page.lang}}/wallets/{{platform.name}}/{{os.name}}/{{ id }}/" data-link-platform={{platform.name}}>
                    <span class="wallet-os-ico {{os.name}}-ico"></span>
                    <span class="wallet-os-ico-dark {{os.name}}-ico-dark" hidden></span>
                    <span class="wallet-os-ico-bright {{os.name}}-ico-bright" hidden></span>
                    <p class="wallet-ico-tooltip">{{os.name}}</p>
                  </a>
                  {% endif %}
                {% endfor %}
              {% endfor %}
            </div>
          </div>

        {% else %}
        <div class="wallet-list-item">
          {% if platformName == osName %}
          <a class="wallet-list-item-link" href="/{{ page.lang}}/wallets/{{ platformName }}/{{ id }}/">
          {% else %}
          <a class="wallet-list-item-link" href="/{{ page.lang}}/wallets/{{ platformName }}/{{ osName }}/{{ id }}/">
          {% endif %}
            <img src="/img/wallet/{{ id }}.png?{{site.time | date: '%s'}}" alt="{{ wallet.title }}" /> {{ wallet.titleshort }}
          </a>
        </div>
        {% endif %}


        {% endif %}
        {% endfor %}
      {% endif %}

    </div>
  </div>
</div>
