mirror of
https://github.com/plankanban/planka.git
synced 2025-07-18 12:49:43 +02:00
feat: Add copy link action to card modal (#804)
This commit is contained in:
parent
d8635e7915
commit
f8bf5ff18b
3 changed files with 22 additions and 1 deletions
|
@ -1,4 +1,4 @@
|
|||
import React, { useCallback, useRef } from 'react';
|
||||
import React, { useCallback, useRef, useState } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import classNames from 'classnames';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
@ -81,6 +81,7 @@ const CardModal = React.memo(
|
|||
onClose,
|
||||
}) => {
|
||||
const [t] = useTranslation();
|
||||
const [isLinkCopied, setIsLinkCopied] = useState(false);
|
||||
|
||||
const isGalleryOpened = useRef(false);
|
||||
|
||||
|
@ -146,6 +147,14 @@ const CardModal = React.memo(
|
|||
onClose();
|
||||
}, [onDuplicate, onClose]);
|
||||
|
||||
const handleCopyLinkClick = useCallback(() => {
|
||||
navigator.clipboard.writeText(window.location.href);
|
||||
setIsLinkCopied(true);
|
||||
setTimeout(() => {
|
||||
setIsLinkCopied(false);
|
||||
}, 5000);
|
||||
}, []);
|
||||
|
||||
const handleGalleryOpen = useCallback(() => {
|
||||
isGalleryOpened.current = true;
|
||||
}, []);
|
||||
|
@ -506,6 +515,14 @@ const CardModal = React.memo(
|
|||
<Icon name="copy outline" className={styles.actionIcon} />
|
||||
{t('action.duplicate')}
|
||||
</Button>
|
||||
<Button fluid className={styles.actionButton} onClick={handleCopyLinkClick}>
|
||||
<Icon name={isLinkCopied ? 'linkify' : 'unlink'} className={styles.actionIcon} />
|
||||
{isLinkCopied
|
||||
? t('common.linkIsCopied')
|
||||
: t('action.copyLink', {
|
||||
context: 'title',
|
||||
})}
|
||||
</Button>
|
||||
<DeletePopup
|
||||
title="common.deleteCard"
|
||||
content="common.areYouSureYouWantToDeleteThisCard"
|
||||
|
|
|
@ -104,6 +104,7 @@ export default {
|
|||
language: 'Sprache',
|
||||
leaveBoard_title: 'Board verlassen',
|
||||
leaveProject_title: 'Projekt verlassen',
|
||||
linkIsCopied: 'Link kopiert',
|
||||
list: 'Listen',
|
||||
listActions_title: 'Aufgaben auflisten',
|
||||
managers: 'Manager',
|
||||
|
@ -169,6 +170,7 @@ export default {
|
|||
addTask: 'Aufgabe hinzufügen',
|
||||
addToCard: 'Zu Karte hinzufügen',
|
||||
addUser: 'Benutzer hinzufügen',
|
||||
copyLink_title: 'Link kopieren',
|
||||
createBoard: 'Board erstellen',
|
||||
createFile: 'Datei erstellen',
|
||||
createLabel: 'Label erstellen',
|
||||
|
|
|
@ -106,6 +106,7 @@ export default {
|
|||
language: 'Language',
|
||||
leaveBoard_title: 'Leave Board',
|
||||
leaveProject_title: 'Leave Project',
|
||||
linkIsCopied: 'Link is copied',
|
||||
list: 'List',
|
||||
listActions_title: 'List Actions',
|
||||
managers: 'Managers',
|
||||
|
@ -183,6 +184,7 @@ export default {
|
|||
addTask: 'Add task',
|
||||
addToCard: 'Add to card',
|
||||
addUser: 'Add user',
|
||||
copyLink_title: 'Copy Link',
|
||||
createBoard: 'Create board',
|
||||
createFile: 'Create file',
|
||||
createLabel: 'Create label',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue