Skip to content

Commit

Permalink
[WEB-2145] chore: added copy button for intake issues (makeplane#5455)
Browse files Browse the repository at this point in the history
* chore: added copy button for intake issues

* Updated button UX

Updated button UX and handleCopyIssue function

* Removed commented code
  • Loading branch information
Jimmycutie authored Aug 29, 2024
1 parent 6d8ba9d commit b14a919
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions web/core/components/inbox/content/inbox-issue-header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
Link,
Trash2,
MoveRight,
Copy
} from "lucide-react";
import { Button, ControlLink, CustomMenu, TOAST_TYPE, setToast } from "@plane/ui";
// components
Expand Down Expand Up @@ -93,6 +94,7 @@ export const InboxIssueActionsHeader: FC<TInboxIssueActionsHeader> = observer((p
const currentInboxIssueId = inboxIssue?.issue?.id;

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 => {
let nextOrPreviousIssueId: string | undefined = undefined;
Expand Down Expand Up @@ -157,8 +159,8 @@ export const InboxIssueActionsHeader: FC<TInboxIssueActionsHeader> = observer((p
}
};

const handleCopyIssueLink = () =>
copyUrlToClipboard(issueLink).then(() =>
const handleCopyIssueLink = (path: string) =>
copyUrlToClipboard(path).then(() =>
setToast({
type: TOAST_TYPE.SUCCESS,
title: "Link copied",
Expand Down Expand Up @@ -316,7 +318,7 @@ export const InboxIssueActionsHeader: FC<TInboxIssueActionsHeader> = observer((p
variant="neutral-primary"
prependIcon={<Link className="h-2.5 w-2.5" />}
size="sm"
onClick={handleCopyIssueLink}
onClick={() => handleCopyIssueLink(issueLink)}
>
Copy issue link
</Button>
Expand Down Expand Up @@ -354,6 +356,12 @@ export const InboxIssueActionsHeader: FC<TInboxIssueActionsHeader> = observer((p
</div>
</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 && (
<CustomMenu.MenuItem onClick={() => setDeleteIssueModal(true)}>
<div className="flex items-center gap-2">
Expand All @@ -362,6 +370,7 @@ export const InboxIssueActionsHeader: FC<TInboxIssueActionsHeader> = observer((p
</div>
</CustomMenu.MenuItem>
)}

</CustomMenu>
)}
</>
Expand All @@ -374,7 +383,7 @@ export const InboxIssueActionsHeader: FC<TInboxIssueActionsHeader> = observer((p
<InboxIssueActionsMobileHeader
inboxIssue={inboxIssue}
isSubmitting={isSubmitting}
handleCopyIssueLink={handleCopyIssueLink}
handleCopyIssueLink={() => handleCopyIssueLink(issueLink)}
setAcceptIssueModal={setAcceptIssueModal}
setDeclineIssueModal={setDeclineIssueModal}
handleIssueSnoozeAction={handleIssueSnoozeAction}
Expand Down

0 comments on commit b14a919

Please sign in to comment.