1
0
Fork 0
mirror of https://github.com/binwiederhier/ntfy.git synced 2024-12-24 10:42:31 +01:00

Preview local file before send

This commit is contained in:
Cao Mingjun 2023-11-25 03:39:26 +00:00 committed by GitHub
parent a3312f69fb
commit 94781c89f3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 12 deletions

View file

@ -1,5 +1,5 @@
import * as React from "react"; import * as React from "react";
import { Box } from "@mui/material"; import { Box, Link } from "@mui/material";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import fileDocument from "../img/file-document.svg"; import fileDocument from "../img/file-document.svg";
import fileImage from "../img/file-image.svg"; import fileImage from "../img/file-image.svg";
@ -32,6 +32,7 @@ const AttachmentIcon = (props) => {
imageLabel = t("notifications_attachment_file_document"); imageLabel = t("notifications_attachment_file_document");
} }
return ( return (
<Link href={props.href} target="_blank">
<Box <Box
component="img" component="img"
src={imageFile} src={imageFile}
@ -42,6 +43,7 @@ const AttachmentIcon = (props) => {
height: "28px", height: "28px",
}} }}
/> />
</Link>
); );
}; };

View file

@ -798,7 +798,7 @@ const AttachmentBox = (props) => {
borderRadius: "4px", borderRadius: "4px",
}} }}
> >
<AttachmentIcon type={file.type} /> <AttachmentIcon type={file.type} href={URL.createObjectURL(file)} />
<Box sx={{ marginLeft: 1, textAlign: "left" }}> <Box sx={{ marginLeft: 1, textAlign: "left" }}>
<ExpandingTextField <ExpandingTextField
minWidth={140} minWidth={140}