Skip to content

Commit

Permalink
issue #27: fix bug 27, 32
Browse files Browse the repository at this point in the history
  • Loading branch information
blackskin18 committed Jun 7, 2023
1 parent b0d9e2a commit a968120
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/Components/BuyPositionBox/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ const Component = ({
const leverageData = useGenerateLeverageData(isLong)

useEffect(() => {
const address = barData.token ? barData.token : ''
setOutputTokenAddress(address)
if (barData.token) {
setOutputTokenAddress(barData.token)
}
}, [barData])

const leverage = useMemo(() => {
Expand All @@ -73,7 +74,7 @@ const Component = ({
useEffect(() => {
if (outputTokenAddress) {
for (let i = 0; i < leverageData.length; i++) {
const leve: any = leverageData[i];
const leve: any = leverageData[i]
for (let k = 0; k < leve.bars.length; k++) {
if (leve.bars[k].token.includes(outputTokenAddress.slice(0, -3))) {
setBarData(leve.bars[k])
Expand Down
5 changes: 4 additions & 1 deletion src/Components/Slider/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ const renderBar = (barData: any, barDataEntriesKeys: any, barColor: any, setLeve
for (let i = 0; i < barDataEntriesKeys.length; i++) {
barArray.push(
<Bar
style={{ transform: `translateY(-${5 * i}px)` }}
yAxisId={1000}
dataKey={barDataEntriesKeys[i]}
stackId='a'
fill={barColor[i]}
Expand Down Expand Up @@ -52,6 +54,7 @@ const StackedBarChart = ({
for (const i in barData) {
result[i] = barData[i].size
}

return result
}, [barData])

Expand All @@ -73,7 +76,7 @@ const StackedBarChart = ({
right: rightPixel
}}
>
<BarChart className='d-flex' width={30} height={barTotalSize < 1 ? 1 : barTotalSize} data={[barSizeData]}>
<BarChart className='d-flex' width={30} height={barTotalSize + (Object.values(barSizeData).length - 1) * 5} data={[barSizeData]}>
{renderBar(barData, barDataEntriesKeys, barColorValues, setLeverage)}
</BarChart>
</div>
Expand Down

0 comments on commit a968120

Please sign in to comment.