diff --git a/enjoy/src/renderer/components/medias/index.ts b/enjoy/src/renderer/components/medias/index.ts index 4c1e9241..3e2cf688 100644 --- a/enjoy/src/renderer/components/medias/index.ts +++ b/enjoy/src/renderer/components/medias/index.ts @@ -7,6 +7,7 @@ export * from "./media-recorder"; export * from "./media-transcription"; export * from "./media-transcription-read-button"; export * from "./media-transcription-form"; +export * from "./media-transcription-generate-button"; export * from "./media-player"; export * from "./media-provider"; export * from "./media-tabs"; diff --git a/enjoy/src/renderer/components/medias/media-transcription-form.tsx b/enjoy/src/renderer/components/medias/media-transcription-form.tsx index 174c7c1c..a891196f 100644 --- a/enjoy/src/renderer/components/medias/media-transcription-form.tsx +++ b/enjoy/src/renderer/components/medias/media-transcription-form.tsx @@ -25,15 +25,21 @@ import { t } from "i18next"; import { useContext, useState } from "react"; import { LoaderIcon } from "lucide-react"; -export const MediaTranscriptionForm = () => { +export const MediaTranscriptionForm = (props: { + children?: React.ReactNode; +}) => { const [open, setOpen] = useState(false); return ( - + {props.children ? ( + props.children + ) : ( + + )} diff --git a/enjoy/src/renderer/components/medias/media-transcription-generate-button.tsx b/enjoy/src/renderer/components/medias/media-transcription-generate-button.tsx new file mode 100644 index 00000000..032c96c5 --- /dev/null +++ b/enjoy/src/renderer/components/medias/media-transcription-generate-button.tsx @@ -0,0 +1,68 @@ +import { useContext, useRef, useState } from "react"; +import { MediaPlayerProviderContext } from "@renderer/context"; +import { t } from "i18next"; +import { + Button, + AlertDialog, + AlertDialogTrigger, + AlertDialogFooter, + AlertDialogHeader, + AlertDialogContent, + AlertDialogTitle, + AlertDialogDescription, + AlertDialogCancel, + AlertDialogAction, +} from "@renderer/components/ui"; +import { LoaderIcon } from "lucide-react"; + +export const MediaTranscriptionGenerateButton = (props: { + children: React.ReactNode; +}) => { + const { media, generateTranscription, transcribing, transcription } = + useContext(MediaPlayerProviderContext); + + return ( + + + {props.children ? ( + props.children + ) : ( + + )} + + + + {t("transcribe")} + + {t("transcribeMediaConfirmation", { + name: media.name, + })} + + + + {t("cancel")} + + generateTranscription({ + originalText: "", + }) + } + > + {t("transcribe")} + + + + + ); +}; diff --git a/enjoy/src/renderer/components/medias/media-transcription-read-button.tsx b/enjoy/src/renderer/components/medias/media-transcription-read-button.tsx index 6b381884..405d4f7f 100644 --- a/enjoy/src/renderer/components/medias/media-transcription-read-button.tsx +++ b/enjoy/src/renderer/components/medias/media-transcription-read-button.tsx @@ -53,7 +53,9 @@ import { Caption, RecordingDetail } from "@renderer/components"; const TEN_MINUTES = 60 * 10; let interval: NodeJS.Timeout; -export const MediaTranscriptionReadButton = () => { +export const MediaTranscriptionReadButton = (props: { + children: React.ReactNode; +}) => { const [open, setOpen] = useState(false); const [deleting, setDeleting] = useState(null); const { EnjoyApp } = useContext(AppSettingsProviderContext); @@ -107,9 +109,13 @@ export const MediaTranscriptionReadButton = () => { <> - + {props.children ? ( + props.children + ) : ( + + )} event.preventDefault()} diff --git a/enjoy/src/renderer/components/medias/media-transcription.tsx b/enjoy/src/renderer/components/medias/media-transcription.tsx index 37bba283..2cb8e7eb 100644 --- a/enjoy/src/renderer/components/medias/media-transcription.tsx +++ b/enjoy/src/renderer/components/medias/media-transcription.tsx @@ -7,27 +7,26 @@ import { import { t } from "i18next"; import { Button, - AlertDialog, - AlertDialogTrigger, - AlertDialogFooter, - AlertDialogHeader, - AlertDialogContent, - AlertDialogTitle, - AlertDialogDescription, - AlertDialogCancel, - AlertDialogAction, PingPoint, + DropdownMenu, + DropdownMenuTrigger, + DropdownMenuContent, + DropdownMenuItem, } from "@renderer/components/ui"; import { LoaderIcon, CheckCircleIcon, MicIcon, PencilLineIcon, + SquareMenuIcon, } from "lucide-react"; import { AlignmentResult } from "echogarden/dist/api/API.d.js"; import { formatDuration } from "@renderer/lib/utils"; -import { MediaTranscriptionForm } from "./media-transcription-form"; -import { MediaTranscriptionReadButton } from "./media-transcription-read-button"; +import { + MediaTranscriptionForm, + MediaTranscriptionReadButton, + MediaTranscriptionGenerateButton, +} from "@renderer/components"; export const MediaTranscription = () => { const containerRef = useRef(); @@ -38,7 +37,6 @@ export const MediaTranscription = () => { wavesurfer, setCurrentSegmentIndex, transcription, - generateTranscription, transcribing, transcribingProgress, } = useContext(MediaPlayerProviderContext); @@ -120,48 +118,46 @@ export const MediaTranscription = () => { {t("transcript")}
- - - - - - - - {t("transcribe")} - - {t("transcribeMediaConfirmation", { - name: media.name, - })} - - - - {t("cancel")} - - generateTranscription({ - originalText: "", - }) - } - > - {t("transcribe")} - - - - - - + + + + + + + + + + + + + + + + + + + + + +