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
cf708674
Commit
cf708674
authored
May 29, 2024
by
Steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: update tag section
parent
719c22fe
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
32 deletions
+32
-32
TagsSection.tsx
web/src/components/HomeSidebar/TagsSection.tsx
+4
-30
UserStatisticsView.tsx
web/src/components/UserStatisticsView.tsx
+28
-2
No files found.
web/src/components/HomeSidebar/TagsSection.tsx
View file @
cf708674
import
{
Dropdown
,
Menu
,
MenuButton
,
MenuItem
,
Tooltip
}
from
"@mui/joy"
;
import
{
Dropdown
,
Menu
,
MenuButton
,
MenuItem
}
from
"@mui/joy"
;
import
clsx
from
"clsx"
;
import
toast
from
"react-hot-toast"
;
import
toast
from
"react-hot-toast"
;
import
{
useLocation
}
from
"react-router-dom"
;
import
{
useLocation
}
from
"react-router-dom"
;
import
useDebounce
from
"react-use/lib/useDebounce"
;
import
useDebounce
from
"react-use/lib/useDebounce"
;
...
@@ -42,36 +41,11 @@ const TagsSection = (props: Props) => {
...
@@ -42,36 +41,11 @@ const TagsSection = (props: Props) => {
await
tagStore
.
fetchTags
(
filters
.
join
(
" && "
));
await
tagStore
.
fetchTags
(
filters
.
join
(
" && "
));
};
};
const
handleRebuildMemoTags
=
()
=>
{
showCommonDialog
({
title
:
"Rebuild tags"
,
content
:
"It will rebuild tags for all memos, are you sure?"
,
style
:
"warning"
,
dialogName
:
"rebuild-memo-tags-dialog"
,
onConfirm
:
async
()
=>
{
await
memoServiceClient
.
rebuildMemoProperty
({
name
:
"memos/-"
,
});
await
fetchTags
();
toast
.
success
(
"Rebuild tags successfully"
);
},
});
};
return
(
return
(
<
div
className=
"flex flex-col justify-start items-start w-full mt-3 px-1 h-auto shrink-0 flex-nowrap hide-scrollbar"
>
<
div
className=
"flex flex-col justify-start items-start w-full mt-3 px-1 h-auto shrink-0 flex-nowrap hide-scrollbar"
>
<
div
className=
"group flex flex-row justify-start items-center w-full gap-1 mb-1"
>
<
div
className=
"flex flex-row justify-start items-center w-full gap-1 mb-1 text-sm leading-6 text-gray-400 select-none"
>
<
span
className=
"text-sm leading-6 font-mono text-gray-400 select-none"
>
{
t
(
"common.tags"
)
}
</
span
>
<
span
>
{
t
(
"common.tags"
)
}
</
span
>
{
!
props
.
readonly
&&
(
{
tagAmounts
.
length
>
0
&&
<
span
className=
"shrink-0"
>
(
{
tagAmounts
.
length
}
)
</
span
>
}
<
div
className=
{
clsx
(
"group-hover:block"
,
tagAmounts
.
length
>
0
?
"hidden"
:
""
)
}
>
<
Tooltip
title=
{
"Rebuild"
}
placement=
"top"
>
<
Icon
.
RefreshCcw
className=
"text-gray-400 w-4 h-auto cursor-pointer opacity-60 hover:opacity-100"
onClick=
{
handleRebuildMemoTags
}
/>
</
Tooltip
>
</
div
>
)
}
</
div
>
</
div
>
{
tagAmounts
.
length
>
0
?
(
{
tagAmounts
.
length
>
0
?
(
<
div
className=
"w-full flex flex-row justify-start items-center relative flex-wrap gap-x-2 gap-y-1"
>
<
div
className=
"w-full flex flex-row justify-start items-center relative flex-wrap gap-x-2 gap-y-1"
>
...
...
web/src/components/UserStatisticsView.tsx
View file @
cf708674
import
{
Divider
}
from
"@mui/joy"
;
import
{
Divider
,
Tooltip
}
from
"@mui/joy"
;
import
{
useEffect
,
useState
}
from
"react"
;
import
{
useEffect
,
useState
}
from
"react"
;
import
toast
from
"react-hot-toast"
;
import
{
memoServiceClient
}
from
"@/grpcweb"
;
import
{
memoServiceClient
}
from
"@/grpcweb"
;
import
{
useFilterStore
}
from
"@/store/module"
;
import
{
useFilterStore
}
from
"@/store/module"
;
import
{
useMemoStore
}
from
"@/store/v1"
;
import
{
useMemoStore
}
from
"@/store/v1"
;
import
{
User
}
from
"@/types/proto/api/v1/user_service"
;
import
{
User
}
from
"@/types/proto/api/v1/user_service"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
import
{
showCommonDialog
}
from
"./Dialog/CommonDialog"
;
import
Icon
from
"./Icon"
;
import
Icon
from
"./Icon"
;
interface
Props
{
interface
Props
{
...
@@ -52,10 +54,34 @@ const UserStatisticsView = (props: Props) => {
...
@@ -52,10 +54,34 @@ const UserStatisticsView = (props: Props) => {
})();
})();
},
[
memos
.
length
,
user
.
name
]);
},
[
memos
.
length
,
user
.
name
]);
const
handleRebuildMemoTags
=
()
=>
{
showCommonDialog
({
title
:
"Refresh"
,
content
:
"It will refersh memo properties, are you sure?"
,
style
:
"warning"
,
dialogName
:
"refersh-memo-property-dialog"
,
onConfirm
:
async
()
=>
{
await
memoServiceClient
.
rebuildMemoProperty
({
name
:
"memos/-"
,
});
toast
.
success
(
"Refresh successfully"
);
window
.
location
.
reload
();
},
});
};
return
(
return
(
<
div
className=
"w-full border mt-2 py-2 px-3 rounded-lg space-y-0.5 text-gray-500 dark:text-gray-400 bg-zinc-50 dark:bg-zinc-900 dark:border-zinc-800"
>
<
div
className=
"w-full border mt-2 py-2 px-3 rounded-lg space-y-0.5 text-gray-500 dark:text-gray-400 bg-zinc-50 dark:bg-zinc-900 dark:border-zinc-800"
>
<
div
className=
"w-full flex flex-row justify-between items-center"
>
<
div
className=
"
group
w-full flex flex-row justify-between items-center"
>
<
p
className=
"text-sm font-medium leading-6 dark:text-gray-500"
>
{
t
(
"common.statistics"
)
}
</
p
>
<
p
className=
"text-sm font-medium leading-6 dark:text-gray-500"
>
{
t
(
"common.statistics"
)
}
</
p
>
<
div
className=
"hidden group-hover:block"
>
<
Tooltip
title=
{
"Refresh"
}
placement=
"top"
>
<
Icon
.
RefreshCcw
className=
"text-gray-400 w-4 h-auto cursor-pointer opacity-60 hover:opacity-100"
onClick=
{
handleRebuildMemoTags
}
/>
</
Tooltip
>
</
div
>
</
div
>
</
div
>
<
div
className=
"w-full grid grid-cols-1 gap-x-4"
>
<
div
className=
"w-full grid grid-cols-1 gap-x-4"
>
<
div
className=
"w-full flex justify-between items-center"
>
<
div
className=
"w-full flex justify-between items-center"
>
...
...
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