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
e7df504b
Commit
e7df504b
authored
Dec 28, 2022
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mocks
parent
bc0d69ae
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
44 deletions
+58
-44
index.ts
mocks/search/index.ts
+58
-0
useSearchQuery.tsx
ui/snippets/searchBar/useSearchQuery.tsx
+0
-44
No files found.
mocks/search/index.ts
0 → 100644
View file @
e7df504b
import
type
{
SearchResultToken
,
SearchResultBlock
,
SearchResultAddressOrContract
,
SearchResultTx
,
SearchResult
}
from
'
types/api/search
'
;
export
const
token1
:
SearchResultToken
=
{
address
:
'
0x377c5F2B300B25a534d4639177873b7fEAA56d4B
'
,
address_url
:
'
/address/0x377c5F2B300B25a534d4639177873b7fEAA56d4B
'
,
name
:
'
Toms NFT
'
,
symbol
:
'
TNT
'
,
token_url
:
'
/token/0x377c5F2B300B25a534d4639177873b7fEAA56d4B
'
,
type
:
'
token
'
as
const
,
};
export
const
token2
:
SearchResultToken
=
{
address
:
'
0xC35Cc7223B0175245E9964f2E3119c261E8e21F9
'
,
address_url
:
'
/address/0xC35Cc7223B0175245E9964f2E3119c261E8e21F9
'
,
name
:
'
TomToken
'
,
symbol
:
'
pdE1B
'
,
token_url
:
'
/token/0xC35Cc7223B0175245E9964f2E3119c261E8e21F9
'
,
type
:
'
token
'
as
const
,
};
export
const
block1
:
SearchResultBlock
=
{
block_hash
:
'
0x1af31d7535dded06bab9a88eb40ee2f8d0529a60ab3b8a7be2ba69b008cacbd1
'
,
block_number
:
8198536
,
type
:
'
block
'
as
const
,
url
:
'
/block/0x1af31d7535dded06bab9a88eb40ee2f8d0529a60ab3b8a7be2ba69b008cacbd1
'
,
};
export
const
address1
:
SearchResultAddressOrContract
=
{
address
:
'
0xb64a30399f7F6b0C154c2E7Af0a3ec7B0A5b131a
'
,
name
:
null
,
type
:
'
address
'
as
const
,
url
:
'
/address/0xb64a30399f7F6b0C154c2E7Af0a3ec7B0A5b131a
'
,
};
export
const
contract1
:
SearchResultAddressOrContract
=
{
address
:
'
0xb64a30399f7F6b0C154c2E7Af0a3ec7B0A5b131a
'
,
name
:
'
Unknown contract in this network
'
,
type
:
'
contract
'
as
const
,
url
:
'
/address/0xb64a30399f7F6b0C154c2E7Af0a3ec7B0A5b131a
'
,
};
export
const
tx1
:
SearchResultTx
=
{
tx_hash
:
'
0x349d4025d03c6faec117ee10ac0bce7c7a805dd2cbff7a9f101304d9a8a525dd
'
,
type
:
'
transaction
'
as
const
,
url
:
'
/tx/0x349d4025d03c6faec117ee10ac0bce7c7a805dd2cbff7a9f101304d9a8a525dd
'
,
};
export
const
baseResponse
:
SearchResult
=
{
items
:
[
token1
,
token2
,
block1
,
address1
,
contract1
,
tx1
,
],
next_page_params
:
null
,
};
ui/snippets/searchBar/useSearchQuery.tsx
View file @
e7df504b
...
...
@@ -6,50 +6,6 @@ import useDebounce from 'lib/hooks/useDebounce';
import
useQueryWithPages
from
'
lib/hooks/useQueryWithPages
'
;
import
useUpdateValueEffect
from
'
lib/hooks/useUpdateValueEffect
'
;
// const data = {
// items: [
// {
// address: '0x377c5F2B300B25a534d4639177873b7fEAA56d4B',
// address_url: '/address/0x377c5F2B300B25a534d4639177873b7fEAA56d4B',
// name: 'Toms NFT',
// symbol: 'TNT',
// token_url: '/token/0x377c5F2B300B25a534d4639177873b7fEAA56d4B',
// type: 'token' as const,
// },
// {
// address: '0xC35Cc7223B0175245E9964f2E3119c261E8e21F9',
// address_url: '/address/0xC35Cc7223B0175245E9964f2E3119c261E8e21F9',
// name: 'TomToken',
// symbol: 'pdE1B',
// token_url: '/token/0xC35Cc7223B0175245E9964f2E3119c261E8e21F9',
// type: 'token' as const,
// },
// {
// block_hash: '0x1af31d7535dded06bab9a88eb40ee2f8d0529a60ab3b8a7be2ba69b008cacbd1',
// block_number: 8198536,
// type: 'block' as const,
// url: '/block/0x1af31d7535dded06bab9a88eb40ee2f8d0529a60ab3b8a7be2ba69b008cacbd1',
// },
// {
// address: '0xb64a30399f7F6b0C154c2E7Af0a3ec7B0A5b131a',
// name: null,
// type: 'address' as const,
// url: '/address/0xb64a30399f7F6b0C154c2E7Af0a3ec7B0A5b131a',
// },
// {
// address: '0xb64a30399f7F6b0C154c2E7Af0a3ec7B0A5b131a',
// name: 'Unkown',
// type: 'contract' as const,
// url: '/address/0xb64a30399f7F6b0C154c2E7Af0a3ec7B0A5b131a',
// },
// {
// tx_hash: '0x349d4025d03c6faec117ee10ac0bce7c7a805dd2cbff7a9f101304d9a8a525dd',
// type: 'transaction' as const,
// url: '/tx/0x349d4025d03c6faec117ee10ac0bce7c7a805dd2cbff7a9f101304d9a8a525dd',
// },
// ],
// };
export
default
function
useSearchQuery
(
isSearchPage
=
false
)
{
const
router
=
useRouter
();
const
initialValue
=
isSearchPage
?
String
(
router
.
query
.
q
||
''
)
:
''
;
...
...
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