feat(app): review panel reactivity improvements (#37089)

This commit is contained in:
Aarav Sareen 2026-07-17 15:10:42 +05:30 committed by GitHub
commit ed926be253
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 112 additions and 9 deletions

View file

@ -8,6 +8,8 @@ export interface ResizeHandleProps extends Omit<JSX.HTMLAttributes<HTMLDivElemen
max: number
onResize: (size: number) => void
onCollapse?: () => void
/** Called while dragging when size crosses `collapseThreshold`. */
onCollapseChange?: (collapsed: boolean) => void
collapseThreshold?: number
}
@ -20,17 +22,26 @@ export function ResizeHandle(props: ResizeHandleProps) {
"max",
"onResize",
"onCollapse",
"onCollapseChange",
"collapseThreshold",
"class",
"classList",
])
const handleMouseDown = (e: MouseEvent) => {
if (e.detail > 1) return
e.preventDefault()
const edge = local.edge ?? (local.direction === "vertical" ? "start" : "end")
const start = local.direction === "horizontal" ? e.clientX : e.clientY
const startSize = local.size
const min = local.min
const max = local.max
const threshold = local.collapseThreshold ?? 0
const onResize = local.onResize
const onCollapse = local.onCollapse
const onCollapseChange = local.onCollapseChange
let current = startSize
let collapsed = false
document.body.style.userSelect = "none"
document.body.style.overflow = "hidden"
@ -46,8 +57,12 @@ export function ResizeHandle(props: ResizeHandleProps) {
? start - pos
: pos - start
current = startSize + delta
const clamped = Math.min(local.max, Math.max(local.min, current))
local.onResize(clamped)
const nextCollapsed = threshold > 0 && current < threshold
if (nextCollapsed !== collapsed) {
collapsed = nextCollapsed
onCollapseChange?.(collapsed)
}
onResize(Math.min(max, Math.max(min, current)))
}
const onMouseUp = () => {
@ -56,10 +71,11 @@ export function ResizeHandle(props: ResizeHandleProps) {
document.removeEventListener("mousemove", onMouseMove)
document.removeEventListener("mouseup", onMouseUp)
const threshold = local.collapseThreshold ?? 0
if (local.onCollapse && threshold > 0 && current < threshold) {
local.onCollapse()
if (collapsed) {
onCollapse?.()
return
}
onCollapseChange?.(false)
}
document.addEventListener("mousemove", onMouseMove)

View file

@ -793,6 +793,62 @@ body[data-new-layout]
[data-slot="tabs-list"]
> .sticky {
padding-right: 0;
[data-component="icon-button-v2"] {
position: relative;
&::after {
content: "";
position: absolute;
left: 100%;
top: 50%;
transform: translateY(-50%);
width: 20px;
height: 28px;
background-color: var(--v2-background-bg-base);
pointer-events: none;
}
}
}
body[data-new-layout]
#review-panel
[data-component="tabs"]
.session-review-v2-tabs-bar
[data-slot="tabs-list"]
> .session-review-v2-sidebar-toggle-slot.sticky {
padding-right: 0;
&::before {
content: "";
position: absolute;
top: 50%;
bottom: auto;
left: auto;
right: 100%;
transform: translateY(-50%);
width: 12px;
height: 28px;
background-color: var(--v2-background-bg-base);
background-image: none;
pointer-events: none;
}
&::after {
content: "";
position: absolute;
top: 50%;
left: 100%;
transform: translateY(-50%);
width: 8px;
height: 28px;
pointer-events: none;
background: linear-gradient(90deg, var(--v2-background-bg-base), transparent);
}
[data-component="icon-button-v2"]::after {
display: none;
}
}
body[data-new-layout] #review-panel [data-component="tabs"] .session-review-v2-open-in-app-slot {