-
Notifications
You must be signed in to change notification settings - Fork 0
refactor(TransactionTable): Extract demo data to separate file #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,79 @@ | ||||||||||||||||||||||||||
| // Demo data for TransactionTable component | ||||||||||||||||||||||||||
| // Use in Storybook or when showDemoData prop is true | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| import type { Transaction } from './TransactionTable'; | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| export const demoTransactions: Transaction[] = [ | ||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| id: '1', | ||||||||||||||||||||||||||
| date: '06/2025', | ||||||||||||||||||||||||||
| prism: 'bitcoin Pizza', | ||||||||||||||||||||||||||
| amount: '$1,250.00', | ||||||||||||||||||||||||||
| status: 'Successful', | ||||||||||||||||||||||||||
| account: 'Jamie Smith', | ||||||||||||||||||||||||||
| isFavorite: false, | ||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| id: '2', | ||||||||||||||||||||||||||
| date: '07/2025', | ||||||||||||||||||||||||||
| prism: 'Crypto Feast', | ||||||||||||||||||||||||||
| amount: '$500.00', | ||||||||||||||||||||||||||
| status: 'Pending', | ||||||||||||||||||||||||||
| account: 'Alex Johnson', | ||||||||||||||||||||||||||
| isFavorite: false, | ||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| id: '3', | ||||||||||||||||||||||||||
| date: '09/2025', | ||||||||||||||||||||||||||
| prism: 'Tech Summit', | ||||||||||||||||||||||||||
| amount: '225078764578.00 sats', | ||||||||||||||||||||||||||
| status: 'Successful', | ||||||||||||||||||||||||||
| account: 'QHFI8WE8DYHWEBJhbsbdcus...', | ||||||||||||||||||||||||||
| isFavorite: true, | ||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| id: '4', | ||||||||||||||||||||||||||
| date: '11/2025', | ||||||||||||||||||||||||||
| prism: 'Health Expo', | ||||||||||||||||||||||||||
| amount: '3000.00 Sats', | ||||||||||||||||||||||||||
| status: 'Active', | ||||||||||||||||||||||||||
| account: 'Michael Brown', | ||||||||||||||||||||||||||
| isFavorite: false, | ||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| id: '5', | ||||||||||||||||||||||||||
| date: '06/2024', | ||||||||||||||||||||||||||
| prism: 'The true man show movie...', | ||||||||||||||||||||||||||
| amount: '999999999999999 Sats', | ||||||||||||||||||||||||||
| status: 'Active', | ||||||||||||||||||||||||||
| account: 'deekshasatapathy@twelve.cash', | ||||||||||||||||||||||||||
| isFavorite: false, | ||||||||||||||||||||||||||
|
Comment on lines
+45
to
+50
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Replace real-looking email with placeholder data. Demo data should avoid real-looking email addresses to prevent accidental PII in the repo. 🛡️ Suggested change- account: 'deekshasatapathy@twelve.cash',
+ account: 'deeksha.s@example.com',📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| id: '6', | ||||||||||||||||||||||||||
| date: '04/2025', | ||||||||||||||||||||||||||
| prism: 'Fashion Week', | ||||||||||||||||||||||||||
| amount: '56.5643679 Sats', | ||||||||||||||||||||||||||
| status: 'Successful', | ||||||||||||||||||||||||||
| account: 'Jessica Lee', | ||||||||||||||||||||||||||
| isFavorite: false, | ||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| id: '7', | ||||||||||||||||||||||||||
| date: '08/2025', | ||||||||||||||||||||||||||
| prism: 'Food Festival', | ||||||||||||||||||||||||||
| amount: '1 Btc', | ||||||||||||||||||||||||||
| status: 'Successful', | ||||||||||||||||||||||||||
| account: 'kcuabcjbau2e482r982hufwueff...', | ||||||||||||||||||||||||||
| isFavorite: false, | ||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
| id: '8', | ||||||||||||||||||||||||||
| date: '12/2025', | ||||||||||||||||||||||||||
| prism: 'Finance Forum', | ||||||||||||||||||||||||||
| amount: '$1,200.00', | ||||||||||||||||||||||||||
| status: 'Pending', | ||||||||||||||||||||||||||
| account: 'Rachel Adams', | ||||||||||||||||||||||||||
| isFavorite: false, | ||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||
| ]; | ||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,108 @@ | ||
| import type { Meta, StoryObj } from '@storybook/react'; | ||
| import TransactionTable from './TransactionTable'; | ||
| import { demoTransactions } from './TransactionTable.data'; | ||
|
|
||
| const meta: Meta<typeof TransactionTable> = { | ||
| title: 'Components/TransactionTable', | ||
| component: TransactionTable, | ||
| parameters: { | ||
| layout: 'padded', | ||
| }, | ||
| tags: ['autodocs'], | ||
| argTypes: { | ||
| showDemoData: { | ||
| control: 'boolean', | ||
| description: 'Show demo data when no transactions provided', | ||
| }, | ||
| transactions: { | ||
| control: 'object', | ||
| description: 'Array of transactions to display', | ||
| }, | ||
| }, | ||
| }; | ||
|
|
||
| export default meta; | ||
| type Story = StoryObj<typeof TransactionTable>; | ||
|
|
||
| /** | ||
| * Default state with demo data enabled for visualization | ||
| */ | ||
| export const WithDemoData: Story = { | ||
| args: { | ||
| showDemoData: true, | ||
| }, | ||
| }; | ||
|
|
||
| /** | ||
| * Empty state when no transactions and showDemoData is false | ||
| */ | ||
| export const Empty: Story = { | ||
| args: { | ||
| showDemoData: false, | ||
| transactions: [], | ||
| }, | ||
| }; | ||
|
|
||
| /** | ||
| * With custom transactions passed as props | ||
| */ | ||
| export const WithCustomData: Story = { | ||
| args: { | ||
| showDemoData: false, | ||
| transactions: [ | ||
| { | ||
| id: 'custom-1', | ||
| date: '01/2026', | ||
| prism: 'Monthly Subscription', | ||
| amount: '$9.99', | ||
| status: 'Successful', | ||
| account: 'john@example.com', | ||
| isFavorite: false, | ||
| }, | ||
| { | ||
| id: 'custom-2', | ||
| date: '01/2026', | ||
| prism: 'One-time Purchase', | ||
| amount: '50000 Sats', | ||
| status: 'Pending', | ||
| account: 'jane@example.com', | ||
| isFavorite: true, | ||
| }, | ||
| ], | ||
| }, | ||
| }; | ||
|
|
||
| /** | ||
| * With filters populated (prisms and contacts) | ||
| */ | ||
| export const WithFilters: Story = { | ||
| args: { | ||
| showDemoData: true, | ||
| prisms: [ | ||
| { id: 'prism-1', name: 'Bitcoin Pizza' }, | ||
| { id: 'prism-2', name: 'Crypto Feast' }, | ||
| { id: 'prism-3', name: 'Tech Summit' }, | ||
| ], | ||
| contacts: [ | ||
| { id: 'contact-1', firstName: 'Jamie', lastName: 'Smith', email: 'jamie@example.com' }, | ||
| { id: 'contact-2', firstName: 'Alex', lastName: 'Johnson', email: 'alex@example.com' }, | ||
| ], | ||
| }, | ||
| }; | ||
|
|
||
| /** | ||
| * Interactive playground with all controls | ||
| */ | ||
| export const Playground: Story = { | ||
| args: { | ||
| showDemoData: true, | ||
| transactions: demoTransactions, | ||
| prisms: [ | ||
| { id: 'prism-1', name: 'Bitcoin Pizza' }, | ||
| { id: 'prism-2', name: 'Crypto Feast' }, | ||
| ], | ||
| contacts: [ | ||
| { id: 'contact-1', firstName: 'Jamie', lastName: 'Smith' }, | ||
| ], | ||
| }, | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add prismId/accountId to demo rows used by filters.
Filters match on
prismId/accountId; without them, selecting a prism/contact filters out all demo rows. Add matching IDs for the demo entries so filters remain meaningful.🛠️ Suggested change (sample)
{ id: '1', date: '06/2025', prism: 'bitcoin Pizza', + prismId: 'prism-1', amount: '$1,250.00', status: 'Successful', account: 'Jamie Smith', + accountId: 'contact-1', isFavorite: false, }, { id: '2', date: '07/2025', prism: 'Crypto Feast', + prismId: 'prism-2', amount: '$500.00', status: 'Pending', account: 'Alex Johnson', + accountId: 'contact-2', isFavorite: false, }, { id: '3', date: '09/2025', prism: 'Tech Summit', + prismId: 'prism-3', amount: '225078764578.00 sats',🤖 Prompt for AI Agents