Merge branch 'feat/session-panel' into feat/session-panel-sections
This commit is contained in:
commit
12cf2d14a9
2 files changed
+10
-11
No files matched your search
@@ -1,5 +1,6 @@
|
||||
/** The Chat View's aside layer: one Session-level occupant beside the transcript, given the end gutter it keeps within. */
|
||||
import { memo, useLayoutEffect, useMemo, useRef, useState, type ReactNode, type RefObject } from 'react'
|
||||
import { memo, useLayoutEffect, useMemo, useRef, useState, type RefObject } from 'react'
|
||||
import type { PropsRenderSlots } from '@deepseek-ai/dsh-client-ui-slots'
|
||||
import type { ChatAsideOwnerProps } from '../contract/slots.ts'
|
||||
import css from './ChatView.module.css'
|
||||
|
||||
@@ -37,16 +38,15 @@ function useEndGutter(layer: RefObject<HTMLElement>): number {
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the aside layer with its occupant. The layer re-renders only when
|
||||
* the gutter or the renderer changes, not with every transcript update.
|
||||
* @param props - the renderer of the aside slot.
|
||||
* Render the aside layer with its occupant. The Chat View's `renderSlot` is
|
||||
* stable per registration, so the layer re-renders only when the gutter
|
||||
* changes, not with every transcript update.
|
||||
* @param props - the Chat View's slot renderer.
|
||||
* @returns the zero-height aside layer.
|
||||
*/
|
||||
export const ChatAside = memo(function ChatAside({ renderAside }: {
|
||||
readonly renderAside: (owner: ChatAsideOwnerProps) => ReactNode
|
||||
}) {
|
||||
export const ChatAside = memo(function ChatAside({ renderSlot }: Pick<PropsRenderSlots<'conversation.chat.aside'>, 'renderSlot'>) {
|
||||
const layer = useRef<HTMLDivElement>(null)
|
||||
const endGutter = useEndGutter(layer)
|
||||
const owner = useMemo((): ChatAsideOwnerProps => ({ endGutter }), [endGutter])
|
||||
return <div ref={layer} className={css.asideSlot} data-chat-aside="">{renderAside(owner)}</div>
|
||||
return <div ref={layer} className={css.asideSlot} data-chat-aside="">{renderSlot('conversation.chat.aside', owner)}</div>
|
||||
})
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
type MarkdownDelegateFenceInfo, type MarkdownMenuTarget,
|
||||
} from '@deepseek-ai/dsh-client-ui-primitives'
|
||||
import { isAtOrOutside } from '../contract/group-tree.ts'
|
||||
import type { ChatAsideOwnerProps, ChatFlowHookContext, ChatViewSlotProps, OpenFileOptions } from '../contract/slots.ts'
|
||||
import type { ChatFlowHookContext, ChatViewSlotProps, OpenFileOptions } from '../contract/slots.ts'
|
||||
import type { ChatSnapshot } from '../contract/snapshot.ts'
|
||||
import { markdownLabels } from '../markdown-labels.ts'
|
||||
import { TurnNavigator } from './TurnNavigator.tsx'
|
||||
@@ -228,7 +228,6 @@ export function ChatView({
|
||||
const interactionIds = useInteractionIds(ids => ids)
|
||||
const textInteraction = useTextInteraction(scroll.columnRef, interactionSurfaceRef, dispatchInteraction, interactionIds)
|
||||
const flowContext = useMemo<ChatFlowHookContext>(() => ({ motion: scroll.motion }), [scroll.motion])
|
||||
const renderAside = useCallback((owner: ChatAsideOwnerProps) => renderSlot('conversation.chat.aside', owner), [renderSlot])
|
||||
|
||||
return (
|
||||
<div className={css.frame}>
|
||||
@@ -241,7 +240,7 @@ export function ChatView({
|
||||
t={t}
|
||||
/>
|
||||
)}
|
||||
<ChatAside renderAside={renderAside} />
|
||||
<ChatAside renderSlot={renderSlot} />
|
||||
<div className={css.root} data-chat-following-tail={scroll.followingTail ? '' : undefined}>
|
||||
<div ref={scroll.listRef} className={css.scroll}>
|
||||
<div ref={scroll.columnRef} className={css.column} data-chat-flow=""
|
||||
|
||||
Reference in new issue
Block a user