mirror of
https://github.com/zhom/donutbrowser.git
synced 2026-08-14 23:20:41 +02:00
chore: linting
This commit is contained in:
@@ -22,18 +22,15 @@ export function useAutoHeight<T extends HTMLElement = HTMLDivElement>(
|
||||
const el = ref.current;
|
||||
if (!el) return 0;
|
||||
|
||||
const base = el.getBoundingClientRect().height ?? 0;
|
||||
const base = el.getBoundingClientRect().height;
|
||||
|
||||
let extra = 0;
|
||||
|
||||
if (options.includeParentBox && el.parentElement) {
|
||||
const cs = getComputedStyle(el.parentElement);
|
||||
const paddingY =
|
||||
(parseFloat(cs.paddingTop ?? "0") ?? 0) +
|
||||
(parseFloat(cs.paddingBottom ?? "0") ?? 0);
|
||||
const paddingY = parseFloat(cs.paddingTop) + parseFloat(cs.paddingBottom);
|
||||
const borderY =
|
||||
(parseFloat(cs.borderTopWidth ?? "0") ?? 0) +
|
||||
(parseFloat(cs.borderBottomWidth ?? "0") ?? 0);
|
||||
parseFloat(cs.borderTopWidth) + parseFloat(cs.borderBottomWidth);
|
||||
const isBorderBox = cs.boxSizing === "border-box";
|
||||
if (isBorderBox) {
|
||||
extra += paddingY + borderY;
|
||||
@@ -42,20 +39,16 @@ export function useAutoHeight<T extends HTMLElement = HTMLDivElement>(
|
||||
|
||||
if (options.includeSelfBox) {
|
||||
const cs = getComputedStyle(el);
|
||||
const paddingY =
|
||||
(parseFloat(cs.paddingTop ?? "0") ?? 0) +
|
||||
(parseFloat(cs.paddingBottom ?? "0") ?? 0);
|
||||
const paddingY = parseFloat(cs.paddingTop) + parseFloat(cs.paddingBottom);
|
||||
const borderY =
|
||||
(parseFloat(cs.borderTopWidth ?? "0") ?? 0) +
|
||||
(parseFloat(cs.borderBottomWidth ?? "0") ?? 0);
|
||||
parseFloat(cs.borderTopWidth) + parseFloat(cs.borderBottomWidth);
|
||||
const isBorderBox = cs.boxSizing === "border-box";
|
||||
if (isBorderBox) {
|
||||
extra += paddingY + borderY;
|
||||
}
|
||||
}
|
||||
|
||||
const dpr =
|
||||
typeof window !== "undefined" ? (window.devicePixelRatio ?? 1) : 1;
|
||||
const dpr = typeof window !== "undefined" ? window.devicePixelRatio : 1;
|
||||
const total = Math.ceil((base + extra) * dpr) / dpr;
|
||||
|
||||
return total;
|
||||
|
||||
@@ -367,7 +367,9 @@ export function useBrowserDownload() {
|
||||
? loadDownloadedVersions("camoufox")
|
||||
: Promise.resolve([]),
|
||||
]);
|
||||
} catch {}
|
||||
} catch {
|
||||
/* empty */
|
||||
}
|
||||
showDownloadToast(browserName, progress.version, "completed");
|
||||
setDownloadProgress(null);
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ export function useCloudAuth(): UseCloudAuthReturn {
|
||||
};
|
||||
}, [loadUser]);
|
||||
|
||||
const requestOtp = useCallback(async (email: string): Promise<string> => {
|
||||
const requestOtp = useCallback((email: string): Promise<string> => {
|
||||
return invoke<string>("cloud_request_otp", { email });
|
||||
}, []);
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ interface CommonControlledStateProps<T> {
|
||||
defaultValue?: T;
|
||||
}
|
||||
|
||||
export function useControlledState<T, Rest extends any[] = []>(
|
||||
export function useControlledState<T, Rest extends unknown[] = []>(
|
||||
props: CommonControlledStateProps<T> & {
|
||||
onChange?: (value: T, ...args: Rest) => void;
|
||||
},
|
||||
|
||||
@@ -17,7 +17,7 @@ export function useProxyEvents() {
|
||||
// Load proxy usage (how many profiles are using each proxy)
|
||||
const loadProxyUsage = useCallback(async () => {
|
||||
try {
|
||||
const profiles = await invoke<Array<{ proxy_id?: string }>>(
|
||||
const profiles = await invoke<{ proxy_id?: string }[]>(
|
||||
"list_browser_profiles",
|
||||
);
|
||||
const counts: Record<string, number> = {};
|
||||
|
||||
@@ -16,7 +16,7 @@ export function useVpnEvents() {
|
||||
|
||||
const loadVpnUsage = useCallback(async () => {
|
||||
try {
|
||||
const profiles = await invoke<Array<{ vpn_id?: string }>>(
|
||||
const profiles = await invoke<{ vpn_id?: string }[]>(
|
||||
"list_browser_profiles",
|
||||
);
|
||||
const counts: Record<string, number> = {};
|
||||
|
||||
Reference in New Issue
Block a user