Skip to content

Commit 566cdb5

Browse files
Empty table state component, remove search banner (#1252)
## High Level Overview of Change Minor cosmetic changes: - AMM TVL now shows -- when there are no AMMs found - When there are no dex trades or transfers found, empty state looks consistent with explorer design - empty state separated into reusable component - remove search banner ahead of token page launch before: <img width="1281" height="171" alt="Screenshot 2025-10-24 at 11 28 53 AM" src="https://github.com/user-attachments/assets/c8c6728d-3316-4a4b-b1d5-12302bbc9201" /> after: <img width="1226" height="427" alt="Screenshot 2025-10-24 at 11 28 18 AM" src="https://github.com/user-attachments/assets/7323848f-ae90-481a-a848-bcdf90bff74f" /> <!-- Please include a summary/list of the changes. If too broad, please consider splitting into multiple PRs. --> ### Context of Change <!-- Please include the context of a change. If a bug fix, when was the bug introduced? What was the behavior? If a new feature, why was this architecture chosen? What were the alternatives? If a refactor, how is this better than the previous implementation? If there is a design document for this feature, please link it here. --> ### Type of Change <!-- Please check relevant options, delete irrelevant ones. --> - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] Refactor (non-breaking change that only restructures code) - [ ] Tests (You added tests for code that already exists, or your new feature included in this PR) - [ ] Documentation Updates - [ ] Translation Updates - [ ] Release ### Codebase Modernization <!-- In an effort to modernize the codebase, you should convert the files that you work with to React Hooks and TypeScript, and update tests to use the React Testing Library instead of Enzyme. If this is not possible (e.g. it's too many changes, touching too many files, etc.) please explain why here. --> - [ ] Updated files to React Hooks - [ ] Updated files to TypeScript - [ ] Updated tests to React Testing Library ## Before / After <!-- If just refactoring / back-end changes, this can be just an in-English description of the change at a technical level. If a UI change, screenshots should be included. --> ## Test Plan <!-- Please describe the tests that you ran to verify your changes and provide instructions so that others can reproduce. --> <!-- ## Future Tasks For future tasks related to PR. -->
1 parent 5e89193 commit 566cdb5

File tree

18 files changed

+137
-131
lines changed

18 files changed

+137
-131
lines changed

public/locales/ca-CA/translations.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,6 @@
561561
"can_trade": null,
562562
"can_transfer": null,
563563
"can_clawback": null,
564-
"search_results_banner": null,
565564
"enable_amendment_name": null,
566565
"amendment_status": null,
567566
"expected_date": null,

public/locales/en-US/translations.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,6 @@
562562
"can_trade": "Can Trade",
563563
"can_transfer": "Can Transfer",
564564
"can_clawback": "Can Clawback",
565-
"search_results_banner": "Token search by name and account is now available! Try searching for USD",
566565
"enable_amendment_name": "Amendment Name",
567566
"amendment_status": "Amendment Status",
568567
"expected_date": "Expected Date",

public/locales/es-ES/translations.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,6 @@
549549
"can_trade": "Puede Comerciar",
550550
"can_transfer": "Puede Transferir",
551551
"can_clawback": "Puede Recuperar",
552-
"search_results_banner": "¡La búsqueda de tokens por nombre y cuenta ya está disponible! Intenta buscar USD",
553552
"assets.no_mpts_message": null,
554553
"transaction_type_name_MPTokenIssuanceCreate": null,
555554
"transaction_type_name_MPTokenIssuanceDestroy": null,

public/locales/fr-FR/translations.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,6 @@
558558
"can_trade": null,
559559
"can_transfer": null,
560560
"can_clawback": null,
561-
"search_results_banner": null,
562561
"enable_amendment_name": null,
563562
"amendment_status": null,
564563
"expected_date": null,

public/locales/ja-JP/translations.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,6 @@
557557
"can_trade": null,
558558
"can_transfer": null,
559559
"can_clawback": null,
560-
"search_results_banner": "トークン名とアカウントで検索が可能になりました! USDと検索してみてください",
561560
"enable_amendment_name": null,
562561
"amendment_status": null,
563562
"expected_date": null,

public/locales/ko-KR/translations.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,6 @@
555555
"can_trade": null,
556556
"can_transfer": null,
557557
"can_clawback": null,
558-
"search_results_banner": null,
559558
"enable_amendment_name": null,
560559
"amendment_status": null,
561560
"expected_date": null,

public/locales/my-MM/translations.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,6 @@
564564
"can_trade": "ရောင်းဝယ်နိုင်",
565565
"can_transfer": "လွှဲပြောင်းနိုင်",
566566
"can_clawback": "ပြန်လည်ရယူနိုင်",
567-
"search_results_banner": "Token ကို အမည်နှင့် အကောင့်ဖြင့် ရှာဖွေခြင်း ယခု ရရှိနိုင်ပါပြီ! USD ဖြင့် ရှာကြည့်ပါ",
568567
"enable_amendment_name": "ပြင်ဆင်ချက် အမည်",
569568
"amendment_status": "ပြင်ဆင်ချက် အခြေအနေ",
570569
"expected_date": "မျှော်မှန်းရက်စွဲ",

src/containers/Header/Search.tsx

Lines changed: 15 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
import {
2-
FC,
3-
KeyboardEventHandler,
4-
useContext,
5-
useEffect,
6-
useState,
7-
} from 'react'
1+
import { KeyboardEventHandler, useContext, useState } from 'react'
82
import { useTranslation } from 'react-i18next'
93
import { useNavigate } from 'react-router-dom'
104
import { XrplClient } from 'xrpl-client'
@@ -13,7 +7,6 @@ import {
137
isValidXAddress,
148
classicAddressToXAddress,
159
} from 'ripple-address-codec'
16-
import CloseIcon from '../shared/images/close.png'
1710

1811
import { useAnalytics } from '../shared/analytics'
1912
import SocketContext from '../shared/SocketContext'
@@ -148,26 +141,6 @@ const normalizeAccount = (id: string) => {
148141
return id
149142
}
150143

151-
const SearchBanner: FC<{ setIsBannerVisible: (visible: boolean) => void }> = ({
152-
setIsBannerVisible,
153-
}) => {
154-
const { t } = useTranslation()
155-
return (
156-
<div className="banner-search">
157-
<div className="banner-content">
158-
<div>{t('search_results_banner')}</div>
159-
<button
160-
className="banner-button"
161-
type="button"
162-
onClick={() => setIsBannerVisible(false)}
163-
>
164-
<img src={CloseIcon} alt="close-icon" width={10} height={10} />
165-
</button>
166-
</div>
167-
</div>
168-
)
169-
}
170-
171144
export interface SearchProps {
172145
callback?: Function
173146
}
@@ -199,36 +172,21 @@ export const Search = ({ callback = () => {} }: SearchProps) => {
199172
}
200173
}
201174

