Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@ next-env.d.ts
.swc/

# vim
.editorconfig
.editorconfig
*storybook.log
5 changes: 5 additions & 0 deletions .storybook/layout.min.css

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import type { StorybookConfig } from '@storybook/experimental-nextjs-vite';

const config: StorybookConfig = {
stories: ['../app/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
addons: ['@storybook/addon-essentials', '@storybook/experimental-addon-test'],
framework: {
name: '@storybook/experimental-nextjs-vite',
options: {},
},

staticDirs: ['../public'],
};
export default config;
6 changes: 6 additions & 0 deletions .storybook/manager.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { addons } from '@storybook/manager-api';
import { themes } from '@storybook/theming';

addons.setConfig({
theme: themes.light,
});
37 changes: 37 additions & 0 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import type { Preview } from '@storybook/react';
import React from 'react';

import { Rubik } from 'next/font/google';
import './layout.min.css';
import '@/app/styles.css';

const rubikFont = Rubik({
display: 'auto',
subsets: ['latin'],
variable: '--explorer-default-font',
weight: ['300', '400', '700'],
});

const preview: Preview = {
parameters: {
backgrounds: {
values: [{ name: 'Dark', value: '#161b19' }],
default: 'Dark',
},
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},
},
decorators: [
Story => (
<div id="storybook-outer" style={rubikFont.style}>
<Story />
</div>
),
],
};

export default preview;
9 changes: 9 additions & 0 deletions .storybook/vitest.setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { beforeAll } from 'vitest';
import { setProjectAnnotations } from '@storybook/experimental-nextjs-vite';
import * as projectAnnotations from './preview';

// This is an important step to apply the right configuration when testing your stories.
// More info at: https://storybook.js.org/docs/api/portable-stories/portable-stories-vitest#setprojectannotations
const project = setProjectAnnotations([projectAnnotations]);

beforeAll(project.beforeAll);
22 changes: 22 additions & 0 deletions app/__tests__/mock-parsed-extensions-stubs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { PublicKey } from '@solana/web3.js';

import { TokenExtension } from '../validators/accounts/token-extension';

export const transferFeeConfig0 = {
extension: 'transferFeeConfig',
state: {
newerTransferFee: {
epoch: 200,
maximumFee: 2000000,
transferFeeBasisPoints: 200,
},
olderTransferFee: {
epoch: 100,
maximumFee: 1000000,
transferFeeBasisPoints: 100,
},
transferFeeConfigAuthority: new PublicKey('2apBGMsS6ti9RyF5TwQTDswXBWskiJP2LD4cUEDqYJjk'),
withdrawWithheldAuthority: new PublicKey('3apBGMsS6ti9RyF5TwQTDswXBWskiJP2LD4cUEDqYJjk'),
withheldAmount: 500000,
},
} as TokenExtension;
10 changes: 10 additions & 0 deletions app/components/account/TokenAccountSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,12 @@ import useSWR from 'swr';

import { FullLegacyTokenInfo, getTokenInfo, getTokenInfoSwrKey } from '@/app/utils/token-info';

import { TokenExtensionsStatusRow } from './token-extensions/TokenExtensionsStatusRow';
import { UnknownAccountCard } from './UnknownAccountCard';

// !!
// TODO: import styles for badges to be rendered properly

const getEthAddress = (link?: string) => {
let address = '';
if (link) {
Expand Down Expand Up @@ -287,6 +291,9 @@ function FungibleTokenMintAccountCard({
</td>
</tr>
)}
{mintExtensions && (
<TokenExtensionsStatusRow address={account.pubkey.toBase58()} extensions={mintExtensions} />
)}
</TableCardBody>
</div>
</>
Expand Down Expand Up @@ -512,6 +519,9 @@ function TokenAccountCard({ account, info }: { account: Account; info: TokenAcco
</tr>
</>
)}
{accountExtensions && (
<TokenExtensionsStatusRow address={account.pubkey.toBase58()} extensions={accountExtensions} />
)}
</TableCardBody>
</div>
);
Expand Down
Loading
Loading