<!DOCTYPE html>
<html>
  <head>
    <meta data-hook="head-js">
    <title><%=t "head.title", title: (yield :head_title) %></title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta name="max-file-size" content="<%= Rails.configuration.x.file_max_size_mb %>">
    <%= stylesheet_link_tag 'application', media: 'all' %>
    <%= javascript_include_tag 'application' %>
    <%= javascript_pack_tag 'application' %>


    <% if MarvinJsService.enabled? && ENV['MARVINJS_API_KEY'] %>
      <script src="https://marvinjs.chemicalize.com/v1/<%= ENV['MARVINJS_API_KEY'] %>/client-settings.js"></script>
      <script src="https://marvinjs.chemicalize.com/v1/client.js"></script>
    <% end %>

    <%= favicon_link_tag "favicon.ico" %>
    <%= favicon_link_tag "favicon-16.png", type: "image/png", size: "16x16" %>
    <%= favicon_link_tag "favicon-32.png", type: "image/png", size: "32x32" %>
    <%= favicon_link_tag "favicon-48.png", type: "image/png", size: "48x48" %>
    <%= stylesheet_pack_tag 'fonts' %>
    <%= stylesheet_pack_tag 'fontawesome' %>

    <%= csrf_meta_tags %>
    <% if content_for?(:head) %>
      <%= yield(:head) %>
    <% end %>

    <%= javascript_pack_tag 'tui_image_editor' %>
    <%= stylesheet_pack_tag 'tui_image_editor_styles' %>
  </head>
  <body
    class="<%= yield :body_class %>"
    <% if user_signed_in? && current_team.present? %>
    data-atwho-users-url="<%= atwho_users_team_path(current_team) %>"
    data-atwho-task-url="<%= atwho_my_modules_team_path(current_team) %>"
    data-atwho-project-url="<%= atwho_projects_team_path(current_team) %>"
    data-atwho-experiment-url="<%= atwho_experiments_team_path(current_team) %>"
    data-atwho-repositories-url="<%= atwho_menu_team_path(current_team) %>"
    data-atwho-rep-items-url="<%= atwho_rep_items_team_path(current_team) %>"
    data-atwho-menu-items="<%= atwho_menu_items_team_path(current_team) %>"
    <% end %>
  >

    <span style="display: none;" data-hook="body-js"></span>
    <span style="display: none;" data-hook="application-body-html"></span>

    <%= render "shared/navigation" %>

    <% if user_signed_in? %>
      <%= render "shared/about_modal" %>
      <%= render "shared/file_preview/modal.html.erb" %>
      <%= render "shared/file_edit_modal.html.erb" %>
      <%= render "shared/marvinjs_modal.html.erb" %>
      <%= render "shared/comments/comments_sidebar.html.erb" %>
    <% end %>

    <% if user_signed_in? && flash[:system_notification_modal] && current_user.show_login_system_notification? %>
      <%= render partial: "/system_notifications/system_notification_modal", locals: { notification: current_user.user_system_notifications.show_on_login(true) } %>
    <% else %>
      <%= render partial: "/system_notifications/system_notification_modal", locals: { notification: nil} %>
    <% end %>

    <%= render partial: 'shared/flash_alerts',
                 locals: { flash: flash, notice: notice, alert: alert } %>

    <%= render "shared/left_menu_bar" if user_signed_in? %>

    <div id="content-wrapper">
      <% if user_signed_in? && current_user.teams.empty? && !(activities_are_selected? || settings_are_selected?) %>
        <!-- If member of no teams -->
        <div id="no-teams-jumbotron" class="jumbotron">
          <h2><%=t 'general.no_teams.title' %></h2>
          <p data-hook="general-no-teams-text"><%=t 'general.no_teams.text' %></p>
        </div>
      <% else %>
        <%= yield :content %>
      <% end %>
    </div>

    <script data-hook="footer-js">
      // GLOBALS
      window.IN_REQUEST = false;
    </script>
  </body>
</html>
