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
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ services:
web-app:
image: ghcr.io/opexdev/web-app
environment:
- ENV=$WEB_APP_ENV
- API_BASE_URL=$API_BASE_URL
- CLIENT_ID=$CLIENT_ID
- CLIENT_SECRET=$CLIENT_SECRET
Expand Down
3 changes: 2 additions & 1 deletion env-map.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
window.env = {
REACT_APP_ENV: "$ENV",
REACT_APP_API_BASE_URL: "$API_BASE_URL",
REACT_APP_CLIENT_ID: "$CLIENT_ID",
REACT_APP_CLIENT_SECRET: "$CLIENT_SECRET"
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "opex",
"version": "v1.0.0-beta.2",
"version": "v1.0.1-beta.2",
"homepage": "",
"private": true,
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ const AllMarketInfo = () => {
const dispatch = useDispatch();

let USDTMarket,IRTMarket
const baseCurrency = window.env.REACT_APP_ENV === "development" ? "USDT" : "BUSD";

if (!isLoading) {
const overviewWithPair = overview.map((o)=>{
o.pairInfo = allSymbols.find((s => s.symbol === o.symbol))
return o
})
const USDTPrice = overview.find(s => s.symbol.includes("USDTIRT")).lastPrice
USDTMarket = overviewWithPair.filter(s => s.symbol.includes("USDT")).sort((a , b) => b.lastPrice * b.volume * USDTPrice - a.lastPrice * a.volume * USDTPrice)
const USDTPrice = overview.find(s => s.symbol.includes(baseCurrency+"IRT")).lastPrice
USDTMarket = overviewWithPair.filter(s => s.symbol.includes(baseCurrency)).sort((a , b) => b.lastPrice * b.volume * USDTPrice - a.lastPrice * a.volume * USDTPrice)
IRTMarket = overviewWithPair.filter(s => s.symbol.includes("IRT")).sort((a , b) => b.lastPrice * b.volume - a.lastPrice * a.volume)
}

Expand Down Expand Up @@ -57,7 +59,7 @@ const AllMarketInfo = () => {
</div>
<div className={`row jc-center ai-center mr-1`}>
<span className={`px-2 py-1 rounded cursor-pointer hover-text ${IRT && classes.active}`} onClick={()=>setIRT(true)}>{t("currency.IRT")}</span>
<span className={`px-2 py-1 rounded cursor-pointer hover-text ${!IRT && classes.active}`} onClick={()=>setIRT(false)}>{t("currency.USDT")}</span>
<span className={`px-2 py-1 rounded cursor-pointer hover-text ${!IRT && classes.active}`} onClick={()=>setIRT(false)}>{t("currency."+baseCurrency)}</span>
</div>
</div>
<div className={`${classes.content}`}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,31 +16,33 @@ const MarketInfo = () => {

const {t} = useTranslation();
const interval = "24h"
const {data:overview, isLoading, error} = useOverview(null , interval)
const {data: overview, isLoading, error} = useOverview(null, interval)
const [card, setCard] = useState(false)
const [IRT, setIRT] = useState(true)
const allSymbols = useSelector((state) => state.exchange.symbols)

let USDTMarket,IRTMarket
let USDTMarket, IRTMarket

const baseCurrency = window.env.REACT_APP_ENV === "development" ? "USDT" : "BUSD";

if (!isLoading) {
const overviewWithPair = overview.map((o)=>{
const overviewWithPair = overview.map((o) => {
o.pairInfo = allSymbols.find((s => s.symbol === o.symbol))
return o
})
const USDTPrice = overview.find(s => s.symbol.includes("USDTIRT")).lastPrice
USDTMarket = overviewWithPair.filter(s => s.symbol.includes("USDT")).sort((a , b) => b.lastPrice * b.volume * USDTPrice - a.lastPrice * a.volume * USDTPrice).slice(0 , 5)
IRTMarket = overviewWithPair.filter(s => s.symbol.includes("IRT")).sort((a , b) => b.lastPrice * b.volume - a.lastPrice * a.volume).slice(0 , 5)
const USDTPrice = overview.find(s => s.symbol.includes(baseCurrency+"IRT")).lastPrice
USDTMarket = overviewWithPair.filter(s => s.symbol.includes(baseCurrency)).sort((a, b) => b.lastPrice * b.volume * USDTPrice - a.lastPrice * a.volume * USDTPrice).slice(0, 5)
IRTMarket = overviewWithPair.filter(s => s.symbol.includes("IRT")).sort((a, b) => b.lastPrice * b.volume - a.lastPrice * a.volume).slice(0, 5)
}

const content = () => {
if (isLoading) return <div style={{height: "40vh"}}><Loading/></div>
if (error) return <div style={{height: "40vh"}}><Error/></div>
else return <>
{card ?
<MarketInfoCard data={ IRT ? IRTMarket : USDTMarket}/>
<MarketInfoCard data={IRT ? IRTMarket : USDTMarket}/>
:
<MarketInfoTable data={ IRT ? IRTMarket : USDTMarket}/>
<MarketInfoTable data={IRT ? IRTMarket : USDTMarket}/>
}
</>
}
Expand All @@ -50,19 +52,24 @@ const MarketInfo = () => {
<div className={`${classes.container} card-background card-border width-90 my-4`}>
<div className={`${classes.header} card-header-bg row jc-between ai-center px-2 py-2`}>
<div className={`row jc-center ai-center`}>
<Icon iconName={`${card ? 'icon-row' : 'icon-grid'} font-size-md-01 flex cursor-pointer hover-text`} onClick={()=>setCard(prevState => !prevState)}/>
<Icon iconName={`${card ? 'icon-row' : 'icon-grid'} font-size-md-01 flex cursor-pointer hover-text`}
onClick={() => setCard(prevState => !prevState)}/>
<div className={`row jc-center ai-baseline mr-1 ml-1`}>
<h2 className={`ml-025`}>{t("market.title")}</h2>
<span className={`font-size-sm-plus mr-025`}>( {t("marketInterval." + interval)} )</span>
</div>
<div className={`row jc-center ai-center mr-1`}>
<span className={`px-2 py-1 rounded cursor-pointer hover-text ${IRT && classes.active}`} onClick={()=>setIRT(true)}>{t("currency.IRT")}</span>
<span className={`px-2 py-1 rounded cursor-pointer hover-text ${!IRT && classes.active}`} onClick={()=>setIRT(false)}>{t("currency.USDT")}</span>
<span className={`px-2 py-1 rounded cursor-pointer hover-text ${IRT && classes.active}`}
onClick={() => setIRT(true)}>{t("currency.IRT")}</span>
<span className={`px-2 py-1 rounded cursor-pointer hover-text ${!IRT && classes.active}`}
onClick={() => setIRT(false)}>{t("currency."+baseCurrency)}</span>
</div>
</div>
<Link to={Routes.AllMarket} className={`row jc-center ai-center cursor-pointer hover-text`}>
<span className={`ml-05`}>{t("MarketInfo.viewAllMarket")}</span>
<Icon iconName={`${i18n.language !== "fa" ? 'icon-right-open-1' : 'icon-left-open-1'} font-size-md flex`} className={`mr-05`}/>
<Icon
iconName={`${i18n.language !== "fa" ? 'icon-right-open-1' : 'icon-left-open-1'} font-size-md flex`}
className={`mr-05`}/>
</Link>
</div>
<div className={`${classes.content}`}>
Expand Down