-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pages Editor: misc updates for internal review #7105
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good! The majority of changes in this PR we've discussed through weekly meetings, so I just double checked that the various features work on this PR branch.
A major styling behavior I didn't notice until now is that the dropdowns appear differently in Safari. There's probably some css rules used in the Pages Editor that are handled differently in various browser. Here's screenshots of Safari:
// if (!workflow || !taskKey || !workflow?.tasks?.[taskKey]) return; | ||
// UPDATE: DON'T actually check if the task exists. | ||
// This is useful if a Step refers to a Task that doesn't exist. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should these lines be permanently removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking of keeping this in as a warning, since other functions usually have this if (!thing) return
safety pattern, but for this function specifically, that safety breaks the code. Maybe I'll rewrite this to a simpler warning note so it doesn't look like commented-out code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deleteTask() has now been updated:
function deleteTask(taskKey) {
if (!workflow) return;
// NOTE: don't check if task actually exists before deleting it.
// This is useful if a Step somehow refers to a Task that doesn't exist.
...
I've reintroduced the safety check for 'workflow', which I shouldn't have removed. Comment added to explain, yo, pls don't check for Task before trying to delete said Task.taskKey === ''
is also valid, so the safety doesn't check for if (!taskKey) return
either. 👌
@@ -4,12 +4,12 @@ Checks if a step can branch. We're not asking if the step IS branching, but if i | |||
- If multiple Tasks qualify, only return the FIRST. | |||
- If no, returns false. | |||
*/ | |||
export default function canStepBranch(step = [], tasks = {}) { | |||
export default function checkCanStepBranch(step = [], tasks = {}) { | |||
// TODO/QUESTION: what happens when a Step has multiple branching Questions? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a scenario that could still happen? ("what happens when a Step has multiple branching Questions")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, we already know the answer to this - this comment should be rewritten as: NOTE: if a step has multiple single-type tasks, only the first is a valid branching task that decides the branching logic of the FEM classifier.
} | ||
} | ||
|
||
// TODO: experimentalRestyleContainer() should also trigger when the window resizes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I resized my window, it looks like step containers resize as expected 🤔 Do you have screenshots of buggy behavior during resize?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure do:
Screen.Recording.2024-06-07.at.17.32.09.mov
Basically, the issue happens whenever the window resize is sufficient to trigger the row of answers to wrap-around.
1652589
to
0c14973
Compare
…f many) into a single-type task
…gle-type if step isn't branching, multiple-type otherwise
…ng tasks appear outside the container
…or too many answers
8cad3a7
to
c2be98f
Compare
Oh goodness, those Safari visuals! 😭 |
Thanks for the review, Delilah! Update:
Alright, let's go! |
PR Overview
Part of: Pages Editor MVP project and FEM Lab super-project
Follows #7102
Staging branch URL: https://pr-7105.pfe-preview.zooniverse.org/lab/1982/workflows/editor/3711?env=staging
This PR adds a number of misc updates in preparation for the internal team review, at the end of May. Here's the adapted ToDo List from Slack, 13 May:
Functional:
Design:
Limited Branching Rule
The Pages Editor implements some incredibly ad-hoc rules on whether a Page can have more than one Question Task.
This is due to some unfortunate "logic overloading", i.e. a Single Answer Question Task (aka type=single) is ALWAYS a Branching Task. This can be a problem if e.g. you want to have 4x Single-Type Tasks on a page, but don't want the page to branch. 🤷
(Also, a smaller reason is that having a Single Answer Question Task can make the design look wonky when it's not the last item on the page, since the yellow "next page" indicators are supposed to sit outside the grey box representing the page. But at least this is something we can figure out later.)
ANYWAY, here's the intended change to the Limited Branching Rule:
OLD:
NEW:
NOTE: it's easy to completely disable the Limited Branching Rule by setting this in the TasksPage:
Status
WIPUpdate (2024.05.31 23:30 BST): Ready for review!