Skip to content

Build your personal knowledge base with Trilium Notes

refactor(client): use toasts for open-all-too-many and launcher-no-target

Elian Doran467849752560
diff --git a/apps/client/src/widgets/launch_bar/LauncherDefinitions.tsx b/apps/client/src/widgets/launch_bar/LauncherDefinitions.tsx
index 89bdb39194..8f292bbdbe 100644
--- a/apps/client/src/widgets/launch_bar/LauncherDefinitions.tsx
+++ b/apps/client/src/widgets/launch_bar/LauncherDefinitions.tsx
@@ -3,7 +3,6 @@ import { useCallback, useContext, useEffect, useMemo, useState } from "preact/ho
import appContext, { CommandNames } from "../../components/app_context";
import FNote from "../../entities/fnote";
import date_notes from "../../services/date_notes";
-import dialog from "../../services/dialog";
import { LauncherWidgetDefinitionWithType } from "../../services/frontend_script_api_preact";
import { t } from "../../services/i18n";
import toast from "../../services/toast";
@@ -44,7 +43,7 @@ export function NoteLauncher({ launcherNote, ...restProps }: { launcherNote: FNo
getTargetNoteId={(launcherNote) => {
const targetNoteId = launcherNote.getRelationValue("target");
if (!targetNoteId) {
- dialog.info(t("note_launcher.this_launcher_doesnt_define_target_note"));
+ toast.showError(t("note_launcher.this_launcher_doesnt_define_target_note"));
return null;
}
return targetNoteId;
diff --git a/apps/client/src/widgets/note_bars/CollectionProperties.tsx b/apps/client/src/widgets/note_bars/CollectionProperties.tsx
index 207d2a7387..110c42c1f4 100644
--- a/apps/client/src/widgets/note_bars/CollectionProperties.tsx
+++ b/apps/client/src/widgets/note_bars/CollectionProperties.tsx
@@ -7,6 +7,7 @@ import { useRef, useState } from "preact/hooks";
import appContext from "../../components/app_context";
import FNote from "../../entities/fnote";
import dialogService from "../../services/dialog";
+import toast from "../../services/toast";
import { ViewTypeOptions } from "../collections/interface";
import ActionButton from "../react/ActionButton";
import Dropdown from "../react/Dropdown";
@@ -70,7 +71,7 @@ function OpenAllButton({ note, isOpening, setIsOpening }: {
if (count === 0) return;
if (count > MAX_OPEN_TABS) {
- await dialogService.info(t("book_properties.open_all_too_many", { count, max: MAX_OPEN_TABS }));
+ toast.showError(t("book_properties.open_all_too_many", { count, max: MAX_OPEN_TABS }));
return;
}