Add copy link button to notification (#2444)

Signed-off-by: Denis Maslennikov <denis.maslennikov@gmail.com>
This commit is contained in:
Denis Maslennikov 2022-12-16 14:10:52 +07:00 committed by GitHub
parent 27b003f35f
commit cbf83a55ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 5 deletions

View File

@ -70,7 +70,7 @@
import view from '@hcengineering/view'
import { ObjectBox } from '@hcengineering/view-resources'
import { createEventDispatcher } from 'svelte'
import { activeProject, activeSprint, updateIssueRelation } from '../issues'
import { activeProject, activeSprint, generateIssueShortLink, getIssueId, updateIssueRelation } from '../issues'
import tracker from '../plugin'
import AssigneeEditor from './issues/AssigneeEditor.svelte'
import ParentIssue from './issues/ParentIssue.svelte'
@ -555,7 +555,8 @@
addNotification(tracker.string.IssueCreated, getTitle(object.title), IssueNotification, {
issueId: objectId,
subTitlePostfix: (await translate(tracker.string.Created, { value: 1 })).toLowerCase()
subTitlePostfix: (await translate(tracker.string.Created, { value: 1 })).toLowerCase(),
issueUrl: currentTeam && generateIssueShortLink(getIssueId(currentTeam, value as Issue))
})
objectId = generateId()

View File

@ -11,7 +11,7 @@
Label,
showPanel
} from '@hcengineering/ui'
import { createQuery } from '@hcengineering/presentation'
import { copyTextToClipboard, createQuery } from '@hcengineering/presentation'
import { Issue, IssueStatus } from '@hcengineering/tracker'
import IssueStatusIcon from './IssueStatusIcon.svelte'
@ -79,6 +79,11 @@
onRemove()
}
const handleCopyUrl = () => {
if (issue) {
copyTextToClipboard(params?.issueUrl)
}
}
</script>
<div class="root" in:fade out:fade>
@ -104,8 +109,18 @@
</div>
</div>
</div>
<div class="view-issue-button">
<Button label={tracker.string.ViewIssue} kind="link" size="medium" on:click={handleIssueOpened} />
<div class="row">
<div class="view-issue-button">
<Button label={tracker.string.ViewIssue} kind="link" size="medium" on:click={handleIssueOpened} />
</div>
<div class="copy-link-button">
<Button
icon={tracker.icon.CopyURL}
kind={'link'}
label={tracker.string.CopyIssueUrl}
on:click={handleCopyUrl}
/>
</div>
</div>
</div>
@ -152,6 +167,11 @@
margin-left: -5px;
}
.copy-link-button {
margin-top: 10px;
margin-left: 5px;
}
.title {
display: flex;
align-items: center;