Refactor task page UX [SCI-8951]

This commit is contained in:
Anton 2023-08-09 11:01:20 +02:00
parent fcd76661c7
commit f688995635
18 changed files with 102 additions and 215 deletions

View file

@ -72,6 +72,10 @@
@import "settings/teams";
@import "settings/users";
@import "settings/webhooks";
@import "shared/content/attachments";
@import "shared/content/checklist";
@import "shared/content/table";
@import "shared/content/text";
@import "shared/action_toolbar";
@import "shared/assets";
@import "shared/avatar";

View file

@ -1,100 +0,0 @@
/*
*= require_self
*= require jquery-ui/draggable
*= require rails_bootstrap_forms
*= require bootstrap-select
*= require sn-icon-font
*= require sn-inter-font
*= stub reports_pdf
*/
@import "shared_styles/constants/*";
@import "constants";
@import "bootstrap-sprockets";
// Core variables and mixins
@import "bootstrap/variables";
@import "bootstrap/mixins";
// Reset and dependencies
@import "bootstrap/normalize";
@import "bootstrap/print";
@import "bootstrap/glyphicons";
// Core CSS
@import "bootstrap/scaffolding";
@import "bootstrap/type";
@import "bootstrap/code";
@import "bootstrap/grid";
@import "bootstrap/tables";
@import "bootstrap/forms";
// Components
@import "bootstrap/component-animations";
@import "bootstrap/dropdowns";
@import "bootstrap/button-groups";
@import "bootstrap/input-groups";
@import "bootstrap/navs";
@import "bootstrap/navbar";
@import "bootstrap/breadcrumbs";
@import "bootstrap/pagination";
@import "bootstrap/pager";
@import "bootstrap/labels";
@import "bootstrap/badges";
@import "bootstrap/jumbotron";
@import "bootstrap/thumbnails";
@import "bootstrap/alerts";
@import "bootstrap/progress-bars";
@import "bootstrap/media";
@import "bootstrap/list-group";
@import "bootstrap/panels";
@import "bootstrap/responsive-embed";
@import "bootstrap/wells";
@import "bootstrap/close";
// Components w/ JavaScript
@import "bootstrap/modals";
@import "bootstrap/tooltip";
@import "bootstrap/popovers";
@import "bootstrap/carousel";
// Utility classes
@import "bootstrap/utilities";
@import "bootstrap/responsive-utilities";
@import "bootstrap-datetimepicker";
@import "bootstrap-colorselector";
@import "bootstrap-tagsinput";
@import "bootstrap-tagsinput-typeahead";
@import "jstree_style.min";
@import "shared_styles/elements/*";
@import "handsontable.full";
@import "emojionearea.min";
@import "ajax-bootstrap-select.min";
@import "extend/bootstrap";
@import "access_permissions/*";
@import "extend/*";
@import "hooks/*";
@import "partials/*";
@import "my_modules/protocols/*";
@import "my_modules/results/*";
@import "my_modules/*";
@import "protocols/*";
@import "dashboard/*";
@import "repository/*";
@import "experiment/*";
@import "repository_columns/*";
@import "label_templates/*";
@import "reports/*";
@import "settings/*";
@import "shared/*";
@import "shared/content/*";
@import "steps/*";
@import "themes/*";
@import "navigation/*";
@import "*"

View file

