Lutra/ui/src/App.vue
danny d82e57b3ac M4.8: merge conflicts with a three-pane resolve view
Backend (crates/vcs/src/merge.rs, cmd/git_merge.rs via start_with):
git.merge {branch} -> {result: merged|upToDate|conflicts, conflicts},
git.mergeAbort, git.conflictVersions {path} -> {base?, ours, theirs,
binary, tooLarge} from the index stages :1:/:2:/:3:, git.markResolved
{paths}. Repo::lock becomes pub(crate) so merge and abort hold the
mutation lock.

UI (ui/src/components/vcs/merge/): merge dialog with branch picker,
conflicts list from the shared status store, a three-pane resolve view
(ours / editable result / theirs) with accept left/right per chunk,
accept all, previous/next conflict, Apply through the file's buffer then
mark resolved, keep-a-side for modify/delete, abort after confirmation.
Own three-way line merge on @codemirror/merge's diff. UI commands
vcs.merge, vcs.resolveConflicts, vcs.abortMerge (no default shortcuts);
the Changes window opens conflicted rows in the resolve view.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 18:51:04 +01:00

84 lines
2.8 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, the toast stack, the command palette,
* the go-to popup, the settings dialog and the merge dialog. Loads product information from the engine on
* mount, starts showing notifications, following the theme (see
* `theme.ts`; a failed theme report raises an error toast) and the global
* keymap with the UI commands (see `commands/store.ts`), and loads the settings so the
* editor font size applies from the start (see `stores/settings.ts`).
* Starts autosave (see `stores/autosave.ts`) and the Git status colours
* (see `stores/vcsStatus.ts`).
*/
import { onMounted, onUnmounted } from "vue";
import { useCommandsStore } from "./commands/store";
import CommandPalette from "./components/palette/CommandPalette.vue";
import EditorArea from "./components/editor/EditorArea.vue";
import GotoPopup from "./components/goto/GotoPopup.vue";
import MainLayout from "./components/layout/MainLayout.vue";
import NavLayer from "./components/editor/nav/NavLayer.vue";
import NotificationStack from "./components/notifications/NotificationStack.vue";
import RecoveryDialog from "./components/recovery/RecoveryDialog.vue";
import SettingsDialog from "./components/settings/SettingsDialog.vue";
import MergeDialog from "./components/vcs/merge/MergeDialog.vue";
import { useAppStore } from "./stores/app";
import { useAutosaveStore } from "./stores/autosave";
import { useNotificationsStore } from "./stores/notifications";
import { useSettingsStore } from "./stores/settings";
import { useVcsStatusStore } from "./stores/vcsStatus";
import { startTheme } from "./theme";
const app = useAppStore();
const notifications = useNotificationsStore();
const commands = useCommandsStore();
const settings = useSettingsStore();
const autosave = useAutosaveStore();
const vcsStatus = useVcsStatusStore();
/** Stops following the theme; set while mounted. */
let stopTheme: (() => void) | null = null;
onMounted(() => {
notifications.start();
stopTheme = startTheme((error) => notifications.notifyError("theme.systemPreference", error));
void commands.start();
void settings.start();
autosave.start();
vcsStatus.start();
void app.loadAbout();
});
onUnmounted(() => {
stopTheme?.();
stopTheme = null;
commands.stop();
autosave.stop();
vcsStatus.stop();
settings.stop();
notifications.stop();
});
</script>
<template>
<MainLayout>
<EditorArea>
<p class="workbench__hint">
{{ app.about?.slogan ?? "" }}
</p>
</EditorArea>
</MainLayout>
<RecoveryDialog />
<CommandPalette />
<GotoPopup />
<SettingsDialog />
<MergeDialog />
<NavLayer />
<NotificationStack />
</template>
<style scoped>
.workbench__hint {
color: var(--lt-fg-muted);
}
</style>