mirror of
https://github.com/zhom/donutbrowser.git
synced 2026-07-15 08:57:24 +02:00
refactor: cleanup, korean translation
This commit is contained in:
@@ -20,6 +20,14 @@ export type BackendErrorCode =
|
||||
| "COOKIE_DB_LOCKED"
|
||||
| "COOKIE_DB_UNAVAILABLE"
|
||||
| "SELF_HOSTED_REQUIRES_LOGOUT"
|
||||
| "PROXY_NOT_FOUND"
|
||||
| "GROUP_NOT_FOUND"
|
||||
| "VPN_NOT_FOUND"
|
||||
| "EXTENSION_NOT_FOUND"
|
||||
| "EXTENSION_GROUP_NOT_FOUND"
|
||||
| "CANNOT_MODIFY_CLOUD_MANAGED_PROXY"
|
||||
| "SYNC_LOCKED_BY_PROFILE"
|
||||
| "SYNC_NOT_CONFIGURED"
|
||||
| "INTERNAL_ERROR";
|
||||
|
||||
export interface BackendError {
|
||||
@@ -96,6 +104,22 @@ export function translateBackendError(t: TFunction, err: unknown): string {
|
||||
return t("backendErrors.cookieDbUnavailable");
|
||||
case "SELF_HOSTED_REQUIRES_LOGOUT":
|
||||
return t("backendErrors.selfHostedRequiresLogout");
|
||||
case "PROXY_NOT_FOUND":
|
||||
return t("backendErrors.proxyNotFound");
|
||||
case "GROUP_NOT_FOUND":
|
||||
return t("backendErrors.groupNotFound");
|
||||
case "VPN_NOT_FOUND":
|
||||
return t("backendErrors.vpnNotFound");
|
||||
case "EXTENSION_NOT_FOUND":
|
||||
return t("backendErrors.extensionNotFound");
|
||||
case "EXTENSION_GROUP_NOT_FOUND":
|
||||
return t("backendErrors.extensionGroupNotFound");
|
||||
case "CANNOT_MODIFY_CLOUD_MANAGED_PROXY":
|
||||
return t("backendErrors.cannotModifyCloudManagedProxy");
|
||||
case "SYNC_LOCKED_BY_PROFILE":
|
||||
return t("backendErrors.syncLockedByProfile");
|
||||
case "SYNC_NOT_CONFIGURED":
|
||||
return t("backendErrors.syncNotConfigured");
|
||||
case "INTERNAL_ERROR":
|
||||
return t("backendErrors.internal", {
|
||||
detail: parsed.params?.detail ?? "",
|
||||
|
||||
+11
-1
@@ -1,3 +1,4 @@
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
import React from "react";
|
||||
import { type ExternalToast, toast as sonnerToast } from "sonner";
|
||||
import { UnifiedToast } from "@/components/custom-toast";
|
||||
@@ -259,7 +260,7 @@ export function showSyncProgressToast(
|
||||
failed_count: number;
|
||||
phase: string;
|
||||
},
|
||||
options?: { id?: string },
|
||||
options?: { id?: string; profileId?: string },
|
||||
) {
|
||||
return showToast({
|
||||
type: "sync-progress",
|
||||
@@ -268,6 +269,15 @@ export function showSyncProgressToast(
|
||||
id: options?.id,
|
||||
duration: Number.POSITIVE_INFINITY,
|
||||
onCancel: () => {
|
||||
if (options?.profileId) {
|
||||
// Fire-and-forget — backend flips the cancel flag for the in-flight
|
||||
// upload/download loops to drain.
|
||||
void invoke("cancel_profile_sync", {
|
||||
profileId: options.profileId,
|
||||
}).catch((err: unknown) => {
|
||||
console.error("Failed to cancel sync:", err);
|
||||
});
|
||||
}
|
||||
if (options?.id) {
|
||||
dismissToast(options.id);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user