feat(conversation-detail): auto-scroll active tile into view and theme its highlight

This commit is contained in:
xintaofei
2026-04-22 23:18:34 +08:00
parent 7a03cfff36
commit 3030bb7981

View File

@@ -1390,6 +1390,19 @@ export function ConversationDetailPanel() {
const canTile = isTileMode && tabs.length > 1 const canTile = isTileMode && tabs.length > 1
const tileTabRefs = useRef<Map<string, HTMLDivElement | null>>(new Map())
useEffect(() => {
if (!canTile || !activeTabId) return
const el = tileTabRefs.current.get(activeTabId)
if (!el) return
el.scrollIntoView({
behavior: "smooth",
inline: "center",
block: "nearest",
})
}, [canTile, activeTabId])
if (hasNoTabs) { if (hasNoTabs) {
return null return null
} }
@@ -1399,12 +1412,20 @@ export function ConversationDetailPanel() {
return ( return (
<div <div
key={tab.id} key={tab.id}
ref={(el) => {
if (el) {
tileTabRefs.current.set(tab.id, el)
} else {
tileTabRefs.current.delete(tab.id)
}
}}
className={cn( className={cn(
canTile canTile
? cn( ? cn(
"relative h-full min-w-[420px] flex-1 overflow-hidden", "relative h-full min-w-96 flex-1 overflow-hidden",
index > 0 && "border-l border-border", index > 0 && "border-l border-border",
active && "bg-gradient-to-b from-muted/50 to-transparent" active &&
"bg-gradient-to-b from-sidebar-primary/[0.03] to-transparent"
) )
: active : active
? "h-full" ? "h-full"