Browse Source

code review fixes

pull/5555/head
Attila Cseh 1 month ago
parent
commit
6c8e82a57b
  1. 5
      CHANGELOG.md
  2. 25
      apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.component.ts
  3. 8
      apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/types/activity-type.type.ts
  4. 2
      libs/ui/src/lib/i18n.ts

5
CHANGELOG.md

@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added `settings` to the `Access` model
### Changed
- Changed the deprecated `ITEM` activity type to `VALUABLE` in the create or update activity dialog
## 2.201.0 - 2025-09-24
### Added
@ -27,7 +31,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Refreshed the cryptocurrencies list
- Improved the language localization for German (`de`)
- Upgraded `countup.js` from version `2.8.2` to `2.9.0`
- Deprecated _ITEM_ activity type removed from the create or update activity dialog
### Fixed

25
apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.component.ts

@ -51,18 +51,7 @@ import { catchError, delay, takeUntil } from 'rxjs/operators';
import { DataService } from '../../../../services/data.service';
import { validateObjectForForm } from '../../../../util/form.util';
import { CreateOrUpdateActivityDialogParams } from './interfaces/interfaces';
const DisplayedActivityType = {
BUY: Type.BUY,
DIVIDEND: Type.DIVIDEND,
FEE: Type.FEE,
INTEREST: Type.INTEREST,
LIABILITY: Type.LIABILITY,
SELL: Type.SELL,
VALUABLE: 'VALUABLE' as const
};
type DisplayedActivityType =
(typeof DisplayedActivityType)[keyof typeof DisplayedActivityType];
import { ActivityType } from './types/activity-type.type';
@Component({
changeDetection: ChangeDetectionStrategy.OnPush,
@ -190,9 +179,9 @@ export class GfCreateOrUpdateActivityDialog implements OnDestroy {
};
}) ?? [];
Object.keys(DisplayedActivityType).forEach((type) => {
this.typesTranslationMap[DisplayedActivityType[type]] = translate(
DisplayedActivityType[type]
Object.keys(ActivityType).forEach((type) => {
this.typesTranslationMap[ActivityType[type]] = translate(
ActivityType[type]
);
});
@ -277,7 +266,7 @@ export class GfCreateOrUpdateActivityDialog implements OnDestroy {
this.activityForm.get('accountId').valueChanges.subscribe((accountId) => {
const type = this.activityForm.get('type').value;
if (['FEE', 'INTEREST', 'VALUABLE', 'LIABILITY'].includes(type)) {
if (['FEE', 'INTEREST', 'LIABILITY', 'VALUABLE'].includes(type)) {
const currency =
this.data.accounts.find(({ id }) => {
return id === accountId;
@ -373,7 +362,7 @@ export class GfCreateOrUpdateActivityDialog implements OnDestroy {
this.activityForm
.get('type')
.valueChanges.pipe(takeUntil(this.unsubscribeSubject))
.subscribe((type: DisplayedActivityType) => {
.subscribe((type: ActivityType) => {
if (
type === 'VALUABLE' ||
(this.activityForm.get('dataSource').value === 'MANUAL' &&
@ -536,7 +525,7 @@ export class GfCreateOrUpdateActivityDialog implements OnDestroy {
fee: this.activityForm.get('fee').value,
quantity: this.activityForm.get('quantity').value,
symbol:
(['FEE', 'INTEREST', 'VALUABLE', 'LIABILITY'].includes(
(['FEE', 'INTEREST', 'LIABILITY', 'VALUABLE'].includes(
this.activityForm.get('type').value
)
? undefined

8
apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/types/activity-type.type.ts

@ -0,0 +1,8 @@
import { Type } from '@prisma/client';
export const ActivityType = {
...Type,
VALUABLE: 'VALUABLE'
} as const;
export type ActivityType = (typeof ActivityType)[keyof typeof ActivityType];

2
libs/ui/src/lib/i18n.ts

@ -38,9 +38,9 @@ const locales = {
DIVIDEND: $localize`Dividend`,
FEE: $localize`Fee`,
INTEREST: $localize`Interest`,
VALUABLE: $localize`Valuable`,
LIABILITY: $localize`Liability`,
SELL: $localize`Sell`,
VALUABLE: $localize`Valuable`,
// AssetClass (enum)
ALTERNATIVE_INVESTMENT: $localize`Alternative Investment`,

Loading…
Cancel
Save