Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix hovering and delete button issues in backlog view #78

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions src/components/BacklogView/Issue/DeleteButton.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ActionIcon, Transition, Popover, Box } from "@mantine/core"
import { IconTrash } from "@tabler/icons"
import { useEffect, useState } from "react"
import { useHover } from "@mantine/hooks";
import { DeleteIssueAlert } from "../../DetailView/Components/DeleteIssue/DeleteIssueAlert"

export function DeleteButton({
Expand All @@ -11,15 +12,16 @@ export function DeleteButton({
issueKey: string
}) {
const [issuePopoverOpened, setIssuePopoverOpened] = useState(false)
const { ref, hovered } = useHover()

useEffect(() => {
if (!mounted) {
if (!mounted && !hovered) {
setIssuePopoverOpened(false)
}
}, [mounted])
}, [mounted, hovered])

return (
<Box sx={{ position: "absolute", bottom: 5, right: 11 }}>
<Box ref={ref} sx={{ position: "absolute", bottom: 5, right: 11 }}>
<Transition
mounted={mounted}
transition="fade"
Expand All @@ -41,7 +43,10 @@ export function DeleteButton({
size="sm"
variant="transparent"
style={styles}
onClick={() => setIssuePopoverOpened(!issuePopoverOpened)}
onClick={(e) => {
e.stopPropagation()
setIssuePopoverOpened(!issuePopoverOpened)
}}
>
<IconTrash />
</ActionIcon>
Expand All @@ -54,6 +59,13 @@ export function DeleteButton({
: theme.white,
})}
>
<div style={{
height: "20px",
position: "absolute",
width: "inherit",
left: "0px",
top: "-10px",
}} />
<DeleteIssueAlert
issueKey={issueKey}
closeModal={() => setIssuePopoverOpened(false)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ export function DeleteIssueAlert({
If you delete this issue, all related subtasks will be deleted as well!
</Alert>
<Button
onClick={() => {
closeModal()
onClick={(e) => {
e.stopPropagation()
deleteIssue.mutate(issueKey)
closeModal()
}}
>
Confirm
Expand Down