-
Notifications
You must be signed in to change notification settings - Fork 0
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: helper function for dynamic content #1158
base: master
Are you sure you want to change the base?
Conversation
WalkthroughThe pull request introduces a new method Changes
Suggested Labels
Suggested Reviewers
Poem
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 2
🧹 Nitpick comments (6)
src/app/core/services/common/helper.service.ts (1)
Line range hint
289-292
: Fix typo in method name: 'sentenseCase' → 'sentenceCase'.The method name contains a typo. Consider renaming it for consistency.
- sentenseCaseConversion(content: string) { + sentenceCaseConversion(content: string) {src/app/integrations/netsuite/netsuite-shared/netsuite-import-settings/netsuite-custom-segment-dialog/netsuite-custom-segment-dialog.component.ts (1)
76-78
: Consider consistent string concatenation style.While both methods use the helper service correctly, they use different string concatenation styles. Consider using template literals for better readability.
- return this.helper.sentenseCaseConversion('Enter Transaction Line Field') + ' ID'; + return `${this.helper.sentenseCaseConversion('Enter Transaction Line Field')} ID`;Also applies to: 87-89
src/app/integrations/xero/xero-shared/xero-export-settings/xero-export-settings.component.html (1)
185-185
: Consider using template literals for better readability.While the helper function usage is good, the string concatenation could be improved using template literals.
-[label]=" 'Set the ' + helperService.brandingCaseConversion(exportSettingForm.controls.creditCardExportType.value) + ' date as'" +[label]="`Set the ${helperService.brandingCaseConversion(exportSettingForm.controls.creditCardExportType.value)} date as`" -[placeholder]="'Select the date of the ' + helperService.brandingCaseConversion(exportSettingForm.controls.creditCardExportType.value)" +[placeholder]="`Select the date of the ${helperService.brandingCaseConversion(exportSettingForm.controls.creditCardExportType.value)}`"Also applies to: 189-189
src/app/shared/components/configuration/configuration-import-field/configuration-import-field.component.html (1)
41-45
: Consider using template literals for better readability.While the helper function usage is good, the string concatenations could be improved using template literals.
-Import {{ helper.brandingCaseConversion(getDestinationField(expenseField.get('destination_field')?.value)) }} from {{ uiExposedAppName }} +Import ${helper.brandingCaseConversion(getDestinationField(expenseField.get('destination_field')?.value))} from ${uiExposedAppName} -The imported {{ helper.brandingCaseConversion(getDestinationField(expenseField.get('destination_field')?.value)) }} +The imported ${helper.brandingCaseConversion(getDestinationField(expenseField.get('destination_field')?.value))}src/app/integrations/netsuite/netsuite-shared/netsuite-export-settings/netsuite-export-settings.component.html (1)
309-309
: LGTM! Consider extracting the repeated expression.The changes effectively utilize the new helper function for consistent text formatting. However, since the same expression is used in both label and placeholder, consider extracting it to improve readability.
+<!-- Extract the expression to a variable for better readability --> +<ng-container #exportTypeText> + {{ helperService.brandingCaseConversion(exportSettingForm.get('creditCardExportType')?.value) }} +</ng-container> <app-configuration-select-field [form]="exportSettingForm" [isFieldMandatory]="true" [mandatoryErrorListName]="'export date'" - [label]=" 'Set the ' + helperService.brandingCaseConversion(exportSettingForm.get('creditCardExportType')?.value) + ' date as'" + [label]="'Set the ' + exportTypeText + ' date as'" [subLabel]="'The selected date will reflect in the corporate card expenses exported to NetSuite.'" [options]="cccExpenseGroupingDateOptions" [iconPath]="'calendar'" - [placeholder]="'Select the date of the ' + helperService.brandingCaseConversion(exportSettingForm.get('creditCardExportType')?.value)" + [placeholder]="'Select the date of the ' + exportTypeText" [formControllerName]="'creditCardExportDate'"> </app-configuration-select-field>Also applies to: 313-313
src/app/integrations/qbo/qbo-shared/qbo-export-settings/qbo-export-settings.component.html (1)
168-168
: LGTM! Consider extracting repeated expressions.The changes effectively utilize the new helper function for consistent text formatting across both reimbursable and credit card sections. However, since the same expressions are used in multiple places, consider extracting them to improve readability.
+<!-- Extract expressions to variables for better readability --> +<ng-container #reimbursableExportTypeText> + {{ helperService.brandingCaseConversion(exportSettingForm.get('reimbursableExportType')?.value) }} +</ng-container> +<ng-container #creditCardExportTypeText> + {{ helperService.brandingCaseConversion(exportSettingForm.get('creditCardExportType')?.value) }} +</ng-container> <!-- Reimbursable section --> <app-configuration-select-field [form]="exportSettingForm" [isFieldMandatory]="true" [mandatoryErrorListName]="'export date'" - [label]="'Set the ' + helperService.brandingCaseConversion(exportSettingForm.get('reimbursableExportType')?.value) + ' date as'" + [label]="'Set the ' + reimbursableExportTypeText + ' date as'" [subLabel]="'The selected type of date will reflect in the expenses exported from ' + brandingConfig.brandName + ' to QuickBooks Online.'" [options]="reimbursableExpenseGroupingDateOptions" - [placeholder]="'Select the date of the ' + helperService.brandingCaseConversion(exportSettingForm.get('reimbursableExportType')?.value)" + [placeholder]="'Select the date of the ' + reimbursableExportTypeText" [iconPath]="'calendar'" [formControllerName]="'reimbursableExportDate'"> </app-configuration-select-field> <!-- Credit card section --> <app-configuration-select-field [form]="exportSettingForm" [isFieldMandatory]="true" [mandatoryErrorListName]="'export date'" - [label]=" 'Set the ' + helperService.brandingCaseConversion(exportSettingForm.get('creditCardExportType')?.value) + ' date as'" + [label]="'Set the ' + creditCardExportTypeText + ' date as'" [subLabel]="'The selected date will reflect in the corporate card expenses exported to QuickBooks Online.'" [options]="cccExpenseGroupingDateOptions" [iconPath]="'calendar'" - [placeholder]="'Select the date of the ' + helperService.brandingCaseConversion(exportSettingForm.get('creditCardExportType')?.value)" + [placeholder]="'Select the date of the ' + creditCardExportTypeText" [formControllerName]="'creditCardExportDate'"> </app-configuration-select-field>Also applies to: 171-171, 335-335, 339-339
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (11)
src/app/core/services/common/helper.service.ts
(1 hunks)src/app/integrations/netsuite/netsuite-shared/netsuite-export-settings/netsuite-export-settings.component.html
(1 hunks)src/app/integrations/netsuite/netsuite-shared/netsuite-import-settings/netsuite-custom-segment-dialog/netsuite-custom-segment-dialog.component.ts
(4 hunks)src/app/integrations/qbo/qbo-shared/qbo-export-settings/qbo-export-settings.component.html
(2 hunks)src/app/integrations/xero/xero-shared/xero-export-settings/xero-export-settings.component.html
(1 hunks)src/app/shared/components/configuration/configuration-import-field/configuration-import-field.component.html
(4 hunks)src/app/shared/components/configuration/configuration-select-field/configuration-select-field.component.html
(2 hunks)src/app/shared/components/configuration/configuration-select-field/configuration-select-field.component.ts
(2 hunks)src/app/shared/components/dashboard/dashboard-error-section/dashboard-error-section.component.html
(2 hunks)src/app/shared/components/export-log/export-log-table/export-log-table.component.html
(1 hunks)src/app/shared/components/export-log/export-log-table/export-log-table.component.ts
(2 hunks)
🔇 Additional comments (9)
src/app/core/services/common/helper.service.ts (1)
304-315
: LGTM! The branding case conversion implementation looks good.The method effectively handles different branding requirements with clear conditional logic.
src/app/shared/components/export-log/export-log-table/export-log-table.component.ts (1)
7-7
: LGTM! Clean dependency injection.The
HelperService
integration follows Angular's best practices.Also applies to: 38-39
src/app/integrations/netsuite/netsuite-shared/netsuite-import-settings/netsuite-custom-segment-dialog/netsuite-custom-segment-dialog.component.ts (1)
8-8
: LGTM! Clean dependency injection.The
HelperService
integration follows Angular's best practices.Also applies to: 43-45
src/app/shared/components/configuration/configuration-select-field/configuration-select-field.component.ts (1)
19-19
: LGTM! Clean dependency injection.The
HelperService
integration follows Angular's best practices.Also applies to: 119-120
src/app/shared/components/export-log/export-log-table/export-log-table.component.html (1)
40-40
: LGTM! Consistent use of helper function for case conversion.The change improves code maintainability by centralizing the text case transformation logic.
src/app/shared/components/dashboard/dashboard-error-section/dashboard-error-section.component.html (1)
20-20
: LGTM! Consistent error message formatting.The changes improve code maintainability by using the helper function for text case transformations in error messages.
Also applies to: 45-45
src/app/shared/components/configuration/configuration-select-field/configuration-select-field.component.html (1)
174-174
: LGTM! Consistent case conversion in default fields section.The changes improve consistency in text case transformations for default fields.
Also applies to: 179-179
src/app/shared/components/configuration/configuration-import-field/configuration-import-field.component.html (1)
132-132
: LGTM! Consistent field label formatting.The changes improve consistency in text case transformations for field labels.
src/app/integrations/qbo/qbo-shared/qbo-export-settings/qbo-export-settings.component.html (1)
168-168
: Verify the helper function implementation.The
brandingCaseConversion
helper function is used consistently across multiple files. Let's verify its implementation to ensure it handles all possible cases correctly.Also applies to: 171-171, 309-309, 313-313, 335-335, 339-339
✅ Verification successful
Helper function implementation is correct and consistent.
The
brandingCaseConversion
function is properly implemented with brand-specific text formatting and is used consistently across the codebase for UI text formatting.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the implementation of brandingCaseConversion helper function. # Test: Search for the function implementation ast-grep --pattern $'class HelperService { $$$ brandingCaseConversion($$$) { $$$ } $$$ }' # Test: Search for all usages of the function rg -A 5 'brandingCaseConversion'Length of output: 15517
</span> | ||
</td> | ||
<td *ngIf="!isDashboardFailed && appName !== AppName.SAGE300 && appName !== AppName.QBD_DIRECT && appName !== AppName.BUSINESS_CENTRAL"> | ||
<div> | ||
<button (click)="openUrl(rowData.integrationUrl)" [pTooltip]="brandingConfig.brandId === 'co' ? 'Open in new tab' : 'Open in New Tab'" tooltipPosition="top"> | ||
<button (click)="openUrl(rowData.integrationUrl)" [pTooltip]="helper.sentenseCaseConversion('Open in New Tab')" tooltipPosition="top"> |
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.
Fix typo in helper method name.
The method name sentenseCaseConversion
contains a typo (missing 'c'). It should be sentenceCaseConversion
.
-[pTooltip]="helper.sentenseCaseConversion('Open in New Tab')"
+[pTooltip]="helper.sentenceCaseConversion('Open in New Tab')"
Also applies to: 52-52
@@ -77,15 +77,15 @@ <h5 *ngIf="formControllerName === 'cccExportType' && brandingConfig.brandId === | |||
[ngStyle]="{'white-space': 'nowrap', 'overflow': 'hidden', 'text-overflow': 'ellipsis', 'max-width': '16rem'}" | |||
[pTooltip]="isOverflowing(textElement) ? option.label : null" tooltipPosition="top"> | |||
<span> | |||
{{ brandingConfig.brandId === 'co' ? (option.label | sentenceCase) : (option.label)}}</span> | |||
{{ helper.sentenseCaseConversion(option.label)}}</span> |
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.
Fix typo in helper method name across dropdown templates.
The method name sentenseCaseConversion
contains a typo. It should be sentenceCaseConversion
.
-{{ helper.sentenseCaseConversion(option.label)}}
+{{ helper.sentenceCaseConversion(option.label)}}
-{{ helper.sentenseCaseConversion(option.display_name) }}
+{{ helper.sentenceCaseConversion(option.display_name) }}
-{{ helper.sentenseCaseConversion(item.display_name) }}
+{{ helper.sentenceCaseConversion(item.display_name) }}
Also applies to: 88-88, 93-93
Description
feat: helper function for dynamic content
Clickup
https://app.clickup.com/t/
Summary by CodeRabbit
New Features
brandingCaseConversion
method inHelperService
to standardize text case transformations across the application.Refactor
brandingCaseConversion
method for consistent text formatting.Chores
HelperService
as a dependency in several components to centralize case conversion logic.