Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GSW-POOL] fix: Fix entire comment pool detail #309

Merged
merged 24 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
b5594be
[GSW-EARN] fix: Fix chart entire pool list
khiemldk Jan 18, 2024
a51abfc
[GSW-FIX] fix: Fix earn, new position
khiemldk Jan 18, 2024
d1fe4b6
[GSW-EARN] fix entire comment earn, position
khiemldk Jan 19, 2024
036c228
[GSW-POOL] fix: Fix pool detail comment
khiemldk Jan 19, 2024
93d429e
[GSW-POOL] fix: fix new UI pool detail
khiemldk Jan 19, 2024
eac50ae
[GSW-POOL] fix: fix pool detail
khiemldk Jan 23, 2024
8ebe671
Merge branch 'GSW-EARN-Entire' into GSW-POOL-DETAIL
khiemldk Jan 23, 2024
be0aaae
[GSW-POOL] fix: Fix pool detail comment
khiemldk Jan 23, 2024
a43aa21
[GSW-POOL] fix: fix pool entire comment
khiemldk Jan 23, 2024
9564c91
[GSW-POOL] fix: Fix pool detail
khiemldk Jan 23, 2024
1d453cb
[GSW-POOL] fix: Fix pool detail UI
khiemldk Jan 24, 2024
c43d893
[GSW-POOL] fix: Fix pool detail page
khiemldk Jan 24, 2024
2f189fe
[GSW-POOL] fix: fix entire comment ui
khiemldk Jan 24, 2024
3f6d430
Merge remote-tracking branch 'origin' into GSW-POOL-DETAIL
khiemldk Jan 25, 2024
83800c0
[GSW-POOL] Fix: Fix pool detail comment
khiemldk Jan 25, 2024
ab2db04
[GSW-POOL] fix: fix entire comment, integrate data
khiemldk Jan 25, 2024
18dfd1c
[GSW-POOL] fix: Fix comment
khiemldk Jan 26, 2024
9789dc6
[GSW-POOL] fix: Fix comment pool detail
khiemldk Jan 26, 2024
b770568
[GSW-POOL] fix: update new version
khiemldk Jan 26, 2024
060b909
[GSW-POOL] fix: Update pool detail chart hover
khiemldk Jan 26, 2024
524200d
[GSW-POOL] fix: Fix chart bar
khiemldk Jan 26, 2024
01d5d58
[GSW-POOL] fix: fix chart, my amount
khiemldk Jan 27, 2024
8d1491c
[GSW-POOL] fix: Fix comment github, left comment in vercel
khiemldk Jan 29, 2024
c205952
[GSW-POOL] fix: pool detail page
khiemldk Jan 29, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export interface BarAreaGraphProps {
minTickRate?: number;
maxTickRate?: number;
pool: PoolModel;
binsMyAmount: PoolBinModel[];
}

