diff --git a/src/components/cookie-copy-dialog.tsx b/src/components/cookie-copy-dialog.tsx index 6005d6f..8879be6 100644 --- a/src/components/cookie-copy-dialog.tsx +++ b/src/components/cookie-copy-dialog.tsx @@ -3,14 +3,14 @@ import { invoke } from "@tauri-apps/api/core"; import { useCallback, useEffect, useMemo, useState } from "react"; import { useTranslation } from "react-i18next"; -import { - LuChevronDown, - LuChevronRight, - LuCookie, - LuSearch, -} from "react-icons/lu"; +import { LuChevronRight, LuCookie, LuSearch } from "react-icons/lu"; import { toast } from "sonner"; import { LoadingButton } from "@/components/loading-button"; +import { + AnimatedDisclosureChevron, + AnimatedDisclosureContent, + AnimatedDisclosureItem, +} from "@/components/ui/animated-disclosure"; import { Checkbox } from "@/components/ui/checkbox"; import { Dialog, @@ -546,7 +546,7 @@ function DomainRow({ selectedCount > 0 && selectedCount < domain.cookie_count && !isAllSelected; return ( -
{title}
- {onCancel && ( - - )} -+ {title} +
+ {onCancel && ( + + )} +- {progress.percentage.toFixed(1)}% - {progress.speed && ` • ${progress.speed} MB/s`} - {progress.eta && - ` • ${t("toasts.progress.remaining", { time: progress.eta })}`} -
+ {/* Download progress */} + {type === "download" && + progress && + "percentage" in progress && + stage === "downloading" && ( ++ {progress.percentage.toFixed(1)}% + {progress.speed && ` • ${progress.speed} MB/s`} + {progress.eta && + ` • ${t("toasts.progress.remaining", { time: progress.eta })}`} +
+- {progress.percentage.toFixed(1)}% -
-- {progress.current_browser && - t("versionUpdater.toast.lookingForUpdates", { - browser: progress.current_browser, - })} -
-- {progress.phase === "uploading" - ? t("appUpdate.toast.uploading") - : t("appUpdate.toast.downloading")}{" "} - {t("toasts.progress.filesProgress", { - completed: progress.completed_files, - total: progress.total_files, - })} - {" \u2022 "} - {formatBytesCompact(progress.completed_bytes)} /{" "} - {formatBytesCompact(progress.total_bytes)} - {progress.speed_bytes_per_sec > 0 && ( + {type === "download" && + (stage === "extracting" || stage === "verifying") && ( +
+ {progress.percentage.toFixed(1)}% +
+- {t("toasts.progress.filesFailed", { - count: progress.failed_count, +
+ {progress.current_browser && + t("versionUpdater.toast.lookingForUpdates", { + browser: progress.current_browser, + })} +
++ {progress.phase === "uploading" + ? t("appUpdate.toast.uploading") + : t("appUpdate.toast.downloading")}{" "} + {t("toasts.progress.filesProgress", { + completed: progress.completed_files, + total: progress.total_files, })} + {" \u2022 "} + {formatBytesCompact(progress.completed_bytes)} /{" "} + {formatBytesCompact(progress.total_bytes)} + {progress.speed_bytes_per_sec > 0 && ( + <> + {" \u2022 "} + {formatSpeedCompact(progress.speed_bytes_per_sec)} + > + )} + {progress.eta_seconds > 0 && + progress.completed_files < progress.total_files && + ` \u2022 ${t("toasts.progress.remaining", { + time: `~${formatEtaCompact(progress.eta_seconds)}`, + })}`} +
+ {progress.failed_count > 0 && ( ++ {t("toasts.progress.filesFailed", { + count: progress.failed_count, + })} +
+ )} ++ {description} +
+ )} + + {/* Stage-specific descriptions for downloads */} + {type === "download" && !description && ( + <> + {stage === "extracting" && ( ++ {t("browserDownload.toast.extracting")}
)} -+ {t("browserDownload.toast.verifying")} +
+ )} + > )} - - {/* Description */} - {description && ( -- {description} -
- )} - - {/* Stage-specific descriptions for downloads */} - {type === "download" && !description && ( - <> - {stage === "extracting" && ( -- {t("browserDownload.toast.extracting")} -
+ {action && + "onClick" in (action as { onClick?: () => void; label?: string }) && + "label" in (action as { onClick?: () => void; label?: string }) && ( +- {t("browserDownload.toast.verifying")} -
- )} - > - )} - {action && - "onClick" in (action as { onClick?: () => void; label?: string }) && - "label" in (action as { onClick?: () => void; label?: string }) && ( -
- {t("proxies.importDialog.dropzonePrompt")}
-
-
- {t("proxies.importDialog.dropzoneFormats")}
-
-
- {t("proxies.importDialog.pasteHint", { modKey })} -
-
- {t("proxies.importDialog.namePrefixHint", {
- prefix:
- namePrefix || t("proxies.importDialog.namePrefixDefault"),
- })}
+ >
+
+ {t("proxies.importDialog.dropzonePrompt")}
+
+
+ {t("proxies.importDialog.dropzoneFormats")}
+
+
+ {t("proxies.importDialog.pasteHint", { modKey })}
- {t("proxies.importDialog.ambiguousIntro")} -
-
- {proxy.line}
-
- + {t("proxies.importDialog.namePrefixHint", { + prefix: + namePrefix || t("proxies.importDialog.namePrefixDefault"), + })} +
++ {t("proxies.importDialog.ambiguousIntro")} +
+
+ {proxy.line}
+
+ - {t("vpns.import.dropzonePrompt")} -
- { - const file = e.target.files?.[0]; - if (file) handleFileRead(file); - e.target.value = ""; + onKeyDown={(e) => { + if (e.key === "Enter" || e.key === " ") { + e.preventDefault(); + document.getElementById("vpn-file-input")?.click(); + } }} - /> + > ++ {t("vpns.import.dropzonePrompt")} +
+ { + const file = e.target.files?.[0]; + if (file) handleFileRead(file); + e.target.value = ""; + }} + /> ++ {t("vpns.import.pasteHint", { modKey })} +
- {t("vpns.import.pasteHint", { modKey })} -
-
+ {vpnPreview.content.slice(0, 1000)}
+ {vpnPreview.content.length > 1000 && "..."}
+
+
- {vpnPreview.content.slice(0, 1000)}
- {vpnPreview.content.length > 1000 && "..."}
-
-