<%= render HeaderComponent.new(title: "Chat") %>

<%= render MainSimpleComponent.new do %>
  <section>
    <p class="mb-6">
      Chat with anyone on the open Jabber (XMPP) network. Message people directly, or
      join public channels or private rooms.
    </p>
  </section>
  <section data-controller="modal" data-action="keydown.esc->modal#close">
    <h3>Your Chat Address</h3>
    <p class="mb-6">
      When you exchange contacts with people, give them your
      address, or add them using their address:
    </p>
    <p data-controller="clipboard" class="flex gap-1 sm:w-2/5">
      <input type="text" id="user_address" class="grow"
             value=<%= current_user.address %> disabled="disabled"
             data-clipboard-target="source" />
      <button id="copy-user-address" class="btn-md btn-icon btn-outline shrink-0"
              data-clipboard-target="trigger" data-action="clipboard#copy"
              title="Copy to clipboard">
        <span class="content-initial">
          <%= render partial: "icons/copy", locals: { custom_class: "text-blue-600 h-4 w-4 inline" } %>
        </span>
        <span class="content-active hidden">
          <%= render partial: "icons/check", locals: { custom_class: "text-blue-600 h-4 w-4 inline" } %>
        </span>
      </button>
      <button class="btn-md btn-icon btn-outline shrink-0 w-auto"
              data-action="click->modal#open" title="Show QR code">
          <%= render partial: "icons/qr_code", locals: { custom_class: "text-blue-600 h-4 w-4 inline" } %>
      </button>
    </p>
    <%= render QrCodeModalComponent.new(qr_content: "xmpp:"+current_user.address) %>
  </section>
  <section>
    <h3>Chat Apps</h3>
    <p>
      Use your account with many different apps, and on any devices you wish!
      When opening an app for the first time, just enter your address and
      password to log in.
    </p>
  </section>
  <section>
    <h3>Recommended Apps</h3>
    <div data-controller="tabs"
         data-tabs-active-tab-class="-mb-px border-gray-200 border-l border-t border-r rounded-t text-indigo-600 hover:text-indigo-600"
         data-tabs-inactive-tab-class="text-gray-500 hover:text-gray-700"
         class="mb-12">
      <select data-action="tabs#change" data-tabs-target="select"
              class="block w-full mb-8 sm:hidden">
        <optgroup label="Mobile">
          <option>Android</option>
          <option>iOS</option>
        </optgroup>
        <optgroup label="Desktop">
          <option>Linux</option>
          <option>Windows</option>
          <option>macOS</option>
        </optgroup>
      </select>
      <ul class="hidden sm:flex list-reset mb-8 border-gray-200 border-b">
        <li class="mr-2" data-tabs-target="tab" data-action="click->tabs#change:prevent">
          <a href="#" class="bg-white inline-block py-2 px-4 font-semibold no-underline">
            Android
          </a>
        </li>
        <li class="mr-2" data-tabs-target="tab" data-action="click->tabs#change:prevent">
          <a href="#" class="bg-white inline-block py-2 px-4 font-semibold no-underline">
            iOS
          </a>
        </li>
        <li class="mr-2" data-tabs-target="tab" data-action="click->tabs#change:prevent">
          <a href="#" class="bg-white inline-block py-2 px-4 font-semibold no-underline">
            Linux
          </a>
        </li>
        <li class="mr-2" data-tabs-target="tab" data-action="click->tabs#change:prevent">
          <a href="#" class="bg-white inline-block py-2 px-4 font-semibold no-underline">
            Windows
          </a>
        </li>
        <li class="mr-2" data-tabs-target="tab" data-action="click->tabs#change:prevent">
          <a href="#" class="bg-white inline-block py-2 px-4 font-semibold no-underline">
            macOS
          </a>
        </li>
        <!-- <li class="mr&#45;2" data&#45;tabs&#45;target="tab" data&#45;action="click&#45;>tabs#change"> -->
        <!--   <a href="#" class="bg&#45;white inline&#45;block py&#45;2 px&#45;4 font&#45;semibold no&#45;underline"> -->
        <!--     Web -->
        <!--   </a> -->
        <!-- </li> -->
      </ul>

      <div id="apps-android" class="hidden grid grid-cols-1 gap-6"
           data-tabs-target="panel">
        <%= render AppInfoComponent.new(
          name: "Conversations",
          description: "The gold standard for Jabber on mobile devices",
          icon_path: "/img/logos/icon_conversations.png",
          links: [
            ["Website", "https://conversations.im"],
            ["Google Play", "https://play.google.com/store/apps/details?id=eu.siacs.conversations"],
            ["F-Droid", "https://f-droid.org/en/packages/eu.siacs.conversations/"],
          ]
        ) %>
      </div>
      <div id="apps-ios" class="hidden grid grid-cols-1 gap-6"
           data-tabs-target="panel">
        <%= render AppInfoComponent.new(
          name: "Siskin IM",
          description: "Lightweight and powerful chat app for iPhone and iPad",
          icon_path: "/img/logos/logo_siskin.png",
          links: [
            ["Website", "https://siskin.im"],
            ["App Store", "https://apps.apple.com/us/app/tigase-messenger/id1153516838"]
          ]
        ) %>
        <%= render AppInfoComponent.new(
          name: "Monal",
          description: "A chat app for iOS, iPadOS, and macOS",
          icon_path: "/img/logos/icon_monal.svg",
          icon_fill_box: true,
          links: [
            ["Website", "https://monal-im.org"],
            ["App Store", "https://apps.apple.com/app/id317711500"]
          ]
        ) %>
      </div>
      <div id="apps-linux" class="hidden grid grid-cols-1 gap-6"
           data-tabs-target="panel">
        <%= render AppInfoComponent.new(
          name: "Dino",
          description: "A modern and simple chat app for Linux (good for GNOME)",
          icon_path: "/img/logos/icon_dino.svg",
          links: [
            ["Website", "https://dino.im"],
            ["Install from package", "https://github.com/dino/dino/wiki/Distribution-Packages"]
          ]
        ) %>
        <%= render AppInfoComponent.new(
          name: "Kaidan",
          description: "A fairly new, user-friendly chat app for all devices (good for KDE)",
          icon_path: "/img/logos/icon_kaidan.svg",
          links: [
            ["Website", "https://kaidan.im"],
          ]
        ) %>
        <%= render AppInfoComponent.new(
          name: "Gajim",
          description: "A fully-featured chat app for Linux and Windows",
          icon_path: "/img/logos/icon_gajim.png",
          links: [
            ["Website", "https://gajim.org/"]
          ]
        ) %>
      </div>
      <div id="apps-windows" class="hidden grid grid-cols-1 gap-6"
           data-tabs-target="panel">
        <%= render AppInfoComponent.new(
          name: "Gajim",
          description: "A fully-featured chat app for Linux and Windows",
          icon_path: "/img/logos/icon_gajim.png",
          links: [
            ["Website", "https://gajim.org/"],
            ["Microsoft Store", "https://apps.microsoft.com/store/detail/9PGGF6HD43F9?launch=true&mode=mini"],
            ["Download options", "https://gajim.org/download/"]
          ]
        ) %>
      </div>
      <div id="apps-mac" class="hidden grid grid-cols-1 gap-6"
           data-tabs-target="panel">
        <%= render AppInfoComponent.new(
          name: "Beagle IM",
          description: "Lightweight and powerful chat app for macOS",
          icon_path: "/img/logos/logo_beagle.png",
          links: [
            ["Website", "https://beagle.im"],
            ["App Store", "https://apps.apple.com/us/app/beagleim-by-tigase-inc/id1445349494"]
          ]
        ) %>
        <%= render AppInfoComponent.new(
          name: "Monal",
          description: "A chat app for iOS, iPadOS, and macOS",
          icon_path: "/img/logos/icon_monal.svg",
          icon_fill_box: true,
          links: [
            ["Website", "https://monal-im.org"],
            ["App Store", "https://apps.apple.com/app/id1637078500"]
          ]
        ) %>
      </div>
      <!-- <div class="hidden grid grid&#45;cols&#45;1 gap&#45;4 sm:gap&#45;6" data&#45;tabs&#45;target="panel"> -->
      <!--   Web -->
      <!-- </div> -->
    </div>
  </section>
<% end %>
