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:
@@ -57,6 +57,9 @@
|
|||||||
|
|
||||||
"contextMenu": {
|
"contextMenu": {
|
||||||
"assignToMe": "Cakto mua",
|
"assignToMe": "Cakto mua",
|
||||||
|
"copyLink": "Kopjo lidhjen e detyrës",
|
||||||
|
"linkCopied": "Lidhja u kopjua në clipboard",
|
||||||
|
"linkCopyFailed": "Dështoi kopjimi i lidhjes",
|
||||||
"moveTo": "Zhvendos në",
|
"moveTo": "Zhvendos në",
|
||||||
"unarchive": "Ç'arkivizo",
|
"unarchive": "Ç'arkivizo",
|
||||||
"archive": "Arkivizo",
|
"archive": "Arkivizo",
|
||||||
|
|||||||
@@ -57,6 +57,9 @@
|
|||||||
|
|
||||||
"contextMenu": {
|
"contextMenu": {
|
||||||
"assignToMe": "Mir zuweisen",
|
"assignToMe": "Mir zuweisen",
|
||||||
|
"copyLink": "Link zur Aufgabe kopieren",
|
||||||
|
"linkCopied": "Link in die Zwischenablage kopiert",
|
||||||
|
"linkCopyFailed": "Fehler beim Kopieren des Links",
|
||||||
"moveTo": "Verschieben nach",
|
"moveTo": "Verschieben nach",
|
||||||
"unarchive": "Dearchivieren",
|
"unarchive": "Dearchivieren",
|
||||||
"archive": "Archivieren",
|
"archive": "Archivieren",
|
||||||
|
|||||||
@@ -57,6 +57,9 @@
|
|||||||
|
|
||||||
"contextMenu": {
|
"contextMenu": {
|
||||||
"assignToMe": "Assign to me",
|
"assignToMe": "Assign to me",
|
||||||
|
"copyLink": "Copy link to task",
|
||||||
|
"linkCopied": "Link copied to clipboard",
|
||||||
|
"linkCopyFailed": "Failed to copy link",
|
||||||
"moveTo": "Move to",
|
"moveTo": "Move to",
|
||||||
"unarchive": "Unarchive",
|
"unarchive": "Unarchive",
|
||||||
"archive": "Archive",
|
"archive": "Archive",
|
||||||
|
|||||||
@@ -57,6 +57,9 @@
|
|||||||
|
|
||||||
"contextMenu": {
|
"contextMenu": {
|
||||||
"assignToMe": "Asignar a mí",
|
"assignToMe": "Asignar a mí",
|
||||||
|
"copyLink": "Copiar enlace a la tarea",
|
||||||
|
"linkCopied": "Enlace copiado al portapapeles",
|
||||||
|
"linkCopyFailed": "Error al copiar el enlace",
|
||||||
"moveTo": "Mover a",
|
"moveTo": "Mover a",
|
||||||
"unarchive": "Desarchivar",
|
"unarchive": "Desarchivar",
|
||||||
"archive": "Archivar",
|
"archive": "Archivar",
|
||||||
|
|||||||
@@ -57,6 +57,9 @@
|
|||||||
|
|
||||||
"contextMenu": {
|
"contextMenu": {
|
||||||
"assignToMe": "Atribuir a mim",
|
"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",
|
"moveTo": "Mover para",
|
||||||
"unarchive": "Desarquivar",
|
"unarchive": "Desarquivar",
|
||||||
"archive": "Arquivar",
|
"archive": "Arquivar",
|
||||||
|
|||||||
@@ -50,6 +50,9 @@
|
|||||||
"pendingInvitation": "待处理邀请",
|
"pendingInvitation": "待处理邀请",
|
||||||
"contextMenu": {
|
"contextMenu": {
|
||||||
"assignToMe": "分配给我",
|
"assignToMe": "分配给我",
|
||||||
|
"copyLink": "复制任务链接",
|
||||||
|
"linkCopied": "链接已复制到剪贴板",
|
||||||
|
"linkCopyFailed": "复制链接失败",
|
||||||
"moveTo": "移动到",
|
"moveTo": "移动到",
|
||||||
"unarchive": "取消归档",
|
"unarchive": "取消归档",
|
||||||
"archive": "归档",
|
"archive": "归档",
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ import {
|
|||||||
RetweetOutlined,
|
RetweetOutlined,
|
||||||
UserAddOutlined,
|
UserAddOutlined,
|
||||||
LoadingOutlined,
|
LoadingOutlined,
|
||||||
|
CopyOutlined,
|
||||||
|
message,
|
||||||
} from '@/shared/antd-imports';
|
} from '@/shared/antd-imports';
|
||||||
|
|
||||||
interface TaskContextMenuProps {
|
interface TaskContextMenuProps {
|
||||||
@@ -325,6 +327,21 @@ const TaskContextMenu: React.FC<TaskContextMenuProps> = ({
|
|||||||
}
|
}
|
||||||
}, [task?.id, projectId, dispatch, onClose]);
|
}, [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 menuItems = useMemo(() => {
|
||||||
const items = [
|
const items = [
|
||||||
{
|
{
|
||||||
@@ -344,6 +361,18 @@ const TaskContextMenu: React.FC<TaskContextMenuProps> = ({
|
|||||||
</button>
|
</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
|
// Add Move To submenu if there are options
|
||||||
@@ -500,6 +529,7 @@ const TaskContextMenu: React.FC<TaskContextMenuProps> = ({
|
|||||||
handleArchive,
|
handleArchive,
|
||||||
handleDelete,
|
handleDelete,
|
||||||
handleConvertToTask,
|
handleConvertToTask,
|
||||||
|
handleCopyLink,
|
||||||
getMoveToOptions,
|
getMoveToOptions,
|
||||||
dispatch,
|
dispatch,
|
||||||
t,
|
t,
|
||||||
|
|||||||
@@ -182,7 +182,8 @@ export {
|
|||||||
InfoCircleOutlined,
|
InfoCircleOutlined,
|
||||||
WarningTwoTone,
|
WarningTwoTone,
|
||||||
ShareAltOutlined,
|
ShareAltOutlined,
|
||||||
CloudDownloadOutlined
|
CloudDownloadOutlined,
|
||||||
|
CopyOutlined
|
||||||
} from '@ant-design/icons';
|
} from '@ant-design/icons';
|
||||||
|
|
||||||
// Re-export all components with React
|
// Re-export all components with React
|
||||||
|
|||||||
Reference in New Issue
Block a user