chore(desktop): satisfy eslint — lazy OS detect + if-block in AddDrive

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
pull/3587/head
Tomas Dvorak 2 weeks ago
parent d8b0a87870
commit 1ae122dfd7

@ -1,4 +1,4 @@
import { useState, useEffect } from "react";
import { useState } from "react";
import { version } from "@tauri-apps/plugin-os";
/**
@ -7,20 +7,17 @@ import { version } from "@tauri-apps/plugin-os";
* Windows 11 also reports as "10.0" but with build number >= 22000.
*/
export function useIsWindows10(): boolean | null {
const [isWindows10, setIsWindows10] = useState<boolean | null>(null);
useEffect(() => {
const [isWindows10] = useState<boolean | null>(() => {
// Windows version format: "10.0.19045" (Win10) or "10.0.22631" (Win11)
// Windows 11 has build number >= 22000
const parts = version().split(".");
if (parts.length >= 3) {
const buildNumber = parseInt(parts[2], 10);
// Windows 10 has build numbers below 22000
setIsWindows10(!isNaN(buildNumber) && buildNumber < 22000);
} else {
setIsWindows10(false);
return !isNaN(buildNumber) && buildNumber < 22000;
}
}, []);
return false;
});
return isWindows10;
}

@ -129,7 +129,9 @@ export default function AddDrive({ mode = "add" }: AddDriveProps) {
pkceSessionRef.current.callbackData = callbackData;
// Transition to final setup page
callbackData.name && setDriveName(callbackData.name);
if (callbackData.name) {
setDriveName(callbackData.name);
}
setPageState("final_setup");
}).then((fn) => {
unlisten = fn;

Loading…
Cancel
Save