fix: remove 7 unused variables in UI hooks and components

Cleaned up unused parameters and functions:
- status/index.tsx: removed unused className parameter from StatusIndicator
- useDragToDesktop.ts: removed unused sshHost parameter and from dependency
  arrays (4 occurrences)
- useDragToSystemDesktop.ts: removed unused sshHost parameter and
  getLastSaveDirectory function (29 lines removed)

Continued reducing frontend lint errors
This commit is contained in:
ZacharyZcR
2025-10-09 19:46:28 +08:00
parent 45a4f09172
commit 45d4cbf2c1
3 changed files with 6 additions and 43 deletions

View File

@@ -17,10 +17,7 @@ export const Status = ({ className, status, ...props }: StatusProps) => (
export type StatusIndicatorProps = HTMLAttributes<HTMLSpanElement>;
export const StatusIndicator = ({
className,
...props
}: StatusIndicatorProps) => (
export const StatusIndicator = ({ ...props }: StatusIndicatorProps) => (
<span className="relative flex h-2 w-2" {...props}>
<span
className={cn(

View File

@@ -21,10 +21,7 @@ interface DragToDesktopOptions {
onError?: (error: string) => void;
}
export function useDragToDesktop({
sshSessionId,
sshHost,
}: UseDragToDesktopProps) {
export function useDragToDesktop({ sshSessionId }: UseDragToDesktopProps) {
const [state, setState] = useState<DragToDesktopState>({
isDragging: false,
isDownloading: false,
@@ -137,7 +134,7 @@ export function useDragToDesktop({
return false;
}
},
[sshSessionId, sshHost],
[sshSessionId],
);
const dragFilesToDesktop = useCallback(
@@ -246,7 +243,7 @@ export function useDragToDesktop({
return false;
}
},
[sshSessionId, sshHost, dragFileToDesktop],
[sshSessionId, dragFileToDesktop],
);
const dragFolderToDesktop = useCallback(
@@ -274,7 +271,7 @@ export function useDragToDesktop({
return false;
},
[sshSessionId, sshHost],
[],
);
return {

View File

@@ -21,10 +21,7 @@ interface DragToSystemOptions {
onError?: (error: string) => void;
}
export function useDragToSystemDesktop({
sshSessionId,
sshHost,
}: UseDragToSystemProps) {
export function useDragToSystemDesktop({ sshSessionId }: UseDragToSystemProps) {
const [state, setState] = useState<DragToSystemState>({
isDragging: false,
isDownloading: false,
@@ -37,34 +34,6 @@ export function useDragToSystemDesktop({
options: DragToSystemOptions;
} | null>(null);
const getLastSaveDirectory = async () => {
try {
if ("indexedDB" in window) {
const request = indexedDB.open("termix-dirs", 1);
return new Promise((resolve) => {
request.onsuccess = () => {
const db = request.result;
const transaction = db.transaction(["directories"], "readonly");
const store = transaction.objectStore("directories");
const getRequest = store.get("lastSaveDir");
getRequest.onsuccess = () =>
resolve(getRequest.result?.handle || null);
};
request.onerror = () => resolve(null);
request.onupgradeneeded = () => {
const db = request.result;
if (!db.objectStoreNames.contains("directories")) {
db.createObjectStore("directories");
}
};
});
}
} catch {
// IndexedDB not available or failed to retrieve directory
}
return null;
};
const saveLastDirectory = async (fileHandle: any) => {
try {
if ("indexedDB" in window && fileHandle.getParent) {