Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
Block Explorer UI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hive
Block Explorer UI
Commits
e4d2d7da
Commit
e4d2d7da
authored
3 months ago
by
Lukas
Browse files
Options
Downloads
Patches
Plain Diff
Create single component for all search responses
parent
f9570ce0
No related branches found
No related tags found
1 merge request
!494
Lbudginas/#392 part1 reduce searches component
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
components/home/searches/SearchesResponseSection.tsx
+49
-0
49 additions, 0 deletions
components/home/searches/SearchesResponseSection.tsx
with
49 additions
and
0 deletions
components/home/searches/SearchesResponseSection.tsx
0 → 100644
+
49
−
0
View file @
e4d2d7da
import
{
useRef
}
from
"
react
"
;
import
BlockSearchResults
from
"
./searchesResults/BlockSearchResults
"
;
import
CommentPermlinkSearchResults
from
"
./searchesResults/CommentPermlinkSearchResults
"
;
import
CommentSearchResults
from
"
./searchesResults/CommentSearchResults
"
;
import
AccountSearchResults
from
"
./searchesResults/AccountSearchResults
"
;
import
{
useSearchesContext
}
from
"
@/contexts/SearchesContext
"
;
import
useBlockSearch
from
"
@/hooks/api/homePage/useBlockSearch
"
;
import
useAccountOperations
from
"
@/hooks/api/accountPage/useAccountOperations
"
;
import
useCommentSearch
from
"
@/hooks/api/common/useCommentSearch
"
;
import
usePermlinkSearch
from
"
@/hooks/api/common/usePermlinkSearch
"
;
const
SearchesResponseSection
=
()
=>
{
const
searchesRef
=
useRef
<
HTMLDivElement
|
null
>
(
null
);
const
{
blockSearchProps
,
accountOperationsSearchProps
,
permlinkSearchProps
,
commentSearchProps
,
lastSearchKey
,
}
=
useSearchesContext
();
const
{
blockSearchData
}
=
useBlockSearch
(
blockSearchProps
);
const
{
accountOperations
}
=
useAccountOperations
(
accountOperationsSearchProps
);
const
{
permlinkSearchData
}
=
usePermlinkSearch
(
permlinkSearchProps
);
const
{
commentSearchData
}
=
useCommentSearch
(
commentSearchProps
);
return
(
<
div
className
=
"pt-4 scroll-mt-16"
ref
=
{
searchesRef
}
>
{
blockSearchData
&&
lastSearchKey
===
"
block
"
&&
<
BlockSearchResults
/>
}
{
accountOperations
&&
lastSearchKey
===
"
account
"
&&
(
<
AccountSearchResults
/>
)
}
{
permlinkSearchData
&&
lastSearchKey
===
"
comment-permlink
"
&&
(
<
CommentPermlinkSearchResults
/>
)
}
{
commentSearchData
&&
lastSearchKey
===
"
comment
"
&&
(
<
CommentSearchResults
/>
)
}
</
div
>
);
};
export
default
SearchesResponseSection
;
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment