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
2a4ebf57
Commit
2a4ebf57
authored
Jan 18, 2024
by
Steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: add search bar in archived page
parent
5172e4df
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
15 deletions
+36
-15
Archived.tsx
web/src/pages/Archived.tsx
+36
-15
No files found.
web/src/pages/Archived.tsx
View file @
2a4ebf57
...
@@ -6,11 +6,14 @@ import { showCommonDialog } from "@/components/Dialog/CommonDialog";
...
@@ -6,11 +6,14 @@ import { showCommonDialog } from "@/components/Dialog/CommonDialog";
import
Empty
from
"@/components/Empty"
;
import
Empty
from
"@/components/Empty"
;
import
Icon
from
"@/components/Icon"
;
import
Icon
from
"@/components/Icon"
;
import
MemoContent
from
"@/components/MemoContent"
;
import
MemoContent
from
"@/components/MemoContent"
;
import
MemoFilter
from
"@/components/MemoFilter"
;
import
MobileHeader
from
"@/components/MobileHeader"
;
import
MobileHeader
from
"@/components/MobileHeader"
;
import
SearchBar
from
"@/components/SearchBar"
;
import
{
memoServiceClient
}
from
"@/grpcweb"
;
import
{
memoServiceClient
}
from
"@/grpcweb"
;
import
{
getDateTimeString
}
from
"@/helpers/datetime"
;
import
{
getDateTimeString
}
from
"@/helpers/datetime"
;
import
useCurrentUser
from
"@/hooks/useCurrentUser"
;
import
useCurrentUser
from
"@/hooks/useCurrentUser"
;
import
useLoading
from
"@/hooks/useLoading"
;
import
useLoading
from
"@/hooks/useLoading"
;
import
{
useFilterStore
}
from
"@/store/module"
;
import
{
useMemoStore
}
from
"@/store/v1"
;
import
{
useMemoStore
}
from
"@/store/v1"
;
import
{
RowStatus
}
from
"@/types/proto/api/v2/common"
;
import
{
RowStatus
}
from
"@/types/proto/api/v2/common"
;
import
{
Memo
}
from
"@/types/proto/api/v2/memo_service"
;
import
{
Memo
}
from
"@/types/proto/api/v2/memo_service"
;
...
@@ -20,13 +23,25 @@ const Archived = () => {
...
@@ -20,13 +23,25 @@ const Archived = () => {
const
t
=
useTranslate
();
const
t
=
useTranslate
();
const
loadingState
=
useLoading
();
const
loadingState
=
useLoading
();
const
user
=
useCurrentUser
();
const
user
=
useCurrentUser
();
const
filterStore
=
useFilterStore
();
const
memoStore
=
useMemoStore
();
const
memoStore
=
useMemoStore
();
const
[
archivedMemos
,
setArchivedMemos
]
=
useState
<
Memo
[]
>
([]);
const
[
archivedMemos
,
setArchivedMemos
]
=
useState
<
Memo
[]
>
([]);
const
{
tag
:
tagQuery
,
text
:
textQuery
}
=
filterStore
.
state
;
useEffect
(()
=>
{
useEffect
(()
=>
{
(
async
()
=>
{
(
async
()
=>
{
try
{
try
{
const
filters
=
[
`creator == "
${
user
.
name
}
"`
,
"row_status == 'ARCHIVED'"
];
const
filters
=
[
`creator == "
${
user
.
name
}
"`
,
"row_status == 'ARCHIVED'"
];
const
contentSearch
:
string
[]
=
[];
if
(
tagQuery
)
{
contentSearch
.
push
(
`"#
${
tagQuery
}
"`
);
}
if
(
textQuery
)
{
contentSearch
.
push
(
`"
${
textQuery
}
"`
);
}
if
(
contentSearch
.
length
>
0
)
{
filters
.
push
(
`content_search == [
${
contentSearch
.
join
(
", "
)}
]`
);
}
const
{
memos
}
=
await
memoServiceClient
.
listMemos
({
const
{
memos
}
=
await
memoServiceClient
.
listMemos
({
filter
:
filters
.
join
(
" && "
),
filter
:
filters
.
join
(
" && "
),
});
});
...
@@ -36,7 +51,7 @@ const Archived = () => {
...
@@ -36,7 +51,7 @@ const Archived = () => {
}
}
loadingState
.
setFinish
();
loadingState
.
setFinish
();
})();
})();
},
[]);
},
[
tagQuery
,
textQuery
]);
const
handleDeleteMemoClick
=
async
(
memo
:
Memo
)
=>
{
const
handleDeleteMemoClick
=
async
(
memo
:
Memo
)
=>
{
showCommonDialog
({
showCommonDialog
({
...
@@ -72,6 +87,13 @@ const Archived = () => {
...
@@ -72,6 +87,13 @@ const Archived = () => {
<
section
className=
"@container w-full max-w-5xl min-h-full flex flex-col justify-start items-start sm:pt-3 md:pt-6 pb-8"
>
<
section
className=
"@container w-full max-w-5xl min-h-full flex flex-col justify-start items-start sm:pt-3 md:pt-6 pb-8"
>
<
MobileHeader
/>
<
MobileHeader
/>
<
div
className=
"w-full px-4 sm:px-6"
>
<
div
className=
"w-full px-4 sm:px-6"
>
<
div
className=
"w-full flex flex-col justify-start items-start"
>
<
div
className=
"w-full flex flex-row justify-end items-center mb-2"
>
<
div
className=
"w-40"
>
<
SearchBar
/>
</
div
>
</
div
>
<
MemoFilter
className=
"px-2 pb-2"
/>
{
loadingState
.
isLoading
?
(
{
loadingState
.
isLoading
?
(
<
div
className=
"w-full h-32 flex flex-col justify-center items-center"
>
<
div
className=
"w-full h-32 flex flex-col justify-center items-center"
>
<
p
className=
"opacity-70"
>
{
t
(
"memo.fetching-data"
)
}
</
p
>
<
p
className=
"opacity-70"
>
{
t
(
"memo.fetching-data"
)
}
</
p
>
...
@@ -82,8 +104,7 @@ const Archived = () => {
...
@@ -82,8 +104,7 @@ const Archived = () => {
<
p
className=
"mt-4 text-gray-600 dark:text-gray-400"
>
{
t
(
"message.no-data"
)
}
</
p
>
<
p
className=
"mt-4 text-gray-600 dark:text-gray-400"
>
{
t
(
"message.no-data"
)
}
</
p
>
</
div
>
</
div
>
)
:
(
)
:
(
<
div
className=
"w-full flex flex-col justify-start items-start"
>
archivedMemos
.
map
((
memo
)
=>
(
{
archivedMemos
.
map
((
memo
)
=>
(
<
div
<
div
key=
{
memo
.
id
}
key=
{
memo
.
id
}
className=
"relative flex flex-col justify-start items-start w-full p-4 pt-3 mb-2 bg-white dark:bg-zinc-800 rounded-lg"
className=
"relative flex flex-col justify-start items-start w-full p-4 pt-3 mb-2 bg-white dark:bg-zinc-800 rounded-lg"
...
@@ -107,10 +128,10 @@ const Archived = () => {
...
@@ -107,10 +128,10 @@ const Archived = () => {
</
div
>
</
div
>
<
MemoContent
memoId=
{
memo
.
id
}
nodes=
{
memo
.
nodes
}
readonly=
{
true
}
/>
<
MemoContent
memoId=
{
memo
.
id
}
nodes=
{
memo
.
nodes
}
readonly=
{
true
}
/>
</
div
>
</
div
>
))
}
))
</
div
>
)
}
)
}
</
div
>
</
div
>
</
div
>
</
section
>
</
section
>
);
);
};
};
...
...
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