[WEB-2145] chore: added copy button for intake issues (#5455)
* chore: added copy button for intake issues * Updated button UX Updated button UX and handleCopyIssue function * Removed commented code
This commit is contained in:
parent
6d8ba9dfa3
commit
b14a919c35
1 changed files with 13 additions and 4 deletions
|
|
@ -13,6 +13,7 @@ import {
|
||||||
Link,
|
Link,
|
||||||
Trash2,
|
Trash2,
|
||||||
MoveRight,
|
MoveRight,
|
||||||
|
Copy
|
||||||
} from "lucide-react";
|
} from "lucide-react";
|
||||||
import { Button, ControlLink, CustomMenu, TOAST_TYPE, setToast } from "@plane/ui";
|
import { Button, ControlLink, CustomMenu, TOAST_TYPE, setToast } from "@plane/ui";
|
||||||
// components
|
// components
|
||||||
|
|
@ -93,6 +94,7 @@ export const InboxIssueActionsHeader: FC<TInboxIssueActionsHeader> = observer((p
|
||||||
const currentInboxIssueId = inboxIssue?.issue?.id;
|
const currentInboxIssueId = inboxIssue?.issue?.id;
|
||||||
|
|
||||||
const issueLink = `${workspaceSlug}/projects/${issue?.project_id}/issues/${currentInboxIssueId}`;
|
const issueLink = `${workspaceSlug}/projects/${issue?.project_id}/issues/${currentInboxIssueId}`;
|
||||||
|
const intakeIssueLink = `${workspaceSlug}/projects/${issue?.project_id}/inbox/?currentTab=${currentTab}&inboxIssueId=${currentInboxIssueId}`;
|
||||||
|
|
||||||
const redirectIssue = (): string | undefined => {
|
const redirectIssue = (): string | undefined => {
|
||||||
let nextOrPreviousIssueId: string | undefined = undefined;
|
let nextOrPreviousIssueId: string | undefined = undefined;
|
||||||
|
|
@ -157,8 +159,8 @@ export const InboxIssueActionsHeader: FC<TInboxIssueActionsHeader> = observer((p
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleCopyIssueLink = () =>
|
const handleCopyIssueLink = (path: string) =>
|
||||||
copyUrlToClipboard(issueLink).then(() =>
|
copyUrlToClipboard(path).then(() =>
|
||||||
setToast({
|
setToast({
|
||||||
type: TOAST_TYPE.SUCCESS,
|
type: TOAST_TYPE.SUCCESS,
|
||||||
title: "Link copied",
|
title: "Link copied",
|
||||||
|
|
@ -316,7 +318,7 @@ export const InboxIssueActionsHeader: FC<TInboxIssueActionsHeader> = observer((p
|
||||||
variant="neutral-primary"
|
variant="neutral-primary"
|
||||||
prependIcon={<Link className="h-2.5 w-2.5" />}
|
prependIcon={<Link className="h-2.5 w-2.5" />}
|
||||||
size="sm"
|
size="sm"
|
||||||
onClick={handleCopyIssueLink}
|
onClick={() => handleCopyIssueLink(issueLink)}
|
||||||
>
|
>
|
||||||
Copy issue link
|
Copy issue link
|
||||||
</Button>
|
</Button>
|
||||||
|
|
@ -354,6 +356,12 @@ export const InboxIssueActionsHeader: FC<TInboxIssueActionsHeader> = observer((p
|
||||||
</div>
|
</div>
|
||||||
</CustomMenu.MenuItem>
|
</CustomMenu.MenuItem>
|
||||||
)}
|
)}
|
||||||
|
<CustomMenu.MenuItem onClick={() => handleCopyIssueLink(intakeIssueLink)}>
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<Copy size={14} strokeWidth={2} />
|
||||||
|
Copy issue link
|
||||||
|
</div>
|
||||||
|
</CustomMenu.MenuItem>
|
||||||
{canDelete && (
|
{canDelete && (
|
||||||
<CustomMenu.MenuItem onClick={() => setDeleteIssueModal(true)}>
|
<CustomMenu.MenuItem onClick={() => setDeleteIssueModal(true)}>
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
|
|
@ -362,6 +370,7 @@ export const InboxIssueActionsHeader: FC<TInboxIssueActionsHeader> = observer((p
|
||||||
</div>
|
</div>
|
||||||
</CustomMenu.MenuItem>
|
</CustomMenu.MenuItem>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
</CustomMenu>
|
</CustomMenu>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
|
|
@ -374,7 +383,7 @@ export const InboxIssueActionsHeader: FC<TInboxIssueActionsHeader> = observer((p
|
||||||
<InboxIssueActionsMobileHeader
|
<InboxIssueActionsMobileHeader
|
||||||
inboxIssue={inboxIssue}
|
inboxIssue={inboxIssue}
|
||||||
isSubmitting={isSubmitting}
|
isSubmitting={isSubmitting}
|
||||||
handleCopyIssueLink={handleCopyIssueLink}
|
handleCopyIssueLink={() => handleCopyIssueLink(issueLink)}
|
||||||
setAcceptIssueModal={setAcceptIssueModal}
|
setAcceptIssueModal={setAcceptIssueModal}
|
||||||
setDeclineIssueModal={setDeclineIssueModal}
|
setDeclineIssueModal={setDeclineIssueModal}
|
||||||
handleIssueSnoozeAction={handleIssueSnoozeAction}
|
handleIssueSnoozeAction={handleIssueSnoozeAction}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue