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
08a92919
Commit
08a92919
authored
May 31, 2024
by
Steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: update timeline filters
parent
98f2cf63
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
16 deletions
+17
-16
Timeline.tsx
web/src/pages/Timeline.tsx
+17
-16
No files found.
web/src/pages/Timeline.tsx
View file @
08a92919
...
@@ -29,7 +29,7 @@ const Timeline = () => {
...
@@ -29,7 +29,7 @@ const Timeline = () => {
const
memoStore
=
useMemoStore
();
const
memoStore
=
useMemoStore
();
const
memoList
=
useMemoList
();
const
memoList
=
useMemoList
();
const
[,
setLastVisited
]
=
useLocalStorage
<
string
>
(
"lastVisited"
,
Routes
.
TIMELINE
);
const
[,
setLastVisited
]
=
useLocalStorage
<
string
>
(
"lastVisited"
,
Routes
.
TIMELINE
);
const
{
tag
:
tagQuery
,
text
:
textQuery
}
=
useFilterWithUrlParams
();
const
filter
=
useFilterWithUrlParams
();
const
[
activityStats
,
setActivityStats
]
=
useState
<
Record
<
string
,
number
>>
({});
const
[
activityStats
,
setActivityStats
]
=
useState
<
Record
<
string
,
number
>>
({});
const
[
selectedDateString
,
setSelectedDateString
]
=
useState
<
string
>
(
new
Date
().
toDateString
());
const
[
selectedDateString
,
setSelectedDateString
]
=
useState
<
string
>
(
new
Date
().
toDateString
());
const
[
isRequesting
,
setIsRequesting
]
=
useState
(
true
);
const
[
isRequesting
,
setIsRequesting
]
=
useState
(
true
);
...
@@ -44,21 +44,11 @@ const Timeline = () => {
...
@@ -44,21 +44,11 @@ const Timeline = () => {
useEffect
(()
=>
{
useEffect
(()
=>
{
memoList
.
reset
();
memoList
.
reset
();
fetchMemos
(
""
);
fetchMemos
(
""
);
},
[
selectedDateString
,
tagQuery
,
textQuery
]);
},
[
selectedDateString
,
filter
.
text
,
filter
.
tag
,
filter
.
memoPropertyFilter
]);
useEffect
(()
=>
{
useEffect
(()
=>
{
(
async
()
=>
{
(
async
()
=>
{
const
filters
=
[
`row_status == "NORMAL"`
];
const
filters
=
[
`row_status == "NORMAL"`
];
const
contentSearch
:
string
[]
=
[];
if
(
textQuery
)
{
contentSearch
.
push
(
JSON
.
stringify
(
textQuery
));
}
if
(
contentSearch
.
length
>
0
)
{
filters
.
push
(
`content_search == [
${
contentSearch
.
join
(
", "
)}
]`
);
}
if
(
tagQuery
)
{
filters
.
push
(
`tag == "
${
tagQuery
}
"`
);
}
const
{
stats
}
=
await
memoServiceClient
.
getUserMemosStats
({
const
{
stats
}
=
await
memoServiceClient
.
getUserMemosStats
({
name
:
user
.
name
,
name
:
user
.
name
,
timezone
:
Intl
.
DateTimeFormat
().
resolvedOptions
().
timeZone
,
timezone
:
Intl
.
DateTimeFormat
().
resolvedOptions
().
timeZone
,
...
@@ -79,14 +69,25 @@ const Timeline = () => {
...
@@ -79,14 +69,25 @@ const Timeline = () => {
setIsRequesting
(
true
);
setIsRequesting
(
true
);
const
filters
=
[
`creator == "
${
user
.
name
}
"`
,
`row_status == "NORMAL"`
];
const
filters
=
[
`creator == "
${
user
.
name
}
"`
,
`row_status == "NORMAL"`
];
const
contentSearch
:
string
[]
=
[];
const
contentSearch
:
string
[]
=
[];
if
(
textQuery
)
{
if
(
filter
.
text
)
{
contentSearch
.
push
(
JSON
.
stringify
(
textQuery
));
contentSearch
.
push
(
JSON
.
stringify
(
filter
.
text
));
}
}
if
(
contentSearch
.
length
>
0
)
{
if
(
contentSearch
.
length
>
0
)
{
filters
.
push
(
`content_search == [
${
contentSearch
.
join
(
", "
)}
]`
);
filters
.
push
(
`content_search == [
${
contentSearch
.
join
(
", "
)}
]`
);
}
}
if
(
tagQuery
)
{
if
(
filter
.
tag
)
{
filters
.
push
(
`tag == "
${
tagQuery
}
"`
);
filters
.
push
(
`tag == "
${
filter
.
tag
}
"`
);
}
if
(
filter
.
memoPropertyFilter
)
{
if
(
filter
.
memoPropertyFilter
.
hasLink
)
{
filters
.
push
(
`has_link == true`
);
}
if
(
filter
.
memoPropertyFilter
.
hasTaskList
)
{
filters
.
push
(
`has_task_list == true`
);
}
if
(
filter
.
memoPropertyFilter
.
hasCode
)
{
filters
.
push
(
`has_code == true`
);
}
}
}
if
(
selectedDateString
)
{
if
(
selectedDateString
)
{
const
selectedDateStamp
=
getTimeStampByDate
(
selectedDateString
);
const
selectedDateStamp
=
getTimeStampByDate
(
selectedDateString
);
...
...
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