Bugfix/fix storybook setup (#4168)

* Fix storybook setup

* Update changelog
pull/4056/merge
Karel De Smet 4 days ago committed by GitHub
parent a4ee33f6df
commit 68868df41a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed ### Fixed
- Improved the handling of a missing url in the endpoint to fetch the logo of an asset or a platform - Improved the handling of a missing url in the endpoint to fetch the logo of an asset or a platform
- Fixed the _Storybook_ setup
## 2.132.0 - 2024-12-30 ## 2.132.0 - 2024-12-30
@ -47,6 +48,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Upgraded `ngx-markdown` from version `18.0.0` to `19.0.0` - Upgraded `ngx-markdown` from version `18.0.0` to `19.0.0`
- Upgraded `Nx` from version `20.1.2` to `20.3.0` - Upgraded `Nx` from version `20.1.2` to `20.3.0`
- Upgraded `prisma` from version `6.0.1` to `6.1.0` - Upgraded `prisma` from version `6.0.1` to `6.1.0`
- Upgraded `storybook` from version `8.2.5` to `8.4.7`
- Upgraded `zone.js` from version `0.14.10` to `0.15.0` - Upgraded `zone.js` from version `0.14.10` to `0.15.0`
### Fixed ### Fixed

@ -4,47 +4,48 @@ import { CommonModule } from '@angular/common';
import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import '@angular/localize/init'; import '@angular/localize/init';
import { MatButtonModule } from '@angular/material/button'; import { MatButtonModule } from '@angular/material/button';
import { provideNativeDateAdapter } from '@angular/material/core';
import { MatDatepickerModule } from '@angular/material/datepicker';
import { MatFormFieldModule } from '@angular/material/form-field'; import { MatFormFieldModule } from '@angular/material/form-field';
import { MatInputModule } from '@angular/material/input'; import { MatInputModule } from '@angular/material/input';
import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { Meta, Story, moduleMetadata } from '@storybook/angular'; import { moduleMetadata } from '@storybook/angular';
import type { Meta, StoryObj } from '@storybook/angular';
import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader'; import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader';
import { GfValueModule } from '../value'; import { GfValueComponent } from '../value';
import { FireCalculatorComponent } from './fire-calculator.component'; import { GfFireCalculatorComponent } from './fire-calculator.component';
import { FireCalculatorService } from './fire-calculator.service'; import { FireCalculatorService } from './fire-calculator.service';
export default { export default {
title: 'FIRE Calculator', title: 'FIRE Calculator',
component: FireCalculatorComponent, component: GfFireCalculatorComponent,
decorators: [ decorators: [
moduleMetadata({ moduleMetadata({
declarations: [FireCalculatorComponent],
imports: [ imports: [
CommonModule, CommonModule,
FormsModule, FormsModule,
GfValueModule, GfFireCalculatorComponent,
GfValueComponent,
MatButtonModule, MatButtonModule,
MatDatepickerModule,
MatFormFieldModule, MatFormFieldModule,
MatInputModule, MatInputModule,
NgxSkeletonLoaderModule, NgxSkeletonLoaderModule,
NoopAnimationsModule, NoopAnimationsModule,
ReactiveFormsModule ReactiveFormsModule
], ],
providers: [FireCalculatorService] providers: [FireCalculatorService, provideNativeDateAdapter()]
}) })
] ]
} as Meta<FireCalculatorComponent>; } as Meta<GfFireCalculatorComponent>;
const Template: Story<FireCalculatorComponent> = ( type Story = StoryObj<GfFireCalculatorComponent>;
args: FireCalculatorComponent
) => ({
props: args
});
export const Simple = Template.bind({}); export const Simple: Story = {
Simple.args = { args: {
currency: 'USD', currency: 'USD',
fireWealth: 0, fireWealth: 0,
locale: locale locale: locale
}
}; };

@ -1,26 +1,24 @@
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { Meta, Story, moduleMetadata } from '@storybook/angular'; import { moduleMetadata } from '@storybook/angular';
import type { Meta, StoryObj } from '@storybook/angular';
import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader'; import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader';
import { LineChartComponent } from './line-chart.component'; import { GfLineChartComponent } from './line-chart.component';
export default { export default {
title: 'Line Chart', title: 'Line Chart',
component: LineChartComponent, component: GfLineChartComponent,
decorators: [ decorators: [
moduleMetadata({ moduleMetadata({
declarations: [LineChartComponent], imports: [CommonModule, GfLineChartComponent, NgxSkeletonLoaderModule]
imports: [CommonModule, NgxSkeletonLoaderModule]
}) })
] ]
} as Meta<LineChartComponent>; } as Meta<GfLineChartComponent>;
const Template: Story<LineChartComponent> = (args: LineChartComponent) => ({ type Story = StoryObj<GfLineChartComponent>;
props: args
});
export const Simple = Template.bind({}); export const Simple: Story = {
Simple.args = { args: {
historicalDataItems: [ historicalDataItems: [
{ {
date: '2017-01-01', date: '2017-01-01',
@ -232,4 +230,5 @@ Simple.args = {
} }
], ],
isAnimated: true isAnimated: true
}
}; };

@ -1,30 +1,32 @@
import { Meta, Story, moduleMetadata } from '@storybook/angular'; import { moduleMetadata } from '@storybook/angular';
import type { Meta, StoryObj } from '@storybook/angular';
import { LogoComponent } from './logo.component'; import { GfLogoComponent } from './logo.component';
export default { export default {
title: 'Logo', title: 'Logo',
component: LogoComponent, component: GfLogoComponent,
decorators: [ decorators: [
moduleMetadata({ moduleMetadata({
imports: [] imports: []
}) })
] ]
} as Meta<LogoComponent>; } as Meta<GfLogoComponent>;
const Template: Story<LogoComponent> = (args: LogoComponent) => ({ type Story = StoryObj<GfLogoComponent>;
props: args
});
export const Default = Template.bind({}); export const Default: Story = {
Default.args = {}; args: {}
};
export const Large = Template.bind({}); export const Large: Story = {
Large.args = { args: {
size: 'large' size: 'large'
}
}; };
export const NoLabel = Template.bind({}); export const NoLabel: Story = {
NoLabel.args = { args: {
showLabel: false showLabel: false
}
}; };

@ -1,25 +1,23 @@
import { GfLogoModule } from '@ghostfolio/ui/logo'; import { GfLogoComponent } from '@ghostfolio/ui/logo';
import { RouterTestingModule } from '@angular/router/testing'; import { RouterTestingModule } from '@angular/router/testing';
import { Meta, Story, moduleMetadata } from '@storybook/angular'; import { moduleMetadata } from '@storybook/angular';
import type { Meta, StoryObj } from '@storybook/angular';
import { NoTransactionsInfoComponent } from './no-transactions-info.component'; import { GfNoTransactionsInfoComponent } from './no-transactions-info.component';
export default { export default {
title: 'No Transactions Info', title: 'No Transactions Info',
component: NoTransactionsInfoComponent, component: GfNoTransactionsInfoComponent,
decorators: [ decorators: [
moduleMetadata({ moduleMetadata({
imports: [GfLogoModule, RouterTestingModule] imports: [GfLogoComponent, RouterTestingModule]
}) })
] ]
} as Meta<NoTransactionsInfoComponent>; } as Meta<GfNoTransactionsInfoComponent>;
const Template: Story<NoTransactionsInfoComponent> = ( type Story = StoryObj<GfNoTransactionsInfoComponent>;
args: NoTransactionsInfoComponent
) => ({
props: args
});
export const Default = Template.bind({}); export const Default: Story = {
Default.args = {}; args: {}
};

@ -1,29 +1,29 @@
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import '@angular/localize/init'; import '@angular/localize/init';
import { Meta, Story, moduleMetadata } from '@storybook/angular'; import { moduleMetadata } from '@storybook/angular';
import type { Meta, StoryObj } from '@storybook/angular';
import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader'; import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader';
import { PortfolioProportionChartComponent } from './portfolio-proportion-chart.component'; import { GfPortfolioProportionChartComponent } from './portfolio-proportion-chart.component';
export default { export default {
title: 'Portfolio Proportion Chart', title: 'Portfolio Proportion Chart',
component: PortfolioProportionChartComponent, component: GfPortfolioProportionChartComponent,
decorators: [ decorators: [
moduleMetadata({ moduleMetadata({
declarations: [PortfolioProportionChartComponent], imports: [
imports: [CommonModule, NgxSkeletonLoaderModule] CommonModule,
GfPortfolioProportionChartComponent,
NgxSkeletonLoaderModule
]
}) })
] ]
} as Meta<PortfolioProportionChartComponent>; } as Meta<GfPortfolioProportionChartComponent>;
const Template: Story<PortfolioProportionChartComponent> = ( type Story = StoryObj<GfPortfolioProportionChartComponent>;
args: PortfolioProportionChartComponent
) => ({
props: args
});
export const Simple = Template.bind({}); export const Simple: Story = {
Simple.args = { args: {
baseCurrency: 'USD', baseCurrency: 'USD',
keys: ['name'], keys: ['name'],
locale: 'en-US', locale: 'en-US',
@ -35,4 +35,5 @@ Simple.args = {
Oceania: { name: 'Oceania', value: 1402.220605072031 }, Oceania: { name: 'Oceania', value: 1402.220605072031 },
'South America': { name: 'South America', value: 4938.25202180719859 } 'South America': { name: 'South America', value: 4938.25202180719859 }
} }
}
}; };

@ -1,29 +1,28 @@
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { RouterTestingModule } from '@angular/router/testing'; import { RouterTestingModule } from '@angular/router/testing';
import { Meta, Story, moduleMetadata } from '@storybook/angular'; import { moduleMetadata } from '@storybook/angular';
import type { Meta, StoryObj } from '@storybook/angular';
import { PremiumIndicatorComponent } from './premium-indicator.component'; import { GfPremiumIndicatorComponent } from './premium-indicator.component';
export default { export default {
title: 'Premium Indicator', title: 'Premium Indicator',
component: PremiumIndicatorComponent, component: GfPremiumIndicatorComponent,
decorators: [ decorators: [
moduleMetadata({ moduleMetadata({
imports: [CommonModule, RouterTestingModule] imports: [CommonModule, RouterTestingModule]
}) })
] ]
} as Meta<PremiumIndicatorComponent>; } as Meta<GfPremiumIndicatorComponent>;
const Template: Story<PremiumIndicatorComponent> = ( type Story = StoryObj<GfPremiumIndicatorComponent>;
args: PremiumIndicatorComponent
) => ({
props: args
});
export const Default = Template.bind({}); export const Default: Story = {
Default.args = {}; args: {}
};
export const WithoutLink = Template.bind({}); export const WithoutLink = {
WithoutLink.args = { args: {
enableLink: false enableLink: false
}
}; };

@ -1,50 +1,53 @@
import { Meta, Story, moduleMetadata } from '@storybook/angular'; import { moduleMetadata } from '@storybook/angular';
import type { Meta, StoryObj } from '@storybook/angular';
import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader'; import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader';
import { TrendIndicatorComponent } from './trend-indicator.component'; import { GfTrendIndicatorComponent } from './trend-indicator.component';
export default { export default {
title: 'Trend Indicator', title: 'Trend Indicator',
component: TrendIndicatorComponent, component: GfTrendIndicatorComponent,
decorators: [ decorators: [
moduleMetadata({ moduleMetadata({
imports: [NgxSkeletonLoaderModule] imports: [NgxSkeletonLoaderModule]
}) })
] ]
} as Meta<TrendIndicatorComponent>; } as Meta<GfTrendIndicatorComponent>;
const Template: Story<TrendIndicatorComponent> = ( type Story = StoryObj<GfTrendIndicatorComponent>;
args: TrendIndicatorComponent
) => ({
props: args
});
export const Loading = Template.bind({}); export const Loading: Story = {
Loading.args = { args: {
isLoading: true isLoading: true
}
}; };
export const Default = Template.bind({}); export const Default: Story = {
Default.args = {}; args: {}
};
export const Delayed = Template.bind({}); export const Delayed: Story = {
Delayed.args = { args: {
marketState: 'delayed', dateRange: '1d',
range: '1d' marketState: 'delayed'
}
}; };
export const Down = Template.bind({}); export const Down: Story = {
Down.args = { args: {
value: -1 value: -1
}
}; };
export const Up = Template.bind({}); export const Up: Story = {
Up.args = { args: {
value: 1 value: 1
}
}; };
export const MarketClosed = Template.bind({}); export const MarketClosed: Story = {
MarketClosed.args = { args: {
marketState: 'closed', dateRange: '1d',
range: '1d' marketState: 'closed'
}
}; };

@ -1,71 +1,77 @@
import { Meta, Story, moduleMetadata } from '@storybook/angular'; import { moduleMetadata } from '@storybook/angular';
import type { Meta, StoryObj } from '@storybook/angular';
import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader'; import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader';
import { ValueComponent } from './value.component'; import { GfValueComponent } from './value.component';
export default { export default {
title: 'Value', title: 'Value',
component: ValueComponent, component: GfValueComponent,
decorators: [ decorators: [
moduleMetadata({ moduleMetadata({
imports: [NgxSkeletonLoaderModule] imports: [NgxSkeletonLoaderModule]
}) })
] ]
} as Meta<ValueComponent>; } as Meta<GfValueComponent>;
const Template: Story<ValueComponent> = (args: ValueComponent) => ({ type Story = StoryObj<GfValueComponent>;
props: args
});
export const Loading = Template.bind({}); export const Loading: Story = {
Loading.args = { args: {
value: undefined value: undefined
}
}; };
export const Currency = Template.bind({}); export const Currency: Story = {
Currency.args = { args: {
isCurrency: true, isCurrency: true,
locale: 'en-US', locale: 'en-US',
unit: 'USD', unit: 'USD',
value: 7 value: 7
}
}; };
export const Label = Template.bind({}); export const Label: Story = {
Label.args = { args: {
locale: 'en-US', locale: 'en-US',
value: 7.25 value: 7.25
}
}; };
export const PerformancePositive = Template.bind({}); export const PerformancePositive: Story = {
PerformancePositive.args = { args: {
locale: 'en-US',
colorizeSign: true, colorizeSign: true,
isPercent: true, isPercent: true,
locale: 'en-US',
value: 0.0136810853673890378 value: 0.0136810853673890378
},
name: 'Performance (positive)'
}; };
PerformancePositive.storyName = 'Performance (positive)';
export const PerformanceNegative = Template.bind({}); export const PerformanceNegative: Story = {
PerformanceNegative.args = { args: {
locale: 'en-US',
colorizeSign: true, colorizeSign: true,
isPercent: true, isPercent: true,
locale: 'en-US',
value: -0.0136810853673890378 value: -0.0136810853673890378
},
name: 'Performance (negative)'
}; };
PerformanceNegative.storyName = 'Performance (negative)';
export const PerformanceCloseToZero = Template.bind({}); export const PerformanceCloseToZero: Story = {
PerformanceCloseToZero.args = { args: {
locale: 'en-US',
colorizeSign: true, colorizeSign: true,
isPercent: true, isPercent: true,
locale: 'en-US',
value: -2.388915360475e-8 value: -2.388915360475e-8
},
name: 'Performance (negative zero)'
}; };
PerformanceCloseToZero.storyName = 'Performance (negative zero)';
export const Precision = Template.bind({}); export const Precision: Story = {
Precision.args = { args: {
locale: 'en-US', locale: 'en-US',
precision: 3, precision: 3,
value: 7.2534802394809285309 value: 7.2534802394809285309
}
}; };

Loading…
Cancel
Save