fix/114/change duplicate title cntx in add n edit forms#125
fix/114/change duplicate title cntx in add n edit forms#125M-lakshan wants to merge 10 commits intoLeadCMS:developfrom
Conversation
M-lakshan
left a comment
There was a problem hiding this comment.
refined the helper method course:
- first the sub_title keyword will be checked within the MODULE_CONFIG entries
- if no MODULE_CONFIG entry found validation checks with noly with 's' & 'ies' but also with 'es'
- correct suffix change ( replace 'ies' with char 'y')
|
Could you remove the suffix change code and use the module name as it is, if the module isnt found in the config file. Since this case will be when we use dynamic modules, we can change the name from the backend. Change default from "Remove' to "View" Capitalise the first letter of the word too |
There was a problem hiding this comment.
Pull Request Overview
This PR fixes duplicate title context in add and edit forms by refining title generation based on form types and module name plurality. The changes improve form titles to correctly display "Add" vs "Edit" actions and handle plural module names appropriately.
- Adds a new helper function to check module name plurality based on menu configuration
- Updates form title generation to use dynamic action words and singular module names
- Refines arrow function formatting for consistency
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/utils/general-helper.ts | Adds moduleNamePluralBasisCheck function and imports MENU_CONFIG, fixes arrow function formatting |
| src/components/generic-components/generic-form.tsx | Updates form title generation to use dynamic actions and singular module names |
| if (mdl_sub_title[0]) { | ||
| const module_tag = mdl_sub_title[0]?.toString(); | ||
|
|
||
| return module_tag[0].toUpperCase() + module_tag?.substring(1, module_tag.length); |
There was a problem hiding this comment.
[nitpick] The substring operation can be simplified. Use module_tag.slice(1) instead of module_tag?.substring(1, module_tag.length) for better readability and consistency with the existing pattern in the codebase.
| return module_tag[0].toUpperCase() + module_tag?.substring(1, module_tag.length); | |
| return module_tag[0].toUpperCase() + module_tag.slice(1); |
refined areas: