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

<%= render MainSimpleComponent.new do %>
  <section>
    <p class="mb-6">
      Follow and interact with anyone on the open social web, from your Kosmos Mastodon account.
    </p>
  </section>
  <section data-controller="modal" data-action="keydown.esc->modal#close">
    <h3>Your User Address</h3>
    <p class="mb-6">
      Others can follow you under this 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.mastodon_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: current_user.address) %>
  </section>
  <section>
    <h3>Social Apps</h3>
    <p>
      Use your Mastodon account with many different apps, and on any devices
      you wish! When adding your account to an app, you will log in via
      <a href="https://kosmos.social" target="_blank" class="ks-text-link">kosmos.social</a>.
    </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">
        <option>Web</option>
        <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">
            Web
          </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-5 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>
      </ul>

      <div class="hidden grid grid-cols-1 gap-6" data-tabs-target="panel">
        <%= render AppInfoComponent.new(
          name: "kosmos.social",
          description: "The official Web app",
          icon_path: "/img/logos/icon_mastodon-2.svg",
          links: [
            ["Launch", "https://kosmos.social"]
          ]
        ) %>
        <%= render AppInfoComponent.new(
          name: "Elk",
          description: " A nimble Mastodon web client",
          icon_path: "/img/logos/icon_elk.svg",
          links: [
            ["Launch", "https://elk.zone"],
            ["GitHub", "https://github.com/elk-zone/elk"]
          ]
        ) %>
        <%= render AppInfoComponent.new(
          name: "Sengi",
          description: "A cross-platform app, inspired by TweetDeck",
          icon_path: "/img/logos/icon_sengi.png",
          links: [
            ["Website", "https://nicolasconstant.github.io/sengi/"],
            ["GitHub", "https://github.com/NicolasConstant/sengi"]
          ]
        ) %>
      </div>
      <div class="hidden grid grid-cols-1 gap-6" data-tabs-target="panel">
        <%= render AppInfoComponent.new(
          name: "Mastodon for Android",
          description: "Android client by the Mastodon core team",
          icon_path: "/img/logos/icon_mastodon-2.svg",
          links: [
            ["Website", "https://joinmastodon.org/apps"],
            ["Google Play", "https://play.google.com/store/apps/details?id=org.joinmastodon.android"]
          ]
        ) %>
        <%= render AppInfoComponent.new(
          name: "Fedilab",
          description: "Android client with many features",
          icon_path: "/img/logos/icon_fedilab.png",
          links: [
            ["Website", "https://fedilab.app"],
            ["Google Play", "https://play.google.com/store/apps/details?id=app.fedilab.android"],
            ["F-Droid", "https://f-droid.org/packages/fr.gouv.etalab.mastodon"],
          ]
        ) %>
        <%= render AppInfoComponent.new(
          name: "Megalodon",
          description: "A popular fork of the official Android app",
          icon_path: "/img/logos/icon_megalodon.png",
          icon_fill_box: true,
          links: [
            ["Website", "https://sk22.github.io/megalodon/"],
            ["Google Play", "https://play.google.com/store/apps/details?id=org.joinmastodon.android.sk"]
          ]
        ) %>
      </div>
      <div class="hidden grid grid-cols-1 gap-6" data-tabs-target="panel">
        <%= render AppInfoComponent.new(
          name: "Mastodon for iOS",
          description: "iOS client by the Mastodon core team",
          icon_path: "/img/logos/icon_mastodon-2.svg",
          links: [
            ["Website", "https://joinmastodon.org/apps"],
            ["App Store", "https://apps.apple.com/us/app/mastodon-for-iphone/id1571998974"]
          ]
        ) %>
        <%= render AppInfoComponent.new(
          name: "Ice Cubes",
          description: "Slick, fast, open source, and with customizable UI",
          icon_path: "/img/logos/icon_icecubes.png",
          icon_fill_box: true,
          links: [
            ["App Store", "https://apps.apple.com/us/app/ice-cubes-for-mastodon/id6444915884"],
            ["GitHub", "https://github.com/Dimillian/IceCubesApp"]
          ]
        ) %>
        <%= render AppInfoComponent.new(
          name: "Mammoth",
          description: " Powerful, fast, feature-rich",
          icon_path: "/img/logos/icon_mammoth.png",
          links: [
            ["Website", "https://getmammoth.app/"],
            ["App Store", "https://apps.apple.com/app/mammoth-for-mastodon/id1667573899"]
          ]
        ) %>
      </div>
      <div class="hidden grid grid-cols-1 gap-6" data-tabs-target="panel">
        <%= render AppInfoComponent.new(
          name: "Tuba",
          description: "A simple, fast Mastodon app for Linux (good on GNOME)",
          icon_path: "/img/logos/icon_tuba.svg",
          links: [
            ["Website", "https://tuba.geopjr.dev"],
            ["Flathub", "https://flathub.org/apps/dev.geopjr.Tuba"],
          ]
        ) %>
      </div>
      <div class="hidden grid grid-cols-1 gap-6" data-tabs-target="panel">
        <%= render AppInfoComponent.new(
          name: "Sengi",
          description: "A cross-platform app, inspired by TweetDeck",
          icon_path: "/img/logos/icon_sengi.png",
          links: [
            ["Website", "https://nicolasconstant.github.io/sengi/"],
            ["GitHub", "https://github.com/NicolasConstant/sengi"]
          ]
        ) %>
      </div>
      <div class="hidden grid grid-cols-1 gap-6" data-tabs-target="panel">
        <%= render AppInfoComponent.new(
          name: "Mastonaut",
          description: "Simple, elegant, and native Mastodon client for Mac",
          icon_path: "/img/logos/icon_mastonaut.png",
          links: [
            ["Launch", "https://www.mastonaut.app"],
            ["Mac App Store", "https://apps.apple.com/app/mastonaut/id1450757574"]
          ]
        ) %>
      </div>
    </div>
  </section>
<% end %>
