mirror of
https://github.com/zadam/trilium.git
synced 2025-12-14 03:14:24 +01:00
chore(toast): address requested changes
This commit is contained in:
parent
e02440aa59
commit
d3f9bb6def
@ -43,7 +43,7 @@ export function showError(message: string, timeout = 10000) {
|
|||||||
icon: "bx bx-error-circle",
|
icon: "bx bx-error-circle",
|
||||||
message,
|
message,
|
||||||
timeout
|
timeout
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function showErrorTitleAndMessage(title: string, message: string, timeout = 10000) {
|
function showErrorTitleAndMessage(title: string, message: string, timeout = 10000) {
|
||||||
@ -73,7 +73,7 @@ function updateToast(id: string, partial: Partial<ToastOptions>) {
|
|||||||
return { ...toast, ...partial }
|
return { ...toast, ...partial }
|
||||||
}
|
}
|
||||||
return toast;
|
return toast;
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function removeToastFromStore(id: string) {
|
export function removeToastFromStore(id: string) {
|
||||||
|
|||||||
@ -55,5 +55,5 @@
|
|||||||
inset-inline-end: 0;
|
inset-inline-end: 0;
|
||||||
background-color: var(--toast-text-color) !important;
|
background-color: var(--toast-text-color) !important;
|
||||||
height: 4px;
|
height: 4px;
|
||||||
transition: width 0.1s linear;
|
transition: width 0.1s linear;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,7 +23,12 @@ function Toast({ id, title, timeout, progress, message, icon }: ToastOptionsWith
|
|||||||
return () => clearTimeout(timerId);
|
return () => clearTimeout(timerId);
|
||||||
}, [ id, timeout ]);
|
}, [ id, timeout ]);
|
||||||
|
|
||||||
const closeButton = <button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close" />;
|
const closeButton = (
|
||||||
|
<button
|
||||||
|
type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"
|
||||||
|
onClick={() => removeToastFromStore(id)}
|
||||||
|
/>
|
||||||
|
);
|
||||||
const toastIcon = <Icon icon={icon.startsWith("bx ") ? icon : `bx bx-${icon}`} />;
|
const toastIcon = <Icon icon={icon.startsWith("bx ") ? icon : `bx bx-${icon}`} />;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -185,7 +185,7 @@ export class TypedBasicWidget<T extends TypedComponent<any>> extends TypedCompon
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
toastService.showPersistent({
|
toastService.showPersistent({
|
||||||
id: `custom-widget-failure-${noteId}`,
|
id: `custom-widget-failure-unknown-${crypto.randomUUID()}`,
|
||||||
title: t("toast.widget-error.title"),
|
title: t("toast.widget-error.title"),
|
||||||
icon: "bx bx-error-circle",
|
icon: "bx bx-error-circle",
|
||||||
message: t("toast.widget-error.message-unknown", {
|
message: t("toast.widget-error.message-unknown", {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user