diff --git a/src/lib/FileViewer.svelte b/src/lib/FileViewer.svelte index c8a093a..d158974 100644 --- a/src/lib/FileViewer.svelte +++ b/src/lib/FileViewer.svelte @@ -3,18 +3,18 @@ import Dropzone from "./Dropzone.svelte"; import FileList from "./FileList.svelte"; - import { filterFileRequirements } from "../utils/filterFileRequirements"; + import { filterFiles } from "../utils/filterFiles"; let acceptedFiles; let rejectedFiles; - let isAcceptedFilesRendered = false; + let areAcceptedFilesRendered = false; const fileRequirements = { supportedFormats: [".pes"], maxSize: 700000, }; const onSubmit = () => { - isAcceptedFilesRendered = true; + areAcceptedFilesRendered = true; }; const onDrop = (evt) => { @@ -23,13 +23,13 @@ const onChange = (evt) => { acceptedFiles = null; - isAcceptedFilesRendered = false; + areAcceptedFilesRendered = false; const changedFiles = evt.dataTransfer ? evt.dataTransfer.files : evt.target.files; - const results = filterFileRequirements(changedFiles, fileRequirements); + const results = filterFiles(changedFiles, fileRequirements); acceptedFiles = results.accepted; rejectedFiles = results.rejected; }; @@ -69,7 +69,7 @@ -{#if isAcceptedFilesRendered} +{#if areAcceptedFilesRendered} {:else} diff --git a/src/utils/filterFileRequirements.js b/src/utils/filterFiles.js similarity index 89% rename from src/utils/filterFileRequirements.js rename to src/utils/filterFiles.js index 2d5ddae..62f8f36 100644 --- a/src/utils/filterFileRequirements.js +++ b/src/utils/filterFiles.js @@ -5,7 +5,7 @@ const areRequirementsFulfilled = (requirements, file) => requirements.maxSize >= file.size && requirements.supportedFormats.includes(formattedFilenameExt(file.name)); -export function filterFileRequirements(files, requirements) { +export function filterFiles(files, requirements) { let accepted = []; let rejected = []; Array.from(files).forEach((file) => {