-
Notifications
You must be signed in to change notification settings - Fork 0
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
Conversation
✅ Linked to ERA-10348 · Support EFB schemas in ER > Text Field |
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 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
Sure I agree, but not sure what you refer by settings tab 😅 |
Before reviewing, I see some conflicting files 👀 |
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.
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:
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 |
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.
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.
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 left this as true to facilitate QA process, before this PR get merge I will update it
REQUIRED: 'required' | ||
}; | ||
|
||
export const TextFieldValidators = { |
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.
Remember we won't be using these validators, we should remove this and any related 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.
Sure
const TextInput = TEXT_INPUT_TYPE_TO_INPUT[textFieldDetails.inputType]; | ||
const { onFieldChange } = useContext(SchemaFormContext); | ||
|
||
const stylesTheme = { |
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.
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); |
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 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.
src/reducers/index.js
Outdated
@@ -124,6 +125,7 @@ const rootReducer = combineReducers({ | |||
userLocation: userLocationReducer, | |||
userLocationAccessGranted: userLocationAccessGrantedReducer, | |||
showReportHeatmap: reportHeatmapStateReducer, | |||
schemaSelector: schemaSelectorReducer, |
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.
A couple TODOs here and in the duck file would be good to remember to delete the reducer after we are done.
@tiffanynwong you may want to test this! |
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 👀 |
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.
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 🤔
…schema at form level
What does this PR do?
How does it look
Form with a schema with short and text type fields

Schema selector

Relevant link(s)