From 954195c24e65d636d4c1eb184e255866e261ddfd Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Tue, 8 Oct 2024 02:56:22 +0200 Subject: [PATCH] Add button to copy manga title --- src/modules/manga/components/MangaDetails.tsx | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/modules/manga/components/MangaDetails.tsx b/src/modules/manga/components/MangaDetails.tsx index 6fba4bef..e06316ce 100644 --- a/src/modules/manga/components/MangaDetails.tsx +++ b/src/modules/manga/components/MangaDetails.tsx @@ -14,7 +14,6 @@ import { useTranslation } from 'react-i18next'; import { t as translate } from 'i18next'; import Link from '@mui/material/Link'; import Typography from '@mui/material/Typography'; -import { useLongPress } from 'use-long-press'; import Chip from '@mui/material/Chip'; import Tooltip from '@mui/material/Tooltip'; import LaunchIcon from '@mui/icons-material/Launch'; @@ -26,6 +25,7 @@ import ExpandMoreIcon from '@mui/icons-material/ExpandMore'; import OpenInFullIcon from '@mui/icons-material/OpenInFull'; import Modal from '@mui/material/Modal'; import { bindPopover, bindTrigger, usePopupState } from 'material-ui-popup-state/hooks'; +import ContentCopyIcon from '@mui/icons-material/ContentCopy'; import { makeToast } from '@/modules/core/utils/Toast.ts'; import { Mangas } from '@/modules/manga/services/Mangas.ts'; import { SpinnerImage } from '@/modules/core/components/SpinnerImage.tsx'; @@ -298,14 +298,14 @@ export const MangaDetails = ({ const { CategorySelectComponent, updateLibraryState } = useManageMangaLibraryState(manga); - const copyTitleLongPressBind = useLongPress(async () => { + const copyTitle = async () => { try { await navigator.clipboard.writeText(manga.title); makeToast(t('global.label.copied'), 'info'); } catch (e) { defaultPromiseErrorHandler('MangaDetails::copyTitleLongPress')(e); } - }); + }; return ( <> @@ -314,14 +314,16 @@ export const MangaDetails = ({ - - {manga.title} - + + + {manga.title} + + + + + + +