Skip to content
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

[JN-1453] Add freetext editor to survey question designer #1349

Merged
merged 3 commits into from
Jan 8, 2025

Conversation

MatthewBemis
Copy link
Member

@MatthewBemis MatthewBemis commented Dec 17, 2024

DESCRIPTION (include screenshots, and mobile screenshots for participant UX)

Screenshot 2024-12-17 at 8 15 35 AM Screenshot 2024-12-17 at 8 15 45 AM

TO TEST: (simple manual steps for confirming core behavior -- used for pre-release checks)

Go to the survey designer: https://localhost:3000/demo/studies/heartdemo/env/sandbox/forms/surveys/hd_hd_basicInfo
Click the new freetext button
Enter in some text, ensuring it creates text and radio questions correctly

Foo
Bar
Baz

Copy link
Collaborator

@devonbush devonbush left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice, this could probably use a simple frontend test though

@devonbush
Copy link
Collaborator

devonbush commented Dec 22, 2024

Two things tripped me up when using it locally -- I didn't realize that the keyboard was a toggle -- it looked like a tab control. To make it clearer how to switch back, it would be nice to have the icon change (maybe a wand or something for the button to switch back). Then I was thrown that you couldn't switch to JSON view unless you had a stableId (or maybe it's that you can't go direct from typing mode to JSON mode?). This made me think I was trapped after typing in some stuff for a question. Might be nice to either enable the editor switch, or disable it with a note like "you must do to enter JSON mode"

@MatthewBemis
Copy link
Member Author

@devonbush thanks, that's great ux feedback. i'll rework this a bit. throwing into draft in the meantime

@MatthewBemis MatthewBemis marked this pull request as draft January 6, 2025 15:51
@MatthewBemis MatthewBemis marked this pull request as ready for review January 6, 2025 19:49
Comment on lines +43 to +47
<IconButton icon={showFreetextMode ? faKeyboard : faWandMagicSparkles}
disabled={showJsonEditor}
aria-label={showFreetextMode ? 'Switch to designer' : 'Switch to freetext editor'}
onClick={() => setShowFreetextMode(!showFreetextMode)}
/>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There seemed to be some weirdness when I entered freetext mode in a panel where it didn't properly create a stableid and I ended up getting an error preventing me from saving.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's how it behaves with regular questions too. We could auto-generate a question stable id, but since it's an identifier for research/operational datasets I think we should force the user to type one out. Of course, always open to changing later if we hear that it's annoying users!

Copy link
Collaborator

@connorlbark connorlbark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works well, and I appreciate that it isn't destructive when you change an existing question to freetext mode.

rows={15}
onChange={value => {
setFreetext(value)
const newQuestionObj = questionFromRawText(value)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh, crazy that this function already existed!

Copy link

sonarqubecloud bot commented Jan 8, 2025

@MatthewBemis MatthewBemis merged commit ee2e4e1 into development Jan 8, 2025
18 checks passed
@MatthewBemis MatthewBemis deleted the mb-jn-1453-freetext branch January 8, 2025 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants