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:
parent
1bdab239b5
commit
da53e8938e
3 changed files with 21 additions and 17 deletions
|
@ -81,9 +81,9 @@ const CardModal = React.memo(
|
||||||
onClose,
|
onClose,
|
||||||
}) => {
|
}) => {
|
||||||
const [t] = useTranslation();
|
const [t] = useTranslation();
|
||||||
|
const [isLinkCopied, setIsLinkCopied] = useState(false);
|
||||||
|
|
||||||
const isGalleryOpened = useRef(false);
|
const isGalleryOpened = useRef(false);
|
||||||
const [isLinkCopied, setIsLinkCopied] = useState(false);
|
|
||||||
|
|
||||||
const handleToggleStopwatchClick = useCallback(() => {
|
const handleToggleStopwatchClick = useCallback(() => {
|
||||||
onUpdate({
|
onUpdate({
|
||||||
|
@ -147,6 +147,14 @@ const CardModal = React.memo(
|
||||||
onClose();
|
onClose();
|
||||||
}, [onDuplicate, onClose]);
|
}, [onDuplicate, onClose]);
|
||||||
|
|
||||||
|
const handleCopyLinkClick = useCallback(() => {
|
||||||
|
navigator.clipboard.writeText(window.location.href);
|
||||||
|
setIsLinkCopied(true);
|
||||||
|
setTimeout(() => {
|
||||||
|
setIsLinkCopied(false);
|
||||||
|
}, 5000);
|
||||||
|
}, []);
|
||||||
|
|
||||||
const handleGalleryOpen = useCallback(() => {
|
const handleGalleryOpen = useCallback(() => {
|
||||||
isGalleryOpened.current = true;
|
isGalleryOpened.current = true;
|
||||||
}, []);
|
}, []);
|
||||||
|
@ -163,14 +171,6 @@ const CardModal = React.memo(
|
||||||
onClose();
|
onClose();
|
||||||
}, [onClose]);
|
}, [onClose]);
|
||||||
|
|
||||||
const handleLinkCopyClick = useCallback(() => {
|
|
||||||
navigator.clipboard.writeText(window.location.href);
|
|
||||||
setIsLinkCopied(true);
|
|
||||||
setTimeout(() => {
|
|
||||||
setIsLinkCopied(false);
|
|
||||||
}, 5000);
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
const AttachmentAddPopup = usePopup(AttachmentAddStep);
|
const AttachmentAddPopup = usePopup(AttachmentAddStep);
|
||||||
const BoardMembershipsPopup = usePopup(BoardMembershipsStep);
|
const BoardMembershipsPopup = usePopup(BoardMembershipsStep);
|
||||||
const LabelsPopup = usePopup(LabelsStep);
|
const LabelsPopup = usePopup(LabelsStep);
|
||||||
|
@ -515,6 +515,14 @@ const CardModal = React.memo(
|
||||||
<Icon name="copy outline" className={styles.actionIcon} />
|
<Icon name="copy outline" className={styles.actionIcon} />
|
||||||
{t('action.duplicate')}
|
{t('action.duplicate')}
|
||||||
</Button>
|
</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
|
<DeletePopup
|
||||||
title="common.deleteCard"
|
title="common.deleteCard"
|
||||||
content="common.areYouSureYouWantToDeleteThisCard"
|
content="common.areYouSureYouWantToDeleteThisCard"
|
||||||
|
@ -526,10 +534,6 @@ const CardModal = React.memo(
|
||||||
{t('action.delete')}
|
{t('action.delete')}
|
||||||
</Button>
|
</Button>
|
||||||
</DeletePopup>
|
</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>
|
</div>
|
||||||
</Grid.Column>
|
</Grid.Column>
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -104,6 +104,7 @@ export default {
|
||||||
language: 'Sprache',
|
language: 'Sprache',
|
||||||
leaveBoard_title: 'Board verlassen',
|
leaveBoard_title: 'Board verlassen',
|
||||||
leaveProject_title: 'Projekt verlassen',
|
leaveProject_title: 'Projekt verlassen',
|
||||||
|
linkIsCopied: 'Link kopiert',
|
||||||
list: 'Listen',
|
list: 'Listen',
|
||||||
listActions_title: 'Aufgaben auflisten',
|
listActions_title: 'Aufgaben auflisten',
|
||||||
managers: 'Manager',
|
managers: 'Manager',
|
||||||
|
@ -169,6 +170,7 @@ export default {
|
||||||
addTask: 'Aufgabe hinzufügen',
|
addTask: 'Aufgabe hinzufügen',
|
||||||
addToCard: 'Zu Karte hinzufügen',
|
addToCard: 'Zu Karte hinzufügen',
|
||||||
addUser: 'Benutzer hinzufügen',
|
addUser: 'Benutzer hinzufügen',
|
||||||
|
copyLink_title: 'Link kopieren',
|
||||||
createBoard: 'Board erstellen',
|
createBoard: 'Board erstellen',
|
||||||
createFile: 'Datei erstellen',
|
createFile: 'Datei erstellen',
|
||||||
createLabel: 'Label erstellen',
|
createLabel: 'Label erstellen',
|
||||||
|
@ -201,8 +203,6 @@ export default {
|
||||||
hideDetails: 'Details ausblenden',
|
hideDetails: 'Details ausblenden',
|
||||||
leaveBoard: 'Board verlassen',
|
leaveBoard: 'Board verlassen',
|
||||||
leaveProject: 'Projekt verlassen',
|
leaveProject: 'Projekt verlassen',
|
||||||
linkCopy: 'Link kopieren',
|
|
||||||
linkIsCopied: 'Link kopiert',
|
|
||||||
logOut_title: 'Ausloggen',
|
logOut_title: 'Ausloggen',
|
||||||
makeCover_title: 'Als Vorschau festlegen',
|
makeCover_title: 'Als Vorschau festlegen',
|
||||||
move: 'Verschieben',
|
move: 'Verschieben',
|
||||||
|
|
|
@ -106,6 +106,7 @@ export default {
|
||||||
language: 'Language',
|
language: 'Language',
|
||||||
leaveBoard_title: 'Leave Board',
|
leaveBoard_title: 'Leave Board',
|
||||||
leaveProject_title: 'Leave Project',
|
leaveProject_title: 'Leave Project',
|
||||||
|
linkIsCopied: 'Link is copied',
|
||||||
list: 'List',
|
list: 'List',
|
||||||
listActions_title: 'List Actions',
|
listActions_title: 'List Actions',
|
||||||
managers: 'Managers',
|
managers: 'Managers',
|
||||||
|
@ -183,6 +184,7 @@ export default {
|
||||||
addTask: 'Add task',
|
addTask: 'Add task',
|
||||||
addToCard: 'Add to card',
|
addToCard: 'Add to card',
|
||||||
addUser: 'Add user',
|
addUser: 'Add user',
|
||||||
|
copyLink_title: 'Copy Link',
|
||||||
createBoard: 'Create board',
|
createBoard: 'Create board',
|
||||||
createFile: 'Create file',
|
createFile: 'Create file',
|
||||||
createLabel: 'Create label',
|
createLabel: 'Create label',
|
||||||
|
@ -220,8 +222,6 @@ export default {
|
||||||
import: 'Import',
|
import: 'Import',
|
||||||
leaveBoard: 'Leave board',
|
leaveBoard: 'Leave board',
|
||||||
leaveProject: 'Leave project',
|
leaveProject: 'Leave project',
|
||||||
linkCopy: 'Copy link',
|
|
||||||
linkIsCopied: 'Link is copied',
|
|
||||||
logOut_title: 'Log Out',
|
logOut_title: 'Log Out',
|
||||||
makeCover_title: 'Make Cover',
|
makeCover_title: 'Make Cover',
|
||||||
move: 'Move',
|
move: 'Move',
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue