Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/chat/MessageContainer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ $effect(() => {
is a single left-aligned column that centres itself via its own
max-width + auto margins, so centring here would collapse it to its
content width and re-ragged the left edge. -->
<div class="s2b-flex s2b-flex-col s2b-items-stretch s2b-justify-center s2b-h-full">
<div class="s2b-chat-empty-state s2b-flex s2b-flex-col s2b-items-stretch s2b-justify-center s2b-h-full">
<ChatRecommendations {registry} {threadPath} />
</div>
{:else}
Expand Down
18 changes: 14 additions & 4 deletions src/views/chat/Chat.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -265,10 +265,9 @@ function portalComposer(node: HTMLElement) {
const band = (keyboard: number, isComposing: boolean) =>
Math.max(keyboard + (isComposing ? COMPOSING_BAND : toolbarHeight), 52 + safeBottom);

// Core's toolbar technique: the composer is already at its end position, so
// Core's toolbar technique: the element is already at its end position, so
// offset it back by the distance travelled and transition the offset away.
const slideComposer = (el: HTMLElement, offset: number) => {
if (offset === 0 || reducedMotion.matches || el.style.display === "none") return;
const slide = (el: HTMLElement, offset: number) => {
el.style.transition = "none";
el.style.transform = `translateY(${offset}px)`;
// Commit the offset now, in the triggering task, so the slide starts on
Expand All @@ -277,7 +276,7 @@ function portalComposer(node: HTMLElement) {
el.style.transition = KEYBOARD_SLIDE;
el.style.transform = "";
// Children's transitions (the input card's border colour changes on
// focus, mid-slide) bubble here too; only the composer's own transform
// focus, mid-slide) bubble here too; only the element's own transform
// ends the slide.
const finishSlide = (event: TransitionEvent) => {
if (event.target !== el || event.propertyName !== "transform") return;
Expand All @@ -287,6 +286,17 @@ function portalComposer(node: HTMLElement) {
el.addEventListener("transitionend", finishSlide);
};

// The message area resizes with the band in one frame too (see
// `.s2b-chat-root` in the styles), so an empty chat's greeting, centred in
// it, would jump by half the distance the composer slides. It rides along
// on the same curve over that half.
const slideComposer = (el: HTMLElement, offset: number) => {
if (offset === 0 || reducedMotion.matches || el.style.display === "none") return;
slide(el, offset);
const emptyState = node.querySelector<HTMLElement>(".s2b-chat-empty-state");
if (emptyState) slide(emptyState, offset / 2);
};

const setComposing = (el: HTMLElement, on: boolean) => {
composingPending = false;
if (on === composing) return;
Expand Down
Loading