<div class="contextual">
  <%= link_to l(:label_ux_toolkit_configure_dashboard),
              ux_toolkit_my_work_settings_path,
              class: 'icon icon-settings' %>
</div>

<h2><%= l(:label_ux_toolkit_my_work) %></h2>

<% if @visible_blocks.blank? %>
  <div class="nodata ux-toolkit-empty-state">
    <p><%= l(:text_ux_toolkit_no_dashboard_blocks_enabled) %></p>
    <%= link_to l(:label_ux_toolkit_configure_dashboard),
                ux_toolkit_my_work_settings_path,
                class: 'button-small icon icon-settings' %>
  </div>
<% else %>
  <div class="ux-toolkit-my-work" data-ux-toolkit-dashboard>
    <% @visible_blocks.each do |block| %>
      <% case block %>
      <% when UxToolkitUserPreference::DASHBOARD_BLOCK_ASSIGNED_TO_ME %>
        <%= render 'issue_block', block: block, title_key: :label_ux_toolkit_assigned_to_me, issues: @assigned_issues, empty_key: :text_ux_toolkit_no_assigned_issues %>
      <% when UxToolkitUserPreference::DASHBOARD_BLOCK_DUE_TODAY %>
        <%= render 'issue_block', block: block, title_key: :label_ux_toolkit_due_today, issues: @due_today_issues, empty_key: :text_ux_toolkit_no_due_today_issues %>
      <% when UxToolkitUserPreference::DASHBOARD_BLOCK_OVERDUE %>
        <%= render 'issue_block', block: block, title_key: :label_ux_toolkit_overdue, issues: @overdue_issues, empty_key: :text_ux_toolkit_no_overdue_issues %>
      <% when UxToolkitUserPreference::DASHBOARD_BLOCK_DUE_SOON %>
        <%= render 'issue_block', block: block, title_key: :label_ux_toolkit_due_soon, issues: @due_soon_issues, empty_key: :text_ux_toolkit_no_due_soon_issues %>
      <% when UxToolkitUserPreference::DASHBOARD_BLOCK_FAVORITE_PROJECTS %>
        <%= render 'project_block', block: block, projects: @favorite_projects, recent: false %>
      <% when UxToolkitUserPreference::DASHBOARD_BLOCK_FAVORITE_QUERIES %>
        <%= render 'query_block', block: block, queries: @favorite_queries %>
      <% when UxToolkitUserPreference::DASHBOARD_BLOCK_RECENT_ISSUES %>
        <%= render 'recent_issue_block', block: block, recent_issues: @recent_issues %>
      <% when UxToolkitUserPreference::DASHBOARD_BLOCK_RECENT_PROJECTS %>
        <%= render 'project_block', block: block, projects: @recent_projects, recent: true %>
      <% end %>
    <% end %>
  </div>
<% end %>

<% html_title(l(:label_ux_toolkit_my_work)) %>
