Skip to content

Build your personal knowledge base with Trilium Notes

refactor(toast): get rid of closeAfter in favor of delay

Elian Doranda17a63ef512
diff --git a/apps/client/src/services/branches.ts b/apps/client/src/services/branches.ts
index 0613ea4ea5..05dc5b9970 100644
--- a/apps/client/src/services/branches.ts
+++ b/apps/client/src/services/branches.ts
@@ -216,7 +216,7 @@ ws.subscribeToMessages(async (message) => {
toastService.showPersistent(makeToast(message.taskId, t("branches.delete-notes-in-progress", { count: message.progressCount })));
} else if (message.type === "taskSucceeded") {
const toast = makeToast(message.taskId, t("branches.delete-finished-successfully"));
- toast.closeAfter = 5000;
+ toast.delay = 5000;
toastService.showPersistent(toast);
}
@@ -234,7 +234,7 @@ ws.subscribeToMessages(async (message) => {
toastService.showPersistent(makeToast(message.taskId, t("branches.undeleting-notes-in-progress", { count: message.progressCount })));
} else if (message.type === "taskSucceeded") {
const toast = makeToast(message.taskId, t("branches.undeleting-notes-finished-successfully"));
- toast.closeAfter = 5000;
+ toast.delay = 5000;
toastService.showPersistent(toast);
}
diff --git a/apps/client/src/services/import.ts b/apps/client/src/services/import.ts
index 2300ca101f..c6557c21df 100644
--- a/apps/client/src/services/import.ts
+++ b/apps/client/src/services/import.ts
@@ -78,7 +78,7 @@ ws.subscribeToMessages(async (message) => {
toastService.showPersistent(makeToast(message.taskId, t("import.in-progress", { progress: message.progressCount })));
} else if (message.type === "taskSucceeded") {
const toast = makeToast(message.taskId, t("import.successful"));
- toast.closeAfter = 5000;
+ toast.delay = 5000;
toastService.showPersistent(toast);
@@ -100,7 +100,7 @@ ws.subscribeToMessages(async (message: WebSocketMessage) => {
toastService.showPersistent(makeToast(message.taskId, t("import.in-progress", { progress: message.progressCount })));
} else if (message.type === "taskSucceeded") {
const toast = makeToast(message.taskId, t("import.successful"));
- toast.closeAfter = 5000;
+ toast.delay = 5000;
toastService.showPersistent(toast);
diff --git a/apps/client/src/services/protected_session.ts b/apps/client/src/services/protected_session.ts
index 1e1984ae5d..068b630141 100644
--- a/apps/client/src/services/protected_session.ts
+++ b/apps/client/src/services/protected_session.ts
@@ -124,7 +124,7 @@ ws.subscribeToMessages(async (message) => {
} else if (message.type === "taskSucceeded") {
const text = isProtecting ? t("protected_session.protecting-finished-successfully") : t("protected_session.unprotecting-finished-successfully");
const toast = makeToast(message, title, text);
- toast.closeAfter = 3000;
+ toast.delay = 3000;
toastService.showPersistent(toast);
}
diff --git a/apps/client/src/services/toast.ts b/apps/client/src/services/toast.ts
index 7c065b1bb3..a397681449 100644
--- a/apps/client/src/services/toast.ts
+++ b/apps/client/src/services/toast.ts
@@ -9,7 +9,6 @@ export interface ToastOptions {
message: string;
delay?: number;
autohide?: boolean;
- closeAfter?: number;
progress?: number;
}
diff --git a/apps/client/src/widgets/dialogs/export.tsx b/apps/client/src/widgets/dialogs/export.tsx
index b694d9abe5..aaad8ab311 100644
--- a/apps/client/src/widgets/dialogs/export.tsx
+++ b/apps/client/src/widgets/dialogs/export.tsx
@@ -152,7 +152,7 @@ ws.subscribeToMessages(async (message) => {
toastService.showPersistent(makeToast(message.taskId, t("export.export_in_progress", { progressCount: message.progressCount })));
} else if (message.type === "taskSucceeded") {
const toast = makeToast(message.taskId, t("export.export_finished_successfully"));
- toast.closeAfter = 5000;
+ toast.delay = 5000;
toastService.showPersistent(toast);
}
diff --git a/apps/client/src/widgets/react/hooks.tsx b/apps/client/src/widgets/react/hooks.tsx
index c560029405..720acfdcdb 100644
--- a/apps/client/src/widgets/react/hooks.tsx
+++ b/apps/client/src/widgets/react/hooks.tsx
@@ -725,7 +725,7 @@ export function useImperativeSearchHighlighlighting(highlightedTokens: string[]
export function useNoteTreeDrag(containerRef: MutableRef<HTMLElement | null | undefined>, { dragEnabled, dragNotEnabledMessage, callback }: {
dragEnabled: boolean,
- dragNotEnabledMessage: Omit<ToastOptions, "id" | "closeAfter">;
+ dragNotEnabledMessage: Omit<ToastOptions, "id">;
callback: (data: DragData[], e: DragEvent) => void
}) {
useEffect(() => {
@@ -737,7 +737,7 @@ export function useNoteTreeDrag(containerRef: MutableRef<HTMLElement | null | un
toast.showPersistent({
...dragNotEnabledMessage,
id: "drag-not-enabled",
- closeAfter: 5000
+ delay: 5000
});
}
}