Skip to content

Commit c1a2286

Browse files
committed
style: style improvment and some bug fixes
1 parent f66d59a commit c1a2286

19 files changed

+127
-29
lines changed

lib/components/Header/Header.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
align-items: center;
55
justify-content: space-between;
66
padding: 0 0.5rem;
7+
font-size: var(--font-size-base);
78
}
89
.header-setting {
910
display: flex;
@@ -15,7 +16,7 @@
1516
transform: rotate(90deg);
1617
transition: transform 0.15s ease-in-out;
1718
}
18-
font-size: 1rem;
19+
font-size: var(--font-size-xl);
1920
opacity: 0.5;
2021
}
2122
}

lib/components/Header/SlippageSetting.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,7 @@ const SlippageSetting = () => {
4343
setUserInput("");
4444
setSlippage("auto");
4545
};
46-
// write a function to handle the slippage change
47-
// write a function to handle the auto click
48-
// write a function to handle the plus click
49-
// write a function to handle the minus click
46+
5047
const handleOnPlusClick = () => {
5148
if (slippage === "auto") {
5249
setSlippage(1);

lib/components/Header/Wallet.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ const Wallet = () => {
3535
};
3636
const { colors } = useThemeStore();
3737
const TON_BALANCE = formatNumber(
38-
+fromNano(balance.get(TON_ADDR)?.balance || 0n)
38+
+fromNano(balance.get(TON_ADDR)?.balance || 0n),
39+
4,
40+
false
3941
);
4042

4143
return (

lib/components/Swap/Swap.scss

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,31 @@
1111
--text-fade-color: #9caacb;
1212
--skeleton-shine-color: #9c9c9c;
1313
--price-impact-color: #e64646;
14+
--font-size-xxs: 0.625rem;
15+
--font-size-xs: 0.75rem;
16+
--font-size-sm: 0.875rem;
17+
--font-size-base: 1rem;
18+
--font-size-lg: 1.125rem;
19+
--font-size-xl: 1.25rem;
20+
--font-size-2xl: 1.5rem;
21+
--font-size-3xl: 1.875rem;
22+
--font-size-4xl: 2.25rem;
23+
--font-size-5xl: 3rem;
24+
--font-size-6xl: 4rem;
25+
--font-size-7xl: 5rem;
26+
--font-size-8xl: 6rem;
27+
--font-size-9xl: 7rem;
28+
--font-size-10xl: 8rem;
1429
}
1530

1631
.mytonswap-app {
17-
font-family: sans-serif;
32+
font-family: Inter, sans-serif;
33+
1834
button {
1935
border: none;
20-
background: none;
36+
background-color: transparent;
2137
cursor: pointer;
38+
font-family: Inter, sans-serif;
2239
}
2340
input {
2441
border: none;

lib/components/Swap/Swap.stories.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,3 +136,21 @@ export const CyberPunk: Story = {
136136
},
137137
},
138138
};
139+
140+
export const TonJiggle: Story = {
141+
args: {
142+
theme: {
143+
border: "#004A6533",
144+
primary: "#177594",
145+
background: "#181F34",
146+
input_card: "#27272A",
147+
input_token: "#1D2939",
148+
light_shade: "#193349",
149+
slippage_box: "#D1D1E0",
150+
text_black: "#FFFFFF",
151+
text_white: "#FFFFFF",
152+
text_fade: "#6B7280",
153+
skeleton_shine: "#585959",
154+
},
155+
},
156+
};

lib/components/Swap/Swap.tsx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,17 @@ type SwapProps = {
1515
options?: SwapOptions;
1616
};
1717

18+
// declare telegram in window
19+
declare global {
20+
interface Window {
21+
Telegram: {
22+
WebApp: {
23+
initData: string;
24+
};
25+
};
26+
}
27+
}
28+
1829
export const Swap: FC<SwapProps> = ({ theme, options }) => {
1930
const { colors, setTheme } = useThemeStore();
2031
const { setOptions } = useOptionsStore();
@@ -49,6 +60,21 @@ export const Swap: FC<SwapProps> = ({ theme, options }) => {
4960
}
5061
}, 10000);
5162
initializeApp();
63+
if (window?.Telegram?.WebApp?.initData?.length !== 0) {
64+
ensureDocumentIsScrollable();
65+
}
66+
function ensureDocumentIsScrollable() {
67+
const isScrollable =
68+
document.documentElement.scrollHeight > window.innerHeight;
69+
70+
if (!isScrollable) {
71+
document.documentElement.style.setProperty(
72+
"height",
73+
"calc(100vh + 1px)",
74+
"important"
75+
);
76+
}
77+
}
5278
return () => {
5379
clearInterval(refetchInterval);
5480
};

lib/components/SwapButton/SwapButton.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
position: absolute;
66
left: 0;
77
top: 0;
8-
z-index: 10;
8+
z-index: 9999999999999999999999999;
99
background-color: rgba(0, 0, 0, 0.1);
1010
.modal-container-inner {
1111
position: fixed;

lib/components/SwapCard/Card.scss

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44
display: flex;
55
flex-direction: column;
66
gap: 0.25rem;
7-
font-size: 0.75rem;
7+
font-size: var(--font-size-sm);
88
.card-head {
99
display: flex;
1010
align-items: center;
1111
justify-content: space-between;
1212
padding-left: 0.25rem;
1313
padding-right: 0.25rem;
14+
1415
.max-button {
1516
cursor: pointer;
1617
}
@@ -24,22 +25,24 @@
2425
padding-right: 0.5rem;
2526
padding-top: 0.5rem;
2627
padding-bottom: 0.5rem;
27-
28+
margin-top: 0.5rem;
2829
.card-inputs {
2930
display: flex;
3031
flex-direction: column;
32+
justify-content: center;
3133
.card-input {
3234
outline: none;
3335
background: transparent;
36+
font-size: var(--font-size-lg);
37+
font-weight: 900;
3438
}
3539
.card-input-loading {
3640
height: 1rem;
3741
width: 6rem;
3842
border-radius: 0.375rem;
3943
}
4044
.card-rate {
41-
font-size: 0.7rem;
42-
margin-top: 0.25rem;
45+
font-size: var(--font-size-xs);
4346
}
4447
.card-rate-loading {
4548
height: 0.75rem;
@@ -51,9 +54,10 @@
5154
.card-button {
5255
display: flex;
5356
align-items: center;
57+
5458
.selection-box {
55-
height: 1.5rem;
56-
width: 1.5rem;
59+
height: 2rem;
60+
width: 2rem;
5761
border-radius: 9999px;
5862
background-size: contain !important;
5963
}

lib/components/SwapCard/Card.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,8 @@ const Card: FC<CardProps> = ({ type }) => {
147147

148148
let payAmount = BigInt(balanceToken.balance);
149149
if (pay_token.address === TON_ADDR) {
150-
payAmount = payAmount - toNano(0.4);
150+
if (payAmount <= toNano(0.2)) return;
151+
payAmount = payAmount - toNano(0.2);
151152
}
152153
if (payAmount === pay_amount) return;
153154

@@ -185,7 +186,8 @@ const Card: FC<CardProps> = ({ type }) => {
185186
balanceToken.balance,
186187
pay_token!.decimal
187188
),
188-
2
189+
2,
190+
false
189191
)}{" "}
190192
{pay_token?.symbol}
191193
</span>
@@ -238,7 +240,7 @@ const Card: FC<CardProps> = ({ type }) => {
238240
opacity: 0.5,
239241
}}
240242
>
241-
{calculatedRate}$
243+
${calculatedRate}
242244
</span>
243245
)}
244246
{type === "receive" && isFindingBestRoute && (

lib/components/SwapCard/CardButton.scss

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
.mytonswap-app {
22
.selection-box-container {
33
display: flex;
4+
height: 2.5rem;
45
align-items: center;
56
column-gap: 2px;
67
padding-left: 0.25rem;
78
padding-right: 0.25rem;
89
padding-top: 0.25rem;
910
padding-bottom: 0.25rem;
1011
border-radius: 9999px;
12+
font-size: var(--font-size-lg);
13+
font-weight: 700;
1114
&.loading {
1215
width: 5rem;
13-
height: 2rem;
16+
height: 2.5rem;
1417
}
1518
&.pay-loading {
1619
pointer-events: none;

0 commit comments

Comments
 (0)