diff --git a/app/.storybook/preview.tsx b/app/.storybook/preview.tsx index a04fc342..992cf3ea 100644 --- a/app/.storybook/preview.tsx +++ b/app/.storybook/preview.tsx @@ -7,7 +7,7 @@ import { createActions } from '../src/action'; import { Background } from '../src/components/common/base'; import { ThemeProvider } from '../src/components/theme'; import { Store, StoreProvider } from '../src/store'; -import { sampleApiResponses } from '../src/util/sampleData'; +import { sampleApiResponses } from '../src/util/tests/sampleData'; /** * Create a store with dummy data to use for stories diff --git a/app/src/__mocks__/@improbable-eng/grpc-web.ts b/app/src/__mocks__/@improbable-eng/grpc-web.ts index 0fb5a62c..0f3f38fa 100644 --- a/app/src/__mocks__/@improbable-eng/grpc-web.ts +++ b/app/src/__mocks__/@improbable-eng/grpc-web.ts @@ -1,7 +1,7 @@ import { ProtobufMessage } from '@improbable-eng/grpc-web/dist/typings/message'; import { UnaryMethodDefinition } from '@improbable-eng/grpc-web/dist/typings/service'; import { UnaryRpcOptions } from '@improbable-eng/grpc-web/dist/typings/unary'; -import { sampleApiResponses } from 'util/sampleData'; +import { sampleApiResponses } from 'util/tests/sampleData'; // mock grpc module export const grpc = { diff --git a/app/src/__tests__/action/node.spec.ts b/app/src/__tests__/action/node.spec.ts index d708021f..11cbcbf8 100644 --- a/app/src/__tests__/action/node.spec.ts +++ b/app/src/__tests__/action/node.spec.ts @@ -1,4 +1,4 @@ -import { lndChannelBalance, lndWalletBalance } from 'util/sampleData'; +import { lndChannelBalance, lndWalletBalance } from 'util/tests/sampleData'; import NodeAction from 'action/node'; import { GrpcClient, LndApi } from 'api'; import { Store } from 'store'; diff --git a/app/src/__tests__/action/store.spec.ts b/app/src/__tests__/action/store.spec.ts index b31651d8..a83d40e9 100644 --- a/app/src/__tests__/action/store.spec.ts +++ b/app/src/__tests__/action/store.spec.ts @@ -1,4 +1,4 @@ -import { lndListChannels } from 'util/sampleData'; +import { lndListChannels } from 'util/tests/sampleData'; import { createActions, StoreActions } from 'action'; import { Store } from 'store'; diff --git a/app/src/components/pages/SamplePage.tsx b/app/src/components/pages/SamplePage.tsx deleted file mode 100644 index 0f80eb76..00000000 --- a/app/src/components/pages/SamplePage.tsx +++ /dev/null @@ -1,129 +0,0 @@ -import React, { useEffect } from 'react'; -import { observer } from 'mobx-react-lite'; -import { usePrefixedTranslation } from 'hooks'; -import { useActions, useStore } from 'store/provider'; - -const SamplePage: React.FC = () => { - const store = useStore(); - const { node, channel, swap } = useActions(); - const { l } = usePrefixedTranslation('App'); - useEffect(() => { - // fetch node info when the component is mounted - const fetchInfo = async () => { - try { - await node.getInfo(); - await node.getBalances(); - } catch (error) { - console.log('Failed to fetch node info', error); - } - }; - - fetchInfo(); - }, [node]); - - const balances = store.balances || { channelBalance: 0, walletBalance: 0 }; - - return ( - <> -
-

Lightning Loop

-
-
-

{l('App.nodeInfo')}

- {store.info && ( - - - - - - - - - - - - - - - - - - - - - - - -
{l('pubkey')}{store.info.identityPubkey}
{l('alias')}{store.info.alias}
{l('version')}{store.info.version}
{l('numChannels')}{store.info.numActiveChannels}
{l('balances')}{`${balances.channelBalance} in channels, ${balances.walletBalance} in wallet`}
- )} -
-
-

- {store.channels.length} Channels - -

- - - - - - - - - - - - - - {store.channels.map(c => ( - - - - - - - - - - ))} - -
Can ReceiveCan SendIn Fee %Up time %Volume (24h)Peer/AliasCapacity
{c.remoteBalance}{c.localBalance}{c.uptime}{c.remotePubkey.substring(0, 12)}{c.capacity}
-
-
-

- {store.swaps.length} Swaps - -

- - - - - - - - - - - {store.swaps.map(s => ( - - - - - - - ))} - -
DateTypeAmountStatus
{s.createdOn.toString()}{s.type}{s.amount.toString()}{s.status}
-
- - ); -}; - -export default observer(SamplePage); diff --git a/app/src/util/sampleData.ts b/app/src/util/tests/sampleData.ts similarity index 100% rename from app/src/util/sampleData.ts rename to app/src/util/tests/sampleData.ts