1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-08-08 15:05:30 +02:00

ref: Little refactoring

This commit is contained in:
Maksim Eltyshev 2024-06-21 11:47:58 +02:00
parent 1bdab239b5
commit da53e8938e
3 changed files with 21 additions and 17 deletions

View file

@ -81,9 +81,9 @@ const CardModal = React.memo(
onClose,
}) => {
const [t] = useTranslation();
const [isLinkCopied, setIsLinkCopied] = useState(false);
const isGalleryOpened = useRef(false);
const [isLinkCopied, setIsLinkCopied] = useState(false);
const handleToggleStopwatchClick = useCallback(() => {
onUpdate({
@ -147,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;
}, []);
@ -163,14 +171,6 @@ const CardModal = React.memo(
onClose();
}, [onClose]);
const handleLinkCopyClick = useCallback(() => {
navigator.clipboard.writeText(window.location.href);
setIsLinkCopied(true);
setTimeout(() => {
setIsLinkCopied(false);
}, 5000);
}, []);
const AttachmentAddPopup = usePopup(AttachmentAddStep);
const BoardMembershipsPopup = usePopup(BoardMembershipsStep);
const LabelsPopup = usePopup(LabelsStep);
@ -515,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"
@ -526,10 +534,6 @@ const CardModal = React.memo(
{t('action.delete')}
</Button>
</DeletePopup>
<Button fluid className={styles.actionButton} onClick={handleLinkCopyClick}>
<Icon name={isLinkCopied ? 'linkify' : 'unlink'} className={styles.actionIcon} />
{isLinkCopied ? t('action.linkIsCopied') : t('action.linkCopy')}
</Button>
</div>
</Grid.Column>
)}

View file

@ -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',
@ -201,8 +203,6 @@ export default {
hideDetails: 'Details ausblenden',
leaveBoard: 'Board verlassen',
leaveProject: 'Projekt verlassen',
linkCopy: 'Link kopieren',
linkIsCopied: 'Link kopiert',
logOut_title: 'Ausloggen',
makeCover_title: 'Als Vorschau festlegen',
move: 'Verschieben',

View file

@ -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',
@ -220,8 +222,6 @@ export default {
import: 'Import',
leaveBoard: 'Leave board',
leaveProject: 'Leave project',
linkCopy: 'Copy link',
linkIsCopied: 'Link is copied',
logOut_title: 'Log Out',
makeCover_title: 'Make Cover',
move: 'Move',