mirror of
https://github.com/zadam/trilium.git
synced 2025-12-14 11:24:24 +01:00
refactor(toast): get rid of closeAfter in favor of delay
This commit is contained in:
parent
eb8f2021cb
commit
da17a63ef5
@ -216,7 +216,7 @@ ws.subscribeToMessages(async (message) => {
|
|||||||
toastService.showPersistent(makeToast(message.taskId, t("branches.delete-notes-in-progress", { count: message.progressCount })));
|
toastService.showPersistent(makeToast(message.taskId, t("branches.delete-notes-in-progress", { count: message.progressCount })));
|
||||||
} else if (message.type === "taskSucceeded") {
|
} else if (message.type === "taskSucceeded") {
|
||||||
const toast = makeToast(message.taskId, t("branches.delete-finished-successfully"));
|
const toast = makeToast(message.taskId, t("branches.delete-finished-successfully"));
|
||||||
toast.closeAfter = 5000;
|
toast.delay = 5000;
|
||||||
|
|
||||||
toastService.showPersistent(toast);
|
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 })));
|
toastService.showPersistent(makeToast(message.taskId, t("branches.undeleting-notes-in-progress", { count: message.progressCount })));
|
||||||
} else if (message.type === "taskSucceeded") {
|
} else if (message.type === "taskSucceeded") {
|
||||||
const toast = makeToast(message.taskId, t("branches.undeleting-notes-finished-successfully"));
|
const toast = makeToast(message.taskId, t("branches.undeleting-notes-finished-successfully"));
|
||||||
toast.closeAfter = 5000;
|
toast.delay = 5000;
|
||||||
|
|
||||||
toastService.showPersistent(toast);
|
toastService.showPersistent(toast);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -78,7 +78,7 @@ ws.subscribeToMessages(async (message) => {
|
|||||||
toastService.showPersistent(makeToast(message.taskId, t("import.in-progress", { progress: message.progressCount })));
|
toastService.showPersistent(makeToast(message.taskId, t("import.in-progress", { progress: message.progressCount })));
|
||||||
} else if (message.type === "taskSucceeded") {
|
} else if (message.type === "taskSucceeded") {
|
||||||
const toast = makeToast(message.taskId, t("import.successful"));
|
const toast = makeToast(message.taskId, t("import.successful"));
|
||||||
toast.closeAfter = 5000;
|
toast.delay = 5000;
|
||||||
|
|
||||||
toastService.showPersistent(toast);
|
toastService.showPersistent(toast);
|
||||||
|
|
||||||
@ -100,7 +100,7 @@ ws.subscribeToMessages(async (message: WebSocketMessage) => {
|
|||||||
toastService.showPersistent(makeToast(message.taskId, t("import.in-progress", { progress: message.progressCount })));
|
toastService.showPersistent(makeToast(message.taskId, t("import.in-progress", { progress: message.progressCount })));
|
||||||
} else if (message.type === "taskSucceeded") {
|
} else if (message.type === "taskSucceeded") {
|
||||||
const toast = makeToast(message.taskId, t("import.successful"));
|
const toast = makeToast(message.taskId, t("import.successful"));
|
||||||
toast.closeAfter = 5000;
|
toast.delay = 5000;
|
||||||
|
|
||||||
toastService.showPersistent(toast);
|
toastService.showPersistent(toast);
|
||||||
|
|
||||||
|
|||||||
@ -124,7 +124,7 @@ ws.subscribeToMessages(async (message) => {
|
|||||||
} else if (message.type === "taskSucceeded") {
|
} else if (message.type === "taskSucceeded") {
|
||||||
const text = isProtecting ? t("protected_session.protecting-finished-successfully") : t("protected_session.unprotecting-finished-successfully");
|
const text = isProtecting ? t("protected_session.protecting-finished-successfully") : t("protected_session.unprotecting-finished-successfully");
|
||||||
const toast = makeToast(message, title, text);
|
const toast = makeToast(message, title, text);
|
||||||
toast.closeAfter = 3000;
|
toast.delay = 3000;
|
||||||
|
|
||||||
toastService.showPersistent(toast);
|
toastService.showPersistent(toast);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,7 +9,6 @@ export interface ToastOptions {
|
|||||||
message: string;
|
message: string;
|
||||||
delay?: number;
|
delay?: number;
|
||||||
autohide?: boolean;
|
autohide?: boolean;
|
||||||
closeAfter?: number;
|
|
||||||
progress?: number;
|
progress?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -152,7 +152,7 @@ ws.subscribeToMessages(async (message) => {
|
|||||||
toastService.showPersistent(makeToast(message.taskId, t("export.export_in_progress", { progressCount: message.progressCount })));
|
toastService.showPersistent(makeToast(message.taskId, t("export.export_in_progress", { progressCount: message.progressCount })));
|
||||||
} else if (message.type === "taskSucceeded") {
|
} else if (message.type === "taskSucceeded") {
|
||||||
const toast = makeToast(message.taskId, t("export.export_finished_successfully"));
|
const toast = makeToast(message.taskId, t("export.export_finished_successfully"));
|
||||||
toast.closeAfter = 5000;
|
toast.delay = 5000;
|
||||||
|
|
||||||
toastService.showPersistent(toast);
|
toastService.showPersistent(toast);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -725,7 +725,7 @@ export function useImperativeSearchHighlighlighting(highlightedTokens: string[]
|
|||||||
|
|
||||||
export function useNoteTreeDrag(containerRef: MutableRef<HTMLElement | null | undefined>, { dragEnabled, dragNotEnabledMessage, callback }: {
|
export function useNoteTreeDrag(containerRef: MutableRef<HTMLElement | null | undefined>, { dragEnabled, dragNotEnabledMessage, callback }: {
|
||||||
dragEnabled: boolean,
|
dragEnabled: boolean,
|
||||||
dragNotEnabledMessage: Omit<ToastOptions, "id" | "closeAfter">;
|
dragNotEnabledMessage: Omit<ToastOptions, "id">;
|
||||||
callback: (data: DragData[], e: DragEvent) => void
|
callback: (data: DragData[], e: DragEvent) => void
|
||||||
}) {
|
}) {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -737,7 +737,7 @@ export function useNoteTreeDrag(containerRef: MutableRef<HTMLElement | null | un
|
|||||||
toast.showPersistent({
|
toast.showPersistent({
|
||||||
...dragNotEnabledMessage,
|
...dragNotEnabledMessage,
|
||||||
id: "drag-not-enabled",
|
id: "drag-not-enabled",
|
||||||
closeAfter: 5000
|
delay: 5000
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user