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:
@@ -17,10 +17,7 @@ export const Status = ({ className, status, ...props }: StatusProps) => (
|
|||||||
|
|
||||||
export type StatusIndicatorProps = HTMLAttributes<HTMLSpanElement>;
|
export type StatusIndicatorProps = HTMLAttributes<HTMLSpanElement>;
|
||||||
|
|
||||||
export const StatusIndicator = ({
|
export const StatusIndicator = ({ ...props }: StatusIndicatorProps) => (
|
||||||
className,
|
|
||||||
...props
|
|
||||||
}: StatusIndicatorProps) => (
|
|
||||||
<span className="relative flex h-2 w-2" {...props}>
|
<span className="relative flex h-2 w-2" {...props}>
|
||||||
<span
|
<span
|
||||||
className={cn(
|
className={cn(
|
||||||
|
|||||||
@@ -21,10 +21,7 @@ interface DragToDesktopOptions {
|
|||||||
onError?: (error: string) => void;
|
onError?: (error: string) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function useDragToDesktop({
|
export function useDragToDesktop({ sshSessionId }: UseDragToDesktopProps) {
|
||||||
sshSessionId,
|
|
||||||
sshHost,
|
|
||||||
}: UseDragToDesktopProps) {
|
|
||||||
const [state, setState] = useState<DragToDesktopState>({
|
const [state, setState] = useState<DragToDesktopState>({
|
||||||
isDragging: false,
|
isDragging: false,
|
||||||
isDownloading: false,
|
isDownloading: false,
|
||||||
@@ -137,7 +134,7 @@ export function useDragToDesktop({
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[sshSessionId, sshHost],
|
[sshSessionId],
|
||||||
);
|
);
|
||||||
|
|
||||||
const dragFilesToDesktop = useCallback(
|
const dragFilesToDesktop = useCallback(
|
||||||
@@ -246,7 +243,7 @@ export function useDragToDesktop({
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[sshSessionId, sshHost, dragFileToDesktop],
|
[sshSessionId, dragFileToDesktop],
|
||||||
);
|
);
|
||||||
|
|
||||||
const dragFolderToDesktop = useCallback(
|
const dragFolderToDesktop = useCallback(
|
||||||
@@ -274,7 +271,7 @@ export function useDragToDesktop({
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
[sshSessionId, sshHost],
|
[],
|
||||||
);
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -21,10 +21,7 @@ interface DragToSystemOptions {
|
|||||||
onError?: (error: string) => void;
|
onError?: (error: string) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function useDragToSystemDesktop({
|
export function useDragToSystemDesktop({ sshSessionId }: UseDragToSystemProps) {
|
||||||
sshSessionId,
|
|
||||||
sshHost,
|
|
||||||
}: UseDragToSystemProps) {
|
|
||||||
const [state, setState] = useState<DragToSystemState>({
|
const [state, setState] = useState<DragToSystemState>({
|
||||||
isDragging: false,
|
isDragging: false,
|
||||||
isDownloading: false,
|
isDownloading: false,
|
||||||
@@ -37,34 +34,6 @@ export function useDragToSystemDesktop({
|
|||||||
options: DragToSystemOptions;
|
options: DragToSystemOptions;
|
||||||
} | null>(null);
|
} | 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) => {
|
const saveLastDirectory = async (fileHandle: any) => {
|
||||||
try {
|
try {
|
||||||
if ("indexedDB" in window && fileHandle.getParent) {
|
if ("indexedDB" in window && fileHandle.getParent) {
|
||||||
|
|||||||
Reference in New Issue
Block a user