Skip to content

Commit

Permalink
🔥 clean code and add metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
Quentin Burg committed Aug 21, 2023
1 parent b26bcdc commit ee41238
Show file tree
Hide file tree
Showing 11 changed files with 80 additions and 485 deletions.
26 changes: 10 additions & 16 deletions batcher-ui/components/BatcherInfo/index.tsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,24 @@
import React from 'react';
import { BatcherInfoProps } from '../../utils/types';
import BatcherStepper from '../BatcherStepper';
import { useSelector } from 'react-redux';
import {
batchNumberSelector,
batcherStatusSelector,
currentPairSelector,
currentSwapSelector,
oraclePriceSelector,
remainingTimeSelector,
userAddressSelector,
userBalancesSelector,
} from '../../src/reducers';
import { BatcherStatus } from '../../src/types';

const BatcherInfo: React.FC<BatcherInfoProps> = ({
userAddress,
tokenPair,
buyBalance,
sellBalance,
buyTokenName,
sellTokenName,
openTime,
updateAll,
setUpdateAll,
batchNumber,
}: BatcherInfoProps) => {
const BatcherInfo = () => {
const userBalances = useSelector(userBalancesSelector);
const currentSwap = useSelector(currentSwapSelector);
const tokenPair = useSelector(currentPairSelector);
const batchNumber = useSelector(batchNumberSelector);
const userAddress = useSelector(userAddressSelector);

const status = useSelector(batcherStatusSelector);
const remainingTime = useSelector(remainingTimeSelector);
Expand All @@ -43,18 +37,18 @@ const BatcherInfo: React.FC<BatcherInfoProps> = ({
)}
{status === BatcherStatus.OPEN ? (
<div className="p-5 border-solid border-2 border-[#7B7B7E]">
<p className="p-4">{remainingTime + ' min'}</p>
<p>{`Remaining time : ${remainingTime} min`}</p>
</div>
) : (
<div />
)}
{batchNumber > 0 ? (
<div className="p-5 border-solid border-2 border-[#7B7B7E]">
<p className="p-4">
<p>
{`${
status === BatcherStatus.CLEARED
? 'LastBatch'
: 'Current batch'
: 'Current batch : '
} ${batchNumber}`}
</p>
</div>
Expand Down
8 changes: 1 addition & 7 deletions batcher-ui/components/Exchange/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React, { useEffect, useState } from 'react';
import { SwapOutlined } from '@ant-design/icons';
import { message } from 'antd';
import { compose, OpKind, WalletContract } from '@taquito/taquito';
import { ExchangeProps } from '../../utils/types';
// import { ReactComponent as ExchangeDollarSvg } from '../../../img/exchange-dollar.svg';
import { getErrorMess, getFees, scaleAmountUp } from '../../utils/utils';
import { tzip12 } from '@taquito/tzip12';
Expand All @@ -22,12 +21,7 @@ import { useDispatch } from 'react-redux';
import { reverseSwap, updatePriceStrategy } from 'src/actions';
import * as Form from '@radix-ui/react-form';

const Exchange: React.FC<ExchangeProps> = ({
buyToken,
sellToken,
}: // updateAll,
// setUpdateAll,
ExchangeProps) => {
const Exchange = () => {
const userAddress = useSelector(userAddressSelector);
const batcherStatus = useSelector(batcherStatusSelector);
const priceStategy = useSelector(priceStrategySelector);
Expand Down
14 changes: 0 additions & 14 deletions batcher-ui/components/Volume/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react';
import { Space, Col, Row, Table } from 'antd';
import { PriceStrategy } from 'src/types';
import { volumesSelector } from 'src/reducers';
import { useSelector } from 'react-redux';
Expand All @@ -10,19 +9,6 @@ import { useSelector } from 'react-redux';

const Volume = () => {
const { sell, buy } = useSelector(volumesSelector);
console.log('🚀 ~ file: index.tsx:13 ~ Volume ~ sell, buy:', sell, buy);
// const sellVolumes = [
// {
// sellMinusVolume: volumes.sell_minus_volume,
// sellExactVolume: volumes.sell_exact_volume,
// sellPlusVolume: volumes.sell_plus_volume,
// },
// ];
// const buyVolumes = {
// buyMinusVolume: volumes.buy_minus_volume,
// buyExactVolume: volumes.buy_exact_volume,
// buyPlusVolume: volumes.buy_plus_volume,
// };

const listOfBuyVolumesColumns = [
{
Expand Down
29 changes: 18 additions & 11 deletions batcher-ui/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { store } from '../src/store';
import NavBar from '../components/NavBar';
import ReactGA from 'react-ga4';
import * as api from '@tzkt/sdk-api';
import Head from 'next/head';

process.env.NEXT_PUBLIC_GA_TRACKING_ID &&
ReactGA.initialize(process.env.NEXT_PUBLIC_GA_TRACKING_ID);
Expand All @@ -24,17 +25,23 @@ const App = ({ Component }: AppProps) => {
}, []);

return (
<Provider store={store}>
<TezosToolkitProvider>
<WalletProvider>
<div className="flex flex-col justify-between h-screen">
<NavBar />
<Component />
<Footer />
</div>
</WalletProvider>
</TezosToolkitProvider>
</Provider>
<div>
<Head>
<link rel="shortcut icon" href="/favicon.ico" />
<title>BATCHER</title>
</Head>
<Provider store={store}>
<TezosToolkitProvider>
<WalletProvider>
<div className="flex flex-col justify-between h-screen">
<NavBar />
<Component />
<Footer />
</div>
</WalletProvider>
</TezosToolkitProvider>
</Provider>
</div>
);
};

Expand Down
Loading

0 comments on commit ee41238

Please sign in to comment.