feat(chat): glass scroll-to-bottom pill on the left carries the streaming signal
Away from the live edge the floating status row fades out (it was transparent text over scrolled history) and the scroll-to-bottom pill takes over the activity signal with a pulsing dot. The pill moves to the left edge — matching the status row it stands in for — and gets the same glass treatment as the dropdowns.
This commit is contained in:
@@ -148,6 +148,7 @@ type HydratingToolSkeletonRow = {
|
|||||||
|
|
||||||
type ChatViewportProps = {
|
type ChatViewportProps = {
|
||||||
onStatusOverlayNode: (node: HTMLDivElement | null) => void;
|
onStatusOverlayNode: (node: HTMLDivElement | null) => void;
|
||||||
|
statusOverlayHidden: boolean;
|
||||||
currentSessionId: string;
|
currentSessionId: string;
|
||||||
currentSessionKey: string;
|
currentSessionKey: string;
|
||||||
isDesktopExpandedInput: boolean;
|
isDesktopExpandedInput: boolean;
|
||||||
@@ -192,6 +193,7 @@ type ChatViewportProps = {
|
|||||||
|
|
||||||
const ChatViewport = React.memo(({
|
const ChatViewport = React.memo(({
|
||||||
onStatusOverlayNode,
|
onStatusOverlayNode,
|
||||||
|
statusOverlayHidden,
|
||||||
currentSessionId,
|
currentSessionId,
|
||||||
currentSessionKey,
|
currentSessionKey,
|
||||||
isDesktopExpandedInput,
|
isDesktopExpandedInput,
|
||||||
@@ -421,10 +423,15 @@ const ChatViewport = React.memo(({
|
|||||||
background — text streams beneath it; the measured height
|
background — text streams beneath it; the measured height
|
||||||
feeds composerOverlayHeight so the live line never hides
|
feeds composerOverlayHeight so the live line never hides
|
||||||
under it. */}
|
under it. */}
|
||||||
<div className="pointer-events-none absolute inset-x-0 bottom-0 z-10">
|
<div
|
||||||
|
className={cn(
|
||||||
|
'pointer-events-none absolute inset-x-0 bottom-0 z-10 transition-opacity duration-150',
|
||||||
|
statusOverlayHidden && 'opacity-0',
|
||||||
|
)}
|
||||||
|
>
|
||||||
<div
|
<div
|
||||||
ref={onStatusOverlayNode}
|
ref={onStatusOverlayNode}
|
||||||
className="pointer-events-auto pb-2 [&:not(:has(*))]:hidden"
|
className={cn('pb-2 [&:not(:has(*))]:hidden', statusOverlayHidden ? 'pointer-events-none' : 'pointer-events-auto')}
|
||||||
>
|
>
|
||||||
<StatusRowContainer />
|
<StatusRowContainer />
|
||||||
</div>
|
</div>
|
||||||
@@ -445,6 +452,7 @@ const ChatViewport = React.memo(({
|
|||||||
);
|
);
|
||||||
}, (prev, next) => {
|
}, (prev, next) => {
|
||||||
return prev.onStatusOverlayNode === next.onStatusOverlayNode
|
return prev.onStatusOverlayNode === next.onStatusOverlayNode
|
||||||
|
&& prev.statusOverlayHidden === next.statusOverlayHidden
|
||||||
&& prev.currentSessionId === next.currentSessionId
|
&& prev.currentSessionId === next.currentSessionId
|
||||||
&& prev.currentSessionKey === next.currentSessionKey
|
&& prev.currentSessionKey === next.currentSessionKey
|
||||||
&& prev.isDesktopExpandedInput === next.isDesktopExpandedInput
|
&& prev.isDesktopExpandedInput === next.isDesktopExpandedInput
|
||||||
@@ -1359,6 +1367,7 @@ export const ChatContainer: React.FC<ChatContainerProps> = ({
|
|||||||
return (
|
return (
|
||||||
<ChatViewport
|
<ChatViewport
|
||||||
onStatusOverlayNode={onStatusOverlayNode}
|
onStatusOverlayNode={onStatusOverlayNode}
|
||||||
|
statusOverlayHidden={timelineController.showScrollToBottom}
|
||||||
currentSessionId={currentSessionId ?? ''}
|
currentSessionId={currentSessionId ?? ''}
|
||||||
currentSessionKey={currentSessionKey ?? currentSessionId ?? ''}
|
currentSessionKey={currentSessionKey ?? currentSessionId ?? ''}
|
||||||
isDesktopExpandedInput={isDesktopExpandedInput}
|
isDesktopExpandedInput={isDesktopExpandedInput}
|
||||||
@@ -1418,6 +1427,7 @@ export const ChatContainer: React.FC<ChatContainerProps> = ({
|
|||||||
{!draftLayoutVisible && !isDesktopExpandedInput && sessionMessages.length > 0 && (
|
{!draftLayoutVisible && !isDesktopExpandedInput && sessionMessages.length > 0 && (
|
||||||
<ScrollToBottomButton
|
<ScrollToBottomButton
|
||||||
visible={timelineController.showScrollToBottom}
|
visible={timelineController.showScrollToBottom}
|
||||||
|
working={sessionIsWorking}
|
||||||
onClick={navigation.resumeToLatest}
|
onClick={navigation.resumeToLatest}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -7,26 +7,36 @@ import { useI18n } from '@/lib/i18n';
|
|||||||
|
|
||||||
interface ScrollToBottomButtonProps {
|
interface ScrollToBottomButtonProps {
|
||||||
visible: boolean;
|
visible: boolean;
|
||||||
|
/** The session is still streaming: the pill carries the activity signal
|
||||||
|
while the floating status row is hidden away from the live edge. */
|
||||||
|
working?: boolean;
|
||||||
onClick: () => void;
|
onClick: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ScrollToBottomButton: React.FC<ScrollToBottomButtonProps> = ({ visible, onClick }) => {
|
const ScrollToBottomButton: React.FC<ScrollToBottomButtonProps> = ({ visible, working = false, onClick }) => {
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={cn(
|
className={cn(
|
||||||
'absolute bottom-full left-1/2 -translate-x-1/2 mb-2 transition-all duration-150',
|
// Left-aligned to match the status row it stands in for.
|
||||||
|
'absolute bottom-full left-2 mb-2 transition-all duration-150',
|
||||||
visible ? 'opacity-100 translate-y-0 scale-100 pointer-events-auto' : 'opacity-0 translate-y-2 scale-95 pointer-events-none',
|
visible ? 'opacity-100 translate-y-0 scale-100 pointer-events-auto' : 'opacity-0 translate-y-2 scale-95 pointer-events-none',
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="ghost"
|
||||||
size="sm"
|
size="sm"
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
className="size-8 rounded-full [corner-shape:round] p-0 shadow-none bg-background/95 hover:bg-interactive-hover"
|
className="oc-glass-popover oc-glass-floating relative size-8 rounded-full [corner-shape:round] p-0 shadow-none"
|
||||||
aria-label={t('chat.scrollToBottom.aria')}
|
aria-label={t('chat.scrollToBottom.aria')}
|
||||||
>
|
>
|
||||||
<Icon name="arrow-down" className="h-4 w-4" />
|
<Icon name="arrow-down" className="h-4 w-4" />
|
||||||
|
{working ? (
|
||||||
|
<span
|
||||||
|
aria-hidden
|
||||||
|
className="absolute -right-0.5 -top-0.5 h-2 w-2 rounded-full bg-primary animate-pulse"
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user