fix: remove 13 unused variables in frontend files
- version-check-modal.tsx: removed 4 unused imports and functions - main.tsx: removed unused isMobile state - AdminSettings.tsx: removed 8 unused imports and error variables
This commit is contained in:
@@ -1,18 +1,15 @@
|
|||||||
import React, { useState, useEffect } from "react";
|
import React, { useState, useEffect } from "react";
|
||||||
import { Button } from "@/components/ui/button.tsx";
|
import { Button } from "@/components/ui/button.tsx";
|
||||||
import { VersionAlert } from "@/components/ui/version-alert.tsx";
|
import { VersionAlert } from "@/components/ui/version-alert.tsx";
|
||||||
import { RefreshCw, X } from "lucide-react";
|
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { checkElectronUpdate, isElectron } from "@/ui/main-axios.ts";
|
import { checkElectronUpdate, isElectron } from "@/ui/main-axios.ts";
|
||||||
|
|
||||||
interface VersionCheckModalProps {
|
interface VersionCheckModalProps {
|
||||||
onDismiss: () => void;
|
|
||||||
onContinue: () => void;
|
onContinue: () => void;
|
||||||
isAuthenticated?: boolean;
|
isAuthenticated?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function VersionCheckModal({
|
export function VersionCheckModal({
|
||||||
onDismiss,
|
|
||||||
onContinue,
|
onContinue,
|
||||||
isAuthenticated = false,
|
isAuthenticated = false,
|
||||||
}: VersionCheckModalProps) {
|
}: VersionCheckModalProps) {
|
||||||
@@ -47,10 +44,6 @@ export function VersionCheckModal({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleVersionDismiss = () => {
|
|
||||||
setVersionDismissed(true);
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleDownloadUpdate = () => {
|
const handleDownloadUpdate = () => {
|
||||||
if (versionInfo?.latest_release?.html_url) {
|
if (versionInfo?.latest_release?.html_url) {
|
||||||
window.open(versionInfo.latest_release.html_url, "_blank");
|
window.open(versionInfo.latest_release.html_url, "_blank");
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import { isElectron } from "./ui/main-axios.ts";
|
|||||||
|
|
||||||
function useWindowWidth() {
|
function useWindowWidth() {
|
||||||
const [width, setWidth] = useState(window.innerWidth);
|
const [width, setWidth] = useState(window.innerWidth);
|
||||||
const [isMobile, setIsMobile] = useState(window.innerWidth < 768);
|
|
||||||
const lastSwitchTime = useRef(0);
|
const lastSwitchTime = useRef(0);
|
||||||
const isCurrentlyMobile = useRef(window.innerWidth < 768);
|
const isCurrentlyMobile = useRef(window.innerWidth < 768);
|
||||||
const hasSwitchedOnce = useRef(false);
|
const hasSwitchedOnce = useRef(false);
|
||||||
@@ -36,7 +35,6 @@ function useWindowWidth() {
|
|||||||
isCurrentlyMobile.current = newIsMobile;
|
isCurrentlyMobile.current = newIsMobile;
|
||||||
hasSwitchedOnce.current = true;
|
hasSwitchedOnce.current = true;
|
||||||
setWidth(newWidth);
|
setWidth(newWidth);
|
||||||
setIsMobile(newIsMobile);
|
|
||||||
} else {
|
} else {
|
||||||
setWidth(newWidth);
|
setWidth(newWidth);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ import {
|
|||||||
Trash2,
|
Trash2,
|
||||||
Users,
|
Users,
|
||||||
Database,
|
Database,
|
||||||
Key,
|
|
||||||
Lock,
|
Lock,
|
||||||
Download,
|
Download,
|
||||||
Upload,
|
Upload,
|
||||||
@@ -46,7 +45,6 @@ import {
|
|||||||
makeUserAdmin,
|
makeUserAdmin,
|
||||||
removeAdminStatus,
|
removeAdminStatus,
|
||||||
deleteUser,
|
deleteUser,
|
||||||
getCookie,
|
|
||||||
isElectron,
|
isElectron,
|
||||||
} from "@/ui/main-axios.ts";
|
} from "@/ui/main-axios.ts";
|
||||||
|
|
||||||
@@ -96,8 +94,6 @@ export function AdminSettings({
|
|||||||
null,
|
null,
|
||||||
);
|
);
|
||||||
|
|
||||||
const [securityInitialized, setSecurityInitialized] = React.useState(true);
|
|
||||||
|
|
||||||
const [exportLoading, setExportLoading] = React.useState(false);
|
const [exportLoading, setExportLoading] = React.useState(false);
|
||||||
const [importLoading, setImportLoading] = React.useState(false);
|
const [importLoading, setImportLoading] = React.useState(false);
|
||||||
const [importFile, setImportFile] = React.useState<File | null>(null);
|
const [importFile, setImportFile] = React.useState<File | null>(null);
|
||||||
@@ -278,7 +274,7 @@ export function AdminSettings({
|
|||||||
await removeAdminStatus(username);
|
await removeAdminStatus(username);
|
||||||
toast.success(t("admin.adminStatusRemoved", { username }));
|
toast.success(t("admin.adminStatusRemoved", { username }));
|
||||||
fetchUsers();
|
fetchUsers();
|
||||||
} catch (err: unknown) {
|
} catch {
|
||||||
toast.error(t("admin.failedToRemoveAdminStatus"));
|
toast.error(t("admin.failedToRemoveAdminStatus"));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -292,7 +288,7 @@ export function AdminSettings({
|
|||||||
await deleteUser(username);
|
await deleteUser(username);
|
||||||
toast.success(t("admin.userDeletedSuccessfully", { username }));
|
toast.success(t("admin.userDeletedSuccessfully", { username }));
|
||||||
fetchUsers();
|
fetchUsers();
|
||||||
} catch (err: unknown) {
|
} catch {
|
||||||
toast.error(t("admin.failedToDeleteUser"));
|
toast.error(t("admin.failedToDeleteUser"));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -363,7 +359,7 @@ export function AdminSettings({
|
|||||||
toast.error(error.error || t("admin.databaseExportFailed"));
|
toast.error(error.error || t("admin.databaseExportFailed"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch {
|
||||||
toast.error(t("admin.databaseExportFailed"));
|
toast.error(t("admin.databaseExportFailed"));
|
||||||
} finally {
|
} finally {
|
||||||
setExportLoading(false);
|
setExportLoading(false);
|
||||||
@@ -455,7 +451,7 @@ export function AdminSettings({
|
|||||||
toast.error(error.error || t("admin.databaseImportFailed"));
|
toast.error(error.error || t("admin.databaseImportFailed"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch {
|
||||||
toast.error(t("admin.databaseImportFailed"));
|
toast.error(t("admin.databaseImportFailed"));
|
||||||
} finally {
|
} finally {
|
||||||
setImportLoading(false);
|
setImportLoading(false);
|
||||||
|
|||||||
Reference in New Issue
Block a user