Skip to content
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

fix: Qbd direct dashboard error section fix and video update #1135

Merged
merged 2 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/app/branding/fyle-branding-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,6 @@ export const fyleDemoVideoLinks: DemoVideo[string] = {
TRAVELPERK: 'https://www.youtube.com/embed/2oYdc8KcQnk',
XERO: 'https://www.youtube.com/embed/IplJd7tGWBk',
NETSUITE: 'https://www.youtube.com/embed/wQXQYTLsVH8',
QBD_DIRECT: 'https://www.youtube.com/embed/b63lS2DG5j4'
QBD_DIRECT: 'https://www.youtube.com/embed/rKxbQWETnlo'
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ <h4 class="tw-text-16-px tw-pb-4-px tw-font-500 tw-text-text-tertiary">Enter com
<div class="tw-w-[40%]">
<div class="tw-shadow-md tw-rounded-border-radius-2xl">
<div class="tw-flex tw-justify-center tw-overflow-hidden">
<iframe class="tw-rounded-tl-border-radius-2xl tw-rounded-tr-border-radius-2xl tw-w-[100%] tw-h-240-px" src="https://www.youtube.com/embed/2oYdc8KcQnk" frameborder="0"></iframe>
<iframe class="tw-rounded-tl-border-radius-2xl tw-rounded-tr-border-radius-2xl tw-w-[100%] tw-h-240-px" src="https://www.youtube.com/embed/HHm1ASm20j0" frameborder="0"></iframe>
</div>
<div class="tw-p-16-px">
<p class="tw-text-14-px tw-font-500 tw-text-text-tertiary">Where to find company file path?</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ <h4 class="tw-text-14-px tw-text-text-tertiary tw-font-500 tw-pb-4-px">Click on
</div>
<div class="tw-w-[40%]">
<div class="tw-flex tw-justify-center tw-shadow-sm">
<iframe class="tw-rounded-border-radius-2xl tw-w-[100%]" height="260" src="https://www.youtube.com/embed/2oYdc8KcQnk" frameborder="0"></iframe>
<iframe class="tw-rounded-border-radius-2xl tw-w-[100%]" height="260" src="https://www.youtube.com/embed/jfPPb8wYcQ4" frameborder="0"></iframe>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { Component, Input, OnInit } from '@angular/core';
import { Observable, filter, forkJoin } from 'rxjs';
import { brandingConfig, brandingContent, brandingFeatureConfig } from 'src/app/branding/branding-config';
import { DestinationFieldMap } from 'src/app/core/models/db/dashboard.model';
import { DestinationAttribute, GroupedDestinationAttribute } from 'src/app/core/models/db/destination-attribute.model';
import { DestinationAttribute } from 'src/app/core/models/db/destination-attribute.model';
import { Error, AccountingGroupedErrors, AccountingGroupedErrorStat, ErrorModel, ErrorResponse } from 'src/app/core/models/db/error.model';
import { ExtendedGenericMapping, GenericMappingResponse } from 'src/app/core/models/db/extended-generic-mapping.model';
import { ExtendedGenericMapping } from 'src/app/core/models/db/extended-generic-mapping.model';
import { AccountingDisplayName, AccountingErrorType, AccountingField, AppName, AppUrl, ExportErrorSourceType, FyleField, MappingState } from 'src/app/core/models/enum/enum.model';
import { ResolveMappingErrorProperty, trackingAppMap } from 'src/app/core/models/misc/tracking.model';
import { Expense } from 'src/app/core/models/intacct/db/expense.model';
Expand Down Expand Up @@ -175,7 +174,11 @@ export class DashboardErrorSectionComponent implements OnInit {
this.groupedError = groupedError;
this.sourceField = sourceField;
this.destinationField = this.destinationFieldMap[this.sourceField];
this.isMultiLineOption = this.importCodeFields?.includes(this.destinationField);
if ([AppName.QBD_DIRECT, AppName.QBO].includes(this.appName)) {
this.isMultiLineOption = this.sourceField === ExportErrorSourceType.CATEGORY && brandingConfig.brandId !== 'co' ? true : false;
} else {
this.isMultiLineOption = this.importCodeFields?.includes(this.destinationField) && brandingConfig.brandId !== 'co' ? true : false;
}
Comment on lines +177 to +181
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Simplify conditional logic and improve code clarity

The current implementation has several areas for improvement:

  1. Unnecessary ternary operators with boolean literals
  2. Repeated brandId check
  3. Missing documentation for special QBD/QBO handling

Apply this diff to improve the code:

+  // Special handling for QBD and QBO apps where category mapping always enables multi-line option
+  // for non-co brands
   if ([AppName.QBD_DIRECT, AppName.QBO].includes(this.appName)) {
-    this.isMultiLineOption = this.sourceField === ExportErrorSourceType.CATEGORY && brandingConfig.brandId !== 'co' ? true : false;
+    this.isMultiLineOption = this.sourceField === ExportErrorSourceType.CATEGORY && brandingConfig.brandId !== 'co';
   } else {
-    this.isMultiLineOption = this.importCodeFields?.includes(this.destinationField) && brandingConfig.brandId !== 'co' ? true : false;
+    this.isMultiLineOption = this.importCodeFields?.includes(this.destinationField) && brandingConfig.brandId !== 'co';
   }

Consider extracting the brandId check into a private method for better reusability:

private isNonCoBrand(): boolean {
  return brandingConfig.brandId !== 'co';
}
🧰 Tools
🪛 Biome (1.9.4)

[error] 178-178: Unnecessary use of boolean literals in conditional expression.

Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with

(lint/complexity/noUselessTernary)


[error] 180-180: Unnecessary use of boolean literals in conditional expression.

Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with

(lint/complexity/noUselessTernary)


if (this.destinationOptionsVersion === 'v1') {
this.getDestinationOptionsV1(errorType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
[emptyFilterMessage]="isSearching ? 'Searching...' : 'No results found'"
(onFilter)="searchOptions($event)">
<ng-template let-value pTemplate="selectedItem">
<div *ngIf="value">
<div *ngIf="value" #textElement
[ngStyle]="{'white-space': 'nowrap', 'overflow': 'hidden', 'text-overflow': 'ellipsis', 'max-width': '16rem'}"
[pTooltip]="isOverflowing(textElement, value)" tooltipPosition="top">
<p>
<span *ngIf="value?.code && isMultiLineOption && brandingFeatureConfig.featureFlags.importSettings.allowImportCode">{{ value?.code }}: </span>
{{ value?.value }}
Expand Down
Loading