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
8cdc0c7f
Commit
8cdc0c7f
authored
Mar 09, 2024
by
steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: add delete tag action
parent
999a0530
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
1 deletion
+19
-1
TagList.tsx
web/src/components/TagList.tsx
+19
-1
No files found.
web/src/components/TagList.tsx
View file @
8cdc0c7f
...
...
@@ -5,6 +5,7 @@ import { useFilterStore, useTagStore } from "@/store/module";
import
{
useMemoList
}
from
"@/store/v1"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
import
showCreateTagDialog
from
"./CreateTagDialog"
;
import
{
showCommonDialog
}
from
"./Dialog/CommonDialog"
;
import
Icon
from
"./Icon"
;
import
showRenameTagDialog
from
"./RenameTagDialog"
;
...
...
@@ -97,7 +98,9 @@ interface TagItemContainerProps {
}
const
TagItemContainer
:
React
.
FC
<
TagItemContainerProps
>
=
(
props
:
TagItemContainerProps
)
=>
{
const
t
=
useTranslate
();
const
filterStore
=
useFilterStore
();
const
tagStore
=
useTagStore
();
const
{
tag
,
tagQuery
}
=
props
;
const
isActive
=
tagQuery
===
tag
.
text
;
const
hasSubTags
=
tag
.
subTags
.
length
>
0
;
...
...
@@ -116,6 +119,18 @@ const TagItemContainer: React.FC<TagItemContainerProps> = (props: TagItemContain
toggleSubTags
();
};
const
handleDeleteTag
=
async
()
=>
{
showCommonDialog
({
title
:
"Delete Tag"
,
content
:
"Are you sure to delete this tag?"
,
style
:
"danger"
,
dialogName
:
"delete-tag-dialog"
,
onConfirm
:
async
()
=>
{
await
tagStore
.
deleteTag
(
tag
.
text
);
},
});
};
return
(
<>
<
div
className=
"relative group flex flex-row justify-between items-center w-full h-8 py-0 mt-px first:mt-1 rounded-lg text-base sm:text-sm cursor-pointer select-none shrink-0 hover:opacity-80"
>
...
...
@@ -131,7 +146,10 @@ const TagItemContainer: React.FC<TagItemContainerProps> = (props: TagItemContain
</
div
>
</
MenuButton
>
<
Menu
size=
"sm"
placement=
"bottom-start"
>
<
MenuItem
onClick=
{
()
=>
showRenameTagDialog
({
tag
:
tag
.
text
})
}
>
Rename
</
MenuItem
>
<
MenuItem
onClick=
{
()
=>
showRenameTagDialog
({
tag
:
tag
.
text
})
}
>
{
t
(
"common.rename"
)
}
</
MenuItem
>
<
MenuItem
color=
"danger"
onClick=
{
handleDeleteTag
}
>
{
t
(
"common.delete"
)
}
</
MenuItem
>
</
Menu
>
</
Dropdown
>
<
span
className=
"truncate"
onClick=
{
handleTagClick
}
>
...
...
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