diff --git a/libs/ui/src/lib/activities-table/activities-table.component.stories.ts b/libs/ui/src/lib/activities-table/activities-table.component.stories.ts index 95e61ef85..5e774730b 100644 --- a/libs/ui/src/lib/activities-table/activities-table.component.stories.ts +++ b/libs/ui/src/lib/activities-table/activities-table.component.stories.ts @@ -24,92 +24,340 @@ import { GfActivitiesTableComponent } from './activities-table.component'; const activities: Activity[] = [ { - id: '383d25b0-cff4-4b66-8bb7-8244cb787ca5' as any, + accountId: '776bd1e9-b2f6-4f7e-933d-18756c2f0625', + accountUserId: '081aa387-487d-4438-83a4-3060eb2a016e', + comment: null, + createdAt: new Date('2025-04-09T13:47:33.133Z'), + currency: 'USD', + date: new Date('2025-04-09T13:45:45.504Z'), + fee: 1, + id: 'a76968ff-80a4-4453-81ed-c3627dea3919', + isDraft: false, + quantity: 115, + symbolProfileId: '21746431-d612-4298-911c-3099b2a43003', type: 'BUY', - date: new Date('2025-06-01T10:00:00.000Z') as any, - quantity: 10 as any, - fee: 1 as any, + unitPrice: 103.543, + updatedAt: new Date('2025-05-31T18:43:01.840Z'), + userId: '081aa387-487d-4438-83a4-3060eb2a016e', + account: { + balance: 150.2, + comment: null, + createdAt: new Date('2025-05-31T13:00:13.940Z'), + currency: 'USD', + id: '776bd1e9-b2f6-4f7e-933d-18756c2f0625', + isExcluded: false, + name: 'Trading Account', + platformId: '9da3a8a7-4795-43e3-a6db-ccb914189737', + updatedAt: new Date('2025-06-01T06:53:10.569Z'), + userId: '081aa387-487d-4438-83a4-3060eb2a016e', + platform: { + id: '9da3a8a7-4795-43e3-a6db-ccb914189737', + name: 'Interactive Brokers', + url: 'https://interactivebrokers.com' + } + }, + SymbolProfile: { + assetClass: 'EQUITY', + assetSubClass: 'ETF', + comment: null, + countries: [], + createdAt: new Date('2021-06-06T16:12:20.982Z'), + currency: 'USD', + cusip: '922042742', + dataSource: 'YAHOO', + figi: 'BBG000GM5FZ6', + figiComposite: 'BBG000GM5FZ6', + figiShareClass: 'BBG001T2YZG9', + holdings: [], + id: '21746431-d612-4298-911c-3099b2a43003', + isActive: true, + isin: 'US9220427424', + name: 'Vanguard Total World Stock Index Fund ETF Shares', + updatedAt: new Date('2025-10-01T20:09:39.500Z'), + scraperConfiguration: null, + sectors: [], + symbol: 'VT', + symbolMapping: {}, + url: 'https://www.vanguard.com', + userId: null, + activitiesCount: 267, + dateOfFirstActivity: new Date('2018-05-31T16:00:00.000Z') + }, + tags: [], feeInAssetProfileCurrency: 1, feeInBaseCurrency: 1, - unitPrice: 250 as any, - unitPriceInAssetProfileCurrency: 250, - value: 2500, - valueInBaseCurrency: 2500, - currency: 'USD' as any, - isDraft: false as any, + unitPriceInAssetProfileCurrency: 103.543, + value: 11907.445, + valueInBaseCurrency: 11907.445 + }, + { + accountId: '776bd1e9-b2f6-4f7e-933d-18756c2f0625', + accountUserId: '081aa387-487d-4438-83a4-3060eb2a016e', + comment: null, + createdAt: new Date('2024-08-07T13:40:39.103Z'), + currency: 'USD', + date: new Date('2024-08-07T13:38:06.289Z'), + fee: 2.97, + id: '0c2f4fbf-6edc-4adc-8f83-abf8148500ec', + isDraft: false, + quantity: 105, + symbolProfileId: '21746431-d612-4298-911c-3099b2a43003', + type: 'BUY', + unitPrice: 110.24, + updatedAt: new Date('2025-05-31T18:46:14.175Z'), + userId: '081aa387-487d-4438-83a4-3060eb2a016e', account: { - id: 'b73d7d6f-88b6-45f1-a1b2-27c1182fed81' as any, - name: 'Brokerage Account' as any, + balance: 150.2, + comment: null, + createdAt: new Date('2025-05-31T13:00:13.940Z'), + currency: 'USD', + id: '776bd1e9-b2f6-4f7e-933d-18756c2f0625', + isExcluded: false, + name: 'Trading Account', + platformId: '9da3a8a7-4795-43e3-a6db-ccb914189737', + updatedAt: new Date('2025-06-01T06:53:10.569Z'), + userId: '081aa387-487d-4438-83a4-3060eb2a016e', platform: { - id: '7fececf6-9bf1-4318-ad1f-1d61e357a8c1' as any, - name: 'Interactive Brokers' as any, - url: 'https://interactivebrokers.com' as any + id: '9da3a8a7-4795-43e3-a6db-ccb914189737', + name: 'Interactive Brokers', + url: 'https://interactivebrokers.com' } - } as any, + }, SymbolProfile: { - dataSource: 'YAHOO' as any, - symbol: 'AAPL' as any, - name: 'Apple Inc.' as any - } as any - } as any, + assetClass: 'EQUITY', + assetSubClass: 'ETF', + comment: null, + countries: [], + createdAt: new Date('2021-06-06T16:12:20.982Z'), + currency: 'USD', + cusip: '922042742', + dataSource: 'YAHOO', + figi: 'BBG000GM5FZ6', + figiComposite: 'BBG000GM5FZ6', + figiShareClass: 'BBG001T2YZG9', + holdings: [], + id: '21746431-d612-4298-911c-3099b2a43003', + isActive: true, + isin: 'US9220427424', + name: 'Vanguard Total World Stock Index Fund ETF Shares', + updatedAt: new Date('2025-10-01T20:09:39.500Z'), + scraperConfiguration: null, + sectors: [], + symbol: 'VT', + symbolMapping: {}, + url: 'https://www.vanguard.com', + userId: null, + activitiesCount: 267, + dateOfFirstActivity: new Date('2018-05-31T16:00:00.000Z') + }, + tags: [], + feeInAssetProfileCurrency: 2.97, + feeInBaseCurrency: 2.97, + unitPriceInAssetProfileCurrency: 110.24, + value: 11575.2, + valueInBaseCurrency: 11575.2 + }, { - id: '7ccf3e14-9fc3-4237-b6e7-831e185b9f76' as any, - type: 'DIVIDEND', - date: new Date('2025-06-10T10:00:00.000Z') as any, - quantity: 0 as any, - fee: 0 as any, - feeInAssetProfileCurrency: 0, - feeInBaseCurrency: 0, - unitPrice: 0 as any, - unitPriceInAssetProfileCurrency: 0, - value: 15.5, - valueInBaseCurrency: 15.5, - currency: 'USD' as any, - isDraft: false as any, + accountId: '776bd1e9-b2f6-4f7e-933d-18756c2f0625', + accountUserId: '081aa387-487d-4438-83a4-3060eb2a016e', + comment: null, + createdAt: new Date('2024-03-12T15:15:21.217Z'), + currency: 'USD', + date: new Date('2024-03-12T15:14:38.597Z'), + fee: 45.29, + id: 'bfc92677-faf4-4d4f-9762-e0ec056525c2', + isDraft: false, + quantity: 167, + symbolProfileId: '888d4123-db9a-42f3-9775-01b1ae6f9092', + type: 'BUY', + unitPrice: 41.0596, + updatedAt: new Date('2025-05-31T18:49:54.064Z'), + userId: '081aa387-487d-4438-83a4-3060eb2a016e', account: { - id: '54927ef3-ee2b-488f-b72e-a42b16c57a16' as any, - name: 'Brokerage Account' as any, + balance: 150.2, + comment: null, + createdAt: new Date('2025-05-31T13:00:13.940Z'), + currency: 'USD', + id: '776bd1e9-b2f6-4f7e-933d-18756c2f0625', + isExcluded: false, + name: 'Trading Account', + platformId: '9da3a8a7-4795-43e3-a6db-ccb914189737', + updatedAt: new Date('2025-06-01T06:53:10.569Z'), + userId: '081aa387-487d-4438-83a4-3060eb2a016e', platform: { - id: 'fa43c986-6638-42db-85f9-015c6b83f730' as any, - name: 'Interactive Brokers' as any, - url: 'https://interactivebrokers.com' as any + id: '9da3a8a7-4795-43e3-a6db-ccb914189737', + name: 'Interactive Brokers', + url: 'https://interactivebrokers.com' } - } as any, + }, SymbolProfile: { - dataSource: 'YAHOO' as any, - symbol: 'AAPL' as any, - name: 'Apple Inc.' as any - } as any - } as any, + assetClass: 'LIQUIDITY', + assetSubClass: 'CRYPTOCURRENCY', + comment: null, + countries: [], + createdAt: new Date('2024-03-12T15:15:21.217Z'), + currency: 'USD', + cusip: '463918102', + dataSource: 'YAHOO', + figi: 'BBG01KYQ6PV3', + figiComposite: 'BBG01KYQ6PV3', + figiShareClass: 'BBG01KYQ6QS5', + holdings: [], + id: '888d4123-db9a-42f3-9775-01b1ae6f9092', + isActive: true, + isin: 'CA4639181029', + name: 'iShares Bitcoin Trust', + updatedAt: new Date('2025-09-29T03:14:07.742Z'), + scraperConfiguration: null, + sectors: [], + symbol: 'IBIT', + symbolMapping: {}, + url: 'https://www.ishares.com', + userId: null, + activitiesCount: 6, + dateOfFirstActivity: new Date('2024-01-01T08:00:00.000Z') + }, + tags: [], + feeInAssetProfileCurrency: 45.29, + feeInBaseCurrency: 45.29, + unitPriceInAssetProfileCurrency: 41.0596, + value: 6856.9532, + valueInBaseCurrency: 6856.9532 + }, { - id: '84ebfe47-14bc-4b26-88e4-4d3224bb453c' as any, - type: 'SELL', - date: new Date('2025-06-15T10:00:00.000Z') as any, - quantity: 5 as any, - fee: 1 as any, - feeInAssetProfileCurrency: 1, - feeInBaseCurrency: 1, - unitPrice: 300 as any, - unitPriceInAssetProfileCurrency: 300, - value: 1500, - valueInBaseCurrency: 1500, - currency: 'USD' as any, - isDraft: false as any, + accountId: '776bd1e9-b2f6-4f7e-933d-18756c2f0625', + accountUserId: '081aa387-487d-4438-83a4-3060eb2a016e', + comment: null, + createdAt: new Date('2024-02-23T15:53:46.907Z'), + currency: 'USD', + date: new Date('2024-02-23T15:53:15.745Z'), + fee: 3, + id: '7c9ceb54-acb1-4850-bfb1-adb41c29fd6a', + isDraft: false, + quantity: 81, + symbolProfileId: '36effe43-7cb4-4e8b-b7ac-03ff65702cb9', + type: 'BUY', + unitPrice: 67.995, + updatedAt: new Date('2025-05-31T18:48:48.209Z'), + userId: '081aa387-487d-4438-83a4-3060eb2a016e', account: { - id: '169abccc-fc0d-49a4-9be2-4b3d6ef4d21f' as any, - name: 'Trading Account' as any, + balance: 150.2, + comment: null, + createdAt: new Date('2025-05-31T13:00:13.940Z'), + currency: 'USD', + id: '776bd1e9-b2f6-4f7e-933d-18756c2f0625', + isExcluded: false, + name: 'Trading Account', + platformId: '9da3a8a7-4795-43e3-a6db-ccb914189737', + updatedAt: new Date('2025-06-01T06:53:10.569Z'), + userId: '081aa387-487d-4438-83a4-3060eb2a016e', platform: { - id: 'a02bcac9-cd82-48fb-8b89-3670f1ad8841' as any, - name: 'Robinhood' as any, - url: 'https://robinhood.com' as any + id: '9da3a8a7-4795-43e3-a6db-ccb914189737', + name: 'Interactive Brokers', + url: 'https://interactivebrokers.com' } - } as any, + }, SymbolProfile: { - dataSource: 'YAHOO' as any, - symbol: 'MSFT' as any, - name: 'Microsoft Corp.' as any - } as any - } as any + assetClass: 'FIXED_INCOME', + assetSubClass: 'BOND', + comment: 'No data', + countries: [], + createdAt: new Date('2022-04-13T20:05:47.301Z'), + currency: 'USD', + cusip: '92206C565', + dataSource: 'YAHOO', + figi: 'BBG00LWSF7T3', + figiComposite: 'BBG00LWSF7T3', + figiShareClass: 'BBG00LWSF8K0', + holdings: [], + id: '36effe43-7cb4-4e8b-b7ac-03ff65702cb9', + isActive: true, + isin: 'US92206C5655', + name: 'Vanguard Total World Bond ETF', + updatedAt: new Date('2025-10-02T06:02:56.314Z'), + + sectors: [], + symbol: 'BNDW', + symbolMapping: {}, + url: 'https://vanguard.com', + userId: null, + activitiesCount: 38, + dateOfFirstActivity: new Date('2022-04-13T20:05:48.742Z') + }, + tags: [], + feeInAssetProfileCurrency: 3, + feeInBaseCurrency: 3, + unitPriceInAssetProfileCurrency: 67.995, + value: 5507.595, + valueInBaseCurrency: 5507.595 + }, + { + accountId: '776bd1e9-b2f6-4f7e-933d-18756c2f0625', + accountUserId: '081aa387-487d-4438-83a4-3060eb2a016e', + comment: null, + createdAt: new Date('2023-01-11T14:35:22.325Z'), + currency: 'USD', + date: new Date('2023-01-11T14:34:55.174Z'), + fee: 7.38, + id: '3fe87b3f-78de-407a-bc02-4189b221051f', + isDraft: false, + quantity: 55, + symbolProfileId: '21746431-d612-4298-911c-3099b2a43003', + type: 'BUY', + unitPrice: 89.48, + updatedAt: new Date('2025-05-31T18:46:44.616Z'), + userId: '081aa387-487d-4438-83a4-3060eb2a016e', + account: { + balance: 150.2, + comment: null, + createdAt: new Date('2025-05-31T13:00:13.940Z'), + currency: 'USD', + id: '776bd1e9-b2f6-4f7e-933d-18756c2f0625', + isExcluded: false, + name: 'Trading Account', + platformId: '9da3a8a7-4795-43e3-a6db-ccb914189737', + updatedAt: new Date('2025-06-01T06:53:10.569Z'), + userId: '081aa387-487d-4438-83a4-3060eb2a016e', + platform: { + id: '9da3a8a7-4795-43e3-a6db-ccb914189737', + name: 'Interactive Brokers', + url: 'https://interactivebrokers.com' + } + }, + SymbolProfile: { + assetClass: 'EQUITY', + assetSubClass: 'ETF', + comment: null, + countries: [], + createdAt: new Date('2021-06-06T16:12:20.982Z'), + currency: 'USD', + cusip: '922042742', + dataSource: 'YAHOO', + figi: 'BBG000GM5FZ6', + figiComposite: 'BBG000GM5FZ6', + figiShareClass: 'BBG001T2YZG9', + holdings: [], + id: '21746431-d612-4298-911c-3099b2a43003', + isActive: true, + isin: 'US9220427424', + name: 'Vanguard Total World Stock Index Fund ETF Shares', + updatedAt: new Date('2025-10-01T20:09:39.500Z'), + scraperConfiguration: null, + sectors: [], + symbol: 'VT', + symbolMapping: {}, + url: 'https://www.vanguard.com', + userId: null, + activitiesCount: 267, + dateOfFirstActivity: new Date('2018-05-31T16:00:00.000Z') + }, + tags: [], + feeInAssetProfileCurrency: 7.38, + feeInBaseCurrency: 7.38, + unitPriceInAssetProfileCurrency: 89.48, + value: 4921.4, + valueInBaseCurrency: 4921.4 + } ]; const dataSource = new MatTableDataSource(activities); @@ -153,7 +401,7 @@ export const Loading: Story = { hasPermissionToCreateActivity: false, hasPermissionToDeleteActivity: false, hasPermissionToExportActivities: false, - hasPermissionToOpenDetails: true, + hasPermissionToOpenDetails: false, locale: 'en-US', pageIndex: 0, pageSize: 10, @@ -177,7 +425,7 @@ export const Default: Story = { hasPermissionToCreateActivity: false, hasPermissionToDeleteActivity: false, hasPermissionToExportActivities: false, - hasPermissionToOpenDetails: true, + hasPermissionToOpenDetails: false, locale: 'en-US', pageIndex: 0, pageSize: 10, @@ -192,38 +440,14 @@ export const Default: Story = { } }; -export const EmptyState: Story = { - args: { - baseCurrency: 'USD', - dataSource: new MatTableDataSource([]), - deviceType: 'desktop', - hasActivities: false, - hasPermissionToCreateActivity: true, - hasPermissionToDeleteActivity: false, - hasPermissionToExportActivities: false, - hasPermissionToOpenDetails: true, - locale: 'en-US', - pageIndex: 0, - pageSize: 10, - showAccountColumn: true, - showActions: false, - showCheckbox: false, - showNameColumn: true, - sortColumn: 'date', - sortDirection: 'desc', - sortDisabled: false, - totalItems: 0 - } -}; - -export const ManyRows: Story = { +export const Pagination: Story = { args: { baseCurrency: 'USD', dataSource: new MatTableDataSource( Array.from({ length: 50 }).map((_, i) => ({ ...(activities[i % activities.length] as Activity), - id: `${i}` as any, - date: new Date(2025, 5, (i % 28) + 1) as any + date: new Date(2025, 5, (i % 28) + 1), + id: `${i}` })) ), deviceType: 'desktop', @@ -231,7 +455,7 @@ export const ManyRows: Story = { hasPermissionToCreateActivity: false, hasPermissionToDeleteActivity: false, hasPermissionToExportActivities: false, - hasPermissionToOpenDetails: true, + hasPermissionToOpenDetails: false, locale: 'en-US', pageIndex: 0, pageSize: 10,