Lutra/ui/src/App.vue
danny f41df518b5 M1.12: notifications as toasts
The host publishes picker, command-line and pump errors as notification
events (Engine::notify, same id sequence) instead of stderr, keeps
notifications and watchFailed published before engine_ready and replays
them after the state replay, so startup warnings (corrupt settings,
journal entries) reach the UI. ipc.ts announces engine_ready once all
subscriptions started together are registered.

Frontend: notifications store and NotificationStack (bottom right, info
auto-dismissed after 5 s, warnings/errors stay, close button and Escape,
at most 5 visible with "+n more", role status/alert); watchFailed maps to
a warning toast; failed commands without their own UI raise an error
toast. Catalog keys notification.settings.*, project.*, vfs.*, watch.*,
command.* plus the runtime allow-list. Docs updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 16:20:45 +02:00

54 lines
1.6 KiB
Vue

<script setup lang="ts">
/**
* Root component: mounts the main window layout with the editor area; the
* slogan shows while no tab is open, and the restore dialog for unsaved
* texts from the recovery journal, and the toast stack. Loads product
* information from the engine on mount, starts showing notifications and
* following the theme (see `theme.ts`); a failed theme report raises an
* error toast.
*/
import { onMounted, onUnmounted } from "vue";
import EditorArea from "./components/editor/EditorArea.vue";
import MainLayout from "./components/layout/MainLayout.vue";
import NotificationStack from "./components/notifications/NotificationStack.vue";
import RecoveryDialog from "./components/recovery/RecoveryDialog.vue";
import { useAppStore } from "./stores/app";
import { useNotificationsStore } from "./stores/notifications";
import { startTheme } from "./theme";
const app = useAppStore();
const notifications = useNotificationsStore();
/** Stops following the theme; set while mounted. */
let stopTheme: (() => void) | null = null;
onMounted(() => {
notifications.start();
stopTheme = startTheme((error) => notifications.notifyError("theme.systemPreference", error));
void app.loadAbout();
});
onUnmounted(() => {
stopTheme?.();
stopTheme = null;
notifications.stop();
});
</script>
<template>
<MainLayout>
<EditorArea>
<p class="workbench__hint">
{{ app.about?.slogan ?? "" }}
</p>
</EditorArea>
</MainLayout>
<RecoveryDialog />
<NotificationStack />
</template>
<style scoped>
.workbench__hint {
color: var(--lt-fg-muted);
}
</style>