const VIEWPORT_DEFAULT_WIDTH = 400;
Expand All @@ -47,7 +48,8 @@ const BarAreaGraph: React.FC<BarAreaGraphProps> = ({
tokenA,
tokenB,
themeKey,
pool
pool,
binsMyAmount,
}) => {

const minTickPosition = useMemo(() => {
Expand Down Expand Up @@ -96,6 +98,8 @@ const BarAreaGraph: React.FC<BarAreaGraphProps> = ({
maxTickPosition={maxTickPosition}
minTickPosition={minTickPosition}
poolPrice={pool?.price || 1}
isPosition
binsMyAmount={binsMyAmount || []}
/>
</BarAreaGraphWrapper>
);
Expand Down
1 change: 1 addition & 0 deletions packages/web/src/components/common/button/Button.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export const ButtonWrapper = styled.button<ButtonStyleProps>`
`;

export const StyledText = styled.span<ButtonStyleProps>`
white-space: nowrap;
${({ fontType }) => fonts[fontType ?? "body9"]};
color: ${({ theme, textColor, hierarchy }) => {
if (hierarchy === ButtonHierarchy.Primary) return theme.color.text09;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const LiquidityEnterAmounts: React.FC<LiquidityEnterAmountsProps> = ({
}
return isSelectTokenA ? depositRatio >= 100 : depositRatio <= 0;
}, [depositRatio, isSelectTokenA]);

return (
<LiquidityEnterAmountsWrapper>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const MissingLogo: React.FC<Props> = ({
mobileWidth={mobileWidth}
className="missing-logo"
>
{symbol.slice(0, 3)}
{(symbol || "").slice(0, 3)}
</LogoWrapper>
)}
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import { convertToKMB, formatUsdNumber } from "@utils/stake-position-utils";
import { isMaxTick, isMinTick } from "@utils/pool-utils";
import IconStrokeArrowUp from "../icons/IconStrokeArrowUp";
import IconStrokeArrowDown from "../icons/IconStrokeArrowDown";
import BigNumber from "bignumber.js";
import { makeDisplayTokenAmount } from "@utils/token-utils";
import { PositionClaimInfo } from "@models/position/info/position-claim-info";

Expand All @@ -33,7 +32,7 @@ interface MyPositionCardProps {
themeKey: "dark" | "light";
}

function estimateTick(tick: number, width: number) {
export function estimateTick(tick: number, width: number) {
if (tick < 0) return 0;
if (tick > width) return width;
return tick;
Expand All @@ -46,6 +45,7 @@ const MyPositionCard: React.FC<MyPositionCardProps> = ({
currentIndex,
themeKey,
}) => {

const GRAPH_WIDTH = mobile ? 226 : 290;
const GRAPH_HEIGHT = 80;
const { pool, rewards } = position;
Expand All @@ -68,7 +68,10 @@ const MyPositionCard: React.FC<MyPositionCardProps> = ({
balance: makeDisplayTokenAmount(reward.token, reward.totalAmount) || 0,
balanceUSD: Number(reward.totalAmount) * Number(tokenPrices[reward.token.priceId]?.usd || 0),
claimableAmount: makeDisplayTokenAmount(reward.token, reward.claimableAmount) || 0,
claimableUSD: Number(reward.claimableUsdValue)
claimableUSD: Number(reward.claimableUsdValue),
accumulatedRewardOf1d: makeDisplayTokenAmount(reward.token, reward.accumulatedRewardOf1d || 0) || 0,
claimableUsdValue: Number(reward.claimableUsdValue),
aprOf7d: Number(reward.aprOf7d),
}))
.forEach((rewardInfo) => {
const existReward = infoMap[rewardInfo.rewardType][rewardInfo.token.priceId];
Expand All @@ -79,6 +82,9 @@ const MyPositionCard: React.FC<MyPositionCardProps> = ({
balanceUSD: existReward.balanceUSD + rewardInfo.balanceUSD,
claimableAmount: existReward.claimableAmount + rewardInfo.claimableAmount,
claimableUSD: existReward.claimableUSD + rewardInfo.claimableUSD,
accumulatedRewardOf1d: existReward.accumulatedRewardOf1d + rewardInfo.accumulatedRewardOf1d,
claimableUsdValue: existReward.claimableUsdValue + rewardInfo.claimableUsdValue,
aprOf7d: existReward.aprOf7d + rewardInfo.aprOf7d,
};
} else {
infoMap[rewardInfo.rewardType][rewardInfo.token.priceId] = rewardInfo;
Expand Down Expand Up @@ -146,7 +152,7 @@ const MyPositionCard: React.FC<MyPositionCardProps> = ({
const maxTickLabel = useMemo(() => {
return maxTickRate === 999
? `>${maxTickRate}%`
: maxTickRate > 1000
: maxTickRate >= 1000
? ">999%"
: `${maxTickRate > 0 ? "+" : ""}${maxTickRate}%`;
}, [maxTickRate]);
Expand Down Expand Up @@ -258,33 +264,19 @@ const MyPositionCard: React.FC<MyPositionCardProps> = ({
return maxTickPosition;
}, [maxTickPosition]);

const isMinTickGreen = useMemo(() => {
if (!getMinTick) {
return true;
}
return BigNumber(getMinTick).isGreaterThanOrEqualTo(GRAPH_WIDTH / 2);
}, [getMinTick, GRAPH_WIDTH]);

const isMaxTickGreen = useMemo(() => {
if (!getMaxTick) {
return true;
}
return BigNumber(getMaxTick).isGreaterThanOrEqualTo(GRAPH_WIDTH / 2);
}, [getMaxTick]);

const startClass = useMemo(() => {
if (getMinTick === null) {
return null;
return "";
}
return !isMinTickGreen || isFullRange ? "negative" : "positive";
}, [getMinTick, isMinTickGreen, isFullRange]);
return (minTickRate > 0 || isFullRange) ? "negative" : "positive";
}, [getMinTick, minTickRate, isFullRange]);

const endClass = useMemo(() => {
if (getMaxTick === null) {
return "";
}
return isMaxTickGreen ? "positive" : "negative";
}, [getMaxTick, isMaxTickGreen, maxTickRate]);
return maxTickRate > 0 ? "positive" : "negative";
}, [getMaxTick, maxTickRate]);

const claimableUSD = useMemo(() => {
const claimableUsdValue = claimableRewardInfo ? Object.values(claimableRewardInfo)
Expand Down Expand Up @@ -386,6 +378,7 @@ const MyPositionCard: React.FC<MyPositionCardProps> = ({
minTickRate={minTickRate}
maxTickRate={maxTickRate}
pool={pool}
binsMyAmount={position.bins}
/>
</div>
<div className="min-max-price">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const OverlapLogo = ({ logos, size = 36 }: OverlapLogoProps) => {
key={index}
overlap={index > 0 ? (size / 3) : 0}
size={size}
className="overlap-logo-wrapper"
>
<img src={logo} alt="logo-image" />
</OverlapLogoImageWrapper>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ export const Default: StoryObj<PoolGraphProps> = {
width: 600,
height: 400,
zoomable: false,
binsMyAmount: pool.bins,
},
};
34 changes: 32 additions & 2 deletions packages/web/src/components/common/pool-graph/PoolGraph.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,12 @@ export const PoolGraphTooltipWrapper = styled.div`
&.price-range {
justify-content: flex-end;
}
&.token-title {
${media.mobile} {
display: none;
}
}
}

}

.header {
Expand All @@ -84,6 +88,13 @@ export const PoolGraphTooltipWrapper = styled.div`
.row {
padding: 4px 0;
}
&:last-of-type {
.token {
${media.mobile} {
display: none;
}
}
}
}

.token {
Expand All @@ -95,19 +106,38 @@ export const PoolGraphTooltipWrapper = styled.div`
width: 20px;
height: 20px;
}
${media.mobile} {
display: none;
}
}

.amount {
flex-shrink: 0;
width: 80px;

& .hidden {
display: inline;
overflow: hidden;
text-overflow: clip;
white-space: nowrap;
word-break: break-all;
}
&.mr-3 {
margin-left: -8px;
}
img {
width: 20px;
height: 20px;
margin-right: 4px;
display: none;
}
${media.mobile} {
&.total-amount {
width: 85px;
}
img {
display: block;
}
}
}

.price-range {
Expand Down
Loading
Loading