F1: conflict toast closes when the merge ends, toasts keep off the commit box

The merge store dismisses its conflict warning once the status lists no
conflicted file (resolved, committed or aborted) and replaces it on a new
conflicted merge. The toast stack moves above areas registered with
keepClearOf; the Changes window registers its commit box.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
danny 2026-11-02 18:53:08 +01:00
parent e228d11ef9
commit 750ecf5e51
7 changed files with 235 additions and 9 deletions

View file

@ -8,13 +8,65 @@
* toasts beyond the visible limit collapse into a "+n more" button. The
* colours match the editor's in-place notices (`--lt-notice-bg`, the error
* tint).
*
* The stack never covers an area registered with `keepClearOf` (the commit
* box): it moves above it ({@link stackBottom}) and is placed again when
* toasts come, the window resizes or a kept area changes size.
*/
import { CircleAlert, Info, TriangleAlert, X } from "@lucide/vue";
import { onBeforeUnmount, onMounted, ref, watch } from "vue";
import { t } from "../../i18n";
import { useNotificationsStore, type NotificationLevel } from "../../stores/notifications";
import { STACK_BOTTOM, stackBottom, useNotificationsStore, type NotificationLevel } from "../../stores/notifications";
const notifications = useNotificationsStore();
/** The stack's CSS `bottom`, in pixels. */
const bottom = ref(STACK_BOTTOM);
/** Watches the kept areas and their parents for size changes; null where unsupported. */
const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(place);
/** Moves the stack above every kept area it would cover. */
function place(): void {
const areas = notifications.keepClear.map((element) => element.getBoundingClientRect());
bottom.value = stackBottom(window.innerWidth, window.innerHeight, areas);
}
/** Observes the kept areas and the elements around them (a resized panel moves them). */
function observe(): void {
if (!observer) {
return;
}
observer.disconnect();
for (const element of notifications.keepClear) {
observer.observe(element);
if (element.parentElement) {
observer.observe(element.parentElement);
}
}
}
watch(
() => notifications.keepClear,
() => {
observe();
place();
},
);
watch(() => notifications.toasts.length, place);
onMounted(() => {
window.addEventListener("resize", place);
observe();
place();
});
onBeforeUnmount(() => {
window.removeEventListener("resize", place);
observer?.disconnect();
});
/** Icon of each level. */
const ICONS = { info: Info, warning: TriangleAlert, error: CircleAlert } as const;
@ -32,6 +84,7 @@ function roleOf(level: NotificationLevel): "status" | "alert" {
<section
v-if="notifications.toasts.length > 0"
class="toasts"
:style="{ bottom: `${bottom}px`, maxHeight: `calc(100vh - ${bottom + STACK_BOTTOM}px)` }"
:aria-label="t('notification.stack.label')"
data-test="toasts"
>
@ -85,14 +138,12 @@ function roleOf(level: NotificationLevel): "status" | "alert" {
.toasts {
position: fixed;
right: 16px;
bottom: 36px;
z-index: 100;
display: flex;
flex-direction: column;
align-items: flex-end;
gap: 8px;
width: min(420px, calc(100vw - 32px));
max-height: calc(100vh - 72px);
overflow-y: auto;
user-select: text;
}