<template>
	<header class="flex">
		<span class="my-auto ml-2 font-bold">Tools</span>
	</header>

  <hr class="mt-2 mb-2">

  <nav class="flex flex-col ml-2">
    <div v-for="[title, routes] of Object.entries(menuRoutes)" class="flex flex-col mb-2">
      <p><i>{{ title }}</i></p>
      <router-link v-for="[key, value] of Object.entries(routes)" :to="{name:key}" class="ml-4" tag="button">{{ value }}</router-link>
    </div>

    <hr class="mt-3 mb-3">

    <div class="flex flex-col mb-2">
      <p><i>Other</i></p>
      <a href="https://gist.stuzer.link/" class="ml-4" tag="button">Gist</a>
      <a href="https://pdf.tools.stuzer.link/" class="ml-4" tag="button">PDF tools</a>
    </div>
  </nav>
</template>

<script>

export default {
  name: "Sidebar",
  components: {},
  data() {
    return {
      menuRoutes: {},
    };
  },
  mounted() {
    let menuRoutes = {
      'General': {
        'home': 'Home',
        'explain_crontab': 'Explain crontab',
        'table_to_mediawiki_table': 'Table to Mediawiki table',
        'dummy_image': 'Dummy image',
        'humans_txt': 'humans.txt generator',
        'file_base64_encode_decode': 'File base64 encode/decode',
        // 'qr_code': 'QR code',
      },
      'Strings': {
        'fix_ru_en_keyboard': 'Fix ru-en keyboard',
        'str_length': 'Str length',
        'str_sort_lines': 'Str sort lines',
        'str_to_lower_upper': 'Str to lower/upper',
        'str_remove_duplicate_lines': 'Str remove duplicate lines',
        'str_pad': 'Str pad',
        'str_numeronym': 'Str numeronym (i18n)',
        'str_to_nato_alphabet': 'Str to NATO alphabet',
        'url_encode_decode': 'URL encode/decode',
        'url_query_viewer': 'URL query viewer',
      },
      'PHP': {
        'str_to_php_array': 'Str to PHP array',
        'php_array_to_json': 'PHP array to Json',
      },
      'GO': {
        'go_json_to_struct': 'JSON to Go struct',
        // 'sql_tables_to_struct': 'SQL tables Go struct',
      },
      'JSON': {
        'json_formatter': 'JSON formatter',
      },
      'SQL': {
        'sql_formatter': 'SQL formatter',
        'sql_split_in': 'SQL split IN',
      },
    };

    this.menuRoutes = menuRoutes;
  }
}
</script>