Import PO MIME/size constants from shared schema module

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
DEls 2026-08-19 03:03:21 +02:00
parent e7f8799c45
commit 5abc96116f

View file

@ -10,6 +10,7 @@ import {
DialogHeader,
DialogTitle,
} from "@/components/ui/dialog";
import { ALLOWED_MIME, MAX_FILE_BYTES } from "@/lib/purchase-order-schema";
type Phase = "idle" | "uploading" | "done" | "error";
@ -18,14 +19,7 @@ interface UploadAck {
filename: string;
}
const ALLOWED_MIMES = [
"image/jpeg",
"image/png",
"image/webp",
"application/pdf",
];
const ACCEPT_ATTR = ".jpg,.jpeg,.png,.webp,.pdf";
const MAX_FILE_BYTES = 20 * 1024 * 1024;
const ACCEPT_ATTR = [...ALLOWED_MIME].join(",");
export function UploadPurchaseOrderButton() {
const [open, setOpen] = React.useState(false);
@ -76,7 +70,7 @@ export function UploadPurchaseOrderButton() {
const onPickFile: React.ChangeEventHandler<HTMLInputElement> = (e) => {
const f = e.target.files?.[0];
if (!f) return;
if (!ALLOWED_MIMES.includes(f.type)) {
if (!ALLOWED_MIME.has(f.type)) {
setErrorMsg("Unsupported file type: " + (f.type || "unknown"));
setFile(null);
return;