diff --git a/batcher-ui/Dockerfile.ghostnet b/batcher-ui/Dockerfile.ghostnet index 990fbf10..cbdefdbf 100644 --- a/batcher-ui/Dockerfile.ghostnet +++ b/batcher-ui/Dockerfile.ghostnet @@ -9,14 +9,10 @@ COPY ./package.json ./ RUN npm install COPY ./tsconfig.json ./jsconfig.json ./ -COPY ./components ./components COPY ./pages ./pages -COPY ./contexts ./contexts -COPY ./utils ./utils COPY ./src ./src COPY ./styles ./styles COPY ./public ./public -COPY ./config ./config COPY ./postcss.config.js ./postcss.config.js COPY ./next.config.js ./next.config.js COPY ./tailwind.config.js ./tailwind.config.js diff --git a/batcher-ui/next.config.js b/batcher-ui/next.config.js index 5db0a35d..c2e43fff 100644 --- a/batcher-ui/next.config.js +++ b/batcher-ui/next.config.js @@ -1,9 +1,10 @@ /** @type {import('next').NextConfig} */ -const config = require('./config/env.ts'); +const config = require('./src/config/env.ts'); const env = process.env.ENV; // 'mainnet' | 'ghostnet' -console.log('🚀 ~ file: next.config.js:6 ~ env:', env); + +console.info('🚀 Current env:', env); const nextConfig = { reactStrictMode: false, diff --git a/batcher-ui/pages/_app.tsx b/batcher-ui/pages/_app.tsx index 8bc24bdd..584a92bc 100644 --- a/batcher-ui/pages/_app.tsx +++ b/batcher-ui/pages/_app.tsx @@ -1,13 +1,13 @@ -import Footer from '../components/Footer'; +import Footer from '../src/components/Footer'; import React, { useEffect, useState } from 'react'; import { AppProps } from 'next/app'; -import { TezosToolkitProvider } from '../contexts/tezos-toolkit'; -import { WalletProvider } from '../contexts/wallet'; -import { EventsProvider } from '../contexts/events'; +import { TezosToolkitProvider } from '../src/contexts/tezos-toolkit'; +import { WalletProvider } from '../src/contexts/wallet'; +import { EventsProvider } from '../src/contexts/events'; import '../styles/globals.css'; import { Provider } from 'react-redux'; import { store } from '../src/store'; -import NavBar from '../components/NavBar'; +import NavBar from '../src/components/NavBar'; import ReactGA from 'react-ga4'; import * as api from '@tzkt/sdk-api'; import Head from 'next/head'; @@ -59,4 +59,4 @@ const App = ({ Component }: AppProps) => { ); }; -export default App; \ No newline at end of file +export default App; diff --git a/batcher-ui/pages/holdings.tsx b/batcher-ui/pages/holdings.tsx index 156e3a96..f70dc545 100644 --- a/batcher-ui/pages/holdings.tsx +++ b/batcher-ui/pages/holdings.tsx @@ -1,5 +1,5 @@ import React, { useCallback, useContext, useEffect } from 'react'; -import { TezosToolkitContext } from 'contexts/tezos-toolkit'; +import { TezosToolkitContext } from 'src/contexts/tezos-toolkit'; import { useDispatch, useSelector } from 'react-redux'; import { getHoldings, userAddressSelector } from 'src/reducers'; import { getHoldings as getHoldingsAction } from 'src/actions'; diff --git a/batcher-ui/pages/index.tsx b/batcher-ui/pages/index.tsx index 585f82fe..cb31db4f 100644 --- a/batcher-ui/pages/index.tsx +++ b/batcher-ui/pages/index.tsx @@ -1,7 +1,7 @@ import React, { useEffect } from 'react'; -import Exchange from '../components/Exchange'; -import BatcherInfo from '../components/BatcherInfo'; -import PriceStrategy from '../components/PriceStrategy'; +import Exchange from '../src/components/Exchange'; +import BatcherInfo from '../src/components/BatcherInfo'; +import PriceStrategy from '../src/components/PriceStrategy'; import { useSelector, useDispatch } from 'react-redux'; import { userAddressSelector } from '../src/reducers'; diff --git a/batcher-ui/src/actions/wallet.ts b/batcher-ui/src/actions/wallet.ts index 0bcad226..c4aa9f95 100644 --- a/batcher-ui/src/actions/wallet.ts +++ b/batcher-ui/src/actions/wallet.ts @@ -1,5 +1,5 @@ // import { Option } from 'fp-ts/Option'; -import { Balances } from 'utils/utils'; +import { Balances } from 'src/utils/utils'; const connectedWallet = ({ userAddress }: { userAddress: string }) => ({ diff --git a/batcher-ui/src/commands/events.ts b/batcher-ui/src/commands/events.ts index 005d457a..bb26cabb 100644 --- a/batcher-ui/src/commands/events.ts +++ b/batcher-ui/src/commands/events.ts @@ -8,7 +8,7 @@ import { import { getHoldings } from 'src/actions/holdings'; import { currentSwapSelector, userAddressSelector } from 'src/reducers'; import { Batch, BigMapEvent, UpdateRateEvent } from 'src/types/events'; -import { computeOraclePrice, toVolumes } from 'utils/utils'; +import { computeOraclePrice, toVolumes } from 'src/utils/utils'; export const newEventCmd = (event: BigMapEvent) => { return Cmd.run( diff --git a/batcher-ui/src/commands/exchange.ts b/batcher-ui/src/commands/exchange.ts index bcad6810..fe7e5597 100644 --- a/batcher-ui/src/commands/exchange.ts +++ b/batcher-ui/src/commands/exchange.ts @@ -6,7 +6,7 @@ import { getCurrentRates, getPairsInformations, getVolumes, -} from '../../utils/utils'; +} from '../utils/utils'; import { updateBatchNumber, updateBatcherStatus, diff --git a/batcher-ui/src/commands/holdings.ts b/batcher-ui/src/commands/holdings.ts index ad5b78ac..5b225d0a 100644 --- a/batcher-ui/src/commands/holdings.ts +++ b/batcher-ui/src/commands/holdings.ts @@ -1,5 +1,5 @@ import { Cmd } from 'redux-loop'; -import { getOrdersBook } from '../../utils/utils'; +import { getOrdersBook } from '../utils/utils'; import { updateHoldings } from 'src/actions/holdings'; const fetchHoldingsCmd = (userAddress?: string) => { diff --git a/batcher-ui/src/commands/wallet.ts b/batcher-ui/src/commands/wallet.ts index 8a4ef079..dab5dcd1 100644 --- a/batcher-ui/src/commands/wallet.ts +++ b/batcher-ui/src/commands/wallet.ts @@ -1,5 +1,5 @@ import { Cmd } from 'redux-loop'; -import { scaleAmountDown, storeBalances } from '../../utils/utils'; +import { scaleAmountDown, storeBalances } from '../utils/utils'; import { gotUserBalances } from '../actions'; import * as api from '@tzkt/sdk-api'; diff --git a/batcher-ui/components/BatcherInfo.tsx b/batcher-ui/src/components/BatcherInfo.tsx similarity index 96% rename from batcher-ui/components/BatcherInfo.tsx rename to batcher-ui/src/components/BatcherInfo.tsx index 11d9420d..2adc7770 100644 --- a/batcher-ui/components/BatcherInfo.tsx +++ b/batcher-ui/src/components/BatcherInfo.tsx @@ -7,8 +7,8 @@ import { currentPairSelector, oraclePriceSelector, remainingTimeSelector, -} from '../src/reducers'; -import { BatcherStatus } from '../src/types'; +} from '../reducers'; +import { BatcherStatus } from '../types'; const BatcherInfo = () => { const tokenPair = useSelector(currentPairSelector); diff --git a/batcher-ui/components/BatcherStepper.tsx b/batcher-ui/src/components/BatcherStepper.tsx similarity index 94% rename from batcher-ui/components/BatcherStepper.tsx rename to batcher-ui/src/components/BatcherStepper.tsx index 58014e25..2e22853b 100644 --- a/batcher-ui/components/BatcherStepper.tsx +++ b/batcher-ui/src/components/BatcherStepper.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { useSelector } from 'react-redux'; -import { batcherStatusSelector } from '../src/reducers'; -import { BatcherStatus } from '../src/types'; +import { batcherStatusSelector } from '../reducers'; +import { BatcherStatus } from '../types'; const Square = ({ isActive }: { isActive: boolean }) => (
({}); diff --git a/batcher-ui/contexts/tezos-toolkit.tsx b/batcher-ui/src/contexts/tezos-toolkit.tsx similarity index 100% rename from batcher-ui/contexts/tezos-toolkit.tsx rename to batcher-ui/src/contexts/tezos-toolkit.tsx diff --git a/batcher-ui/contexts/wallet.tsx b/batcher-ui/src/contexts/wallet.tsx similarity index 98% rename from batcher-ui/contexts/wallet.tsx rename to batcher-ui/src/contexts/wallet.tsx index 50314ca9..c99f6e45 100644 --- a/batcher-ui/contexts/wallet.tsx +++ b/batcher-ui/src/contexts/wallet.tsx @@ -3,7 +3,7 @@ import React, { createContext, useEffect, useReducer } from 'react'; import { BeaconWallet } from '@taquito/beacon-wallet'; import { AccountInfo, NetworkType } from '@airgap/beacon-sdk'; import { useTezosToolkit } from './tezos-toolkit'; -import { getByKey, setByKey } from 'utils/local-storage'; +import { getByKey, setByKey } from 'src/utils/local-storage'; type WalletState = { wallet: BeaconWallet | undefined; diff --git a/batcher-ui/src/reducers/exchange.ts b/batcher-ui/src/reducers/exchange.ts index 428683ec..c53871c7 100644 --- a/batcher-ui/src/reducers/exchange.ts +++ b/batcher-ui/src/reducers/exchange.ts @@ -20,7 +20,7 @@ import { getOraclePriceCmd, setupBatcherCmd, } from '../../src/commands/exchange'; -import { getTimeDifference } from 'utils/utils'; +import { getTimeDifference } from 'src/utils/utils'; const initialSwap: CurrentSwap = { swap: { diff --git a/batcher-ui/src/reducers/wallet.ts b/batcher-ui/src/reducers/wallet.ts index 7fa0cd78..a92bce04 100644 --- a/batcher-ui/src/reducers/wallet.ts +++ b/batcher-ui/src/reducers/wallet.ts @@ -2,7 +2,7 @@ import { WalletActions } from 'src/actions'; import { Loop, liftState, loop } from 'redux-loop'; import { fetchUserBalancesCmd } from '../commands/wallet'; import { WalletState } from 'src/types'; -import { TOKENS } from 'utils/utils'; +import { TOKENS } from 'src/utils/utils'; // TODO: fp-ts diff --git a/batcher-ui/utils/local-storage.ts b/batcher-ui/src/utils/local-storage.ts similarity index 100% rename from batcher-ui/utils/local-storage.ts rename to batcher-ui/src/utils/local-storage.ts diff --git a/batcher-ui/utils/utils.ts b/batcher-ui/src/utils/utils.ts similarity index 99% rename from batcher-ui/utils/utils.ts rename to batcher-ui/src/utils/utils.ts index 3619498a..0f37b2ae 100644 --- a/batcher-ui/utils/utils.ts +++ b/batcher-ui/src/utils/utils.ts @@ -7,7 +7,7 @@ import { VolumesState, VolumesStorage, batchIsCleared, -} from '../src/types'; +} from '../types'; import { Batch } from 'src/types/events'; import { NetworkType } from '@airgap/beacon-sdk'; @@ -83,7 +83,6 @@ export const getNetworkType = () => { } }; - // ----- BALANCES ------ export type Balances = { diff --git a/batcher-ui/utils/webSocketUtils.ts b/batcher-ui/src/utils/webSocketUtils.ts similarity index 100% rename from batcher-ui/utils/webSocketUtils.ts rename to batcher-ui/src/utils/webSocketUtils.ts diff --git a/batcher-ui/tailwind.config.js b/batcher-ui/tailwind.config.js index 9d31eb1c..a6b38689 100644 --- a/batcher-ui/tailwind.config.js +++ b/batcher-ui/tailwind.config.js @@ -1,10 +1,6 @@ /** @type {import('tailwindcss').Config} */ module.exports = { - content: [ - './pages/**/*.{js,ts,jsx,tsx}', - './components/**/*.{js,ts,jsx,tsx}', - './src/**/*.{js,ts,jsx,tsx}', - ], + content: ['./pages/**/*.{js,ts,jsx,tsx}', './src/**/*.{js,ts,jsx,tsx}'], theme: { extend: { colors: { diff --git a/batcher-ui/tsconfig.json b/batcher-ui/tsconfig.json index d6992ad8..eb9ff0d4 100644 --- a/batcher-ui/tsconfig.json +++ b/batcher-ui/tsconfig.json @@ -27,12 +27,12 @@ "module": "esnext" }, "include": [ - "utils/**/*", + "src/utils/**/*", "src/**/*", "tests/**/*", "test/**/*", "__test__/**/*", - "config/**/*", + "src/config/**/*", ".eslintrc.json", ".prettierrc.json", "jest.config.js",