diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json index 67f41c2c1e..fdd6f9fb2d 100644 --- a/apps/client/src/translations/en/translation.json +++ b/apps/client/src/translations/en/translation.json @@ -1036,7 +1036,7 @@ "file_preview_not_available": "File preview is not available for this file format.", "too_big": "The preview only shows the first {{maxNumChars}} characters of the file for performance reasons. Download the file and open it externally to be able to see the entire content." }, - "video": { + "media": { "play": "Play (Space)", "pause": "Pause (Space)", "back-10s": "Back 10s (Left arrow key)", @@ -1051,7 +1051,7 @@ "exit-picture-in-picture": "Exit picture-in-picture", "fullscreen": "Fullscreen (F)", "exit-fullscreen": "Exit fullscreen", - "unsupported-format": "Video preview is not available for this file format.", + "unsupported-format": "Media preview is not available for this file format:\n{{mime}}", "zoom-to-fit": "Zoom to fill", "zoom-reset": "Reset zoom to fill" }, diff --git a/apps/client/src/widgets/note_wrapper.ts b/apps/client/src/widgets/note_wrapper.ts index 80fc42c6d2..ccaa5614d9 100644 --- a/apps/client/src/widgets/note_wrapper.ts +++ b/apps/client/src/widgets/note_wrapper.ts @@ -83,7 +83,7 @@ export default class NoteWrapperWidget extends FlexContainer { return true; } - if (note.type === "file" && (note.mime === "application/pdf" || note.mime.startsWith("video/"))) { + if (note.type === "file" && (note.mime === "application/pdf" || note.mime.startsWith("video/") || note.mime.startsWith("audio/"))) { return true; } @@ -108,7 +108,7 @@ export default class NoteWrapperWidget extends FlexContainer { return true; } - if (note.type === "file" && MIME_TYPES_WITH_BACKGROUND_EFFECTS.includes(note.mime)) { + if (note.type === "file" && (MIME_TYPES_WITH_BACKGROUND_EFFECTS.includes(note.mime) || note.mime.startsWith("audio/"))) { return true; } diff --git a/apps/client/src/widgets/react/NoItems.css b/apps/client/src/widgets/react/NoItems.css index f3cc6c6553..2bf1d4e067 100644 --- a/apps/client/src/widgets/react/NoItems.css +++ b/apps/client/src/widgets/react/NoItems.css @@ -8,6 +8,7 @@ color: var(--muted-text-color); height: 100%; text-align: center; + white-space: pre-line; .tn-icon { font-size: 4em; 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 ( -