<p><%= I18n.t 'user_mailer.new_musicians_match.greeting' -%> <%= @user.first_name -%>,</p>
<p>
  <%= I18n.t 'user_mailer.new_musicians_match.paragraph1' -%>
</p>
<table width="100%">
  <tbody>
      <% @musicians_data.each do | data |
          musicians = data[:musicians]
          latencies = data[:latencies]
          
          musicians.each do | musician |
      %>
        <tr>
          <td>
            <%= image_tag musician.photo_url.blank?? "avatar.png" : musician.photo_url, height: '32', width: '32', host: APP_CONFIG.action_mailer.assets_host, alt: 'photo' -%>
          </td>
          <td>
            <p>
              <strong><%= musician.first_name %> <%= musician.last_name %></strong>
              <br />
              <span>
              <% latency = latencies.find{|l| l[:user_id] == musician.id } %>
              <%= I18n.t 'user_mailer.new_musicians_match.latency_to_you' -%>: <%= latency_info(latency) %></span>
              <% if musician.last_active_timestamp %>
                <br />
                <span><%= I18n.t 'user_mailer.new_musicians_match.last_active' -%>: <%= time_ago_in_words(Time.at(musician.last_active_timestamp)) %> <%= I18n.t 'user_mailer.new_musicians_match.ago' -%></span>
              <% end %>
            </p>
          </td>
          <td>
            <table>
              <% musician.musician_instruments.each do |mi| %>
                <tr>
                  <td><%= mi.description %>:&nbsp;<%= @instrument_proficiencies[mi.proficiency_level.to_s.to_sym] %></td>
                </tr>
              <% end %>
            </table>
          </td>
          <td>
            <table>
              <tr>
                <td><a href="<%= APP_CONFIG.spa_origin_url -%>/friends?id=<%= musician.id %>&open=details" style="color: #407dde;"><%= I18n.t 'user_mailer.new_musicians_match.view_profile' -%></a></td>
              </tr>
              <tr>
                <td><a href="<%= APP_CONFIG.spa_origin_url -%>/friends?id=<%= musician.id %>&open=message" style="color: #407dde;"><%= I18n.t 'user_mailer.new_musicians_match.send_message' -%></a></td>
              </tr>
              <tr>
                <td><a href="<%= APP_CONFIG.spa_origin_url -%>/friends?id=<%= musician.id %>&open=connect" style="color: #407dde;"><%= I18n.t 'user_mailer.new_musicians_match.send_friend_request' -%></a></td>
              </tr>
            </table>
          </td>
        </tr>
      <% end %>
    <% end %>
  </tbody>
</table>
<p>
  <%= I18n.t 'user_mailer.new_musicians_match.paragraph2' -%>
</p>
<div style="text-align: center">
  <a
    href="<%= APP_CONFIG.spa_origin_url -%>/friends"
    style="
      color: #fff;
      text-decoration: none;
      background-color: #2c7be5;
      border-color: #2c7be5;
      border: 1px solid transparent;
      padding: 0.3125rem 1rem;
      line-height: 2.5;
      font-size: 1em;
      border-radius: 0.25rem;
      transition: color 0.15s ease-in-out,
        background-color 0.15s ease-in-out, border-color 0.15s ease-in-out,
        box-shadow 0.15s ease-in-out;
    "
    ><%= I18n.t 'user_mailer.new_musicians_match.search_musicians' -%></a
  >
</div>