/**
 * @copyright nhcarrigan
 * @license Naomi's Public License
 * @author Naomi Carrigan
 */

/**
 * This is the HTML rendered for the landing page.
 */
export const html = `
<!DOCTYPE html>
<html>
  <head>
    <title>Mommy</title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta name="description" content="Mommy loves you~!" />
    <script src="https://cdn.nhcarrigan.com/headers/index.js" async defer></script>
    <script>
      const getMommy = (e) => {
        e.preventDefault();
        const input = document.getElementById("name");
        const params = new URLSearchParams();
        if (input?.value) {
          params.append("name", input.value);
        }
        fetch('/api?' + params.toString(), {
          method: "GET",
        }).then(res => res.text()).then(data => {
          const result = document.getElementById("result");
          if (!result) {
            throw new Error("Cannot find result element!")
          }
          result.innerText = data;
        });
      }
    </script>
  </head>
  <body>
    <main>
    <h1>Mommy</h1>
    <section>
      <p id="result">Mommy loves you~!</p>
    </section>
    <form>
      <label>Tell mommy your name?</label>
      <input id="name" type="text" placeholder="optional"/>
      <button onclick="getMommy(event)" type="text">I need some love...</button>
    </form>
    <section>
        <h2>Links</h2>
        <p>
            <a href="https://codeberg.org/nhcarrigan/boost-monitor">
                <i class="fa-solid fa-code"></i> Source Code
            </a>
        </p>
        <p>
            <a href="https://docs.nhcarrigan.com">
                <i class="fa-solid fa-book"></i> Documentation
            </a>
        </p>
        <p>
            <a href="https://chat.nhcarrigan.com">
                <i class="fa-solid fa-circle-info"></i> Support
            </a>
        </p>
    </section>
    </main>
  </body>
</html>`;