From 9ca0de1d627ee2a583414ae4e4cadd0ee9502705 Mon Sep 17 00:00:00 2001 From: harumiWeb Date: Tue, 7 Jan 2025 23:27:17 +0900 Subject: [PATCH] Update dependencies and refactor modal type in utils.ts - Added `antd` version 5.23.0 to package.json and package-lock.json. - Updated modal type from `ModalType` to `HookAPI` in `utils.ts` for improved type safety and consistency. - Updated various dependencies in package-lock.json to their latest versions, enhancing overall application stability and performance. These changes aim to streamline the development process and ensure compatibility with the latest features of the `antd` library. --- .../ConvertButton/ConvertButton.tsx | 8 +- app/components/Dropzone/Dropzone.tsx | 4 +- app/components/InputTab/InputNavMenu.tsx | 4 +- app/components/InputTab/InputTab.tsx | 4 +- app/components/OutputTab/Null.tsx | 2 +- app/components/OutputTab/OutputNavMenu.tsx | 4 +- app/components/OutputTab/OutputTab.tsx | 2 +- .../ProcessedFiles/ProcessedFiles.tsx | 2 +- app/components/SelectFiles/File.tsx | 2 +- app/components/SelectFiles/SelectFiles.tsx | 3 +- app/components/SelectFiles/utils.ts | 2 +- .../WindowMenu/ContextMenu/FileMenu.tsx | 44 +-- .../WindowMenu/ContextMenu/HelpMenu.tsx | 37 +- .../WindowMenu/ContextMenu/SelectMenu.tsx | 8 +- app/components/WindowMenu/WindowMenu.tsx | 2 +- app/lib/utils.ts | 8 +- package-lock.json | 319 +++++------------- package.json | 1 + 18 files changed, 157 insertions(+), 299 deletions(-) diff --git a/app/components/ConvertButton/ConvertButton.tsx b/app/components/ConvertButton/ConvertButton.tsx index 3154a9c..a90f18b 100644 --- a/app/components/ConvertButton/ConvertButton.tsx +++ b/app/components/ConvertButton/ConvertButton.tsx @@ -15,15 +15,13 @@ import { Modal } from "antd"; import { convert } from "@/app/lib/utils"; export default function ConvertButton() { - const [filePaths, setFilePaths] = useAtom(filePathsAtom); + const [filePaths] = useAtom(filePathsAtom); const [fileInfos] = useAtom(fileInfosAtom); const [extensionType] = useAtom(extensionTypeAtom); const [quality] = useAtom(qualityAtom); const [isProcessing, setIsProcessing] = useAtom(isProcessingAtom); - const [processedFilePaths, setProcessedFilePaths] = useAtom( - processedFilePathsAtom - ); - const [tabSelected, setTabSelected] = useAtom(tabSelectedAtom); + const [, setProcessedFilePaths] = useAtom(processedFilePathsAtom); + const [, setTabSelected] = useAtom(tabSelectedAtom); const [modal, contextHolder] = Modal.useModal(); diff --git a/app/components/Dropzone/Dropzone.tsx b/app/components/Dropzone/Dropzone.tsx index 9ed5f73..05abcc9 100644 --- a/app/components/Dropzone/Dropzone.tsx +++ b/app/components/Dropzone/Dropzone.tsx @@ -8,8 +8,8 @@ import { filePathsAtom, tabSelectedAtom } from "../../lib/atom"; import { Modal } from "antd"; export default function Dropzone() { - const [filePaths, setFilePaths] = useAtom(filePathsAtom); - const [tabSelected, setTabSelected] = useAtom(tabSelectedAtom); + const [, setFilePaths] = useAtom(filePathsAtom); + const [, setTabSelected] = useAtom(tabSelectedAtom); const [modal, modalContextHolder] = Modal.useModal(); useEffect(() => { diff --git a/app/components/InputTab/InputNavMenu.tsx b/app/components/InputTab/InputNavMenu.tsx index 1a066c5..de53adb 100644 --- a/app/components/InputTab/InputNavMenu.tsx +++ b/app/components/InputTab/InputNavMenu.tsx @@ -6,8 +6,8 @@ import { useAtom } from "jotai"; import { filePathsAtom, fileInfosAtom } from "../../lib/atom"; export default function InputNubMenu() { - const [filePaths, setFilePaths] = useAtom(filePathsAtom); - const [fileInfos, setFileInfos] = useAtom(fileInfosAtom); + const [, setFilePaths] = useAtom(filePathsAtom); + const [, setFileInfos] = useAtom(fileInfosAtom); const removeAll = () => { setFilePaths([]); diff --git a/app/components/InputTab/InputTab.tsx b/app/components/InputTab/InputTab.tsx index 8eaa37b..5137240 100644 --- a/app/components/InputTab/InputTab.tsx +++ b/app/components/InputTab/InputTab.tsx @@ -8,8 +8,8 @@ import InputNubMenu from "./InputNavMenu"; import Null from "./Null"; export default function InputTab() { - const [tabSelected, setTabSelected] = useAtom(tabSelectedAtom); - const [filePaths, setFilePaths] = useAtom(filePathsAtom); + const [tabSelected] = useAtom(tabSelectedAtom); + const [filePaths] = useAtom(filePathsAtom); return (
No result
- Select images from "INPUT" tab
+ Select images from "INPUT" tab
and convert them to see the result here.
diff --git a/app/components/OutputTab/OutputNavMenu.tsx b/app/components/OutputTab/OutputNavMenu.tsx index 9b9ec63..f1505b6 100644 --- a/app/components/OutputTab/OutputNavMenu.tsx +++ b/app/components/OutputTab/OutputNavMenu.tsx @@ -19,10 +19,10 @@ export default function OutputNavMenu() { processedFilePathsSortedAtom ); const [checkboxSelected, setCheckboxSelected] = useAtom(checkboxSelectedAtom); - const [processedFilePaths, setProcessedFilePaths] = useAtom( + const [, setProcessedFilePaths] = useAtom( processedFilePathsAtom ); - const [isSaving, setIsSaving] = useAtom(isSavingAtom); + const [, setIsSaving] = useAtom(isSavingAtom); const [modal, modalContextHolder] = Modal.useModal(); diff --git a/app/components/OutputTab/OutputTab.tsx b/app/components/OutputTab/OutputTab.tsx index c6124f7..b238f97 100644 --- a/app/components/OutputTab/OutputTab.tsx +++ b/app/components/OutputTab/OutputTab.tsx @@ -6,7 +6,7 @@ import ProcessedFiles from "../ProcessedFiles/ProcessedFiles"; import OutputNavMenu from "./OutputNavMenu"; export default function OutputTab() { - const [tabSelected, setTabSelected] = useAtom(tabSelectedAtom); + const [tabSelected] = useAtom(tabSelectedAtom); return (
{ const fetchProcessedInfos = async () => { diff --git a/app/components/SelectFiles/File.tsx b/app/components/SelectFiles/File.tsx index 7a9b0a6..30f4df2 100644 --- a/app/components/SelectFiles/File.tsx +++ b/app/components/SelectFiles/File.tsx @@ -9,7 +9,7 @@ import { readFile } from "@tauri-apps/plugin-fs"; export default function File({ fileInfo, index }: FileProps) { const [filePaths, setFilePaths] = useAtom(filePathsAtom); - const [fileInfos, setFileInfos] = useAtom(fileInfosAtom); + const [, setFileInfos] = useAtom(fileInfosAtom); const [imageSrc, setImageSrc] = useState(null); useEffect(() => { diff --git a/app/components/SelectFiles/SelectFiles.tsx b/app/components/SelectFiles/SelectFiles.tsx index b9b4bd9..0e27425 100644 --- a/app/components/SelectFiles/SelectFiles.tsx +++ b/app/components/SelectFiles/SelectFiles.tsx @@ -1,7 +1,7 @@ "use client"; import { useAtom } from "jotai"; -import { filePathsAtom, fileInfosAtom, isProcessingAtom } from "@/app/lib/atom"; +import { filePathsAtom, fileInfosAtom } from "@/app/lib/atom"; import { FileInfo } from "@/app/index.d"; import { useEffect } from "react"; import File from "./File"; @@ -11,7 +11,6 @@ import { readFileAsync } from "../FileDialog/utils"; export default function SelectFiles() { const [filePaths] = useAtom(filePathsAtom); const [fileInfos, setFileInfos] = useAtom(fileInfosAtom); - const [_, setIsProcessing] = useAtom(isProcessingAtom); useEffect(() => { const fetchData = async () => { diff --git a/app/components/SelectFiles/utils.ts b/app/components/SelectFiles/utils.ts index f652ede..f924d8f 100644 --- a/app/components/SelectFiles/utils.ts +++ b/app/components/SelectFiles/utils.ts @@ -72,7 +72,7 @@ export async function getProcessedFileInfo(processedFilePaths: string[], fileInf .filter((info) => info !== undefined) as ProcessedFileInfo[]; // mime_typeを変換後のものに変更 - sortedProcessedInfos.forEach((processedInfo, index) => { + sortedProcessedInfos.forEach((processedInfo) => { const extension: string = processedInfo.file_name_with_extension.split(".").pop()?.toLowerCase() || ""; processedInfo.mime_type = `image/${extension}`; }); diff --git a/app/components/WindowMenu/ContextMenu/FileMenu.tsx b/app/components/WindowMenu/ContextMenu/FileMenu.tsx index f2ba4b6..50d92de 100644 --- a/app/components/WindowMenu/ContextMenu/FileMenu.tsx +++ b/app/components/WindowMenu/ContextMenu/FileMenu.tsx @@ -51,7 +51,7 @@ const items: MenuProps["items"] = [ export default function FileMenu() { const [filePaths, setFilePaths] = useAtom(filePathsAtom); - const [isFocused, setIsFocused] = useAtom(isFocusedAtom); + const [isFocused, ] = useAtom(isFocusedAtom); const fileButtonRef = useRef(null); const [fileInfos, setFileInfos] = useAtom(fileInfosAtom); const [tabSelected, setTabSelected] = useAtom(tabSelectedAtom); @@ -59,14 +59,14 @@ export default function FileMenu() { processedFilePathsSortedAtom ); const [checkboxSelected, setCheckboxSelected] = useAtom(checkboxSelectedAtom); - const [processedFilePaths, setProcessedFilePaths] = useAtom( + const [, setProcessedFilePaths] = useAtom( processedFilePathsAtom ); - const [isSaving, setIsSaving] = useAtom(isSavingAtom); - const [quality, setQuality] = useAtom(qualityAtom); - const [extensionType, setExtensionType] = useAtom(extensionTypeAtom); + const [, setIsSaving] = useAtom(isSavingAtom); + const [quality, ] = useAtom(qualityAtom); + const [extensionType, ] = useAtom(extensionTypeAtom); const [isProcessing, setIsProcessing] = useAtom(isProcessingAtom); - const [modal, modalContextHolder] = Modal.useModal(); + const [modal, ] = Modal.useModal(); function removeResult() { setProcessedFilePathsSorted([]); @@ -191,13 +191,13 @@ function FileOpen(): React.ReactNode { function FileRemoveAll(): React.ReactNode { const [filePaths, setFilePaths] = useAtom(filePathsAtom); - const [tabSelected, setTabSelected] = useAtom(tabSelectedAtom); - const [fileInfos, setFileInfos] = useAtom(fileInfosAtom); + const [tabSelected, ] = useAtom(tabSelectedAtom); + const [, setFileInfos] = useAtom(fileInfosAtom); const [processedFilePathsSorted, setProcessedFilePathsSorted] = useAtom( processedFilePathsSortedAtom ); - const [checkboxSelected, setCheckboxSelected] = useAtom(checkboxSelectedAtom); - const [processedFilePaths, setProcessedFilePaths] = useAtom( + const [, setCheckboxSelected] = useAtom(checkboxSelectedAtom); + const [, setProcessedFilePaths] = useAtom( processedFilePathsAtom ); @@ -252,10 +252,10 @@ function FileRemoveAll(): React.ReactNode { function FileSaveAll(): React.ReactNode { const [isSaving, setIsSaving] = useState(false); - const [processedFilePathsSorted, setProcessedFilePathsSorted] = useAtom( + const [processedFilePathsSorted, ] = useAtom( processedFilePathsSortedAtom ); - const [modal, modalContextHolder] = Modal.useModal(); + const [modal, ] = Modal.useModal(); return (