From 2cd5204bbbd70f823514019d94827be1e3b3ac20 Mon Sep 17 00:00:00 2001
From: "Shaun A. Noordin"
Date: Mon, 17 Jun 2024 18:38:44 +0100
Subject: [PATCH 01/14] pages-editor-pt26: remove Safari fix which kills other
browsers
---
css/lab-pages-editor.styl | 1 -
1 file changed, 1 deletion(-)
diff --git a/css/lab-pages-editor.styl b/css/lab-pages-editor.styl
index d558ef56ef..b8541ac4ac 100644
--- a/css/lab-pages-editor.styl
+++ b/css/lab-pages-editor.styl
@@ -85,7 +85,6 @@ $fontWeightBoldPlus = 700
color: $black
font-size: $fontSizeM
padding: $sizeS
- -webkit-appearance: none // Remove gradient overlay in Safari
button
border-radius: $sizeXS
From 5d0a5adbd8913722138324c17743667d7be3ad2a Mon Sep 17 00:00:00 2001
From: "Shaun A. Noordin"
Date: Tue, 18 Jun 2024 22:46:32 +0100
Subject: [PATCH 02/14] TasksPage design: Add New Task button only takes 50%
width when workflow is empty
---
app/pages/lab-pages-editor/components/TasksPage/TasksPage.jsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/pages/lab-pages-editor/components/TasksPage/TasksPage.jsx b/app/pages/lab-pages-editor/components/TasksPage/TasksPage.jsx
index 6061472180..31f18b4c5b 100644
--- a/app/pages/lab-pages-editor/components/TasksPage/TasksPage.jsx
+++ b/app/pages/lab-pages-editor/components/TasksPage/TasksPage.jsx
@@ -296,7 +296,7 @@ export default function TasksPage() {
aria-label="Choose starting Page"
className="flex-item workflow-starting-page"
onChange={handleChangeStartingPage}
- style={(workflow?.steps?.length < 1) ? { display: 'none' } : undefined}
+ style={(workflow?.steps?.length < 1) ? { visibility: 'hidden' } : undefined}
value={firstStepKey}
>
From b42e07a749b2aa4cde1f67d9e6311468f3176b9f Mon Sep 17 00:00:00 2001
From: "Shaun A. Noordin"
Date: Tue, 18 Jun 2024 22:49:48 +0100
Subject: [PATCH 03/14] EditStepDialog design: Done button now has 33% min
width
---
css/lab-pages-editor.styl | 1 +
1 file changed, 1 insertion(+)
diff --git a/css/lab-pages-editor.styl b/css/lab-pages-editor.styl
index b8541ac4ac..8e17092d13 100644
--- a/css/lab-pages-editor.styl
+++ b/css/lab-pages-editor.styl
@@ -359,6 +359,7 @@ $fontWeightBoldPlus = 700
&.done
border: 3px solid $teal
+ min-width: 33%
padding: $sizeS $sizeXL
&[disabled]
From 2719866f66666edd35a76da28f3c762c2d00c2b1 Mon Sep 17 00:00:00 2001
From: "Shaun A. Noordin"
Date: Tue, 18 Jun 2024 22:54:27 +0100
Subject: [PATCH 04/14] NewTaskDialog design: center-align new Tasks button
---
.../components/TasksPage/components/NewTaskDialog.jsx | 2 +-
css/lab-pages-editor.styl | 3 +++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/app/pages/lab-pages-editor/components/TasksPage/components/NewTaskDialog.jsx b/app/pages/lab-pages-editor/components/TasksPage/components/NewTaskDialog.jsx
index 037b2dbbfe..f488b5adc9 100644
--- a/app/pages/lab-pages-editor/components/TasksPage/components/NewTaskDialog.jsx
+++ b/app/pages/lab-pages-editor/components/TasksPage/components/NewTaskDialog.jsx
@@ -85,7 +85,7 @@ function NewTaskDialog({
A task is a unit of work you are asking volunteers to do.
You can ask them to answer a question or mark an image.
-
+
);
@@ -100,6 +124,7 @@ function TextTask({
TextTask.propTypes = {
deleteTask: PropTypes.func,
+ isFirstTaskInStep: PropTypes.bool,
stepHasManyTasks: PropTypes.bool,
task: PropTypes.object,
taskKey: PropTypes.string,
diff --git a/app/pages/lab-pages-editor/icons/CollapseIcon.jsx b/app/pages/lab-pages-editor/icons/CollapseIcon.jsx
new file mode 100644
index 0000000000..690d3c4c5a
--- /dev/null
+++ b/app/pages/lab-pages-editor/icons/CollapseIcon.jsx
@@ -0,0 +1,5 @@
+export default function CollapseIcon({ alt }) {
+ return (
+
+ );
+}
diff --git a/app/pages/lab-pages-editor/icons/ExpandIcon.jsx b/app/pages/lab-pages-editor/icons/ExpandIcon.jsx
new file mode 100644
index 0000000000..b30fa81b2e
--- /dev/null
+++ b/app/pages/lab-pages-editor/icons/ExpandIcon.jsx
@@ -0,0 +1,5 @@
+export default function ExpandIcon({ alt }) {
+ return (
+
+ );
+}
From 4e9762acfda90012e65a6efbd0bc5e04cc164df6 Mon Sep 17 00:00:00 2001
From: "Shaun A. Noordin"
Date: Fri, 21 Jun 2024 17:28:22 +0100
Subject: [PATCH 07/14] Add collapsible Help field for Drawing and Question
Tasks
---
.../EditStepDialog/types/DrawingTask.jsx | 46 +++++++++++++-----
.../EditStepDialog/types/QuestionTask.jsx | 47 ++++++++++++++-----
.../EditStepDialog/types/TextTask.jsx | 3 +-
3 files changed, 70 insertions(+), 26 deletions(-)
diff --git a/app/pages/lab-pages-editor/components/TasksPage/components/EditStepDialog/types/DrawingTask.jsx b/app/pages/lab-pages-editor/components/TasksPage/components/EditStepDialog/types/DrawingTask.jsx
index d912ea8533..693dc1fd25 100644
--- a/app/pages/lab-pages-editor/components/TasksPage/components/EditStepDialog/types/DrawingTask.jsx
+++ b/app/pages/lab-pages-editor/components/TasksPage/components/EditStepDialog/types/DrawingTask.jsx
@@ -1,8 +1,10 @@
import { useEffect, useState } from 'react';
import PropTypes from 'prop-types';
+import CollapseIcon from '../../../../../icons/CollapseIcon.jsx';
import DeleteIcon from '../../../../../icons/DeleteIcon.jsx';
import DrawingToolIcon from '../../../../../icons/DrawingToolIcon.jsx';
+import ExpandIcon from '../../../../../icons/ExpandIcon.jsx';
import MinusIcon from '../../../../../icons/MinusIcon.jsx';
import PlusIcon from '../../../../../icons/PlusIcon.jsx';
@@ -141,6 +143,11 @@ function DrawingTask({
return false;
}
+ const [ showHelpField, setShowHelpField ] = useState(isFirstTaskInStep || task?.help?.length > 0);
+ function toggleShowHelpField() {
+ setShowHelpField(!showHelpField);
+ }
+
// For inputs that don't have onBlur, update triggers automagically.
// (You can't call update() in the onChange() right after setStateValue().)
// TODO: useEffect() means update() is called on the first render, which is unnecessary. Clean this up.
@@ -320,18 +327,33 @@ function DrawingTask({
-
-
);
diff --git a/app/pages/lab-pages-editor/components/TasksPage/components/EditStepDialog/types/QuestionTask.jsx b/app/pages/lab-pages-editor/components/TasksPage/components/EditStepDialog/types/QuestionTask.jsx
index 6772083056..5c112f5f77 100644
--- a/app/pages/lab-pages-editor/components/TasksPage/components/EditStepDialog/types/QuestionTask.jsx
+++ b/app/pages/lab-pages-editor/components/TasksPage/components/EditStepDialog/types/QuestionTask.jsx
@@ -1,7 +1,9 @@
import { useEffect, useState } from 'react';
import PropTypes from 'prop-types';
+import CollapseIcon from '../../../../../icons/CollapseIcon.jsx';
import DeleteIcon from '../../../../../icons/DeleteIcon.jsx';
+import ExpandIcon from '../../../../../icons/ExpandIcon.jsx';
import MinusIcon from '../../../../../icons/MinusIcon.jsx';
import PlusIcon from '../../../../../icons/PlusIcon.jsx';
@@ -10,6 +12,7 @@ const DEFAULT_HANDLER = () => {};
function QuestionTask({
deleteTask = DEFAULT_HANDLER,
enforceLimitedBranchingRule,
+ isFirstTaskInStep = true,
stepHasManyTasks = false,
task,
taskKey,
@@ -73,6 +76,11 @@ function QuestionTask({
return false;
}
+ const [ showHelpField, setShowHelpField ] = useState(isFirstTaskInStep || task?.help?.length > 0);
+ function toggleShowHelpField() {
+ setShowHelpField(!showHelpField);
+ }
+
// For inputs that don't have onBlur, update triggers automagically.
// (You can't call update() in the onChange() right after setStateValue().)
// TODO: useEffect() means update() is called on the first render, which is unnecessary. Clean this up.
@@ -177,18 +185,33 @@ function QuestionTask({
-
-
{ setHelp(e?.target?.value) }}
- />
+
+
+
+
+ {showHelpField && (
+ { setHelp(e?.target?.value) }}
+ />
+ )}
);
diff --git a/app/pages/lab-pages-editor/components/TasksPage/components/EditStepDialog/types/TextTask.jsx b/app/pages/lab-pages-editor/components/TasksPage/components/EditStepDialog/types/TextTask.jsx
index c128c9d7fe..d64ebf5cef 100644
--- a/app/pages/lab-pages-editor/components/TasksPage/components/EditStepDialog/types/TextTask.jsx
+++ b/app/pages/lab-pages-editor/components/TasksPage/components/EditStepDialog/types/TextTask.jsx
@@ -18,7 +18,6 @@ function TextTask({
const [ help, setHelp ] = useState(task?.help || '');
const [ instruction, setInstruction ] = useState(task?.instruction || '');
const [ required, setRequired ] = useState(!!task?.required);
- const [ showHelpField, setShowHelpField ] = useState(isFirstTaskInStep || task?.help?.length > 0);
const title = stepHasManyTasks ? 'Text Task' : 'Main Text';
// Update is usually called manually onBlur, after user input is complete.
function update() {
@@ -35,6 +34,7 @@ function TextTask({
deleteTask(taskKey);
}
+ const [ showHelpField, setShowHelpField ] = useState(isFirstTaskInStep || task?.help?.length > 0);
function toggleShowHelpField() {
setShowHelpField(!showHelpField);
}
@@ -116,7 +116,6 @@ function TextTask({
onChange={(e) => { setHelp(e?.target?.value) }}
/>
)}
-
);
From 9fd1672c8aee5ae98cf30496f2f0e411651cd19a Mon Sep 17 00:00:00 2001
From: "Shaun A. Noordin"
Date: Fri, 21 Jun 2024 17:53:59 +0100
Subject: [PATCH 08/14] Lab Workflows: set certain projects to use PagesEditor
---
app/pages/lab/workflows-table.jsx | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/app/pages/lab/workflows-table.jsx b/app/pages/lab/workflows-table.jsx
index 8c54cebcc9..b37fb25152 100644
--- a/app/pages/lab/workflows-table.jsx
+++ b/app/pages/lab/workflows-table.jsx
@@ -2,6 +2,11 @@ import React from 'react';
import PropTypes from 'prop-types';
import { Link } from 'react-router';
+// TEMPORARY HACK: Pages Editor
+// (@shaunanoordin 2024.06.21)
+const TEST_PROJECTS_THAT_SHOULD_USE_PAGES_EDITOR = ['23976']; // Production IDs.
+// WARNING: doesn't differentiate between production and staging projects
+
const WorkflowsTable = ({
handleSetStatsCompletenessType,
handleWorkflowStatusChange,
@@ -11,6 +16,7 @@ const WorkflowsTable = ({
project,
workflows
}) => {
+ const shouldUsePagesEditor = TEST_PROJECTS_THAT_SHOULD_USE_PAGES_EDITOR.includes(project?.id + '')
return (
@@ -31,10 +37,14 @@ const WorkflowsTable = ({
statsVisible = !workflow.configuration.stats_hidden;
}
+ const viewWorkflowUrl = shouldUsePagesEditor
+ ? labPath(`/workflows/editor/${workflow.id}`)
+ : labPath(`/workflows/${workflow.id}`); // Default
+
return (
-
+
{workflow.display_name}
{' '}(#{workflow.id})
{(project.configuration && workflow.id === project.configuration.default_workflow) && (
From 4f000d23a2ec35d2c1685207e947a891a59d6a4b Mon Sep 17 00:00:00 2001
From: "Shaun A. Noordin"
Date: Mon, 24 Jun 2024 17:47:40 +0100
Subject: [PATCH 09/14] Accessibility: hidden fields now use HTML hidden
---
.../EditStepDialog/types/DrawingTask.jsx | 15 +++++++--------
.../EditStepDialog/types/QuestionTask.jsx | 15 +++++++--------
.../components/EditStepDialog/types/TextTask.jsx | 15 +++++++--------
3 files changed, 21 insertions(+), 24 deletions(-)
diff --git a/app/pages/lab-pages-editor/components/TasksPage/components/EditStepDialog/types/DrawingTask.jsx b/app/pages/lab-pages-editor/components/TasksPage/components/EditStepDialog/types/DrawingTask.jsx
index 693dc1fd25..b79964583d 100644
--- a/app/pages/lab-pages-editor/components/TasksPage/components/EditStepDialog/types/DrawingTask.jsx
+++ b/app/pages/lab-pages-editor/components/TasksPage/components/EditStepDialog/types/DrawingTask.jsx
@@ -346,14 +346,13 @@ function DrawingTask({
}
- {showHelpField && (
- { setHelp(e?.target?.value) }}
- />
- )}
+ { setHelp(e?.target?.value) }}
+ />
);
diff --git a/app/pages/lab-pages-editor/components/TasksPage/components/EditStepDialog/types/QuestionTask.jsx b/app/pages/lab-pages-editor/components/TasksPage/components/EditStepDialog/types/QuestionTask.jsx
index 5c112f5f77..94f44b82f9 100644
--- a/app/pages/lab-pages-editor/components/TasksPage/components/EditStepDialog/types/QuestionTask.jsx
+++ b/app/pages/lab-pages-editor/components/TasksPage/components/EditStepDialog/types/QuestionTask.jsx
@@ -204,14 +204,13 @@ function QuestionTask({
}
- {showHelpField && (
- { setHelp(e?.target?.value) }}
- />
- )}
+ { setHelp(e?.target?.value) }}
+ />
);
diff --git a/app/pages/lab-pages-editor/components/TasksPage/components/EditStepDialog/types/TextTask.jsx b/app/pages/lab-pages-editor/components/TasksPage/components/EditStepDialog/types/TextTask.jsx
index d64ebf5cef..ec04cc06ba 100644
--- a/app/pages/lab-pages-editor/components/TasksPage/components/EditStepDialog/types/TextTask.jsx
+++ b/app/pages/lab-pages-editor/components/TasksPage/components/EditStepDialog/types/TextTask.jsx
@@ -108,14 +108,13 @@ function TextTask({
}
- {showHelpField && (
- { setHelp(e?.target?.value) }}
- />
- )}
+ { setHelp(e?.target?.value) }}
+ />
);
From 1d6b945a6ed4444cb69d326f4b40baea11569ed1 Mon Sep 17 00:00:00 2001
From: "Shaun A. Noordin"
Date: Mon, 24 Jun 2024 22:02:49 +0100
Subject: [PATCH 10/14] Accessibility: show/hide Help field button indicates
change of state
Co-authored-by: Jim O'Donnell
---
.../TasksPage/components/EditStepDialog/types/DrawingTask.jsx | 2 ++
1 file changed, 2 insertions(+)
diff --git a/app/pages/lab-pages-editor/components/TasksPage/components/EditStepDialog/types/DrawingTask.jsx b/app/pages/lab-pages-editor/components/TasksPage/components/EditStepDialog/types/DrawingTask.jsx
index b79964583d..b8a0501fa1 100644
--- a/app/pages/lab-pages-editor/components/TasksPage/components/EditStepDialog/types/DrawingTask.jsx
+++ b/app/pages/lab-pages-editor/components/TasksPage/components/EditStepDialog/types/DrawingTask.jsx
@@ -336,6 +336,8 @@ function DrawingTask({
|