mirror of
https://github.com/zhom/donutbrowser.git
synced 2026-06-12 09:47:51 +02:00
chore: simplify js linting
This commit is contained in:
+21
-21
@@ -63,7 +63,7 @@ export default function Home() {
|
||||
|
||||
try {
|
||||
const profileList = await invoke<BrowserProfile[]>(
|
||||
"list_browser_profiles",
|
||||
"list_browser_profiles"
|
||||
);
|
||||
setProfiles(profileList);
|
||||
|
||||
@@ -94,7 +94,7 @@ export default function Home() {
|
||||
() => {
|
||||
void checkForUpdates();
|
||||
},
|
||||
30 * 60 * 1000,
|
||||
30 * 60 * 1000
|
||||
);
|
||||
|
||||
return () => {
|
||||
@@ -107,7 +107,7 @@ export default function Home() {
|
||||
|
||||
try {
|
||||
const shouldShow = await invoke<boolean>(
|
||||
"should_show_settings_on_startup",
|
||||
"should_show_settings_on_startup"
|
||||
);
|
||||
if (shouldShow) {
|
||||
setSettingsDialogOpen(true);
|
||||
@@ -122,7 +122,7 @@ export default function Home() {
|
||||
|
||||
try {
|
||||
const hasStartupUrl = await invoke<boolean>(
|
||||
"check_and_handle_startup_url",
|
||||
"check_and_handle_startup_url"
|
||||
);
|
||||
if (hasStartupUrl) {
|
||||
console.log("Handled startup URL successfully");
|
||||
@@ -155,10 +155,10 @@ export default function Home() {
|
||||
await listen<string>("show-create-profile-dialog", (event) => {
|
||||
console.log(
|
||||
"Received show create profile dialog request:",
|
||||
event.payload,
|
||||
event.payload
|
||||
);
|
||||
setError(
|
||||
"No profiles available. Please create a profile first before opening URLs.",
|
||||
"No profiles available. Please create a profile first before opening URLs."
|
||||
);
|
||||
setCreateProfileDialogOpen(true);
|
||||
});
|
||||
@@ -180,7 +180,7 @@ export default function Home() {
|
||||
} catch (error: any) {
|
||||
console.log(
|
||||
"Smart URL opening failed or requires profile selection:",
|
||||
error,
|
||||
error
|
||||
);
|
||||
|
||||
// Check if it's the special error cases
|
||||
@@ -190,7 +190,7 @@ export default function Home() {
|
||||
} else if (error === "no_profiles") {
|
||||
// No profiles available, show error message
|
||||
setError(
|
||||
"No profiles available. Please create a profile first before opening URLs.",
|
||||
"No profiles available. Please create a profile first before opening URLs."
|
||||
);
|
||||
} else {
|
||||
// Some other error occurred
|
||||
@@ -228,7 +228,7 @@ export default function Home() {
|
||||
setError(`Failed to update proxy settings: ${JSON.stringify(err)}`);
|
||||
}
|
||||
},
|
||||
[currentProfileForProxy, loadProfiles],
|
||||
[currentProfileForProxy, loadProfiles]
|
||||
);
|
||||
|
||||
const handleCreateProfile = useCallback(
|
||||
@@ -247,7 +247,7 @@ export default function Home() {
|
||||
name: profileData.name,
|
||||
browserStr: profileData.browserStr,
|
||||
version: profileData.version,
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
// Update proxy if provided
|
||||
@@ -264,11 +264,11 @@ export default function Home() {
|
||||
throw error;
|
||||
}
|
||||
},
|
||||
[loadProfiles],
|
||||
[loadProfiles]
|
||||
);
|
||||
|
||||
const [runningProfiles, setRunningProfiles] = useState<Set<string>>(
|
||||
new Set(),
|
||||
new Set()
|
||||
);
|
||||
|
||||
const runningProfilesRef = useRef<Set<string>>(new Set());
|
||||
@@ -300,7 +300,7 @@ export default function Home() {
|
||||
console.error("Failed to check browser status:", err);
|
||||
}
|
||||
},
|
||||
[isClient],
|
||||
[isClient]
|
||||
);
|
||||
|
||||
const launchProfile = useCallback(
|
||||
@@ -315,12 +315,12 @@ export default function Home() {
|
||||
"is_browser_disabled_for_update",
|
||||
{
|
||||
browser: profile.browser,
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
if (isDisabled || isUpdating(profile.browser)) {
|
||||
setError(
|
||||
`${profile.browser} is currently being updated. Please wait for the update to complete.`,
|
||||
`${profile.browser} is currently being updated. Please wait for the update to complete.`
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -331,7 +331,7 @@ export default function Home() {
|
||||
try {
|
||||
const updatedProfile = await invoke<BrowserProfile>(
|
||||
"launch_browser_profile",
|
||||
{ profile },
|
||||
{ profile }
|
||||
);
|
||||
await loadProfiles();
|
||||
await checkBrowserStatus(updatedProfile);
|
||||
@@ -340,7 +340,7 @@ export default function Home() {
|
||||
setError(`Failed to launch browser: ${JSON.stringify(err)}`);
|
||||
}
|
||||
},
|
||||
[loadProfiles, checkBrowserStatus, isUpdating, isClient],
|
||||
[loadProfiles, checkBrowserStatus, isUpdating, isClient]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -379,7 +379,7 @@ export default function Home() {
|
||||
setError(`Failed to delete profile: ${JSON.stringify(err)}`);
|
||||
}
|
||||
},
|
||||
[loadProfiles],
|
||||
[loadProfiles]
|
||||
);
|
||||
|
||||
const handleRenameProfile = useCallback(
|
||||
@@ -394,7 +394,7 @@ export default function Home() {
|
||||
throw err;
|
||||
}
|
||||
},
|
||||
[loadProfiles],
|
||||
[loadProfiles]
|
||||
);
|
||||
|
||||
const handleKillProfile = useCallback(
|
||||
@@ -408,7 +408,7 @@ export default function Home() {
|
||||
setError(`Failed to kill browser: ${JSON.stringify(err)}`);
|
||||
}
|
||||
},
|
||||
[loadProfiles],
|
||||
[loadProfiles]
|
||||
);
|
||||
|
||||
// Don't render anything until we're on the client side to prevent hydration issues
|
||||
@@ -554,7 +554,7 @@ export default function Home() {
|
||||
isOpen={true}
|
||||
onClose={() => {
|
||||
setPendingUrls((prev) =>
|
||||
prev.filter((u) => u.id !== pendingUrl.id),
|
||||
prev.filter((u) => u.id !== pendingUrl.id)
|
||||
);
|
||||
}}
|
||||
url={pendingUrl.url}
|
||||
|
||||
Reference in New Issue
Block a user