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
54 changes: 23 additions & 31 deletions apps/web/src/bots/bots.css
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,9 @@ html:active-view-transition[data-bots-app]
[data-chat-composer-overlay]::before {
background-color: var(--bots-page) !important;
}
/* The jump-to-latest disc stands in the composer's area, so it never covers the transcript. On a
wide lane it sits in the gutter after the composer, level with its top edge. */
/* The jump-to-latest disc stays out of the composer field. On a wide lane it sits in the gutter
after the composer, level with its top edge; on a narrow lane it floats just above the composer
at its right edge. */
@media (min-width: 640px) {
:root[data-bots-app] [data-bots-mode="true"] .chat-scroll-to-bottom {
bottom: calc(var(--bot-composer-height, 0px) - 2.5rem) !important;
Expand All @@ -200,36 +201,12 @@ html:active-view-transition[data-bots-app]
margin-inline-start: calc((100% + min(100%, var(--chat-content-max-width))) / 2 + 0.5rem);
}
}
/* A narrow lane has no gutter: the disc ends the composer's row, as the attach disc starts it,
and the capsule between them gives up that much of its width. */
@media (max-width: 639px) {
:root[data-bots-app] [data-bots-mode="true"] .chat-scroll-to-bottom {
bottom: max(env(safe-area-inset-bottom), 0.5rem) !important;
bottom: calc(var(--bot-composer-height, 0px) + 0.375rem) !important;
justify-content: flex-end;
padding: 0 calc(env(safe-area-inset-right) + 0.75rem) 0 0;
}
:root[data-bots-app][data-keyboard-open] [data-bots-mode="true"] .chat-scroll-to-bottom {
bottom: 0.5rem !important;
}
:root[data-bots-app] [data-bots-mode="true"] .chat-scroll-to-bottom [data-slot="button"] {
width: 2.75rem;
height: 2.75rem;
}
:root[data-bots-app]
[data-bots-mode="true"]
:has(> .chat-scroll-to-bottom)
~ [data-chat-composer-overlay]
[data-bot-composer="true"]
[data-chat-composer-surface] {
padding-inline-end: 3.25rem;
}
:root[data-bots-app]
[data-bots-mode="true"]
:has(> .chat-scroll-to-bottom)
~ [data-chat-composer-overlay]
[data-bot-composer="true"]
[data-chat-composer-surface]::after {
inset-inline-end: 3.25rem;
padding: 0 calc(env(safe-area-inset-right) + 0.75rem) 0
calc(env(safe-area-inset-left) + 0.75rem);
}
}
/* A tab screen's list ends above the tab bar. */
Expand Down Expand Up @@ -344,6 +321,19 @@ html[data-bots-app] body {
:is([data-slot="button"], [data-bots-tab-bar] button, [data-bots-tab-search]) {
transition: scale 120ms cubic-bezier(0.2, 0.8, 0.2, 1) !important;
}
/* The jump-to-latest disc fades in and out in place, then hides so it paints nothing at rest. */
:root[data-bots-app] .chat-scroll-to-bottom [data-scroll-to-end] {
transition:
scale 120ms cubic-bezier(0.2, 0.8, 0.2, 1),
opacity 160ms ease-out,
visibility 0s linear 160ms !important;
}
:root[data-bots-app] .chat-scroll-to-bottom[data-visible="true"] [data-scroll-to-end] {
transition:
scale 120ms cubic-bezier(0.2, 0.8, 0.2, 1),
opacity 160ms ease-out,
visibility 0s linear 0s !important;
}
/* A message, the typing bubble or a bot row that just arrived rises in once (data-row-enter). */
:root[data-bots-app] [data-row-enter] {
animation: bots-row-enter 200ms cubic-bezier(0.2, 0.8, 0.2, 1) both !important;
Expand Down Expand Up @@ -2018,7 +2008,8 @@ html[data-bots-app]:has(
[data-bot-header-actions] :is([data-slot="button"], [data-slot="menu-trigger"]),
[data-settings-page-header] [data-slot="button"]:not([data-settings-bar-action] *),
[data-bots-mode="true"] [data-composer-banner-surface],
[data-bot-composer="true"] [data-chat-composer-attach] button
[data-bot-composer="true"] [data-chat-composer-attach] button,
[data-bots-mode="true"] .chat-scroll-to-bottom [data-slot="button"]
),
/* The capsule is a pseudo-element, which :is() cannot hold. */
:root[data-bots-app] [data-bot-composer="true"] [data-chat-composer-surface]::after {
Expand Down Expand Up @@ -2051,7 +2042,8 @@ html[data-bots-app]:has(
[data-bot-header-actions] :is([data-slot="button"], [data-slot="menu-trigger"]),
[data-settings-page-header] [data-slot="button"]:not([data-settings-bar-action] *),
[data-bots-mode="true"] [data-composer-banner-surface],
[data-bot-composer="true"] [data-chat-composer-attach] button
[data-bot-composer="true"] [data-chat-composer-attach] button,
[data-bots-mode="true"] .chat-scroll-to-bottom [data-slot="button"]
),
html:active-view-transition[data-bots-app]
[data-bot-composer="true"]
Expand Down
16 changes: 8 additions & 8 deletions apps/web/src/components/ChatView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3599,14 +3599,14 @@ export default function ChatView(props: ChatViewProps) {
/>
</WorkspaceMutationIdContext>

{showScrollToBottom && !isThreadFindActive && (
<ScrollToEndButton
bottom={scrollToEndClearance + 4}
summary={scrollToEndSummary}
compact={botChrome !== null}
onScrollToEnd={() => scrollToEnd(true)}
/>
)}
<ScrollToEndButton
key={displayedTimelineKey}
bottom={scrollToEndClearance + 4}
summary={scrollToEndSummary}
compact={botChrome !== null}
visible={showScrollToBottom && !isThreadFindActive}
onScrollToEnd={() => scrollToEnd(true)}
/>
</div>

<div
Expand Down
10 changes: 9 additions & 1 deletion apps/web/src/components/chat/TimelineOverlays.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,23 @@ export function WorkspaceFileDropOverlay() {
/**
* Sits `bottom` pixels up, clear of the composer and its attached banners. The summary names
* what waits at the end of the timeline, which is out of view while it shows. `compact` (bot
* chats) is a round arrow; in bots mode bots.css moves it into the composer's area.
* chats) is a round arrow; in bots mode bots.css places it clear of the field.
*/
export function ScrollToEndButton(props: {
readonly bottom: number;
readonly summary: string | null;
readonly compact?: boolean;
readonly visible?: boolean;
readonly onScrollToEnd: () => void;
}) {
const visible = props.visible ?? true;
if (props.compact) {
return (
<div
className="chat-scroll-to-bottom pointer-events-none absolute z-30 flex justify-center py-1.5"
data-visible={visible ? "true" : "false"}
aria-hidden={!visible}
inert={!visible}
style={{ bottom: props.bottom }}
>
<Button
Expand All @@ -53,6 +58,9 @@ export function ScrollToEndButton(props: {
return (
<div
className="chat-scroll-to-bottom pointer-events-none absolute z-30 flex justify-center py-1.5"
data-visible={visible ? "true" : "false"}
aria-hidden={!visible}
inert={!visible}
style={{ bottom: props.bottom }}
>
<Button
Expand Down
13 changes: 6 additions & 7 deletions apps/web/src/components/guest/GuestPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -534,13 +534,12 @@ function GuestThread({
}
/>
</HostImageUrlContext>
{follow.showScrollToBottom ? (
<ScrollToEndButton
summary={null}
bottom={4}
onScrollToEnd={() => follow.scrollToEnd(true)}
/>
) : null}
<ScrollToEndButton
summary={null}
bottom={4}
visible={follow.showScrollToBottom}
onScrollToEnd={() => follow.scrollToEnd(true)}
/>
</div>
<div className={cn(LANE, "shrink-0 pb-4")}>
<GuestComposer shareId={shareId} model={model} onSent={() => follow.scrollToEnd(true)} />
Expand Down
26 changes: 26 additions & 0 deletions apps/web/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -2671,6 +2671,32 @@ code {
}
}

.chat-scroll-to-bottom[data-visible="false"] [data-scroll-to-end] {
pointer-events: none;
opacity: 0;
visibility: hidden;
}
.chat-scroll-to-bottom[data-visible="true"] [data-scroll-to-end] {
opacity: 1;
visibility: visible;
}
@media (prefers-reduced-motion: no-preference) {
.chat-scroll-to-bottom [data-scroll-to-end] {
transition:
box-shadow 150ms cubic-bezier(0.4, 0, 0.2, 1),
scale 150ms cubic-bezier(0.4, 0, 0.2, 1),
opacity 160ms ease-out,
visibility 0s linear 160ms;
}
.chat-scroll-to-bottom[data-visible="true"] [data-scroll-to-end] {
transition:
box-shadow 150ms cubic-bezier(0.4, 0, 0.2, 1),
scale 150ms cubic-bezier(0.4, 0, 0.2, 1),
opacity 160ms ease-out,
visibility 0s linear 0s;
}
}

/* A workspace area with no control of its own takes F6 focus itself; keep that visible.
workspaceFocus.ts marks those, since :focus-visible also matches a clicked area after a key press.
The conversation's timeline takes it instead, and its top fade mask would hide its own ring. */
Expand Down
Loading