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
15a091fe
Commit
15a091fe
authored
Dec 18, 2023
by
Steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: fix offset params in explore page
parent
d8a05281
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
32 deletions
+8
-32
Explore.tsx
web/src/pages/Explore.tsx
+8
-32
No files found.
web/src/pages/Explore.tsx
View file @
15a091fe
...
@@ -7,7 +7,6 @@ import MobileHeader from "@/components/MobileHeader";
...
@@ -7,7 +7,6 @@ import MobileHeader from "@/components/MobileHeader";
import
{
DEFAULT_MEMO_LIMIT
}
from
"@/helpers/consts"
;
import
{
DEFAULT_MEMO_LIMIT
}
from
"@/helpers/consts"
;
import
{
useFilterStore
,
useMemoStore
}
from
"@/store/module"
;
import
{
useFilterStore
,
useMemoStore
}
from
"@/store/module"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
import
{
TAG_REG
}
from
"@/utils/tag"
;
const
Explore
=
()
=>
{
const
Explore
=
()
=>
{
const
t
=
useTranslate
();
const
t
=
useTranslate
();
...
@@ -15,38 +14,15 @@ const Explore = () => {
...
@@ -15,38 +14,15 @@ const Explore = () => {
const
memoStore
=
useMemoStore
();
const
memoStore
=
useMemoStore
();
const
filter
=
filterStore
.
state
;
const
filter
=
filterStore
.
state
;
const
{
loadingStatus
,
memos
}
=
memoStore
.
state
;
const
{
loadingStatus
,
memos
}
=
memoStore
.
state
;
const
{
tag
:
tagQuery
,
text
:
textQuery
}
=
filter
;
const
{
text
:
textQuery
}
=
filter
;
const
showMemoFilter
=
Boolean
(
tagQuery
||
textQuery
);
const
fetchMoreRef
=
useRef
<
HTMLSpanElement
>
(
null
);
const
fetchMoreRef
=
useRef
<
HTMLSpanElement
>
(
null
);
const
fetchedMemos
=
showMemoFilter
const
fetchedMemos
=
memos
.
filter
((
memo
)
=>
{
?
memos
.
filter
((
memo
)
=>
{
let
shouldShow
=
true
;
if
(
tagQuery
)
{
const
tagsSet
=
new
Set
<
string
>
();
for
(
const
t
of
Array
.
from
(
memo
.
content
.
match
(
new
RegExp
(
TAG_REG
,
"g"
))
??
[]))
{
const
tag
=
t
.
replace
(
TAG_REG
,
"$1"
).
trim
();
const
items
=
tag
.
split
(
"/"
);
let
temp
=
""
;
for
(
const
i
of
items
)
{
temp
+=
i
;
tagsSet
.
add
(
temp
);
temp
+=
"/"
;
}
}
if
(
!
tagsSet
.
has
(
tagQuery
))
{
shouldShow
=
false
;
}
}
if
(
textQuery
&&
!
memo
.
content
.
toLowerCase
().
includes
(
textQuery
.
toLowerCase
()))
{
if
(
textQuery
&&
!
memo
.
content
.
toLowerCase
().
includes
(
textQuery
.
toLowerCase
()))
{
shouldShow
=
false
;
return
false
;
}
}
return
true
;
return
shouldShow
;
});
})
:
memos
;
const
sortedMemos
=
fetchedMemos
const
sortedMemos
=
fetchedMemos
.
filter
((
m
)
=>
m
.
rowStatus
===
"NORMAL"
&&
m
.
visibility
!==
"PRIVATE"
)
.
filter
((
m
)
=>
m
.
rowStatus
===
"NORMAL"
&&
m
.
visibility
!==
"PRIVATE"
)
...
@@ -71,7 +47,7 @@ const Explore = () => {
...
@@ -71,7 +47,7 @@ const Explore = () => {
const
handleFetchMoreClick
=
async
()
=>
{
const
handleFetchMoreClick
=
async
()
=>
{
try
{
try
{
await
memoStore
.
fetchAllMemos
(
DEFAULT_MEMO_LIMIT
,
m
emos
.
length
);
await
memoStore
.
fetchAllMemos
(
DEFAULT_MEMO_LIMIT
,
sortedM
emos
.
length
);
}
catch
(
error
:
any
)
{
}
catch
(
error
:
any
)
{
toast
.
error
(
error
.
response
.
data
.
message
);
toast
.
error
(
error
.
response
.
data
.
message
);
}
}
...
...
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