Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
interface
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
LuckySwap
interface
Commits
4deab755
Unverified
Commit
4deab755
authored
Sep 23, 2022
by
cartcrom
Committed by
GitHub
Sep 23, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: search crash and explore row numbering (#4715)
fixed
parent
b92c8007
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
3 deletions
+11
-3
SuggestionRow.tsx
src/components/NavBar/SuggestionRow.tsx
+2
-1
TokenTable.tsx
src/components/Tokens/TokenTable/TokenTable.tsx
+3
-2
TopTokens.ts
src/graphql/data/TopTokens.ts
+6
-0
No files found.
src/components/NavBar/SuggestionRow.tsx
View file @
4deab755
import
clsx
from
'
clsx
'
import
clsx
from
'
clsx
'
import
{
useGlobalChainName
}
from
'
graphql/data/util
'
import
uriToHttp
from
'
lib/utils/uriToHttp
'
import
uriToHttp
from
'
lib/utils/uriToHttp
'
import
{
Box
}
from
'
nft/components/Box
'
import
{
Box
}
from
'
nft/components/Box
'
import
{
Column
,
Row
}
from
'
nft/components/Flex
'
import
{
Column
,
Row
}
from
'
nft/components/Flex
'
...
@@ -128,7 +129,7 @@ export const TokenRow = ({ token, isHovered, setHoveredIndex, toggleOpen, index
...
@@ -128,7 +129,7 @@ export const TokenRow = ({ token, isHovered, setHoveredIndex, toggleOpen, index
return
(
return
(
<
Link
<
Link
to=
{
`/tokens/${token.address}`
}
to=
{
`/tokens/${
useGlobalChainName().toLowerCase()}/${
token.address}`
}
onClick=
{
handleClick
}
onClick=
{
handleClick
}
onMouseEnter=
{
()
=>
!
isHovered
&&
setHoveredIndex
(
index
)
}
onMouseEnter=
{
()
=>
!
isHovered
&&
setHoveredIndex
(
index
)
}
onMouseLeave=
{
()
=>
isHovered
&&
setHoveredIndex
(
undefined
)
}
onMouseLeave=
{
()
=>
isHovered
&&
setHoveredIndex
(
undefined
)
}
...
...
src/components/Tokens/TokenTable/TokenTable.tsx
View file @
4deab755
...
@@ -72,7 +72,8 @@ export default function TokenTable() {
...
@@ -72,7 +72,8 @@ export default function TokenTable() {
// TODO: consider moving prefetched call into app.tsx and passing it here, use a preloaded call & updated on interval every 60s
// TODO: consider moving prefetched call into app.tsx and passing it here, use a preloaded call & updated on interval every 60s
const
chainName
=
validateUrlChainParam
(
useParams
<
{
chainName
?:
string
}
>
().
chainName
)
const
chainName
=
validateUrlChainParam
(
useParams
<
{
chainName
?:
string
}
>
().
chainName
)
const
{
loading
,
tokens
,
tokensWithoutPriceHistoryCount
,
hasMore
,
loadMoreTokens
}
=
useTopTokens
(
chainName
)
const
{
loading
,
tokens
,
tokensWithoutPriceHistoryCount
,
hasMore
,
loadMoreTokens
,
maxFetchable
}
=
useTopTokens
(
chainName
)
const
showMoreLoadingRows
=
Boolean
(
loading
&&
hasMore
)
const
showMoreLoadingRows
=
Boolean
(
loading
&&
hasMore
)
const
observer
=
useRef
<
IntersectionObserver
>
()
const
observer
=
useRef
<
IntersectionObserver
>
()
...
@@ -123,7 +124,7 @@ export default function TokenTable() {
...
@@ -123,7 +124,7 @@ export default function TokenTable() {
<
LoadedRow
<
LoadedRow
key=
{
token
?.
address
}
key=
{
token
?.
address
}
tokenListIndex=
{
index
}
tokenListIndex=
{
index
}
tokenListLength=
{
tokens
?.
length
??
0
}
tokenListLength=
{
maxFetchable
}
token=
{
token
}
token=
{
token
}
ref=
{
index
+
1
===
tokens
.
length
?
lastTokenRef
:
undefined
}
ref=
{
index
+
1
===
tokens
.
length
?
lastTokenRef
:
undefined
}
/>
/>
...
...
src/graphql/data/TopTokens.ts
View file @
4deab755
...
@@ -162,6 +162,7 @@ interface UseTopTokensReturnValue {
...
@@ -162,6 +162,7 @@ interface UseTopTokensReturnValue {
tokensWithoutPriceHistoryCount
:
number
tokensWithoutPriceHistoryCount
:
number
hasMore
:
boolean
hasMore
:
boolean
loadMoreTokens
:
()
=>
void
loadMoreTokens
:
()
=>
void
maxFetchable
:
number
}
}
export
function
useTopTokens
(
chain
:
Chain
):
UseTopTokensReturnValue
{
export
function
useTopTokens
(
chain
:
Chain
):
UseTopTokensReturnValue
{
const
duration
=
toHistoryDuration
(
useAtomValue
(
filterTimeAtom
))
const
duration
=
toHistoryDuration
(
useAtomValue
(
filterTimeAtom
))
...
@@ -170,6 +171,10 @@ export function useTopTokens(chain: Chain): UseTopTokensReturnValue {
...
@@ -170,6 +171,10 @@ export function useTopTokens(chain: Chain): UseTopTokensReturnValue {
const
[
page
,
setPage
]
=
useState
(
0
)
const
[
page
,
setPage
]
=
useState
(
0
)
const
prefetchedData
=
usePrefetchTopTokens
(
duration
,
chain
)
const
prefetchedData
=
usePrefetchTopTokens
(
duration
,
chain
)
const
prefetchedSelectedTokensWithoutPriceHistory
=
useFilteredTokens
(
useSortedTokens
(
prefetchedData
.
topTokens
))
const
prefetchedSelectedTokensWithoutPriceHistory
=
useFilteredTokens
(
useSortedTokens
(
prefetchedData
.
topTokens
))
const
maxFetchable
=
useMemo
(
()
=>
prefetchedSelectedTokensWithoutPriceHistory
.
length
,
[
prefetchedSelectedTokensWithoutPriceHistory
]
)
const
hasMore
=
!
tokens
||
tokens
.
length
<
prefetchedSelectedTokensWithoutPriceHistory
.
length
const
hasMore
=
!
tokens
||
tokens
.
length
<
prefetchedSelectedTokensWithoutPriceHistory
.
length
...
@@ -239,6 +244,7 @@ export function useTopTokens(chain: Chain): UseTopTokensReturnValue {
...
@@ -239,6 +244,7 @@ export function useTopTokens(chain: Chain): UseTopTokensReturnValue {
hasMore
,
hasMore
,
tokensWithoutPriceHistoryCount
:
prefetchedSelectedTokensWithoutPriceHistory
.
length
,
tokensWithoutPriceHistoryCount
:
prefetchedSelectedTokensWithoutPriceHistory
.
length
,
loadMoreTokens
,
loadMoreTokens
,
maxFetchable
,
}
}
}
}
...
...
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