feat(task-context-menu): add copy link functionality and update translations

- Implemented a new "Copy link to task" feature in the task context menu, allowing users to easily copy task links to the clipboard.
- Added corresponding success and error messages for link copying.
- Updated localization files for Albanian, German, English, Spanish, Portuguese, and Chinese to include new translation keys for the copy link feature.
This commit is contained in:
chamikaJ
2025-07-29 12:49:51 +05:30
parent c2b231d5cc
commit 29b8c1b2af
8 changed files with 50 additions and 1 deletions

View File

@@ -57,6 +57,9 @@
"contextMenu": {
"assignToMe": "Cakto mua",
"copyLink": "Kopjo lidhjen e detyrës",
"linkCopied": "Lidhja u kopjua në clipboard",
"linkCopyFailed": "Dështoi kopjimi i lidhjes",
"moveTo": "Zhvendos në",
"unarchive": "Ç'arkivizo",
"archive": "Arkivizo",

View File

@@ -57,6 +57,9 @@
"contextMenu": {
"assignToMe": "Mir zuweisen",
"copyLink": "Link zur Aufgabe kopieren",
"linkCopied": "Link in die Zwischenablage kopiert",
"linkCopyFailed": "Fehler beim Kopieren des Links",
"moveTo": "Verschieben nach",
"unarchive": "Dearchivieren",
"archive": "Archivieren",

View File

@@ -57,6 +57,9 @@
"contextMenu": {
"assignToMe": "Assign to me",
"copyLink": "Copy link to task",
"linkCopied": "Link copied to clipboard",
"linkCopyFailed": "Failed to copy link",
"moveTo": "Move to",
"unarchive": "Unarchive",
"archive": "Archive",

View File

@@ -57,6 +57,9 @@
"contextMenu": {
"assignToMe": "Asignar a mí",
"copyLink": "Copiar enlace a la tarea",
"linkCopied": "Enlace copiado al portapapeles",
"linkCopyFailed": "Error al copiar el enlace",
"moveTo": "Mover a",
"unarchive": "Desarchivar",
"archive": "Archivar",

View File

@@ -57,6 +57,9 @@
"contextMenu": {
"assignToMe": "Atribuir a mim",
"copyLink": "Copiar link da tarefa",
"linkCopied": "Link copiado para a área de transferência",
"linkCopyFailed": "Falha ao copiar o link",
"moveTo": "Mover para",
"unarchive": "Desarquivar",
"archive": "Arquivar",

View File

@@ -50,6 +50,9 @@
"pendingInvitation": "待处理邀请",
"contextMenu": {
"assignToMe": "分配给我",
"copyLink": "复制任务链接",
"linkCopied": "链接已复制到剪贴板",
"linkCopyFailed": "复制链接失败",
"moveTo": "移动到",
"unarchive": "取消归档",
"archive": "归档",

View File

@@ -32,6 +32,8 @@ import {
RetweetOutlined,
UserAddOutlined,
LoadingOutlined,
CopyOutlined,
message,
} from '@/shared/antd-imports';
interface TaskContextMenuProps {
@@ -325,6 +327,21 @@ const TaskContextMenu: React.FC<TaskContextMenuProps> = ({
}
}, [task?.id, projectId, dispatch, onClose]);
const handleCopyLink = useCallback(async () => {
if (!projectId || !task.id) return;
try {
const taskLink = `${window.location.origin}/worklenz/projects/${projectId}?tab=tasks-list&pinned_tab=tasks-list&task=${task.id}`;
await navigator.clipboard.writeText(taskLink);
message.success(t('contextMenu.linkCopied'));
} catch (error) {
logger.error('Error copying link:', error);
message.error(t('contextMenu.linkCopyFailed'));
} finally {
onClose();
}
}, [projectId, task.id, onClose, t]);
const menuItems = useMemo(() => {
const items = [
{
@@ -344,6 +361,18 @@ const TaskContextMenu: React.FC<TaskContextMenuProps> = ({
</button>
),
},
{
key: 'copyLink',
label: (
<button
onClick={handleCopyLink}
className="flex items-center gap-2 px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 w-full text-left"
>
<CopyOutlined className="text-gray-500 dark:text-gray-400" />
<span>{t('contextMenu.copyLink')}</span>
</button>
),
},
];
// Add Move To submenu if there are options
@@ -500,6 +529,7 @@ const TaskContextMenu: React.FC<TaskContextMenuProps> = ({
handleArchive,
handleDelete,
handleConvertToTask,
handleCopyLink,
getMoveToOptions,
dispatch,
t,

View File

@@ -182,7 +182,8 @@ export {
InfoCircleOutlined,
WarningTwoTone,
ShareAltOutlined,
CloudDownloadOutlined
CloudDownloadOutlined,
CopyOutlined
} from '@ant-design/icons';
// Re-export all components with React