Add more preview types

This commit is contained in:
Kieran 2022-02-28 22:40:39 +00:00
parent 3df3a816d6
commit 1b460e7236
Signed by: Kieran
GPG Key ID: DE71CEB3925BE941

View File

@ -35,13 +35,30 @@ export function FilePreview() {
if (info.metadata) { if (info.metadata) {
switch (info.metadata.mimeType) { switch (info.metadata.mimeType) {
case "image/avif":
case "image/bmp":
case "image/gif":
case "image/svg+xml":
case "image/tiff":
case "image/webp":
case "image/jpg": case "image/jpg":
case "image/jpeg": case "image/jpeg":
case "image/png": { case "image/png": {
return <img src={link} alt={info.metadata.name}/>; return <img src={link} alt={info.metadata.name}/>;
} }
case "audio/mp3": case "audio/aac":
case "audio/ogg": case "audio/opus":
case "audio/wav":
case "audio/webm":
case "audio/midi":
case "audio/mpeg":
case "audio/ogg": {
return <audio src={link} controls/>;
}
case "video/x-msvideo":
case "video/mpeg":
case "video/ogg":
case "video/mp2t":
case "video/mp4": case "video/mp4":
case "video/matroksa": case "video/matroksa":
case "video/x-matroska": case "video/x-matroska":
@ -49,6 +66,10 @@ export function FilePreview() {
case "video/quicktime": { case "video/quicktime": {
return <video src={link} controls/>; return <video src={link} controls/>;
} }
case "application/json":
case "text/javascript":
case "text/html":
case "text/csv":
case "text/css": case "text/css":
case "text/plain": { case "text/plain": {
return <TextPreview link={link}/>; return <TextPreview link={link}/>;