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
Commits
4b21e38a
Commit
4b21e38a
authored
3 months ago
by
Lukas
Browse files
Options
Downloads
Patches
Plain Diff
Add pagination for comment search results and render results table based on view
parent
69a7edd7
Branches
Branches containing commit
No related tags found
1 merge request
!524
Lbudginas/#424 add new tab on account page
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
components/home/searches/searchesResults/CommentPermlinkSearchResults.tsx
+37
-5
37 additions, 5 deletions
...searches/searchesResults/CommentPermlinkSearchResults.tsx
with
37 additions
and
5 deletions
components/home/searches/searchesResults/CommentPermlinkSearchResults.tsx
+
37
−
5
View file @
4b21e38a
...
@@ -3,6 +3,10 @@ import CommentPermlinkResultTable from "../CommentPermlinkResultTable";
...
@@ -3,6 +3,10 @@ import CommentPermlinkResultTable from "../CommentPermlinkResultTable";
import
{
useSearchesContext
}
from
"
@/contexts/SearchesContext
"
;
import
{
useSearchesContext
}
from
"
@/contexts/SearchesContext
"
;
import
{
getCommentPageLink
}
from
"
../utils/commentSearchHelpers
"
;
import
{
getCommentPageLink
}
from
"
../utils/commentSearchHelpers
"
;
import
PostTypeSelector
from
"
../PostTypeSelector
"
;
import
PostTypeSelector
from
"
../PostTypeSelector
"
;
import
CustomPagination
from
"
@/components/CustomPagination
"
;
import
{
config
}
from
"
@/Config
"
;
import
{
useRouter
}
from
"
next/router
"
;
import
AccountCommentPermlinkResultTable
from
"
@/components/account/tabs/posts/AccountCommentPermlinkResultTable
"
;
const
CommentPermlinkSearchResults
=
()
=>
{
const
CommentPermlinkSearchResults
=
()
=>
{
const
{
const
{
...
@@ -11,7 +15,11 @@ const CommentPermlinkSearchResults = () => {
...
@@ -11,7 +15,11 @@ const CommentPermlinkSearchResults = () => {
setCommentType
,
setCommentType
,
setPermlinkSearchProps
,
setPermlinkSearchProps
,
searchRanges
,
searchRanges
,
permlinkPaginationPage
,
setPermlinkPaginationPage
,
}
=
useSearchesContext
();
}
=
useSearchesContext
();
const
router
=
useRouter
();
const
isAccountPage
=
Boolean
(
router
.
query
.
accountName
)
||
false
;
const
{
permlinkSearchData
}
=
usePermlinkSearch
(
permlinkSearchProps
);
const
{
permlinkSearchData
}
=
usePermlinkSearch
(
permlinkSearchProps
);
...
@@ -42,10 +50,27 @@ const CommentPermlinkSearchResults = () => {
...
@@ -42,10 +50,27 @@ const CommentPermlinkSearchResults = () => {
if
(
!
permlinkSearchData
)
return
;
if
(
!
permlinkSearchData
)
return
;
const
changePermlinkSearchPagination
=
(
newPageNum
:
number
)
=>
{
const
newSearchProps
:
any
=
{
...
permlinkSearchProps
,
pageNumber
:
newPageNum
,
};
setPermlinkSearchProps
(
newSearchProps
);
setPermlinkPaginationPage
(
newPageNum
);
};
return
(
return
(
<>
<>
{
permlinkSearchData
.
total_permlinks
?
(
{
permlinkSearchData
.
total_permlinks
?
(
<
div
>
<
div
>
<
div
className
=
"flex justify-center items-center text-text"
>
<
CustomPagination
currentPage
=
{
permlinkPaginationPage
}
totalCount
=
{
permlinkSearchData
.
total_permlinks
}
pageSize
=
{
config
.
standardPaginationSize
}
onPageChange
=
{
changePermlinkSearchPagination
}
/>
</
div
>
<
div
className
=
"flex justify-end my-4"
>
<
div
className
=
"flex justify-end my-4"
>
<
PostTypeSelector
<
PostTypeSelector
handleChange
=
{
handleChangeCommentType
}
handleChange
=
{
handleChangeCommentType
}
...
@@ -54,11 +79,18 @@ const CommentPermlinkSearchResults = () => {
...
@@ -54,11 +79,18 @@ const CommentPermlinkSearchResults = () => {
</
div
>
</
div
>
<
div
className
=
"flex flex-wrap"
>
<
div
className
=
"flex flex-wrap"
>
<
CommentPermlinkResultTable
{
isAccountPage
?
(
buildLink
=
{
buildLink
}
<
AccountCommentPermlinkResultTable
data
=
{
permlinkSearchData
.
permlinks_result
}
data
=
{
permlinkSearchData
.
permlinks_result
}
accountName
=
{
accountName
}
accountName
=
{
accountName
}
/>
/>
)
:
(
<
CommentPermlinkResultTable
buildLink
=
{
buildLink
}
data
=
{
permlinkSearchData
.
permlinks_result
}
accountName
=
{
accountName
}
/>
)
}
</
div
>
</
div
>
</
div
>
</
div
>
)
:
(
)
:
(
...
...
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