Skip to content

Build your personal knowledge base with Trilium Notes

refactor(audio): extract to separate file

Elian Doran23890e64e9cb
diff --git a/apps/client/src/widgets/type_widgets/File.tsx b/apps/client/src/widgets/type_widgets/File.tsx
index a13d765ed7..f36ecce854 100644
--- a/apps/client/src/widgets/type_widgets/File.tsx
+++ b/apps/client/src/widgets/type_widgets/File.tsx
@@ -1,10 +1,9 @@
import "./File.css";
-import FNote from "../../entities/fnote";
import { t } from "../../services/i18n";
-import { getUrlForDownload } from "../../services/open";
import Alert from "../react/Alert";
import { useNoteBlob } from "../react/hooks";
+import AudioPreview from "./file/Audio";
import PdfPreview from "./file/Pdf";
import VideoPreview from "./file/Video";
import { TypeWidgetProps } from "./type_widget";
@@ -43,16 +42,6 @@ function TextPreview({ content }: { content: string }) {
);
}
-function AudioPreview({ note }: { note: FNote }) {
- return (
- <audio
- class="audio-preview"
- src={getUrlForDownload(`api/notes/${note.noteId}/open-partial`)}
- controls
- />
- );
-}
-
function NoPreview() {
return (
<Alert className="file-preview-not-available" type="info">
diff --git a/apps/client/src/widgets/type_widgets/file/Audio.tsx b/apps/client/src/widgets/type_widgets/file/Audio.tsx
new file mode 100644
index 0000000000..45b4693a97
--- /dev/null
+++ b/apps/client/src/widgets/type_widgets/file/Audio.tsx
@@ -0,0 +1,12 @@
+import FNote from "../../../entities/fnote";
+import { getUrlForDownload } from "../../../services/open";
+
+export default function AudioPreview({ note }: { note: FNote }) {
+ return (
+ <audio
+ class="audio-preview"
+ src={getUrlForDownload(`api/notes/${note.noteId}/open-partial`)}
+ controls
+ />
+ );
+}
\ No newline at end of file