Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "opex-admin-panel",
"version": "v1.0.0-beta.5",
"version": "v1.0.0-beta.6",
"private": true,
"license": "MIT",
"dependencies": {
Expand Down
1 change: 0 additions & 1 deletion src/components/Date/Date.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import moment from "moment-jalaali";

const Date = ({date}) => {
Expand Down
1 change: 0 additions & 1 deletion src/components/SideBar/SideBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import {toAbsoluteUrl} from "../utils";
import {NavLink} from "react-router-dom";
import * as Routes from "../../routes/routes";
import Icon from "../Icon/Icon";
import {Wallet, WhiteList} from "../../routes/routes";

const SideBar = ({closeMenu}) => {
return <div className={`sidebar text-color ${closeMenu ? "close" : "open"}`}>
Expand Down
30 changes: 30 additions & 0 deletions src/components/SimplePagination/SimplePagination.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import React from "react";
import {useSearchParams} from "react-router-dom";

const SimplePagination = ({paginate, length}) => {
const [searchParams, setSearchParams] = useSearchParams();
const params = Object.fromEntries([...searchParams])

const nextPage = () => {
setSearchParams({...params, per_page: paginate.perPage, page: ++paginate.page})
}
const pervPage = () => {
if (paginate.page === 0) return
setSearchParams({...params, per_page: paginate.perPage, page: --paginate.page})
}

return (
<nav aria-label="Page navigation example">
<ul className="pagination justify-content-center">
<li className={`page-item ${paginate.page === 1 ? "disabled" : ""}`}>
<button className="page-link" onClick={pervPage}>Previous</button>
</li>

<li className={`page-item ${ paginate.perPage > length ? "disabled" : ""}`}>
<button className="page-link" onClick={nextPage}>Next</button>
</li>
</ul>
</nav>)
}

export default SimplePagination
2 changes: 0 additions & 2 deletions src/components/TopBar/Title/Title.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import React from "react";
import {Route, Routes} from "react-router-dom";
import * as RoutesName from "../../../routes/routes";
import WhiteList from "../../../pages/WhiteList/WhiteList";
import {Wallet} from "../../../routes/routes";

const Title = () => {

Expand Down
1 change: 0 additions & 1 deletion src/pages/ChainAndToken/ChainAndToken.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react';
import classes from './ChainAndToken.module.css'
import Chains from "./Chains/Chains";
import Tokens from "./Tokens/Tokens";

Expand Down
68 changes: 36 additions & 32 deletions src/pages/ChainAndToken/Chains/ChainBalance.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, {useEffect, useState} from 'react';
import classes from './Chains.module.css'

import ToggleSwitch from "../../../components/ToggleSwitch/ToggleSwitch";
import {useGetAllBalanceByChain, useGetTotalBalanceByChain} from "../../../query";
import {BN} from "../../../utils/utils";
Expand All @@ -13,29 +12,35 @@ const ChainBalance = ({chainId}) => {
});

const {data, isLoading, error, refetch} = useGetAllBalanceByChain(chainId, params);
const {data:total, isLoading:totalIsLoading, error:totalError} = useGetTotalBalanceByChain(chainId);
const {data: total, isLoading: totalIsLoading} = useGetTotalBalanceByChain(chainId);


useEffect(() => {
refetch()
}, [params]);

const content = ()=> {
const content = () => {

if (isLoading) return <div className={`d-flex flex-column justify-content-center align-items-center col-12 mt-4 py-5 ${classes.box}`}>
if (isLoading) return <div
className={`d-flex flex-column justify-content-center align-items-center col-12 mt-4 py-5 ${classes.box}`}>
Loading...
</div>
if (error) return <div className={`d-flex flex-column justify-content-center align-items-center col-12 mt-4 py-5 ${classes.box}`}>
if (error) return <div
className={`d-flex flex-column justify-content-center align-items-center col-12 mt-4 py-5 ${classes.box}`}>
Error!
</div>
if (data?.length === 0) return <div className={`d-flex flex-column justify-content-center align-items-center col-12 mt-4 py-5 ${classes.box}`}>
if (data?.length === 0) return <div
className={`d-flex flex-column justify-content-center align-items-center col-12 mt-4 py-5 ${classes.box}`}>
No Data!
</div>
else return <div className={`d-flex flex-column justify-content-center align-items-center col-12 mt-4 py-3 ${classes.box} ${classes.striped}`}>
else return <div
className={`d-flex flex-column justify-content-center align-items-center col-12 mt-4 py-3 ${classes.box} ${classes.striped}`}>
{data?.map((balance, index) => <div className={`d-flex flex-row col-12 py-4 px-2 font-size-sm`} key={index}>
<span className={`col-8`}>{index + 1} <span className={`mx-3`}></span> {balance?.address}</span>
<span className={`col-2 text-center`} style={{color: '#fff'}}>Balance: <span className={``}>{new BN(balance?.balance).toFormat()}</span></span>
<span className={`col-2 text-center`} style={{color: '#fff'}}> $ { new BN(balance?.balanceUsd).isZero() ? "---" : new BN(balance?.balanceUsd).toFormat()} </span>
<span className={`col-2 text-center`} style={{color: '#fff'}}>Balance: <span
className={``}>{new BN(balance?.balance).toFormat()}</span></span>
<span className={`col-2 text-center`}
style={{color: '#fff'}}> $ {new BN(balance?.balanceUsd).isZero() ? "---" : new BN(balance?.balanceUsd).toFormat()} </span>
</div>)}
</div>
}
Expand All @@ -44,43 +49,42 @@ const ChainBalance = ({chainId}) => {

<>

<div className={`col-12 my-2 d-flex flex-row justify-content-between align-items-center col-12 mt-4 py-4 px-4 ${classes.box} font-size-sm`}>
<div className={`d-flex flex-row align-items-center col-5`}>
<span className={``}>Exclude Zero Balance</span>
<span className={`mx-2`}> </span>
<ToggleSwitch
<div
className={`col-12 my-2 d-flex flex-row justify-content-between align-items-center col-12 mt-4 py-4 px-4 ${classes.box} font-size-sm`}>
<div className={`d-flex flex-row align-items-center col-5`}>
<span className={``}>Exclude Zero Balance</span>
<span className={`mx-2`}> </span>
<ToggleSwitch

onchange={ () => {
onchange={() => {

setParams(prevState => {return {
...prevState,
excludeZero: !prevState.excludeZero
}})
setParams(prevState => {
return {
...prevState,
excludeZero: !prevState.excludeZero
}
})


} }
}}

/*onchange={()=> setQuery({
...query,
ascendingByTime: (prevState => !prevState)}
)}*/
checked={params?.excludeZero}/>
</div>
/*onchange={()=> setQuery({
...query,
ascendingByTime: (prevState => !prevState)}
)}*/
checked={params?.excludeZero}/>
</div>

<div className={`d-flex flex-row justify-content-center align-items-center col-7 text-center`}>
<span className={``}>{total?.chain?.toUpperCase()}</span>
<span className={`mx-1`}> </span>
<span className={``}>Total Balance: </span>
<span className={`mx-2`}> </span>
<span className={`font-size-md`} style={{color: 'white'}}>{ totalIsLoading ? "Loading..." : new BN(total?.balance).toFormat()}</span>
<span className={`font-size-md`}
style={{color: 'white'}}>{totalIsLoading ? "Loading..." : new BN(total?.balance).toFormat()}</span>
</div>
</div>

{content()}




</>

);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/ChainAndToken/Chains/Chains.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {useGetChains} from "../../../query";

const Chains = () => {

const {data, isLoading, error, refetch} = useGetChains();
const {data, isLoading, error} = useGetChains();


const [chainId, setChainId] = useState(null);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/ChainAndToken/Tokens/Tokens.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {useGetTokens} from "../../../query";

const Tokens = () => {

const {data, isLoading, error, refetch} = useGetTokens();
const {data, isLoading, error} = useGetTokens();


const [chainId, setChainId] = useState(null);
Expand Down
47 changes: 26 additions & 21 deletions src/pages/ChainAndToken/Tokens/TokensBalance.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,35 @@ const TokensBalance = ({chainId}) => {
});

const {data, isLoading, error, refetch} = useGetTokenAllBalanceById(chainId, params);
const {data:total, isLoading:totalIsLoading, error:totalError} = useGetTokenTotalBalanceById(chainId);
const {data: total, isLoading: totalIsLoading} = useGetTokenTotalBalanceById(chainId);


useEffect(() => {
refetch()
}, [params]);

const content = ()=> {
const content = () => {

if (isLoading) return <div className={`d-flex flex-column justify-content-center align-items-center col-12 mt-4 py-5 ${classes.box}`}>
if (isLoading) return <div
className={`d-flex flex-column justify-content-center align-items-center col-12 mt-4 py-5 ${classes.box}`}>
Loading...
</div>
if (error) return <div className={`d-flex flex-column justify-content-center align-items-center col-12 mt-4 py-5 ${classes.box}`}>
if (error) return <div
className={`d-flex flex-column justify-content-center align-items-center col-12 mt-4 py-5 ${classes.box}`}>
Error!
</div>
if (data?.length === 0) return <div className={`d-flex flex-column justify-content-center align-items-center col-12 mt-4 py-5 ${classes.box}`}>
if (data?.length === 0) return <div
className={`d-flex flex-column justify-content-center align-items-center col-12 mt-4 py-5 ${classes.box}`}>
No Data!
</div>
else return <div className={`d-flex flex-column justify-content-center align-items-center col-12 mt-4 py-3 ${classes.box} ${classes.striped}`}>
else return <div
className={`d-flex flex-column justify-content-center align-items-center col-12 mt-4 py-3 ${classes.box} ${classes.striped}`}>
{data?.map((balance, index) => <div className={`d-flex flex-row col-12 py-4 px-2 font-size-sm`} key={index}>
<span className={`col-8`}>{index + 1} <span className={`mx-3`}></span> {balance?.address}</span>
<span className={`col-2 text-center`} style={{color: '#fff'}}>Balance: <span className={``}>{new BN(balance?.balance).toFormat()}</span></span>
<span className={`col-2 text-center`} style={{color: '#fff'}}> $ { new BN(balance?.balanceUsd).isZero() ? "---" : new BN(balance?.balanceUsd).toFormat()} </span>
<span className={`col-2 text-center`} style={{color: '#fff'}}>Balance: <span
className={``}>{new BN(balance?.balance).toFormat()}</span></span>
<span className={`col-2 text-center`}
style={{color: '#fff'}}> $ {new BN(balance?.balanceUsd).isZero() ? "---" : new BN(balance?.balanceUsd).toFormat()} </span>

</div>)}
</div>
Expand All @@ -44,21 +50,24 @@ const TokensBalance = ({chainId}) => {
return (
<>

<div className={`col-12 my-2 d-flex flex-row justify-content-between align-items-center col-12 mt-4 py-4 px-4 ${classes.box} font-size-sm`}>
<div
className={`col-12 my-2 d-flex flex-row justify-content-between align-items-center col-12 mt-4 py-4 px-4 ${classes.box} font-size-sm`}>
<div className={`d-flex flex-row align-items-center col-5`}>
<span className={``}>Exclude Zero Balance</span>
<span className={`mx-2`}> </span>
<ToggleSwitch

onchange={ () => {
onchange={() => {

setParams(prevState => {return {
...prevState,
excludeZero: !prevState.excludeZero
}})
setParams(prevState => {
return {
...prevState,
excludeZero: !prevState.excludeZero
}
})


} }
}}

/*onchange={()=> setQuery({
...query,
Expand All @@ -72,15 +81,11 @@ const TokensBalance = ({chainId}) => {
<span className={`mx-1`}> </span>
<span className={``}>Total Balance: </span>
<span className={`mx-2`}> </span>
<span className={`font-size-md`} style={{color: 'white'}}>{ totalIsLoading ? "Loading..." : new BN(total?.balance).toFormat()}</span>
<span className={`font-size-md`}
style={{color: 'white'}}>{totalIsLoading ? "Loading..." : new BN(total?.balance).toFormat()}</span>
</div>
</div>

{content()}




</>
);
};
Expand Down
1 change: 0 additions & 1 deletion src/pages/Dashboard/BriefWallet/BriefWalletCard.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react';
import classes from './BriefWallet.module.css'
import {BN} from "../../../utils/utils";

const BriefWalletCard = ({data, index}) => {
Expand Down
1 change: 0 additions & 1 deletion src/pages/Dashboard/Chain/ChainCard.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react';
import classes from './Chain.module.css'
import {BN} from "../../../utils/utils";

const ChainCard = ({data, index}) => {
Expand Down
15 changes: 1 addition & 14 deletions src/pages/Dashboard/Dashboard.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
import React from "react";
import Loading from "../../components/Loading";
import ScrollBar from "../../components/ScrollBar";
import {useGetUsersByGroup, useGetUsersList, useGetWithdrawsReq} from "../../query";
import Chains from "../ChainAndToken/Chains/Chains";
import {useGetUsersByGroup, useGetUsersList} from "../../query";
import Chain from "./Chain/Chain";
import Token from "./Token/Token";
import BriefWallet from "./BriefWallet/BriefWallet";

const Dashboard = () => {

const {data: users} = useGetUsersList(1, 10)
const {data: withdraws} = useGetWithdrawsReq(null, 1, 10)
const {data: kycReq} = useGetUsersByGroup("kyc-requested", 1, 10)

return <ScrollBar>
<div className="d-flex flex-column justify-content-start align-items-center" style={{minHeight: "100%"}}>

<div className="d-flex flex-row justify-content-between align-items-center my-5" style={{width: "90%"}}>
<div className="d-flex justify-content-center align-items-center primary-bg"
style={{width: "30%", height: "20vh", borderRadius: "7px"}}>
Expand All @@ -27,16 +24,6 @@ const Dashboard = () => {
</div> : <Loading/>
}
</div>
<div className="d-flex justify-content-center align-items-center primary-bg"
style={{width: "30%", height: "20vh", borderRadius: "7px"}}>
{withdraws !== null ?
<div className="d-flex flex-column justify-content-center align-items-center"
style={{height: "100%"}}>
<h4 className="mb-2">Withdraws Req</h4>
<span className="mt-2 text-info" style={{fontSize: "2rem"}}>{withdraws?.total || "-"}</span>
</div> : <Loading/>
}
</div>
<div className="d-flex justify-content-center align-items-center primary-bg"
style={{width: "30%", height: "20vh", borderRadius: "7px"}}>
{kycReq !== null ?
Expand Down
5 changes: 0 additions & 5 deletions src/pages/Dashboard/Token/Token.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import React from 'react';
import classes from './Token.module.css'
import {useGetTotalBalance} from "../../../query";
import {useGetTokenTotalBalance} from "../../../query/hooks/useGetTokenTotalBalance";
import ChainCard from "../Chain/ChainCard";
import TokenCard from "./TokenCard";

const Token = () => {
Expand All @@ -26,12 +24,9 @@ const Token = () => {
<div className={`flex-column justify-content-start`} style={{width: "32%"}}>

<p className={`font-size-md-plus mb-4`}>Token List</p>

{
content()
}


</div>
);
};
Expand Down
1 change: 0 additions & 1 deletion src/pages/Dashboard/Token/TokenCard.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react';
import classes from './Token.module.css'
import {BN} from "../../../utils/utils";

const TokenCard = ({data, index}) => {
Expand Down
Loading