fix the conditions checked in handleOnChange

This commit is contained in:
Khalim Conn-Kowlessar 2023-10-16 12:50:32 +11:00
parent c21ad83dc8
commit f822030c5d
3 changed files with 14 additions and 10 deletions

View file

@ -1,18 +1,19 @@
"use client";
import { Input } from "@/app/shadcn_components/ui/input";
import { Label } from "@/app/shadcn_components/ui/label";
export function SelectFolder({
handleOnChange,
accept = ".xml,.pdf,.docx",
}: {
handleOnChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
accept?: string;
}) {
return (
<Input
id="folder-uploader"
type="file"
accept=".xml,.pdf,.docx"
accept={accept}
multiple={true}
className="cursor-pointer"
onChange={handleOnChange}

View file

@ -183,9 +183,9 @@ export default function EcoSpreadsheetHome() {
if (
extensions.includes("xml") &&
extensions.includes(".pdf") &&
names.includes("epr") &&
names.includes("ventilation")
extensions.includes("pdf") &&
names.some((name) => name.includes("epr")) &&
names.some((name) => name.includes("ventilation"))
) {
setFiles(filesArray);
setButtonDisabled(false);
@ -241,19 +241,21 @@ export default function EcoSpreadsheetHome() {
<SelectFolder handleOnChange={handleOnChange} />
</div>
<div className="mb-4">
Additionally, you can upload an optional ECO Excel spreadsheet if you
wish to add new records to an already populated spreadsheet
<div>{uploadMessage}</div>
<div className="mb-4 text-left">
Additionally, you can upload an optional ECO Excel spreadsheet
<br />
if you wish to add new records to an already populated spreadsheet
</div>
<div className="mb-5">
<SelectFolder handleOnChange={handleOnChangeExcel} />
<SelectFolder handleOnChange={handleOnChangeExcel} accept={".xlsx"} />
</div>
<div className="mb-4"></div>
<div className="flex justify-between w-full">
<div>{uploadMessage}</div>
<Button
disabled={
buttonDisabled || isGeneratingUrlLoading || isUploadLoading

View file

@ -5,6 +5,7 @@ export const config = {
"/search/:path*",
"/addresses/:path",
"/due-considerations/:path",
"/eco-spreadsheet/:path",
],
};