<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap">
  <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
  <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
  <!-- Initialize side navigation drawer -->
  <script>
    $(document).ready(function(){
        $('.sidenav').sidenav();

        // Fetch routes from Flask endpoint
        $.ajax({
          url: '/routes',
          type: 'GET',
          success: function(data) {
            // Loop through routes and add them to the side navigation drawer
            var $sidenav = $('#slide-out');
            data.forEach(function(route){
              $sidenav.append('<li><a href="' + route.path + '">' + route.name + '</a></li>');
            });
          },
          error: function(xhr, textStatus, errorThrown) {
            console.log('Error fetching routes: ' + errorThrown);
          }
        });
    });
  </script>
  <title>Daisy</title>
</head>
<body>
  <!-- Header -->
  <header>
    <nav>
      <div class="nav-wrapper">
        <a href="#" data-target="slide-out" class="sidenav-trigger"><i class="material-icons">menu</i></a>
        <a href="#" class="brand-logo center"><i class="material-icons">local_florist</i>Daisy</a>
        <ul class="right hide-on-med-and-down">
          <!-- Add your right-aligned links here -->
        </ul>
      </div>
    </nav>
  </header>

  <!-- Side Navigation Drawer -->
  <ul id="slide-out" class="sidenav">
  </ul>
</body>
</html>
