From 5168201b8e456be4441ba8bc75a99d2ecc318eac Mon Sep 17 00:00:00 2001 From: an-lee Date: Wed, 10 Jan 2024 11:12:56 +0800 Subject: [PATCH] remove longpress --- enjoy/src/i18n/en.json | 1 + enjoy/src/i18n/zh-CN.json | 1 + .../components/recordings/recording-card.tsx | 65 +++++-------------- .../components/recordings/recordings-list.tsx | 2 +- 4 files changed, 19 insertions(+), 50 deletions(-) diff --git a/enjoy/src/i18n/en.json b/enjoy/src/i18n/en.json index 6f9ab3b2..69fccef2 100644 --- a/enjoy/src/i18n/en.json +++ b/enjoy/src/i18n/en.json @@ -153,6 +153,7 @@ "autoScroll": "auto scroll", "detail": "detail", "remove": "remove", + "share": "share", "loadMore": "Load more", "databaseError": "Failed to connect to database {{url}}", "somethingWentWrong": "Something went wrong", diff --git a/enjoy/src/i18n/zh-CN.json b/enjoy/src/i18n/zh-CN.json index 86e6bc6e..6870f263 100644 --- a/enjoy/src/i18n/zh-CN.json +++ b/enjoy/src/i18n/zh-CN.json @@ -153,6 +153,7 @@ "autoScroll": "自动滚动", "detail": "详情", "remove": "删除", + "share": "分享", "loadMore": "加载更多", "databaseError": "数据库错误 {{url}}", "somethingWentWrong": "出错了", diff --git a/enjoy/src/renderer/components/recordings/recording-card.tsx b/enjoy/src/renderer/components/recordings/recording-card.tsx index cc49067c..0cc60e92 100644 --- a/enjoy/src/renderer/components/recordings/recording-card.tsx +++ b/enjoy/src/renderer/components/recordings/recording-card.tsx @@ -1,9 +1,6 @@ import { useState, useContext } from "react"; import { AppSettingsProviderContext } from "@/renderer/context"; -import { - RecordingPlayer, - PronunciationAssessmentScoreIcon, -} from "@renderer/components"; +import { RecordingPlayer } from "@renderer/components"; import { AlertDialog, AlertDialogHeader, @@ -19,9 +16,8 @@ import { DropdownMenuSeparator, DropdownMenuTrigger, } from "@renderer/components/ui"; -import { MoreHorizontalIcon, Trash2Icon, InfoIcon } from "lucide-react"; -import { formatDateTime , secondsToTimestamp } from "@renderer/lib/utils"; -import { useLongPress } from "@uidotdev/usehooks"; +import { ChevronDownIcon, Trash2Icon, InfoIcon, Share2Icon } from "lucide-react"; +import { formatDateTime, secondsToTimestamp } from "@renderer/lib/utils"; import { t } from "i18next"; export const RecordingCard = (props: { @@ -30,45 +26,19 @@ export const RecordingCard = (props: { onSelect?: () => void; }) => { const { recording, id, onSelect } = props; - const [isMenuOpen, setIsMenuOpen] = useState(false); const [isDeleteDialogOpen, setIsDeleteDialogOpen] = useState(false); const { EnjoyApp } = useContext(AppSettingsProviderContext); const [isPlaying, setIsPlaying] = useState(false); - const longPressAttrs = useLongPress( - () => { - setIsMenuOpen(true); - }, - { - onFinish: () => {}, - onCancel: () => {}, - threshold: 400, - } - ); - const handleDelete = () => { EnjoyApp.recordings.destroy(recording.id); }; return ( -
- setIsMenuOpen(value)} - > -
-
- - - -
- -
+
+ +
+
{secondsToTimestamp(recording.duration / 1000)} @@ -81,7 +51,7 @@ export const RecordingCard = (props: { setIsPlaying={setIsPlaying} /> -
+
- - - {formatDateTime(recording.createdAt)} - + + +
+
+ + {formatDateTime(recording.createdAt)} + +
- - {t("detail")} - - - - - setIsDeleteDialogOpen(true)}> {t("delete")} diff --git a/enjoy/src/renderer/components/recordings/recordings-list.tsx b/enjoy/src/renderer/components/recordings/recordings-list.tsx index a6d51156..f3dca534 100644 --- a/enjoy/src/renderer/components/recordings/recordings-list.tsx +++ b/enjoy/src/renderer/components/recordings/recordings-list.tsx @@ -156,7 +156,7 @@ export const RecordingsList = (props: {
)} -
+
{recordings.map((recording) => (