Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
frontend
Commits
d2e39b36
Commit
d2e39b36
authored
Jul 25, 2024
by
Max Alekseenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove get gas button from address page
parent
2faf4182
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
6 additions
and
105 deletions
+6
-105
AddressBalance.pw.tsx
ui/address/details/AddressBalance.pw.tsx
+0
-85
AddressBalance.tsx
ui/address/details/AddressBalance.tsx
+6
-20
AddressBalance.pw.tsx_dark-color-mode_with-get-gas-button-internal-dark-mode-1.png
...k-color-mode_with-get-gas-button-internal-dark-mode-1.png
+0
-0
AddressBalance.pw.tsx_default_base-view-1.png
...reenshots__/AddressBalance.pw.tsx_default_base-view-1.png
+0
-0
AddressBalance.pw.tsx_default_mobile-base-view-1.png
...ts__/AddressBalance.pw.tsx_default_mobile-base-view-1.png
+0
-0
AddressBalance.pw.tsx_default_with-get-gas-button-external-1.png
...Balance.pw.tsx_default_with-get-gas-button-external-1.png
+0
-0
AddressBalance.pw.tsx_default_with-get-gas-button-internal-dark-mode-1.png
....tsx_default_with-get-gas-button-internal-dark-mode-1.png
+0
-0
No files found.
ui/address/details/AddressBalance.pw.tsx
deleted
100644 → 0
View file @
2faf4182
import
{
Grid
,
Box
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
*
as
addressMock
from
'
mocks/address/address
'
;
import
{
test
,
expect
,
devices
}
from
'
playwright/lib
'
;
import
AddressBalance
from
'
./AddressBalance
'
;
const
ICON_URL
=
'
https://localhost:3000/my-icon.png
'
;
const
eoaWithSmallBalance
=
{
...
addressMock
.
eoa
,
coin_balance
:
'
500000000000000000
'
,
// 0.5 * 10^18
exchange_rate
:
'
1
'
,
// 1 USD
};
test
(
'
base view
'
,
async
({
render
})
=>
{
const
component
=
await
render
(
<
Grid
columnGap=
{
8
}
templateColumns=
{
{
base
:
'
minmax(0, 1fr)
'
,
lg
:
'
auto minmax(0, 1fr)
'
}
}
overflow=
"hidden"
>
<
AddressBalance
data=
{
addressMock
.
eoa
}
isLoading=
{
false
}
/>
</
Grid
>,
);
await
expect
(
component
).
toHaveScreenshot
();
});
test
(
'
with get gas button internal +@dark-mode
'
,
async
({
render
,
mockEnvs
,
mockAssetResponse
})
=>
{
await
mockEnvs
([
[
'
NEXT_PUBLIC_GAS_REFUEL_PROVIDER_CONFIG
'
,
`{"name": "Need gas?", "dapp_id": "duck", "url_template": "https://duck.url/{chainId}", "logo": "
${
ICON_URL
}
", "usd_threshold": 1}`
,
],
]);
await
mockAssetResponse
(
ICON_URL
,
'
./playwright/mocks/image_svg.svg
'
);
const
component
=
await
render
(
<
Grid
columnGap=
{
8
}
templateColumns=
{
{
base
:
'
minmax(0, 1fr)
'
,
lg
:
'
auto minmax(0, 1fr)
'
}
}
overflow=
"hidden"
>
<
AddressBalance
data=
{
eoaWithSmallBalance
}
isLoading=
{
false
}
/>
</
Grid
>,
);
await
expect
(
component
).
toHaveScreenshot
();
});
test
(
'
with get gas button external
'
,
async
({
render
,
mockEnvs
,
mockAssetResponse
})
=>
{
await
mockEnvs
([
[
'
NEXT_PUBLIC_GAS_REFUEL_PROVIDER_CONFIG
'
,
`{"name": "Need gas?", "url_template": "https://duck.url/{chainId}", "logo": "
${
ICON_URL
}
", "usd_threshold": 1}`
,
],
]);
await
mockAssetResponse
(
ICON_URL
,
'
./playwright/mocks/image_svg.svg
'
);
const
component
=
await
render
(
<
Grid
columnGap=
{
8
}
templateColumns=
{
{
base
:
'
minmax(0, 1fr)
'
,
lg
:
'
auto minmax(0, 1fr)
'
}
}
overflow=
"hidden"
>
<
AddressBalance
data=
{
eoaWithSmallBalance
}
isLoading=
{
false
}
/>
</
Grid
>,
);
await
expect
(
component
).
toHaveScreenshot
();
});
test
.
describe
(
'
mobile
'
,
()
=>
{
test
.
use
({
viewport
:
devices
[
'
iPhone 13 Pro
'
].
viewport
});
test
(
'
base view
'
,
async
({
render
,
mockEnvs
,
mockAssetResponse
})
=>
{
await
mockEnvs
([
[
'
NEXT_PUBLIC_GAS_REFUEL_PROVIDER_CONFIG
'
,
`{"name": "Need gas?", "dapp_id": "duck", "url_template": "https://duck.url/{chainId}", "logo": "
${
ICON_URL
}
", "usd_threshold": 1}`
,
],
]);
await
mockAssetResponse
(
ICON_URL
,
'
./playwright/mocks/image_svg.svg
'
);
const
component
=
await
render
(
<
Box
w=
"300px"
>
<
Grid
columnGap=
{
8
}
templateColumns=
{
{
base
:
'
minmax(0, 1fr)
'
,
lg
:
'
auto minmax(0, 1fr)
'
}
}
overflow=
"hidden"
>
<
AddressBalance
data=
{
eoaWithSmallBalance
}
isLoading=
{
false
}
/>
</
Grid
>
</
Box
>,
);
await
expect
(
component
).
toHaveScreenshot
();
});
});
ui/address/details/AddressBalance.tsx
View file @
d2e39b36
...
@@ -6,7 +6,6 @@ import type { Address } from 'types/api/address';
...
@@ -6,7 +6,6 @@ import type { Address } from 'types/api/address';
import
config
from
'
configs/app
'
;
import
config
from
'
configs/app
'
;
import
{
getResourceKey
}
from
'
lib/api/useApiQuery
'
;
import
{
getResourceKey
}
from
'
lib/api/useApiQuery
'
;
import
getCurrencyValue
from
'
lib/getCurrencyValue
'
;
import
useSocketChannel
from
'
lib/socket/useSocketChannel
'
;
import
useSocketChannel
from
'
lib/socket/useSocketChannel
'
;
import
useSocketMessage
from
'
lib/socket/useSocketMessage
'
;
import
useSocketMessage
from
'
lib/socket/useSocketMessage
'
;
import
{
currencyUnits
}
from
'
lib/units
'
;
import
{
currencyUnits
}
from
'
lib/units
'
;
...
@@ -14,10 +13,8 @@ import CurrencyValue from 'ui/shared/CurrencyValue';
...
@@ -14,10 +13,8 @@ import CurrencyValue from 'ui/shared/CurrencyValue';
import
*
as
DetailsInfoItem
from
'
ui/shared/DetailsInfoItem
'
;
import
*
as
DetailsInfoItem
from
'
ui/shared/DetailsInfoItem
'
;
import
NativeTokenIcon
from
'
ui/shared/NativeTokenIcon
'
;
import
NativeTokenIcon
from
'
ui/shared/NativeTokenIcon
'
;
import
GetGasButton
from
'
./GetGasButton
'
;
interface
Props
{
interface
Props
{
data
:
Pick
<
Address
,
'
block_number_balance_updated_at
'
|
'
coin_balance
'
|
'
hash
'
|
'
exchange_rate
'
|
'
is_contract
'
>
;
data
:
Pick
<
Address
,
'
block_number_balance_updated_at
'
|
'
coin_balance
'
|
'
hash
'
|
'
exchange_rate
'
>
;
isLoading
:
boolean
;
isLoading
:
boolean
;
}
}
...
@@ -68,14 +65,6 @@ const AddressBalance = ({ data, isLoading }: Props) => {
...
@@ -68,14 +65,6 @@ const AddressBalance = ({ data, isLoading }: Props) => {
handler
:
handleNewCoinBalanceMessage
,
handler
:
handleNewCoinBalanceMessage
,
});
});
const
value
=
data
.
coin_balance
||
'
0
'
;
const
exchangeRate
=
data
.
exchange_rate
;
const
decimals
=
String
(
config
.
chain
.
currency
.
decimals
);
const
accuracyUsd
=
2
;
const
accuracy
=
8
;
const
{
usd
:
usdResult
}
=
getCurrencyValue
({
value
,
accuracy
,
accuracyUsd
,
exchangeRate
,
decimals
});
return
(
return
(
<>
<>
<
DetailsInfoItem
.
Label
<
DetailsInfoItem
.
Label
...
@@ -87,18 +76,15 @@ const AddressBalance = ({ data, isLoading }: Props) => {
...
@@ -87,18 +76,15 @@ const AddressBalance = ({ data, isLoading }: Props) => {
<
DetailsInfoItem
.
Value
alignSelf=
"center"
flexWrap=
"nowrap"
>
<
DetailsInfoItem
.
Value
alignSelf=
"center"
flexWrap=
"nowrap"
>
<
NativeTokenIcon
boxSize=
{
6
}
mr=
{
2
}
isLoading=
{
isLoading
}
/>
<
NativeTokenIcon
boxSize=
{
6
}
mr=
{
2
}
isLoading=
{
isLoading
}
/>
<
CurrencyValue
<
CurrencyValue
value=
{
value
}
value=
{
data
.
coin_balance
||
'
0
'
}
exchangeRate=
{
exchangeR
ate
}
exchangeRate=
{
data
.
exchange_r
ate
}
decimals=
{
decimals
}
decimals=
{
String
(
config
.
chain
.
currency
.
decimals
)
}
currency=
{
currencyUnits
.
ether
}
currency=
{
currencyUnits
.
ether
}
accuracyUsd=
{
accuracyUsd
}
accuracyUsd=
{
2
}
accuracy=
{
accuracy
}
accuracy=
{
8
}
flexWrap=
"wrap"
flexWrap=
"wrap"
isLoading=
{
isLoading
}
isLoading=
{
isLoading
}
/>
/>
{
!
isLoading
&&
(
<
GetGasButton
usdValue=
{
usdResult
}
isContract=
{
data
?.
is_contract
}
/>
)
}
</
DetailsInfoItem
.
Value
>
</
DetailsInfoItem
.
Value
>
</>
</>
);
);
...
...
ui/address/details/__screenshots__/AddressBalance.pw.tsx_dark-color-mode_with-get-gas-button-internal-dark-mode-1.png
deleted
100644 → 0
View file @
2faf4182
6.47 KB
ui/address/details/__screenshots__/AddressBalance.pw.tsx_default_base-view-1.png
deleted
100644 → 0
View file @
2faf4182
7.46 KB
ui/address/details/__screenshots__/AddressBalance.pw.tsx_default_mobile-base-view-1.png
deleted
100644 → 0
View file @
2faf4182
6.13 KB
ui/address/details/__screenshots__/AddressBalance.pw.tsx_default_with-get-gas-button-external-1.png
deleted
100644 → 0
View file @
2faf4182
6.38 KB
ui/address/details/__screenshots__/AddressBalance.pw.tsx_default_with-get-gas-button-internal-dark-mode-1.png
deleted
100644 → 0
View file @
2faf4182
6.23 KB
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment