From e496c49555f83309d648cc0eab4e15833e3f3079 Mon Sep 17 00:00:00 2001 From: Ken Tandrian <60643640+KenTandrian@users.noreply.github.com> Date: Fri, 7 Feb 2025 16:28:04 +0700 Subject: [PATCH 1/2] Feature/set up Storybook stories for tags selector component (#4289) * feat(storybook): create story for tags selector * Update changelog --- CHANGELOG.md | 1 + .../ui/src/lib/logo/logo.component.stories.ts | 2 +- .../tags-selector.component.stories.ts | 62 +++++++++++++++++++ 3 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 libs/ui/src/lib/tags-selector/tags-selector.component.stories.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index f86fccdd..5e4ae5b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added a new static portfolio analysis rule: _Regional Market Cluster Risk_ (Europe) - Added a link to _Duck.ai_ to the _Copy AI prompt to clipboard_ action on the analysis page (experimental) - Extracted the tags selector to a reusable component used in the create or update activity dialog and holding detail dialog +- Added stories for the tags selector component ### Changed diff --git a/libs/ui/src/lib/logo/logo.component.stories.ts b/libs/ui/src/lib/logo/logo.component.stories.ts index c720ebd9..50f04718 100644 --- a/libs/ui/src/lib/logo/logo.component.stories.ts +++ b/libs/ui/src/lib/logo/logo.component.stories.ts @@ -25,7 +25,7 @@ export const Large: Story = { } }; -export const NoLabel: Story = { +export const WithoutLabel: Story = { args: { showLabel: false } diff --git a/libs/ui/src/lib/tags-selector/tags-selector.component.stories.ts b/libs/ui/src/lib/tags-selector/tags-selector.component.stories.ts new file mode 100644 index 00000000..c1adf128 --- /dev/null +++ b/libs/ui/src/lib/tags-selector/tags-selector.component.stories.ts @@ -0,0 +1,62 @@ +import { CommonModule } from '@angular/common'; +import { NoopAnimationsModule } from '@angular/platform-browser/animations'; +import { Meta, moduleMetadata, StoryObj } from '@storybook/angular'; + +import { GfTagsSelectorComponent } from './tags-selector.component'; + +export default { + title: 'Tags Selector', + component: GfTagsSelectorComponent, + decorators: [ + moduleMetadata({ + imports: [CommonModule, NoopAnimationsModule] + }) + ] +} as Meta; + +type Story = StoryObj; + +const OPTIONS = [ + { + id: '3ef7e6d9-4598-4eb2-b0e8-00e61cfc0ea6', + name: 'Gambling', + userId: 'c6a71541-d0e3-4e22-ae83-b5e5611b6695' + }, + { + id: 'EMERGENCY_FUND', + name: 'Emergency Fund', + userId: null + }, + { + id: 'RETIREMENT_FUND', + name: 'Retirement Fund', + userId: null + } +]; + +export const Default: Story = { + args: { + tags: [ + { + id: 'EMERGENCY_FUND', + name: 'Emergency Fund', + userId: null + } + ], + tagsAvailable: OPTIONS + } +}; + +export const WithoutValue: Story = { + args: { + tags: [], + tagsAvailable: OPTIONS + } +}; + +export const WithoutOptions: Story = { + args: { + tags: [], + tagsAvailable: [] + } +}; From 5b786ba1431536e30a587cd9b93e4e8a5b44acc2 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Fri, 7 Feb 2025 10:32:25 +0100 Subject: [PATCH 2/2] Feature/improve error handling in CoinGecko service (#4287) * Improve error handling * Update changelog --- CHANGELOG.md | 1 + .../data-provider/coingecko/coingecko.service.ts | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e4ae5b6..2a6f45a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Improved the caching of the portfolio snapshot in the portfolio calculator by expiring cache entries when a user changes tags in the holding detail dialog +- Improved the error handling in the _CoinGecko_ service - Improved the language localization for German (`de`) - Upgraded `svgmap` from version `2.6.0` to `2.12.2` diff --git a/apps/api/src/services/data-provider/coingecko/coingecko.service.ts b/apps/api/src/services/data-provider/coingecko/coingecko.service.ts index 30dbe0ae..fb1fa9b6 100644 --- a/apps/api/src/services/data-provider/coingecko/coingecko.service.ts +++ b/apps/api/src/services/data-provider/coingecko/coingecko.service.ts @@ -112,7 +112,7 @@ export class CoinGeckoService implements DataProviderInterface { [symbol: string]: { [date: string]: IDataProviderHistoricalResponse }; }> { try { - const { prices } = await fetch( + const { error, prices, status } = await fetch( `${ this.apiUrl }/coins/${symbol}/market_chart/range?vs_currency=${DEFAULT_CURRENCY.toLowerCase()}&from=${getUnixTime( @@ -124,6 +124,14 @@ export class CoinGeckoService implements DataProviderInterface { } ).then((res) => res.json()); + if (error?.status) { + throw new Error(error.status.error_message); + } + + if (status) { + throw new Error(status.error_message); + } + const result: { [symbol: string]: { [date: string]: IDataProviderHistoricalResponse }; } = {