Skip to content
GitLab
Explore
Sign in
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
Merge requests
!494
Lbudginas/
#392
part1 reduce searches component
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Lbudginas/
#392
part1 reduce searches component
lbudginas/#392_part1_reduce_searches_component
into
develop
Overview
0
Commits
10
Pipelines
1
Changes
1
Merged
Lukas Budginas
requested to merge
lbudginas/#392_part1_reduce_searches_component
into
develop
4 months ago
Overview
0
Commits
10
Pipelines
1
Changes
1
Expand
#392 (closed)
PART 1 : Reduce searches section
Changes made:
Create context for all searches used on main page
Separate searches accordion and searches results sections
Create utility functions for each search
Make updates on other components which used updated components
Test if searches section is working as expected after changes (might need more time for testing, because of code refactoring)
0
0
Merge request reports
Viewing commit
e4d2d7da
Prev
Next
Show latest version
1 file
+
49
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
e4d2d7da
Create single component for all search responses
· e4d2d7da
Lukas
authored
4 months ago
components/home/searches/SearchesResponseSection.tsx
0 → 100644
+
49
−
0
Options
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
;
Loading