Skip to content

Commit

Permalink
feat(plugin): add integration Upwork UI package
Browse files Browse the repository at this point in the history
  • Loading branch information
rahul-rocket committed Oct 15, 2024
1 parent 6680af8 commit 3e51829
Show file tree
Hide file tree
Showing 30 changed files with 289 additions and 246 deletions.
21 changes: 8 additions & 13 deletions apps/gauzy/src/app/pages/integrations/integrations.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,16 @@ import { IntegrationsComponent } from './integrations.component';
import { IntegrationLayoutComponent } from './layout/layout.component';
import { IntegrationListComponent } from './components/integration-list/list.component';

// Nebular Modules
const NB_MODULES = [
NbButtonModule,
NbCardModule,
NbIconModule,
NbInputModule,
NbSelectModule,
NbSpinnerModule,
NbTooltipModule
];

@NgModule({
declarations: [IntegrationLayoutComponent, IntegrationListComponent, IntegrationsComponent],
imports: [
...NB_MODULES,
NbButtonModule,
NbCardModule,
NbIconModule,
NbInputModule,
NbSelectModule,
NbSpinnerModule,
NbTooltipModule,
RouterModule.forChild([]),
NgxPermissionsModule.forChild(),
TranslateModule.forChild(),
Expand Down Expand Up @@ -76,7 +71,7 @@ export class IntegrationsModule {
// Register the path 'upwork'
path: 'upwork',
// Register the loadChildren function to load the UpworkModule lazy module
loadChildren: () => import('../upwork/upwork.module').then((m) => m.UpworkModule)
loadChildren: () => import('@gauzy/plugin-integration-upwork-ui').then((m) => m.IntegrationUpworkUiModule)
});

// Register the routes for hubstaff integration
Expand Down
62 changes: 0 additions & 62 deletions apps/gauzy/src/app/pages/upwork/upwork-routing.module.ts

This file was deleted.

58 changes: 0 additions & 58 deletions apps/gauzy/src/app/pages/upwork/upwork.module.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -25,48 +25,38 @@ import { distinctUntilChange } from '@gauzy/ui-core/common';
import { Store } from '@gauzy/ui-core/core';
import { HttpLoaderFactory, I18nService } from '@gauzy/ui-core/i18n';
import { getBrowserLanguage, SmartDataViewLayoutModule, SharedModule } from '@gauzy/ui-core/shared';
import { IntegrationHubstaffRoutingModule } from './integration-hubstaff-routing.module';
import { IntegrationHubstaffRoutes } from './integration-hubstaff.routes';
import { HubstaffComponent } from './components/hubstaff/hubstaff.component';
import { HubstaffAuthorizeComponent } from './components/hubstaff-authorize/hubstaff-authorize.component';
import { SettingsDialogComponent } from './components/settings-dialog/settings-dialog.component';

// Nebular Modules
const NB_MODULES = [
NbActionsModule,
NbButtonModule,
NbCardModule,
NbCheckboxModule,
NbContextMenuModule,
NbDatepickerModule,
NbDialogModule.forChild(),
NbIconModule,
NbInputModule,
NbSelectModule,
NbSpinnerModule,
NbToggleModule,
NbTooltipModule
];

// Third Party Modules
const THIRD_PARTY_MODULES = [
NgSelectModule,
NgxPermissionsModule.forRoot(),
TranslateModule.forRoot({
defaultLanguage: getBrowserLanguage(), // Get the browser language and fall back to a default if needed
loader: {
provide: TranslateLoader,
useFactory: HttpLoaderFactory,
deps: [HttpClient]
}
})
];

@NgModule({
declarations: [HubstaffAuthorizeComponent, HubstaffComponent, SettingsDialogComponent],
imports: [
...NB_MODULES,
...THIRD_PARTY_MODULES,
IntegrationHubstaffRoutingModule,
NbActionsModule,
NbButtonModule,
NbCardModule,
NbCheckboxModule,
NbContextMenuModule,
NbDatepickerModule,
NbDialogModule.forChild(),
NbIconModule,
NbInputModule,
NbSelectModule,
NbSpinnerModule,
NbToggleModule,
NbTooltipModule,
NgSelectModule,
NgxPermissionsModule.forRoot(),
TranslateModule.forRoot({
defaultLanguage: getBrowserLanguage(), // Get the browser language and fall back to a default if needed
loader: {
provide: TranslateLoader,
useFactory: HttpLoaderFactory,
deps: [HttpClient]
}
}),
IntegrationHubstaffRoutes,
SharedModule,
SmartDataViewLayoutModule
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ import { HubstaffComponent } from './components/hubstaff/hubstaff.component';
],
exports: [RouterModule]
})
export class IntegrationHubstaffRoutingModule {}
export class IntegrationHubstaffRoutes {}
6 changes: 6 additions & 0 deletions packages/plugins/integration-upwork-ui/src/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
export * from './lib/integration-upwork-ui.module';
export * from './lib/components/upwork/upwork.component';
export * from './lib/components/upwork-authorize/upwork-authorize.component';
export * from './lib/components/transactions/transactions.component';
export * from './lib/components/contracts/contracts.component';
export * from './lib/components/reports/reports.component';
export * from './lib/components/sync-data-selection/sync-data-selection.component';
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { Component, OnInit, OnDestroy } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { TitleCasePipe } from '@angular/common';
import { Observable, of, EMPTY, firstValueFrom, filter } from 'rxjs';
import { catchError, tap } from 'rxjs/operators';
import { ActivatedRoute } from '@angular/router';
import { Observable, of, EMPTY, firstValueFrom, filter, catchError, tap } from 'rxjs';
import { NbDialogService } from '@nebular/theme';
import { TranslateService } from '@ngx-translate/core';
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
Expand All @@ -22,8 +21,8 @@ import { SyncDataSelectionComponent } from '../sync-data-selection/sync-data-sel
providers: [TitleCasePipe]
})
export class ContractsComponent extends TranslationBaseComponent implements OnInit, OnDestroy {
public smartTableSettings: any;
public contracts$: Observable<IEngagement[]> = this._upworkStoreServices.contracts$;
public smartTableSettings: object;
public selectedContracts: IEngagement[] = [];

constructor(
Expand Down Expand Up @@ -178,8 +177,8 @@ export class ContractsComponent extends TranslationBaseComponent implements OnIn
);
}),
// Handle errors using the _ehs.handleError method and return an EMPTY observable
catchError((err) => {
this._errorHandlingService.handleError(err);
catchError((error) => {
this._errorHandlingService.handleError(error);
return EMPTY;
}),
// Automatically unsubscribe when the component is destroyed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@
<div class="ml-1">
<input
nbInput
[placeholder]="
'INTEGRATIONS.UPWORK_PAGE.DATE_RANGE_PLACEHOLDER'
| translate
"
[placeholder]="'INTEGRATIONS.UPWORK_PAGE.DATE_RANGE_PLACEHOLDER' | translate"
[nbDatepicker]="rangePicker"
[value]="displayDate"
/>
Expand All @@ -21,8 +18,7 @@
[range]="defaultDateRange$ | async"
[max]="today"
(rangeChange)="handleRangeChange($event)"
>
</nb-rangepicker>
></nb-rangepicker>
</div>
<div class="input-group-append ml-1">
<button
Expand Down
Loading

0 comments on commit 3e51829

Please sign in to comment.