@ -7,9 +7,9 @@
}
.protocol-buttons-group {
column-gap: .5rem;
display: grid;
grid-template-columns: auto auto auto;
align-items: center;
display: flex;
gap: .5rem;
}
.portocol-header-left-part {
@ -41,11 +41,11 @@
&::before,
&::after {
background-color: var(--sn-light-grey);
border-bottom: 1px dotted var(--sn-light-grey);
content: "";
display: inline-block;
flex-grow: 1;
height: 1px;
height: 0;
}
.sn-icon-new-task {

View file

@ -51,15 +51,6 @@
width: calc(100% + 2rem);
}
.my-module-position-container {
background-color: $color-white;
box-shadow: $flyout-shadow;
margin: 1rem auto 0 0;
max-width: 900px;
padding: 0 0 1rem;
z-index: 2;
}
.dropdown {
.dropdown-menu {
z-index: 102;
@ -76,7 +67,9 @@
}
.task-section {
margin: 16px 0;
background-color: var(--sn-white);
border-radius: .25rem;
margin: 1rem 0;
padding: 0 1rem;
.task-section-caret {
@ -115,6 +108,10 @@
}
}
.task-section-body {
padding-bottom: 1rem;
}
.task-section-header {
align-items: center;
display: flex;

View file

@ -1,25 +0,0 @@
.sci--layout-navigation-breadcrumbs {
background-color: var(--sn-white);
}
.sci--layout-content {
background-color: var(--sn-white);
.content-pane {
.title-row {
background-color: var(--sn-white);
}
.header-actions {
background-color: var(--sn-white);
display: flex;
height: 3rem;
padding: 0rem 1rem;
align-items: center;
gap: 0.5rem;
align-self: stretch;
z-index: 205;
border-bottom: 1px solid var(--sn-light-grey);
}
}
}

View file

@ -1,7 +1,6 @@
.sci--layout-navigation-breadcrumbs {
--max-breadcrumbs-link-width: 11.25rem;
align-items: center;
background-color: var(--sn-white);
display: flex;
flex-wrap: nowrap;
padding-left: 1.5rem;

View file

@ -69,6 +69,7 @@ body.navigator-collapsed {
}
.sci--layout-navigation-navigator {
background-color: var(--sn-white);
grid-area: navigator;
height: calc(100vh - var(--top-navigation-height) - var(--breadcrumbs-navigation-height) - 1rem);
position: sticky;
@ -80,6 +81,7 @@ body.navigator-collapsed {
}
.sci--layout-navigation-breadcrumbs {
background-color: var(--sn-white);
grid-area: breadcrumbs;
height: var(--breadcrumbs-navigation-height);
position: sticky;
@ -91,6 +93,7 @@ body.navigator-collapsed {
}
.sci--layout-content {
background-color: var(--sn-white);
grid-area: content;
padding: 0 1.5rem;
width: 100%;
@ -99,6 +102,15 @@ body.navigator-collapsed {
padding: 1em; // override bootstrap and old pages support
}
}
&[data-grey-background="true"] {
.sci--layout-content,
.sci--layout-navigation-breadcrumbs,
.sci--layout-navigation-navigator {
background-color: var(--sn-super-light-grey);
}
}
}
.w-98 {

View file

@ -3,16 +3,20 @@
.content-pane {
--content-header-size: 9.5em;
background-color: $color-white;
background-color: var(--sn-white);
margin: 20px 0;
&.with-grey-background {
background: var(--sn-super-light-grey);
}
&.flexible {
margin: 0;
}
.content-header {
&.sticky-header {
background: $color-white;
background-color: inherit;
position: sticky;
position: -webkit-sticky;
top: var(--navbar-height);
@ -21,7 +25,7 @@
.title-row {
align-items: center;
background: $color-white;
background-color: inherit;
display: flex;
height: 4em;
margin-left: -1.5rem;

View file

@ -76,27 +76,32 @@
.step-state {
align-self: center;
border: 1px solid $color-alto;
background-color: var(--sn-light-grey);
border: 1px solid transparent;
border-radius: 50%;
cursor: pointer;
height: 24px;
position: relative;
text-align: center;
width: 24px;
margin-bottom: -.5em;
&::after {
@include font-sn-icon;
color: $color-white;
content: $sn-icon-check;
height: 24px;
left: -1px;
position: absolute;
top: -6px;
}
&:hover {
border-color: $brand-success;
border-color: var(--sn-science-blue);
}
&.completed {
background: $brand-success;
border: 2px solid $brand-success;
&::after {
@include font-awesome;
color: $color-white;
content: $font-fas-check;
}
background: var(--sn-science-blue);
border: 1px solid var(--sn-science-blue);
}
}
@ -279,7 +284,7 @@
.step-controls {
display: flex;
align-items: baseline;
align-items: center;
min-height: 35px;
}

View file

@ -15,28 +15,44 @@
<div class="actions-block">
<div class="protocol-buttons-group">
<a v-if="urls.add_step_url"
class="btn btn-primary"
class="btn btn-secondary"
@keyup.enter="addStep(steps.length)"
@click="addStep(steps.length)"
tabindex="0">
<span class="sn-icon sn-icon-new-task" aria-hidden="true"></span>
<span>{{ i18n.t("protocols.steps.new_step") }}</span>
</a>
<button class="btn btn-secondary" data-toggle="modal" data-target="#print-protocol-modal" tabindex="0">
<span class="sn-icon sn-icon-printer" aria-hidden="true"></span>
<span>{{ i18n.t("protocols.print.button") }}</span>
</button>
<template v-if="steps.length > 0">
<button class="btn btn-secondary" @click="collapseSteps" tabindex="0">
{{ i18n.t("protocols.steps.collapse_label") }}
</button>
<button class="btn btn-secondary" @click="expandSteps" tabindex="0">
{{ i18n.t("protocols.steps.expand_label") }}
</button>
</template>
<ProtocolOptions
v-if="protocol.attributes && protocol.attributes.urls"
:protocol="protocol"
@protocol:delete_steps="deleteSteps"
:canDeleteSteps="steps.length > 0 && urls.delete_steps_url !== null"
/>
<button class="btn btn-light icon-btn" data-toggle="modal" data-target="#print-protocol-modal" tabindex="0">
<span class="sn-icon sn-icon-printer" aria-hidden="true"></span>
</button>
<a v-if="steps.length > 0 && urls.reorder_steps_url"
class="btn btn-light icon-btn"
data-toggle="modal"
@click="startStepReorder"
@keyup.enter="startStepReorder"
:class="{'disabled': steps.length == 1}"
tabindex="0" >
<i class="sn-icon sn-icon-sort" aria-hidden="true"></i>
</a>
</div>
</div>
</div>
<div id="protocol-content" class="protocol-content collapse in" aria-expanded="true">
<div>
<div class="pl-9">
<div class="protocol-name" v-if="!inRepository">
<InlineEdit
v-if="urls.update_protocol_name_url"
@ -103,26 +119,6 @@
</div>
</div>
<div id="protocol-steps-container" :class=" inRepository ? 'protocol-steps collapse in' : ''">
<div v-if="steps.length > 0" class="protocol-step-actions">
<button class="btn btn-light" @click="collapseSteps" tabindex="0">
<span class="sn-icon sn-icon-collapse"></span>
{{ i18n.t("protocols.steps.collapse_label") }}
</button>
<button class="btn btn-light" @click="expandSteps" tabindex="0">
<span class="sn-icon sn-icon-expand"></span>
{{ i18n.t("protocols.steps.expand_label") }}
</button>
<a v-if="urls.reorder_steps_url"
class="btn btn-light"
data-toggle="modal"
@click="startStepReorder"
@keyup.enter="startStepReorder"
:class="{'disabled': steps.length == 1}"
tabindex="0" >
<i class="sn-icon sn-icon-sort" aria-hidden="true"></i>
<span>{{ i18n.t("protocols.reorder_steps.button") }}</span>
</a>
</div>
<div class="protocol-steps">
<template v-for="(step, index) in steps">
<div class="step-block" :key="step.id">

View file

@ -59,7 +59,7 @@
<div class="step-actions-container">
<input type="file" class="hidden" ref="fileSelector" @change="loadFromComputer" multiple />
<div ref="elementsDropdownButton" v-if="urls.update_url" class="dropdown">
<button class="btn btn-light btn-black dropdown-toggle insert-button" type="button" :id="'stepInserMenu_' + step.id" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
<button class="btn btn-light dropdown-toggle insert-button" type="button" :id="'stepInserMenu_' + step.id" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
{{ i18n.t('protocols.steps.insert.button') }}
<span class="sn-icon sn-icon-down"></span>
</button>
@ -120,7 +120,7 @@
<a href="#"
v-if="!inRepository"
ref="comments"
class="open-comments-sidebar btn icon-btn btn-light btn-black"
class="open-comments-sidebar btn icon-btn btn-light"
data-turbolinks="false"
data-object-type="Step"
@click="openCommentsSidebar"
@ -135,7 +135,7 @@
</a>
<div v-if="urls.update_url" class="step-actions-container">
<div ref="actionsDropdownButton" class="dropdown">
<button class="btn btn-light icon-btn btn-black dropdown-toggle insert-button" type="button" :id="'stepOptionsMenu_' + step.id" data-toggle="dropdown" data-display="static" aria-haspopup="true" aria-expanded="true">
<button class="btn btn-light icon-btn dropdown-toggle insert-button" type="button" :id="'stepOptionsMenu_' + step.id" data-toggle="dropdown" data-display="static" aria-haspopup="true" aria-expanded="true">
<i class="sn-icon sn-icon-more-hori"></i>
</button>
<ul ref="actionsDropdown" class="dropdown-menu dropdown-menu-right insert-element-dropdown" :aria-labelledby="'stepOptionsMenu_' + step.id">

View file

@ -67,6 +67,7 @@
<span style="display: none;" data-hook="application-body-html"></span>
<div class="sci--layout"
data-grey-background="<%= ['my_modules', 'results'].include?(controller_name) %>"
data-breadcrumbs-collapsed="<%= !@breadcrumbs_items.present? %>"
data-navigator-collapsed="<%= !@navigator || session[:navigator_collapsed] %>"
data-left-navigation-collapsed=<%= !user_signed_in? %>

View file

@ -19,4 +19,3 @@
</h1>
</div>
</div>
<%= stylesheet_link_tag 'my_modules/shared/layout_overrides' %>

View file

@ -1,13 +1,13 @@
<div class="header-actions">
<div class="flex items-center uppercase text-bold">
<div class="bg-sn-white border-b border-solid border-0 border-sn-sleepy-grey rounded-t px-4 py-2">
<div class="flex items-center uppercase text-bold gap-4">
<% if can_read_experiment?(@my_module.experiment) %>
<a class="p-4 border-b-4 border-transparent hover:no-underline capitalize <%= is_module_protocols? ? "text-sn-blue" : "text-sn-grey" %>"
<a class="p-3 border-b-4 border-transparent hover:no-underline capitalize <%= is_module_protocols? ? "text-sn-blue" : "text-sn-grey" %>"
href="<%= protocols_my_module_url(@my_module) %>"
title="<%= t("nav2.modules.steps") %>"
>
<%=t "nav2.modules.steps" %>
</a>
<a class="p-4 border-b-4 border-transparent hover:no-underline capitalize <%= is_module_results? ? "text-sn-blue" : "text-sn-grey" %>"
<a class="p-3 border-b-4 border-transparent hover:no-underline capitalize <%= is_module_results? ? "text-sn-blue" : "text-sn-grey" %>"
href="<%= my_module_results_path(@my_module) %>"
title="<%= t("nav2.modules.results") %>"
>
@ -17,7 +17,7 @@
<sup class="navigation-results-counter"><%= @my_module.archived_branch? ? @my_module.results.size : @active_results_size %></sup>
<% end %>
</a>
<a class="p-4 border-b-4 border-transparent hover:no-underline capitalize <%= is_module_activities? ? "text-sn-blue" : "text-sn-grey" %>"
<a class="p-3 border-b-4 border-transparent hover:no-underline capitalize <%= is_module_activities? ? "text-sn-blue" : "text-sn-grey" %>"
href="<%= activities_my_module_url(@my_module, view_mode: params[:view_mode]) %>"
title="<%= t("nav2.modules.activities") %>"
>
@ -27,7 +27,7 @@
<div data-hook="secondary-navigation-tabs"></div>
<% if can_read_experiment?(@my_module.experiment) && !@my_module.archived_branch? %>
<a class="p-4 border-b-4 border-transparent hover:no-underline capitalize <%= is_module_archive? ? "text-sn-blue" : "text-sn-grey" %>"
<a class="p-3 border-b-4 border-transparent hover:no-underline capitalize <%= is_module_archive? ? "text-sn-blue" : "text-sn-grey" %>"
href="<%= archive_my_module_url(@my_module) %>"
title="<%= t'nav2.modules.archive' %>"
>

View file

@ -37,7 +37,7 @@
%>
<% end %>
<%= render partial: 'shared/drag_n_drop_overlay' %>
<div class="content-pane flexible my-modules-protocols-index" data-task-id="<%= @my_module.id %>">
<div class="content-pane flexible my-modules-protocols-index with-grey-background" data-task-id="<%= @my_module.id %>">
<%= render partial: 'my_modules/header' %>
<div class="my-module-position-container">
<!-- Header Actions -->
@ -45,19 +45,6 @@
<!-- Details -->
<div class="task-section task-information hidden">
<div id="task-details" class="task-section-header">
<div class="task-sharing-and-flows">
<%= render partial: 'my_modules/status_flow/task_flow_button', locals: { my_module: @my_module } if @my_module.my_module_status_flow %>
<% if current_team.shareable_links_enabled? %>
<div class="share-task-container" data-behaviour="vue">
<share-task-container
<%= 'shared' if @my_module.shared? %>
shareable-link-url="<%= my_module_shareable_link_path(@my_module) %>"
<%= 'disabled' if !can_manage_my_module?(current_user, @my_module) %> />
</div>
<%= javascript_include_tag 'vue_share_task_container' %>
<% end %>
</div>
<div class="task-details-container flex items-center mr-auto gap-2">
<a class="task-section-caret collapsed" role="button" data-toggle="collapse" href="#details-container" aria-expanded="false" aria-controls="details-container">
<i class="sn-icon sn-icon-right"></i>
@ -84,12 +71,21 @@
<%= @my_module.code %>
</span>
</div>
<div class="task-flows">
<div class="task-sharing-and-flows">
<%= render partial: 'my_modules/status_flow/task_flow_button', locals: { my_module: @my_module } if @my_module.my_module_status_flow %>
<% if current_team.shareable_links_enabled? %>
<div class="share-task-container" data-behaviour="vue">
<share-task-container
<%= 'shared' if @my_module.shared? %>
shareable-link-url="<%= my_module_shareable_link_path(@my_module) %>"
<%= 'disabled' if !can_manage_my_module?(current_user, @my_module) %> />
</div>
<%= javascript_include_tag 'vue_share_task_container' %>
<% end %>
</div>
</div>
<div id="details-container" class="task-details collapse">
<div id="details-container" class="task-details collapse task-section-body">
<%= render partial: 'my_module_details' %>
</div>
</div>
@ -103,7 +99,7 @@
</span>
</a>
</div>
<div class="collapse in" id="notes-container" aria-expanded="true">
<div class="collapse in task-section-body" id="notes-container" aria-expanded="true">
<%= render partial: "my_module_notes" %>
</div>
</div>
@ -121,7 +117,7 @@
<div class="actions-block">
<% if can_assign_my_module_repository_rows?(@my_module) %>
<div class="dropdown repositories-assign-container sci-dropdown" data-repositories-url="<%= my_module_repositories_dropdown_list_path(@my_module) %>">
<a href="#" id="repositories-assign-button" class="btn btn-secondary btn-block" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
<a href="#" id="repositories-assign-button" class="btn btn-light btn-block" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
<span><%= t('my_modules.assigned_items.assign_from') %></span>
<span class="sn-icon sn-icon-down"></span>
</a>
@ -131,7 +127,7 @@
<% end %>
</div>
</div>
<div class="collapse in panel-group" id="assigned-items-container" aria-expanded="true"
<div class="collapse in panel-group task-section-body" id="assigned-items-container" aria-expanded="true"
data-repositories-list-url="<%= my_module_repositories_list_html_path(@my_module) %>">
<%= render partial: "my_modules/repositories/repositories_list" %>
</div>

View file

@ -117,7 +117,6 @@ Rails.application.config.assets.precompile += %w(results/result_texts/edit.js)
Rails.application.config.assets.precompile += %w(shared/file_preview.js)
Rails.application.config.assets.precompile += %w(users/shared/linkedin_sign_in_links.js)
Rails.application.config.assets.precompile += %w(reports/template_helpers.js)
Rails.application.config.assets.precompile += %w(my_modules/shared/layout_overrides.css)
Rails.application.config.assets.precompile += %w(shareable_links/my_module_protocol_show.js)
Rails.application.config.assets.precompile += %w(shareable_links/repositories.js)
Rails.application.config.assets.precompile += %w(shareable_links/date_formatting.js)

View file

@ -1631,7 +1631,7 @@ en:
disclaimer: "Anyone with the link can view the protocol and results pages of this task."
too_long_text: "Text is too long (maximum number is %{counter} characters)"
copy_success: "Shared link copied to clipboard"
destroy_modal:
destroy_modal:
title: "Deactivate shared link"
description: "This action will permanently deactivate the shared link. Any user who has this link will no longer be able to access the task."
deactivate: "Deactivate"
@ -3034,7 +3034,7 @@ en:
duplicate: 'Duplicate'
delete: 'Delete'
insert:
button: 'Insert'
button: 'Add content'
title: 'Insert step content'
table: 'Table'
well_plate: 'Well plate'