202-
const [isBannerVisible, setIsBannerVisible] = useState(true)
203-
204-
useEffect(() => {
205-
const timeoutId = setTimeout(() => {
206-
setIsBannerVisible(false)
207-
}, 10000) // Disappear after 10 seconds
208-
209-
return () => clearTimeout(timeoutId)
210-
}, [])
211-
212175
return (
213-
<>
214-
{process.env.VITE_ENVIRONMENT === 'mainnet' && isBannerVisible && (
215-
<SearchBanner setIsBannerVisible={setIsBannerVisible} />
216-
)}
217-
<div className="search">
218-
<input
219-
type="text"
220-
placeholder={t('header.search.placeholder')}
221-
onKeyDown={onKeyDown}
222-
value={currentSearchInput}
223-
onChange={(e) => setCurrentSearchInput(e.target.value)}
176+
<div className="search">
177+
<input
178+
type="text"
179+
placeholder={t('header.search.placeholder')}
180+
onKeyDown={onKeyDown}
181+
value={currentSearchInput}
182+
onChange={(e) => setCurrentSearchInput(e.target.value)}
183+
/>
184+
{process.env.VITE_ENVIRONMENT === 'mainnet' && (
185+
<TokenSearchResults
186+
setCurrentSearchInput={setCurrentSearchInput}
187+
currentSearchValue={currentSearchInput}
224188
/>
225-
{process.env.VITE_ENVIRONMENT === 'mainnet' && (
226-
<TokenSearchResults
227-
setCurrentSearchInput={setCurrentSearchInput}
228-
currentSearchValue={currentSearchInput}
229-
/>
230-
)}
231-
</div>
232-
</>
189+
)}
190+
</div>
233191
)
234192
}

src/containers/Header/search.scss

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -46,62 +46,3 @@
4646
.normal.fade-out {
4747
opacity: 0;
4848
}
49-
50-
.banner-search {
51-
position: absolute;
52-
top: 50px;
53-
left: 10%;
54-
width: 80%;
55-
max-width: 600px;
56-
padding: 12px 16px;
57-
border-radius: 4px;
58-
background-color: $blue-purple-30 !important;
59-
color: $black !important;
60-
61-
.banner-content {
62-
display: flex;
63-
justify-content: space-between;
64-
font-size: 14px;
65-
font-weight: 500;
66-
}
67-
68-
.banner-button {
69-
width: 5px;
70-
height: 5px;
71-
padding: 5px;
72-
padding-left: 10px;
73-
border: none;
74-
margin-top: -5px;
75-
background: none;
76-
color: inherit;
77-
}
78-
79-
@media (width >= 1350px) {
80-
top: -60px;
81-
}
82-
@media (1000px <= width < 1350px) {
83-
top: -70px;
84-
}
85-
@media (900px <= width < 1000px) {
86-
top: -80px;
87-
}
88-
@media (750px <= width < 900px) {
89-
top: 60px;
90-
}
91-
92-
@media (max-width: $tablet-portrait-upper-boundary) {
93-
left: 5%;
94-
width: 90%;
95-
}
96-
}
97-
98-
.banner-search::after {
99-
position: absolute;
100-
top: 100%;
101-
left: 30%;
102-
border-width: 8px;
103-
border-style: solid;
104-
border-color: $blue-purple-30 transparent transparent transparent;
105-
content: '';
106-
transform: translateX(-50%);
107-
}

src/containers/Token/components/DexTradeTable/DexTradeTable.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { useEffect, useRef } from 'react'
33
import { Link } from 'react-router-dom'
44
import { Account } from '../../../shared/components/Account'
55
import { Loader } from '../../../shared/components/Loader'
6+
import { EmptyStateMessage } from '../../../shared/components/EmptyStateMessage'
67
import { useTooltip, Tooltip } from '../../../shared/components/Tooltip'
78
import HoverIcon from '../../../shared/images/hover.svg'
89
import ArrowIcon from '../../../shared/images/down_arrow.svg'
@@ -275,7 +276,7 @@ export const DexTradeTable = ({
275276
)}
276277

277278
{!isLoading && (!transactions || transactions.length === 0) && (
278-
<div>{t('token_page.dex_no_trades')}</div>
279+
<EmptyStateMessage message={t('token_page.dex_no_trades')} />
279280
)}
280281
</div>
281282
)

0 commit comments

Comments
 (0)