Skip to content

ERA-10348: Support EFB schemas in ER > Text Field #1192

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

Merged
merged 13 commits into from
Nov 28, 2024
Merged

ERA-10348: Support EFB schemas in ER > Text Field #1192

merged 13 commits into from
Nov 28, 2024

Conversation

gaboDev
Copy link
Contributor

@gaboDev gaboDev commented Nov 19, 2024

What does this PR do?

  • Adds support for Text types
  • Adds feature flag logic
  • Adds Schema selector under settings pane

How does it look

Form with a schema with short and text type fields
image

Schema selector
image

Relevant link(s)

Copy link

swarmia bot commented Nov 19, 2024

Copy link
Contributor

@luixlive luixlive left a comment

Choose a reason for hiding this comment

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

I like the approach. Provided a few suggestions. However, the opinion that matters the most here is from QA since they will be the ones taking advantage of this. Let's provide them with a way to test this and see what they have to say.
cc: @AlanCalvillo @fonzy911

@luixlive
Copy link
Contributor

I just noticed I didn't before 😅 The field to select the schema is exactly over the view where QA should be testing the correct rendering of the form:
image

I don't think that's a good idea, we want them to be able to see how the full event view will show to the user. We should put that field somewhere else, maybe in the settings tab?

@gaboDev
Copy link
Contributor Author

gaboDev commented Nov 21, 2024

I just noticed I didn't before 😅 The field to select the schema is exactly over the view where QA should be testing the correct rendering of the form

I don't think that's a good idea, we want them to be able to see how the full event view will show to the user. We should put that field somewhere else, maybe in the settings tab?

Sure I agree, but not sure what you refer by settings tab 😅

@gaboDev gaboDev changed the title ERA-10348: Support EFB schemas in ER > Field ERA-10348: Support EFB schemas in ER > Text Field Nov 22, 2024
@gaboDev gaboDev added the deploy label Nov 22, 2024
@gaboDev gaboDev marked this pull request as ready for review November 22, 2024 21:49
@luixlive
Copy link
Contributor

Before reviewing, I see some conflicting files 👀

Copy link
Contributor

@luixlive luixlive left a comment

Choose a reason for hiding this comment

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

This works great. I added just a couple suggestions and I see a couple differences between your components and the designs that I think should be very easy to fix.
Figma:
image

Env:
image

1- There should be some space between the input and the description text.
2- Font size of the description should be 14px (in rems).
3- The long text input border should be a lighter gray.
4- Also in the long text input I think we should add some padding to the content in all directions (the text seems too close to the borders).

This should be ready once we fix these things ✅

@@ -13,3 +13,4 @@ REACT_APP_DEFAULT_PATROL_FILTER_FROM_DAYS=1
# Feature flags
REACT_APP_LEGACY_RT_ENABLED=false
REACT_APP_I18N_ENABLED=true
REACT_APP_EFB_FORM_SCHEMA_SUPPORT_ENABLED=true
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 false by default. We don't want this to show up in prod envs. Developers must turn it on locally when working on this epic.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I left this as true to facilitate QA process, before this PR get merge I will update it

REQUIRED: 'required'
};

export const TextFieldValidators = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Remember we won't be using these validators, we should remove this and any related code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure

const TextInput = TEXT_INPUT_TYPE_TO_INPUT[textFieldDetails.inputType];
const { onFieldChange } = useContext(SchemaFormContext);

const stylesTheme = {
Copy link
Contributor

Choose a reason for hiding this comment

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

This variable doesn't have any dependency on the content of the component. We should declare it as a constant outside of the component so it's not attached to its lifecycle and its not redefined in every render 👍

return state;
};

export default globallyResettableReducer(schemaSelectorReducer, INITIAL_SCHEMA_SELECTOR_STATE);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would be a good idea to persist this reducer with redux-persist so we don't have to choose the schema everytime we reload the page.

@@ -124,6 +125,7 @@ const rootReducer = combineReducers({
userLocation: userLocationReducer,
userLocationAccessGranted: userLocationAccessGrantedReducer,
showReportHeatmap: reportHeatmapStateReducer,
schemaSelector: schemaSelectorReducer,
Copy link
Contributor

Choose a reason for hiding this comment

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

A couple TODOs here and in the duck file would be good to remember to delete the reducer after we are done.

@luixlive
Copy link
Contributor

@tiffanynwong you may want to test this!

@gaboDev
Copy link
Contributor Author

gaboDev commented Nov 25, 2024

Forgot to add a clarification for QA folks: This PR is only for rendering feature, form validation and submission are not part of this ticket 👀

Copy link
Contributor

@luixlive luixlive left a comment

Choose a reason for hiding this comment

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

Looks great! Approved. Still I think it would be great to have thumbs up from @tiffanynwong if that doesn't block us from delivering in time.

A recommendation I have is to change the fixture you added for one that has more fields with more combinations (required / not required, default input, placeholder, long / short field, etc...). You don't need to worry about activated / hidden fields, that is handled by the method I'll add in the next PR makeFieldsFromSchema to remove the hidden fields there!

No required for this PR, but I don't think the persistence of the schema selector is working properly 🤔

@gaboDev gaboDev merged commit 9f754e9 into develop Nov 28, 2024
3 checks passed
@gaboDev gaboDev deleted the ERA-10348 branch November 28, 2024 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants