Skip to content

Commit

Permalink
Merge pull request #636 from ar-io/PE-7274-funding-source
Browse files Browse the repository at this point in the history
feat(PE-7274): funding source
  • Loading branch information
atticusofsparta authored Jan 7, 2025
2 parents 4f15fec + 95b8cde commit d0adcf2
Show file tree
Hide file tree
Showing 23 changed files with 2,213 additions and 316 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ docs
dist-id.txt
dist-manifest.csv
dist-manifest.json
test-results
test-results
storybook-static
*storybook.log
22 changes: 22 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import type { StorybookConfig } from '@storybook/react-vite';

const config: StorybookConfig = {
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],

addons: [
'@storybook/addon-onboarding',
'@storybook/addon-essentials',
'@chromatic-com/storybook',
'@storybook/addon-interactions',
],

framework: {
name: '@storybook/react-vite',
options: {},
},

typescript: {
reactDocgen: 'react-docgen-typescript',
},
};
export default config;
14 changes: 14 additions & 0 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import type { Preview } from '@storybook/react';

const preview: Preview = {
parameters: {
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},
},
};

export default preview;
24 changes: 22 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"homepage": ".",
"scripts": {
"build": "yarn clean && tsc --build tsconfig.json && NODE_OPTIONS=--max-old-space-size=32768 vite build",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build",
"publish:arweave": "yarn build && permaweb-deploy --ant-process $DEPLOY_ANT_PROCESS_ID ",
"clean": "rimraf dist",
"dev": "NODE_ENV=prod VITE_GITHUB_HASH=local vite",
Expand All @@ -25,8 +27,9 @@
},
"dependencies": {
"@ant-design/icons": "5.4.0",
"@ar.io/sdk": "^3.0.0",
"@ar.io/sdk": "^3.1.0-alpha.9",
"@permaweb/aoconnect": "^0.0.59",
"@radix-ui/react-select": "^2.1.4",
"@radix-ui/react-radio-group": "^1.2.1",
"@sentry/react": "^7.45.0",
"@tanstack/react-query": "^5.51.21",
Expand Down Expand Up @@ -58,11 +61,21 @@
"@babel/preset-env": "^7.19.4",
"@babel/preset-react": "^7.18.6",
"@babel/preset-typescript": "^7.18.6",
"@chromatic-com/storybook": "^3.2.2",
"@commitlint/cli": "^17.6.7",
"@commitlint/config-conventional": "^17.6.7",
"@glen/jest-raw-loader": "^2.0.0",
"@playwright/test": "^1.48.1",
"@sentry/vite-plugin": "^0.7.2",
"@storybook/addon-actions": "^8.4.7",
"@storybook/addon-essentials": "^8.4.7",
"@storybook/addon-interactions": "^8.4.7",
"@storybook/addon-links": "^8.4.7",
"@storybook/addon-onboarding": "^8.4.7",
"@storybook/blocks": "^8.4.7",
"@storybook/react": "^8.4.7",
"@storybook/react-vite": "^8.4.7",
"@storybook/test": "^8.4.7",
"@testing-library/jest-dom": "^6.1.5",
"@testing-library/react": "^14.1.2",
"@testing-library/user-event": "^14.5.1",
Expand Down Expand Up @@ -91,6 +104,7 @@
"eslint-plugin-react": "^7.31.10",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-simple-import-sort": "^8.0.0",
"eslint-plugin-storybook": "^0.11.1",
"fake-indexeddb": "^6.0.0",
"http-server": "^14.1.1",
"husky": "^8.0.0",
Expand All @@ -108,6 +122,7 @@
"react-hooks": "^1.0.1",
"react-test-renderer": "^18.2.0",
"rimraf": "^3.0.2",
"storybook": "^8.4.7",
"tailwind-scrollbar": "^3.1.0",
"tailwindcss": "^3.4.9",
"tailwindcss-animate": "^1.0.7",
Expand All @@ -130,5 +145,10 @@
"prettier --write ."
]
},
"packageManager": "yarn@1.22.22"
"packageManager": "yarn@1.22.22",
"eslintConfig": {
"extends": [
"plugin:storybook/recommended"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
import '@src/index.css';
import type { Meta, StoryObj } from '@storybook/react';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';

import { TransactionDetails } from './TransactionDetails';

const meta = {
title: 'Inputs/TransactionDetails',
component: TransactionDetails,
parameters: {
layout: 'centered',
},
tags: ['autodocs'],
decorators: [
(Story, { parameters }) => {
const queryClient = new QueryClient({
defaultOptions: {
queries: {
retry: false,
initialData: () => parameters.costDetail,
},
},
});

return (
<QueryClientProvider client={queryClient}>
<div className="flex w-[700px] h-[500px] bg-background p-10 rounded-xl">
<Story />
</div>
</QueryClientProvider>
);
},
],
} as Meta<typeof TransactionDetails>;

export default meta;
type Story = StoryObj<typeof meta>;

export const BalancesBuyRecord: Story = {
parameters: {
costDetail: {
tokenCost: 10000000000,
discounts: [],
fundingPlan: {
balance: 10000000000,
address: '5Gru9gQCIiRaIPV7fU7RXcpaVShG4u9nIcPVmm2FJSM',
stakes: {},
shortfall: 0,
},
},
},
args: {
details: {
name: 'ardrive',
intent: 'Buy-Record',
type: 'permabuy',
fromAddress: '5Gru9gQCIiRaIPV7fU7RXcpaVShG4u9nIcPVmm2FJSM',
},
},
};

export const BalancesDiscountBuyRecord: Story = {
parameters: {
discount: true,
costDetail: {
tokenCost: 10000000000,
discounts: [
{
name: 'blah',
discountTotal: 10000000000 / 2,
multiplier: 1,
},
],
fundingPlan: {
balance: 10000000000,
address: '5Gru9gQCIiRaIPV7fU7RXcpaVShG4u9nIcPVmm2FJSM',
stakes: {},
shortfall: 0,
},
},
},
args: {
details: {
name: 'ardrive',
intent: 'Buy-Record',
type: 'permabuy',
fromAddress: '5Gru9gQCIiRaIPV7fU7RXcpaVShG4u9nIcPVmm2FJSM',
},
},
};
export const StakesDiscountBuyRecord: Story = {
parameters: {
discount: true,
costDetail: {
tokenCost: 10000000000,
discounts: [
{
name: 'blah',
discountTotal: 10000000000 / 2,
multiplier: 1,
},
],
fundingPlan: {
balance: 0,
address: '5Gru9gQCIiRaIPV7fU7RXcpaVShG4u9nIcPVmm2FJSM',
stakes: {
stake1: {
delegatedStake: 5000000000,
vaults: {
vault1: 2500000000,
vault2: 2500000000,
},
},
},
shortfall: 0,
},
},
},
args: {
details: {
name: 'ardrive',
intent: 'Buy-Record',
type: 'permabuy',
fromAddress: '5Gru9gQCIiRaIPV7fU7RXcpaVShG4u9nIcPVmm2FJSM',
},
},
};

export const AnyDiscountBuyRecord: Story = {
parameters: {
discount: true,
costDetail: {
tokenCost: 10000000000,
discounts: [
{
name: 'blah',
discountTotal: 10000000000 / 2,
multiplier: 1,
},
],
fundingPlan: {
balance: 1000000000,
address: '5Gru9gQCIiRaIPV7fU7RXcpaVShG4u9nIcPVmm2FJSM',
stakes: {
stake1: {
delegatedStake: 4000000000,
vaults: {
vault1: 2500000000,
vault2: 2500000000,
},
},
},
shortfall: 0,
},
},
},
args: {
details: {
name: 'ardrive',
intent: 'Buy-Record',
type: 'permabuy',
fromAddress: '5Gru9gQCIiRaIPV7fU7RXcpaVShG4u9nIcPVmm2FJSM',
},
},
};
Loading

0 comments on commit d0adcf2

Please sign in to comment.