Skip to content

Commit

Permalink
fix: Fix a test data to foo token
Browse files Browse the repository at this point in the history
  • Loading branch information
jinoosss committed Dec 8, 2023
1 parent 3c566ad commit 725443f
Show file tree
Hide file tree
Showing 21 changed files with 133 additions and 132 deletions.
86 changes: 43 additions & 43 deletions packages/web/src/components/common/bar-graph/BarGraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export interface BarGraphProps {
tooltipOption?: string;
svgColor?: string;
currentIndex?: number;
customData?: { height: number, locationTooltip: number};
customData?: { height: number, locationTooltip: number };
times?: string[];
radiusBorder?: number;
}
Expand Down Expand Up @@ -75,7 +75,7 @@ const BarGraph: React.FC<BarGraphProps> = ({
height = VIEWPORT_DEFAULT_HEIGHT,
tooltipOption = "default",
svgColor = "default",
customData = { height: 0, locationTooltip: 0},
customData = { height: 0, locationTooltip: 0 },
times = [],
radiusBorder = 0,
}) => {
Expand Down Expand Up @@ -166,7 +166,7 @@ const BarGraph: React.FC<BarGraphProps> = ({
setCurrentPointIndex(-1);
return;
}
const { currentTarget } = event;
const { currentTarget } = event;
const { left, top } = currentTarget.getBoundingClientRect();
const positionX = (clientX || 0) - left;
const clientWidth = currentTarget.clientWidth;
Expand All @@ -190,7 +190,7 @@ const BarGraph: React.FC<BarGraphProps> = ({
setCurrentPointIndex(currentPointIndex);
}
if (currentPoint) {
setChartPoint({ x: positionX, y: (clientY || 0) - top});
setChartPoint({ x: positionX, y: (clientY || 0) - top });
setCurrentPoint(currentPoint);
}
}
Expand All @@ -208,11 +208,11 @@ const BarGraph: React.FC<BarGraphProps> = ({
return "right";
}, [currentPoint, width, locationTooltip, height, chartPoint, customHeight]);


const onTouchMove = (event: React.MouseEvent<HTMLDivElement, MouseEvent> | React.TouchEvent<HTMLDivElement>) => {
onMouseMove(event);
};

const onTouchStart = (event: React.MouseEvent<HTMLDivElement, MouseEvent> | React.TouchEvent<HTMLDivElement>) => {
event.preventDefault();
onMouseMove(event);
Expand All @@ -230,45 +230,45 @@ const BarGraph: React.FC<BarGraphProps> = ({
onTouchMove={onTouchMove}
onTouchStart={onTouchStart}
>
<FloatingTooltip className="chart-tooltip" isHiddenArrow position={locationTooltipPosition}
content={tooltipOption === "default" && currentPointIndex > -1 && activated ?
<BarGraphTooltipWrapper>
<div className="tooltip-body">
<span className="date">
{parseTime(times[currentPointIndex]).date}
</span>
</div>
<div className="tooltip-header">
<span className="value">{`$${Number(BigNumber(
datas[currentPointIndex],
)).toLocaleString()}`}</span>
</div>
</BarGraphTooltipWrapper>:
tooltipOption === "incentivized" && currentPointIndex > -1 && activated ?
<IncentivizeGraphTooltipWrapper>
<div className="row">
<div className="token">Token</div>
<div className="amount">Amount</div>
<div className="price">Price Range</div>
</div>
<div className="body">
<div className="token">
<img src="https://s2.coinmarketcap.com/static/img/coins/64x64/1.png" alt="token logo" className="token-logo" />
BTC
<FloatingTooltip className="chart-tooltip" isHiddenArrow position={locationTooltipPosition}
content={tooltipOption === "default" && currentPointIndex > -1 && activated ?
<BarGraphTooltipWrapper>
<div className="tooltip-body">
<span className="date">
{parseTime(times[currentPointIndex]).date}
</span>
</div>
<div className="amount">-</div>
<div className="price">19.30K - 21.45K ADN</div>
</div>
<div className="body">
<div className="token">
<img src="https://s2.coinmarketcap.com/static/img/coins/64x64/1.png" alt="token logo" className="token-logo" />
BTC
<div className="tooltip-header">
<span className="value">{`$${Number(BigNumber(
datas[currentPointIndex],
)).toLocaleString()}`}</span>
</div>
<div className="amount">Amount</div>
<div className="price">0.000046 - 0.000051 BTC</div>
</div>
</IncentivizeGraphTooltipWrapper> : null
}>
</BarGraphTooltipWrapper> :
tooltipOption === "incentivized" && currentPointIndex > -1 && activated ?
<IncentivizeGraphTooltipWrapper>
<div className="row">
<div className="token">Token</div>
<div className="amount">Amount</div>
<div className="price">Price Range</div>
</div>
<div className="body">
<div className="token">
<img src="https://raw.githubusercontent.com/onbloc/gno-token-resource/main/grc20/images/gno_land_r_foo.svg" alt="token logo" className="token-logo" />
BTC
</div>
<div className="amount">-</div>
<div className="price">19.30K - 21.45K ADN</div>
</div>
<div className="body">
<div className="token">
<img src="https://raw.githubusercontent.com/onbloc/gno-token-resource/main/grc20/images/gno_land_r_foo.svg" alt="token logo" className="token-logo" />
BTC
</div>
<div className="amount">Amount</div>
<div className="price">0.000046 - 0.000051 BTC</div>
</div>
</IncentivizeGraphTooltipWrapper> : null
}>
<svg viewBox={`0 0 ${width} ${height + (customHeight || 0)}`}>
<defs>
<linearGradient id="gradient-bar-green" x1="0" x2="0" y1="0" y2="1">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,19 @@ const token: TokenModel = {
createdAt: "2023-10-10T08:48:46+09:00",
name: "Gnoswap",
address: "g1sqaft388ruvsseu97r04w4rr4szxkh4nn6xpax",
path: "gno.land/r/gnos",
path: "gno.land/r/gns",
decimals: 4,
symbol: "GNOS",
logoURI: "https://s2.coinmarketcap.com/static/img/coins/64x64/5994.png",
symbol: "GNS",
logoURI: "https://raw.githubusercontent.com/onbloc/gno-token-resource/main/grc20/images/gno_land_r_gns.svg",
type: "grc20",
priceId: "gno.land/r/gnos"
priceId: "gno.land/r/gns"
};

describe("TokenAmountInput Component", () => {
it("TokenAmountInput render", () => {
const args: TokenAmountInputProps = {
token,
connected: true,
amount: "12,211",
balance: "12,211",
usdValue: "12.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ const token: TokenModel = {
createdAt: "2023-10-10T08:48:46+09:00",
name: "Gnoswap",
address: "g1sqaft388ruvsseu97r04w4rr4szxkh4nn6xpax",
path: "gno.land/r/gnos",
path: "gno.land/r/gns",
decimals: 4,
symbol: "GNOS",
logoURI: "https://s2.coinmarketcap.com/static/img/coins/64x64/5994.png",
symbol: "GNS",
logoURI: "https://raw.githubusercontent.com/onbloc/gno-token-resource/main/grc20/images/gno_land_r_gns.svg",
type: "grc20",
priceId: "gno.land/r/gnos"
priceId: "gno.land/r/gns"
};

export const Default: StoryObj<TokenAmountInputProps> = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ const token: TokenModel = {
createdAt: "2023-10-10T08:48:46+09:00",
name: "Gnoswap",
address: "g1sqaft388ruvsseu97r04w4rr4szxkh4nn6xpax",
path: "gno.land/r/gnos",
path: "gno.land/r/gns",
decimals: 4,
symbol: "GNOS",
logoURI: "https://s2.coinmarketcap.com/static/img/coins/64x64/5994.png",
symbol: "GNS",
logoURI: "https://raw.githubusercontent.com/onbloc/gno-token-resource/main/grc20/images/gno_land_r_gns.svg",
type: "grc20",
priceId: "gno.land/r/gnos"
priceId: "gno.land/r/gns"
};

describe("TokenAmount Component", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ const token: TokenModel = {
createdAt: "2023-10-10T08:48:46+09:00",
name: "Gnoswap",
address: "g1sqaft388ruvsseu97r04w4rr4szxkh4nn6xpax",
path: "gno.land/r/gnos",
path: "gno.land/r/gns",
decimals: 4,
symbol: "GNOS",
logoURI: "https://s2.coinmarketcap.com/static/img/coins/64x64/5994.png",
symbol: "GNS",
logoURI: "https://raw.githubusercontent.com/onbloc/gno-token-resource/main/grc20/images/gno_land_r_gns.svg",
type: "grc20",
priceId: "gno.land/r/gnos"
priceId: "gno.land/r/gns"
};

export const Default: StoryObj<TokenAmountProps> = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,24 @@ const tokenA: TokenModel = {
createdAt: "2023-10-10T08:48:46+09:00",
name: "Gnoswap",
address: "g1sqaft388ruvsseu97r04w4rr4szxkh4nn6xpax",
path: "gno.land/r/gnos",
path: "gno.land/r/gns",
decimals: 4,
symbol: "GNOS",
logoURI: "https://s2.coinmarketcap.com/static/img/coins/64x64/5994.png",
symbol: "GNS",
logoURI: "https://raw.githubusercontent.com/onbloc/gno-token-resource/main/grc20/images/gno_land_r_gns.svg",
type: "grc20",
priceId: "gno.land/r/gnos"
priceId: "gno.land/r/gns"
};
const tokenB: TokenModel = {
chainId: "dev",
createdAt: "2023-10-10T08:48:46+09:00",
name: "Gnoswap",
address: "g1sqaft388ruvsseu97r04w4rr4szxkh4nn6xpax",
path: "gno.land/r/gnos",
path: "gno.land/r/gns",
decimals: 4,
symbol: "GNOS",
logoURI: "https://s2.coinmarketcap.com/static/img/coins/64x64/5994.png",
symbol: "GNS",
logoURI: "https://raw.githubusercontent.com/onbloc/gno-token-resource/main/grc20/images/gno_land_r_gns.svg",
type: "grc20",
priceId: "gno.land/r/gnos"
priceId: "gno.land/r/gns"
};

export const Default = Template.bind({});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const pool: PoolCardInfo = {
path: "gno.land/r/bar",
decimals: 4,
symbol: "BAR",
logoURI: "https://s2.coinmarketcap.com/static/img/coins/64x64/5994.png",
logoURI: "https://raw.githubusercontent.com/onbloc/gno-token-resource/main/grc20/images/gno_land_r_bar.svg",
type: "grc20",
priceId: "gno.land/r/bar"
},
Expand All @@ -28,7 +28,7 @@ const pool: PoolCardInfo = {
path: "gno.land/r/foo",
decimals: 4,
symbol: "FOO",
logoURI: "https://s2.coinmarketcap.com/static/img/coins/64x64/5994.png",
logoURI: "https://raw.githubusercontent.com/onbloc/gno-token-resource/main/grc20/images/gno_land_r_foo.svg",
type: "grc20",
priceId: "gno.land/r/foo"
},
Expand All @@ -44,12 +44,12 @@ const pool: PoolCardInfo = {
createdAt: "2023-10-12T06:56:12+09:00",
name: "Gnoswap",
address: "g1sqaft388ruvsseu97r04w4rr4szxkh4nn6xpax",
path: "gno.land/r/gnos",
path: "gno.land/r/gns",
decimals: 4,
symbol: "GNS",
logoURI: "/gnos.svg",
type: "grc20",
priceId: "gno.land/r/gnos"
priceId: "gno.land/r/gns"
},
amount: 10
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Default.args = {
path: "gno.land/r/foo",
decimals: 4,
symbol: "FOO",
logoURI: "https://s2.coinmarketcap.com/static/img/coins/64x64/5994.png",
logoURI: "https://raw.githubusercontent.com/onbloc/gno-token-resource/main/grc20/images/gno_land_r_foo.svg",
type: "grc20",
priceId: "gno.land/r/foo"
},
Expand All @@ -40,7 +40,7 @@ Default.args = {
path: "gno.land/r/foo",
decimals: 4,
symbol: "FOO",
logoURI: "https://s2.coinmarketcap.com/static/img/coins/64x64/5994.png",
logoURI: "https://raw.githubusercontent.com/onbloc/gno-token-resource/main/grc20/images/gno_land_r_foo.svg",
type: "grc20",
priceId: "gno.land/r/foo"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const Default: StoryObj<TokenChartInfoProps> = {
args: {
token: {
name: "Gnoswap",
symbol: "GNOS",
symbol: "GNS",
image: "https://miro.medium.com/v2/resize:fill:44:44/1*61CWWk33Fx8vLVvto5nJHQ.png",
},
priceInfo: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ const TOKEN_A: TokenModel = {
createdAt: "2023-10-10T08:48:46+09:00",
name: "Gnoswap",
address: "g1sqaft388ruvsseu97r04w4rr4szxkh4nn6xpax",
path: "gno.land/r/gnos",
path: "gno.land/r/gns",
decimals: 4,
symbol: "GNOS",
logoURI: "https://s2.coinmarketcap.com/static/img/coins/64x64/5994.png",
symbol: "GNS",
logoURI: "https://raw.githubusercontent.com/onbloc/gno-token-resource/main/grc20/images/gno_land_r_gns.svg",
type: "grc20",
priceId: "gno.land/r/gnos",
priceId: "gno.land/r/gns",
}

export const Default = Template.bind({});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,39 +14,39 @@ describe("DepositModal Component", () => {
createdAt: "2023-10-10T08:48:46+09:00",
name: "Gnoswap",
address: "g1sqaft388ruvsseu97r04w4rr4szxkh4nn6xpax",
path: "gno.land/r/gnos",
path: "gno.land/r/gns",
decimals: 4,
symbol: "GNOT",
logoURI:
"https://raw.githubusercontent.com/onbloc/gno-token-resource/main/gno-native/images/gnot.svg",
type: "grc20",
priceId: "gno.land/r/gnos",
priceId: "gno.land/r/gns",
},
fromToken: {
chainId: "dev",
createdAt: "2023-10-10T08:48:46+09:00",
name: "Gnoswap",
address: "g1sqaft388ruvsseu97r04w4rr4szxkh4nn6xpax",
path: "gno.land/r/gnos",
path: "gno.land/r/gns",
decimals: 4,
symbol: "GNOT",
logoURI:
"https://raw.githubusercontent.com/onbloc/gno-token-resource/main/gno-native/images/gnot.svg",
type: "grc20",
priceId: "gno.land/r/gnos",
priceId: "gno.land/r/gns",
},
toToken: {
chainId: "dev",
createdAt: "2023-10-10T08:48:46+09:00",
name: "Gnoswap",
address: "g1sqaft388ruvsseu97r04w4rr4szxkh4nn6xpax",
path: "gno.land/r/gnos",
path: "gno.land/r/gns",
decimals: 4,
symbol: "GNOT",
logoURI:
"https://raw.githubusercontent.com/onbloc/gno-token-resource/main/gno-native/images/gnot.svg",
type: "grc20",
priceId: "gno.land/r/gnos",
priceId: "gno.land/r/gns",
},
connected: true,
changeToken: () => null,
Expand Down
Loading

0 comments on commit 725443f

Please sign in to comment.