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

(feat) O3-3947: Add support for different question types #354

Open
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

Kinotijoan
Copy link
Contributor

@Kinotijoan Kinotijoan commented Oct 7, 2024

Requirements

  • This PR has a title that briefly describes the work done including the ticket number. If there is a ticket, make sure your PR title includes a conventional commit label. See existing PR titles for inspiration.
  • My work conforms to the OpenMRS 3.0 Styleguide and design documentation.
  • My work includes tests or is validated by existing tests.

Summary

I have added support for some question types that were in the json-schema but not in the interactive builder hence I have finalised on this ticket

Screenshots

image

image

image

image

image

image

image

Related Issue

https://openmrs.atlassian.net/browse/O3-3947

Other

Kinotijoan and others added 11 commits September 10, 2024 10:20
This change introduces the ability for form questions to utilize Markdown formatting. A new Markdown input field is added to the question editor, allowing users to specify Markdown content. This content is then rendered appropriately when the form is displayed.
Added a new configuration option to enable a Markdown editor for text input.
Introduces the ability for form creators to utilize Markdown formatting in question text, providing greater flexibility and control over question presentation.
When editing a "content-switcher" question type, the available answers are now dynamically populated based on the selected concept. This ensures that users can only choose from relevant answers associated with the chosen concept, streamlining the question editing process.
Introduces the capability to configure and launch workspaces directly from the question builder interface. This enhancement provides users with a streamlined method to initiate workspaces, enhancing the platform's interactive capabilities.
This introduces UI elements specifically for the "workspace-launcher" question type.  Users can now input a button label and a workspace name when editing a question of this type.
@NethmiRodrigo NethmiRodrigo self-requested a review October 7, 2024 09:01
@NethmiRodrigo NethmiRodrigo changed the title Feat[O3-3947] - Add support for different question types (feat) O3-3947: Add support for different question types Oct 7, 2024
@NethmiRodrigo
Copy link
Contributor

@Kinotijoan can you resolve the merge conflicts and update your fork?

@NethmiRodrigo
Copy link
Contributor

For questions of type markdown we don't need a label, if we could conditionally not render it that would be better because otherwise it can be misleading

@Kinotijoan
Copy link
Contributor Author

For questions of type markdown we don't need a label, if we could conditionally not render it that would be better because otherwise it can be misleading

sure

Removes the option to customize labels for the "true" and "false" states of toggle fields.
Standardizes the casing of "On" and "Off" labels used within the toggle component in the English translation file to ensure consistency throughout the application. This addresses a minor visual discrepancy and enhances the overall user experience.
Comment on lines +540 to +541
id="lableTrue"
labelText={t('Label true', 'Label true')}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
id="lableTrue"
labelText={t('Label true', 'Label true')}
id="labelTrue"
labelText={t('labelTrue', 'Label true')}

value={t(toggleLabelTrue || '')}
onChange={(event: React.ChangeEvent<HTMLInputElement>) =>
setToggleLabelTrue(event.target.value)
}
placeholder={t('on', 'On')}
placeholder={t('On')}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
placeholder={t('On')}
placeholder={t('on', 'On')}

Comment on lines +550 to +551
id="lableFalse"
labelText={t('Label false', 'Label false')}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
id="lableFalse"
labelText={t('Label false', 'Label false')}
id="labelFalse"
labelText={t('labelFalse', 'Label false')}

value={t(toggleLabelFalse || '')}
onChange={(event: React.ChangeEvent<HTMLInputElement>) =>
setToggleLabelFalse(event.target.value)
}
placeholder={t('off', 'Off')}
placeholder={t('Off')}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
placeholder={t('Off')}
placeholder={t('off', 'Off')}

Comment on lines +765 to +775
{renderingType == 'markdown' ? (
<TextInput
id="questionMarkdown"
labelText={t('questionMarkdown', 'Markdown')}
placeholder={t('questionMarkdownPlaceholder', 'Enter the Markdown for your form...')}
value={formMarkdown}
onChange={(event: React.ChangeEvent<HTMLInputElement>) =>
setFormMarkdown(event.target.value.split(',').map((item) => item.trim()))
}
/>
) : null}
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we need this since PR #355 will implement this

Comment on lines +665 to +675
{fieldType == 'markdown' ? (
<TextInput
id="questionMarkdown"
labelText={t('questionMarkdown', 'Markdown')}
placeholder={t('questionMarkdownPlaceholder', 'Enter the Markdown for your form...')}
value={formMarkdown}
onChange={(event: React.ChangeEvent<HTMLInputElement>) =>
setFormMarkdown(event.target.value.split(',').map((item) => item.trim()))
}
/>
) : null}
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above, won't be needed

Comment on lines +152 to +153
const [toggleLabelTrue, setToggleLabelTrue] = useState('');
const [toggleLabelFalse, setToggleLabelFalse] = useState('');
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be reverted

Comment on lines +155 to +156
const [buttonLabel, setButtonLabel] = useState('');
const [workspaceName, setWorkspaceName] = useState('');
Copy link
Contributor

Choose a reason for hiding this comment

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

These variables should be initiated not with an empty string but with the relevant values from the questionToEdit object

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