As of #1001, pressing the W+F keys shows the "New Preview" button (which links to Web Forms) instead of the default Preview button (which links to Enketo). However, pressing W+F has no effect in the project overview: even though there is a Preview button for each form, "New Preview" is not shown. This PR changes that so that W+F has an effect wherever the Preview button is shown, including the project overview.
What has been done to verify that this works as intended?
Trying it locally.
Why is this the best possible solution? Were any other approaches considered?
The underlying issue is that the "New Preview" logic appears in FormVersionStandardButtons, but FormRow renders EnketoPreview without FormVersionStandardButtons. FormVersionStandardButtons and FormRow are the only two components that render EnketoPreview. My change involves moving the "New Preview" logic from FormVersionStandardButtons to EnketoPreview. In other words, EnketoPreview will manage the form preview button for both Enketo and Web Forms. I'd be happy to rename the EnketoPreview component if that'd make things clearer.
Before submitting this PR, please make sure you have:
[x] run npm run test and npm run lint and confirmed all checks still pass OR confirm CircleCI build passes
[x] verified that any code or assets from external sources are properly credited in comments or that everything is internally sourced
As of #1001, pressing the W+F keys shows the "New Preview" button (which links to Web Forms) instead of the default Preview button (which links to Enketo). However, pressing W+F has no effect in the project overview: even though there is a Preview button for each form, "New Preview" is not shown. This PR changes that so that W+F has an effect wherever the Preview button is shown, including the project overview.
What has been done to verify that this works as intended?
Trying it locally.
Why is this the best possible solution? Were any other approaches considered?
The underlying issue is that the "New Preview" logic appears in
FormVersionStandardButtons
, butFormRow
rendersEnketoPreview
withoutFormVersionStandardButtons
.FormVersionStandardButtons
andFormRow
are the only two components that renderEnketoPreview
. My change involves moving the "New Preview" logic fromFormVersionStandardButtons
toEnketoPreview
. In other words,EnketoPreview
will manage the form preview button for both Enketo and Web Forms. I'd be happy to rename theEnketoPreview
component if that'd make things clearer.Before submitting this PR, please make sure you have:
npm run test
andnpm run lint
and confirmed all checks still pass OR confirm CircleCI build passes