Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canifa_note
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
Vũ Hoàng Anh
canifa_note
Commits
1f7a90ce
Commit
1f7a90ce
authored
Sep 22, 2024
by
johnnyjoy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: add spinner to paged memo list
parent
339c3875
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
PagedMemoList.tsx
web/src/components/PagedMemoList/PagedMemoList.tsx
+9
-4
No files found.
web/src/components/PagedMemoList/PagedMemoList.tsx
View file @
1f7a90ce
import
{
Button
}
from
"@mui/joy"
;
import
{
Button
}
from
"@mui/joy"
;
import
{
ArrowDownIcon
}
from
"lucide-react"
;
import
{
ArrowDownIcon
,
LoaderIcon
}
from
"lucide-react"
;
import
{
useEffect
,
useState
}
from
"react"
;
import
{
useEffect
,
useState
}
from
"react"
;
import
{
DEFAULT_LIST_MEMOS_PAGE_SIZE
}
from
"@/helpers/consts"
;
import
{
DEFAULT_LIST_MEMOS_PAGE_SIZE
}
from
"@/helpers/consts"
;
import
{
useMemoList
,
useMemoStore
}
from
"@/store/v1"
;
import
{
useMemoList
,
useMemoStore
}
from
"@/store/v1"
;
...
@@ -24,7 +24,7 @@ const PagedMemoList = (props: Props) => {
...
@@ -24,7 +24,7 @@ const PagedMemoList = (props: Props) => {
const
memoStore
=
useMemoStore
();
const
memoStore
=
useMemoStore
();
const
memoList
=
useMemoList
();
const
memoList
=
useMemoList
();
const
[
state
,
setState
]
=
useState
<
State
>
({
const
[
state
,
setState
]
=
useState
<
State
>
({
isRequesting
:
false
,
isRequesting
:
true
,
// Initial request
nextPageToken
:
""
,
nextPageToken
:
""
,
});
});
const
sortedMemoList
=
props
.
listSort
?
props
.
listSort
(
memoList
.
value
)
:
memoList
.
value
;
const
sortedMemoList
=
props
.
listSort
?
props
.
listSort
(
memoList
.
value
)
:
memoList
.
value
;
...
@@ -55,7 +55,12 @@ const PagedMemoList = (props: Props) => {
...
@@ -55,7 +55,12 @@ const PagedMemoList = (props: Props) => {
return
(
return
(
<>
<>
{
sortedMemoList
.
map
((
memo
)
=>
props
.
renderer
(
memo
))
}
{
sortedMemoList
.
map
((
memo
)
=>
props
.
renderer
(
memo
))
}
{
state
.
nextPageToken
&&
(
{
state
.
isRequesting
&&
(
<
div
className=
"w-full flex flex-row justify-center items-center my-4"
>
<
LoaderIcon
className=
"animate-spin text-zinc-500"
/>
</
div
>
)
}
{
!
state
.
isRequesting
&&
state
.
nextPageToken
&&
(
<
div
className=
"w-full flex flex-row justify-center items-center my-4"
>
<
div
className=
"w-full flex flex-row justify-center items-center my-4"
>
<
Button
<
Button
variant=
"plain"
variant=
"plain"
...
@@ -68,7 +73,7 @@ const PagedMemoList = (props: Props) => {
...
@@ -68,7 +73,7 @@ const PagedMemoList = (props: Props) => {
</
Button
>
</
Button
>
</
div
>
</
div
>
)
}
)
}
{
!
state
.
nextPageToken
&&
sortedMemoList
.
length
===
0
&&
(
{
!
state
.
isRequesting
&&
!
state
.
nextPageToken
&&
sortedMemoList
.
length
===
0
&&
(
<
div
className=
"w-full mt-12 mb-8 flex flex-col justify-center items-center italic"
>
<
div
className=
"w-full mt-12 mb-8 flex flex-col justify-center items-center italic"
>
<
Empty
/>
<
Empty
/>
<
p
className=
"mt-2 text-gray-600 dark:text-gray-400"
>
{
t
(
"message.no-data"
)
}
</
p
>
<
p
className=
"mt-2 text-gray-600 dark:text-gray-400"
>
{
t
(
"message.no-data"
)
}
</
p
>
...
...
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