import _Navigation from './_Navigation.js';
import _User from './_User.js';
import MenuItem from './MenuItem.js';

var Navigation = function(){
return {view: function(){
    var hidden_class = _Navigation.is_hidden ?'.hidden':'';
    var v = m("section.navbar-section", _Navigation.menu.map(function(menuitem){
      if(!menuitem.restricted){
        return m(MenuItem, {menuitem: menuitem})
        }
      else if(menuitem.restricted === 'admin' && _User.isAdmin()){
        return m(MenuItem, {menuitem: menuitem})
        }
      else if(menuitem.restricted === true && _User.isLoggedIn()){
        return m(MenuItem, {menuitem: menuitem})
        }
      }));
    return m('header.navbar'+hidden_class, [
      //m('button',{onclick: function(){ _Navigation.is_hidden = true; }},'Close'),
      v
      ]);
    /*
    return m("ul.flex.items-center.justify-center.bg-gray-900.text-white.cursor-default", [
      m("li", [
        m(".hover:bg-gray-700.rounded.px-2.py-1.text-center", {onclick: navigateTo(Home,null)}, "Home")
        ]),
      m("li", [
        m(".hover:bg-gray-700.rounded.px-2.py-1.text-center", {onclick: navigateTo(AboutUs,null)}, "About Us")
        ]),
      m("li", [
        m(".hover:bg-gray-700.rounded.px-2.py-1.text-center", {onclick: navigateTo(Events,null)}, "Events"),
        m(".menu.hidden", [
          m(".item", "Upcoming Trade Shows")
          ])
        ]),
      m("li", [
        m(".hover:bg-gray-700.rounded.px-2.py-1.text-center", "Collections Catalog"),
        m(".menu.hidden", [
          m(".section-heading", "Optical Frames"),
          m(".heading", "Style"),
          m(".subheading", "Adults"),
          m(".item", {onclick: navigateTo(ItemBrowser, {filter:{type: "frame", gender: "mens"}})}, "Mens"),
          m(".item", "Womens"),
          m(".item", "Unisex"),
          m(".subheading.item", "Teens"),
          m(".subheading.item", "Kids"),
          m(".heading", "Material"),
          m(".subheading", "Plastic"),
          m(".item", "Acetate"),
          m(".item", "TR90 & Silicone"),
          m(".item", "Injection"),
          m(".subheading", "Metal"),
          m(".item", "Aluminum"),
          m(".item", "Monel"),
          m(".item", "Stainless Steel"),
          m(".item", "Titanium"),
          m(".section-heading", "Sunglasses"),
          m(".heading", "Brand"),
          m(".subheading.item", "Designer Brands"),
          m(".subheading", "Exclusive Labels"),
          m(".item", "Kadima"),
          m(".item", "Kapricci"),
          m(".item", "Bubble Gum"),
          m(".item", "Primmera"),
          m(".heading", "Gender"),
          m(".item", "Mens"),
          m(".item", "Womens"),
          m(".item", "Unisex"),
          m(".heading.item", "Clearance Items")
          ])
        ]),
      m("li", [
        m(".hover:bg-gray-700.rounded.px-2.py-1.text-center", "Lenses"),
        m(".menu.hidden", [
          m(".section-heading", "Finished"),
          m(".heading", "Blue Bocker"),
          m(".heading", "Single Vision"),
          m(".heading", "Multifocals"),
          m(".section-heading", "Semi-Finished"),
          m(".heading", "Blue Bocker"),
          m(".heading", "Single Vision"),
          m(".heading", "Multifocals")
          ])
        ]),
      m("li", [
        m(".hover:bg-gray-700.rounded.px-2.py-1.text-center", "Equipment"),
        m(".menu.hidden", [
          m(".heading", "Autorefractometer"),
          m(".heading", "Chart Projector"),
          m(".heading", "Lensometer"),
          m(".heading", "Ophthalmoscope"),
          m(".heading", "Pachimeter"),
          m(".heading", "Phoropter"),
          m(".heading", "Prism bar"),
          m(".heading", "Pupilometer"),
          m(".heading", "Retinoscope"),
          m(".heading", "Slit Lamp"),
          m(".heading", "Trial Lens Set"),
          m(".item", "*104 pcs"),
          m(".item", "*158 pcs"),
          m(".item", "*232 pcs"),
          m(".item", "*266 pcs")
          ])
        ]),
      m("li", [
        m(".hover:bg-gray-700.rounded.px-2.py-1.text-center", "Accessories"),
        m(".menu.hidden", [
          m(".heading", "Cases"),
          m(".heading", "Cords"),
          m(".heading", "Microfiber Cloth Lens Cleaner"),
          m(".heading", "Lens Cleaner Bottles"),
          m(".heading", "Nosepads"),
          m(".heading", "Screws")
          ])
        ])
      ]);
      */
      }}}

export default Navigation;