Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement a help macro #22

Open
clorl opened this issue Aug 7, 2023 · 1 comment
Open

Implement a help macro #22

clorl opened this issue Aug 7, 2023 · 1 comment

Comments

@clorl
Copy link

clorl commented Aug 7, 2023

Default help macro that would redirect to a local view, which is a list of macros. It helps to keep in mind what macros we have.
It would just be an app that displays the macro dic in a fancy way

@clorl
Copy link
Author

clorl commented Aug 7, 2023

For anyone looking for this I wipped up a quick poc. Plop this in your chevron folder

<!DOCTYPE html>
<html lang="en">
  <head>
    <title></title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
      <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/full.css" rel="stylesheet" type="text/css" />
      <script src="https://cdn.tailwindcss.com"></script>

  </head>
  <body>
    <div class="container mx-auto columns-1 ">
      <h1 class="text-8xl font-extrabold text-slate-300">Macros Help</h1>

      <table class="table  mx-auto table-auto text-lg">
        <thead>
          <tr>
            <th class="">Name</th>
            <th class="">Triggers</th>
            <th class="max-w-s text-center">Search?</th>
            <th class="max-w-s text-center">Goto?</th>
          </tr>
        </thead>
        <tbody>

        </tbody>
      </table>
    </div>

    <script src="./config.js"></script>
    <script>
    const check = '<span class="text-green-400">✓</span>'
    const cross = '<span class="text-red-400">x</span>'

    const table = document.querySelector('tbody');
    let prevCat = "";
    for (const m of window.CONFIG.macros.sort(e => e.category)) {
      if (m.category !== prevCat) {
        prevCat = m.category;

        const catTemplate = `
        <td colspan="4" class="py-3 my-3 text-extrabold text-xl bg-zinc-900">${m.category}</td>
        `
          table.innerHTML += catTemplate;
    }


      const template = `
        <tr>
          <td>${m.name}</td>
<td><code>${m.triggers.join(", ")}</code></td>
          <td class="text-center">${m.commands && m.commands.search ? check : cross}</td>
          <td class="text-center">${m.commands && m.commands.go ? check : cross}</td>
        </tr>
        `
        table.innerHTML += template;
    }
    </script>
  </body>
</html>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant