<% if flash[:settings_notice] %>
  <div class="crayons-banner" id="notice" style="padding: 35px 4px">
    <%= flash[:settings_notice] %>
  </div>
<% end %>
<div class="crayons-card mb-6 grid grid-flow-row gap-6 p-6">
  <% if @pending_invites.any? %>
    <h1>Pending Invitations</h1>
    <h3>You may leave a group channel at any point in the future.</h3>
    <% @pending_invites.each do |membership| %>
      <div class="crayons-field">
        <h2><%= membership.chat_channel.channel_name %></h2>
        <p><%= membership.chat_channel.description %></p>
        <%= form_for(membership, html: { class: "grid grid-cols-5" }) do |f| %>
          <%= f.hidden_field :user_action, value: "accept" %>
          <%= f.submit "Accept", class: "crayons-btn" %>
        <% end %>
        <%= form_for(membership, html: { class: "grid grid-cols-5" }) do |f| %>
          <%= f.hidden_field :user_action, value: "decline" %>
          <%= f.submit "Decline", class: "crayons-btn crayons-btn--danger" %>
        <% end %>
      </div>
    <% end %>
  <% else %>
    <p>
      <em>You have no pending invitations</em>
    </p>
  <% end %>
</div>
