feat(video): resize transcripts and follow playback earlier

This commit is contained in:
yiling
2026-12-03 16:30:53 +08:00
parent 543862ff9b
commit ce4ae6e33e
10 changed files with 236 additions and 30 deletions
+1 -1
View File
@@ -11,7 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
- **sessions**: See total tokens and estimated cost in the session logs footer, with a breakdown of input, output, and cached tokens. - **sessions**: See total tokens and estimated cost in the session logs footer, with a breakdown of input, output, and cached tokens.
- **projects**: Middle-click or Command/Ctrl-click a project to open it in a new tab. Use **Open in new tab** in a file or folder's context menu to keep your current view open. - **projects**: Middle-click or Command/Ctrl-click a project to open it in a new tab. Use **Open in new tab** in a file or folder's context menu to keep your current view open.
- **video**: Use **Generate Transcripts** in a video's context menu to save a transcript with the local embedding server. Choose a language or let the server detect it automatically. The dialog closes when the transcript is ready. - **video**: Use **Generate Transcripts** in a video's context menu to save a transcript with the local embedding server. Choose a language or let the server detect it automatically. The dialog closes when the transcript is ready.
- **video**: Open saved transcripts from the video player, switch languages, search the text, and jump to the exact start of a segment by selecting it. Follow along as the video plays. - **video**: Open saved transcripts from the video player, switch languages, search the text, and jump to the exact start of a segment by selecting it. Drag the divider to resize the transcript panel on desktop. As the video plays, the panel scrolls early to keep upcoming segments in view.
### Fixed ### Fixed
+1 -1
View File
@@ -121,7 +121,7 @@ apps/web/e2e/
| Upload a txt file, wait for transcode, and create a comment with draw | `tests/file/txt-draw-comment.spec.ts` | | Upload a txt file, wait for transcode, and create a comment with draw | `tests/file/txt-draw-comment.spec.ts` |
| Upload an image file, wait for transcode, and create a comment with draw | `tests/file/image-draw-comment.spec.ts` | | Upload an image file, wait for transcode, and create a comment with draw | `tests/file/image-draw-comment.spec.ts` |
| Upload a video file, wait for transcode, and create a comment with draw at a non-zero timestamp | `tests/file/video-draw-comment.spec.ts` | | Upload a video file, wait for transcode, and create a comment with draw at a non-zero timestamp | `tests/file/video-draw-comment.spec.ts` |
| Read and search saved video transcripts, jump to a segment, resume following playback, and verify desktop, mobile, and version-stack behavior | `tests/file/view-transcript.spec.ts` | | Read and search saved video transcripts, resize the desktop panel, jump to a segment, check early playback scrolling and resume sync, and verify mobile and version-stack behavior | `tests/file/view-transcript.spec.ts` |
| Upload an audio file, wait for transcode, and create a comment at a non-zero timestamp | `tests/file/audio-timestamp-comment.spec.ts` | | Upload an audio file, wait for transcode, and create a comment at a non-zero timestamp | `tests/file/audio-timestamp-comment.spec.ts` |
| Create internal and public comments, verify internal comments are hidden on public share links | `tests/file/internal-comment-and-edit.spec.ts` | | Create internal and public comments, verify internal comments are hidden on public share links | `tests/file/internal-comment-and-edit.spec.ts` |
| Author edits comment text, switches to internal, removes timestamp, and updates attachments | `tests/file/internal-comment-and-edit.spec.ts` | | Author edits comment text, switches to internal, removes timestamp, and updates attachments | `tests/file/internal-comment-and-edit.spec.ts` |
@@ -1,3 +1,4 @@
import type { Locator } from '@playwright/test'
import { expect, test } from '../../fixtures' import { expect, test } from '../../fixtures'
test.use({ fileOptions: { mediaType: 'video' } }) test.use({ fileOptions: { mediaType: 'video' } })
@@ -54,6 +55,7 @@ test('reads, searches and follows a saved transcript in the video player', async
await expect(navigator).toBeVisible() await expect(navigator).toBeVisible()
await toggle.click() await toggle.click()
const panel = page.getByRole('complementary', { name: 'Transcript' }) const panel = page.getByRole('complementary', { name: 'Transcript' })
const divider = page.getByRole('separator', { name: 'Resize transcript' })
const first = panel.getByRole('button', { name: /Signal\. signal\./ }) const first = panel.getByRole('button', { name: /Signal\. signal\./ })
const last = panel.getByRole('button', { name: /Final signal\./ }) const last = panel.getByRole('button', { name: /Final signal\./ })
const video = page.locator('video').first() const video = page.locator('video').first()
@@ -67,6 +69,56 @@ test('reads, searches and follows a saved transcript in the video player', async
await expect(first).toHaveCSS('background-color', 'rgba(0, 0, 0, 0)') await expect(first).toHaveCSS('background-color', 'rgba(0, 0, 0, 0)')
await expect(first).toContainText('00:00.000 – 00:00.180') await expect(first).toContainText('00:00.000 – 00:00.180')
const dragDivider = async (handle: Locator, delta: number) => {
const box = await handle.boundingBox()
if (!box) throw new Error('Expected the divider to be visible')
const x = box.x + box.width / 2
const y = box.y + box.height / 2
await page.mouse.move(x, y)
await page.mouse.down()
await page.mouse.move(x + delta, y, { steps: 8 })
await page.mouse.up()
}
await dragDivider(divider, 256)
await expect(panel).toHaveCSS('width', '576px')
await dragDivider(divider, -384)
await expect(panel).toHaveCSS('width', '256px')
await divider.press('ArrowRight')
await expect(divider).toHaveAttribute('aria-valuenow', '21')
await divider.press('Home')
await expect(panel).toHaveCSS('width', '256px')
await dragDivider(divider, 128)
await expect(panel).toHaveCSS('width', '384px')
const viewport = panel.locator('[data-slot=scroll-area-viewport]')
const nearBottomId = await viewport.evaluate((element) => {
const view = element.getBoundingClientRect()
const nearBottom = Array.from(element.querySelectorAll('li[data-segment-id]')).find((row) => {
const { top, bottom } = row.getBoundingClientRect()
return top > view.top + view.height * 0.75 && bottom < view.bottom
})
return nearBottom?.getAttribute('data-segment-id')
})
if (!nearBottomId) throw new Error('Expected a visible segment in the bottom quarter')
const nearBottom = panel.locator(`[data-segment-id="${nearBottomId}"]`).getByRole('button')
await nearBottom.click()
await expect(nearBottom).toHaveAttribute('aria-current', 'true')
await expect
.poll(() =>
nearBottom.evaluate((element) => {
const view = element.closest('[data-slot=scroll-area-viewport]')!.getBoundingClientRect()
const row = element.getBoundingClientRect()
return (row.top + row.height / 2 - view.top) / view.height
}),
)
.toBeCloseTo(0.5, 1)
await video.evaluate((element) => {
const media = element as HTMLVideoElement
media.currentTime = 0
})
await expect(first).toHaveAttribute('aria-current', 'true')
await expect(first).toBeInViewport()
await panel.getByRole('button', { name: 'Search transcript' }).click() await panel.getByRole('button', { name: 'Search transcript' }).click()
const search = panel.getByRole('searchbox', { name: 'Search transcript' }) const search = panel.getByRole('searchbox', { name: 'Search transcript' })
await expect(search).toBeFocused() await expect(search).toBeFocused()
@@ -98,7 +150,6 @@ test('reads, searches and follows a saved transcript in the video player', async
await sync.click() await sync.click()
await expect(sync).toBeHidden() await expect(sync).toBeHidden()
const viewport = panel.locator('[data-slot=scroll-area-viewport]')
await viewport.hover() await viewport.hover()
await page.mouse.wheel(0, -2500) await page.mouse.wheel(0, -2500)
await expect(sync).toBeVisible() await expect(sync).toBeVisible()
@@ -147,10 +198,27 @@ test('reads, searches and follows a saved transcript in the video player', async
await panel.getByRole('combobox', { name: 'Language' }).selectOption('zh') await panel.getByRole('combobox', { name: 'Language' }).selectOption('zh')
await expect(panel.getByText('你好。')).toBeVisible() await expect(panel.getByText('你好。')).toBeVisible()
await expect(last).toHaveCount(0) await expect(last).toHaveCount(0)
await dragDivider(divider, 64)
await expect(panel).toHaveCSS('width', '448px')
await panel.getByRole('button', { name: 'Close transcript' }).click() await panel.getByRole('button', { name: 'Close transcript' }).click()
await expect(panel).toBeHidden() await expect(panel).toBeHidden()
await expect(navigator).toBeVisible() await expect(navigator).toBeVisible()
await expect(toggle).toBeFocused() await expect(toggle).toBeFocused()
await toggle.click()
await expect(panel).toHaveCSS('width', '448px')
const commentsDivider = page.locator('main [data-slot="resize-handle"]:not([role="separator"])')
await dragDivider(commentsDivider, -200)
await page.setViewportSize({ width: 840, height: 720 })
await expect
.poll(async () => Number(await divider.getAttribute('aria-valuemax')))
.toBeLessThan(20)
await divider.press('End')
await page.setViewportSize({ width: 1280, height: 720 })
await dragDivider(commentsDivider, 200)
await expect(panel).toHaveCSS('width', '448px')
await panel.getByRole('button', { name: 'Close transcript' }).click()
await page.setViewportSize({ width: 390, height: 844 }) await page.setViewportSize({ width: 390, height: 844 })
const comments = page.getByTestId('mobile-bottom-sheet') const comments = page.getByTestId('mobile-bottom-sheet')
@@ -0,0 +1,112 @@
import { ResizeHandle } from '@/ui/components/resize-handle'
import { m } from '@/ui/paraglide/messages.js'
import {
useCallback,
useLayoutEffect,
useRef,
useState,
type ComponentProps,
type Dispatch,
type SetStateAction,
} from 'react'
import { TranscriptPanel } from './transcript-panel'
const minTranscriptWidth = 20
const maxTranscriptWidth = 45
const preferredPlayerWidth = 256
const keyboardSteps = new Map([
['ArrowLeft', -1],
['ArrowRight', 1],
['Home', -maxTranscriptWidth],
['End', maxTranscriptWidth],
])
interface ResizableTranscriptPanelProps extends Omit<
ComponentProps<typeof TranscriptPanel>,
'className'
> {
widthPercent: number
setWidthPercent: Dispatch<SetStateAction<number>>
}
export function ResizableTranscriptPanel({
widthPercent,
setWidthPercent,
...panelProps
}: ResizableTranscriptPanelProps) {
const sheetRef = useRef<HTMLDivElement>(null)
const [maxWidthPercent, setMaxWidthPercent] = useState(maxTranscriptWidth)
const minWidthPercent = Math.min(minTranscriptWidth, maxWidthPercent)
useLayoutEffect(() => {
const viewer = sheetRef.current?.parentElement
if (!viewer) return
const updateLimit = () => {
const viewerWidth = viewer.clientWidth
const playerWidth = Math.min(preferredPlayerWidth, viewerWidth / 2)
const availablePercent = ((viewerWidth - playerWidth) / window.innerWidth) * 100
setMaxWidthPercent(Math.min(maxTranscriptWidth, availablePercent))
}
updateLimit()
const observer = new ResizeObserver(updateLimit)
observer.observe(viewer)
window.addEventListener('resize', updateLimit)
return () => {
observer.disconnect()
window.removeEventListener('resize', updateLimit)
}
}, [])
const adjustWidth = useCallback(
(deltaPercent: number) => {
setWidthPercent((previous) => {
const displayedWidth = Math.min(previous, maxWidthPercent)
const nextWidth = Math.min(
maxWidthPercent,
Math.max(minWidthPercent, displayedWidth + deltaPercent),
)
return nextWidth === displayedWidth ? previous : nextWidth
})
},
[maxWidthPercent, minWidthPercent, setWidthPercent],
)
const onResize = useCallback(
(deltaPixels: number) => adjustWidth((deltaPixels / window.innerWidth) * 100),
[adjustWidth],
)
const displayedWidth = Math.min(widthPercent, maxWidthPercent)
return (
<>
<div ref={sheetRef} className="min-w-0 shrink-0" style={{ width: `${displayedWidth}vw` }}>
<TranscriptPanel {...panelProps} className="h-full" />
</div>
<ResizeHandle
role="separator"
aria-orientation="vertical"
aria-label={m.transcript_resize()}
aria-controls={panelProps.id}
aria-valuemin={Math.round(minWidthPercent)}
aria-valuemax={Math.round(maxWidthPercent)}
aria-valuenow={Math.round(displayedWidth)}
aria-valuetext={`${Math.round(displayedWidth)}%`}
tabIndex={0}
className="shrink-0 focus-visible:outline-2 focus-visible:outline-ring"
hitAreaClassName="left-0 -right-3"
onResize={onResize}
onKeyDown={(event) => {
const step = keyboardSteps.get(event.key)
if (step === undefined) return
event.preventDefault()
event.stopPropagation()
adjustWidth(step)
}}
/>
</>
)
}
@@ -181,30 +181,43 @@ export const TranscriptPanel = memo(function TranscriptPanel({
}) })
}, [activeAt, mediaControllerRef]) }, [activeAt, mediaControllerRef])
function scrollTo(target: HTMLElement | null | undefined, bottomInset = 0) { function scrollTo(
target: HTMLElement | null | undefined,
{ bottomInset = 0, followPlayback = false } = {},
) {
const viewport = viewportRef.current const viewport = viewportRef.current
if (!viewport || !target) return if (!viewport || !target) return
const item = target.getBoundingClientRect() const item = target.getBoundingClientRect()
const { top, bottom } = viewport.getBoundingClientRect() const { top, bottom } = viewport.getBoundingClientRect()
const visibleBottom = bottom - bottomInset if (followPlayback) {
if (item.top < top || item.height > visibleBottom - top) { const height = bottom - top
viewport.scrollTop += item.top - top const midpoint = item.top + item.height / 2
} else if (item.bottom > visibleBottom) { if (item.top < top || midpoint >= top + height * 0.75) {
viewport.scrollTop += item.bottom - visibleBottom viewport.scrollTop += item.top - top - Math.max(0, (height - item.height) / 2)
}
} else {
const visibleBottom = bottom - bottomInset
if (item.top < top || item.height > visibleBottom - top) {
viewport.scrollTop += item.top - top
} else if (item.bottom > visibleBottom) {
viewport.scrollTop += item.bottom - visibleBottom
}
} }
scrollPosition.current = viewport.scrollTop scrollPosition.current = viewport.scrollTop
} }
useLayoutEffect(() => { useLayoutEffect(() => {
if (following && activeId) { if (following && activeId) {
scrollTo(viewportRef.current?.querySelector(`[data-segment-id="${CSS.escape(activeId)}"]`)) scrollTo(viewportRef.current?.querySelector(`[data-segment-id="${CSS.escape(activeId)}"]`), {
followPlayback: true,
})
} }
}, [activeId, following]) }, [activeId, following])
useLayoutEffect(() => { useLayoutEffect(() => {
if (selectedMatch === undefined) return if (selectedMatch === undefined) return
setFollowing(false) setFollowing(false)
scrollTo(viewportRef.current?.querySelector('[data-current-match]'), 48) scrollTo(viewportRef.current?.querySelector('[data-current-match]'), { bottomInset: 48 })
}, [matches, selectedMatch]) }, [matches, selectedMatch])
function toggleSearch() { function toggleSearch() {
@@ -221,7 +234,7 @@ export const TranscriptPanel = memo(function TranscriptPanel({
setFollowing(false) setFollowing(false)
setMatchIndex((selectedMatch + step + matches.total) % matches.total) setMatchIndex((selectedMatch + step + matches.total) % matches.total)
if (matches.total === 1) { if (matches.total === 1) {
scrollTo(viewportRef.current?.querySelector('[data-current-match]'), 48) scrollTo(viewportRef.current?.querySelector('[data-current-match]'), { bottomInset: 48 })
} }
} }
+22 -14
View File
@@ -1,14 +1,19 @@
import { cn } from '@/ui/lib/utils'
import { useEffect, useRef, useState } from 'react' import { useEffect, useRef, useState } from 'react'
interface ResizeHandleProps { interface ResizeHandleProps extends Omit<
React.ComponentProps<'div'>,
'children' | 'onMouseDown' | 'onResize'
> {
onResize: (delta: number) => void onResize: (delta: number) => void
className?: string hitAreaClassName?: string
} }
export const ResizeHandle: React.FC<ResizeHandleProps> = ({ export const ResizeHandle: React.FC<ResizeHandleProps> = ({
onResize, onResize,
hitAreaClassName,
className = '', className = '',
...props
}) => { }) => {
const [isDragging, setIsDragging] = useState(false) const [isDragging, setIsDragging] = useState(false)
const startXref = useRef(0) const startXref = useRef(0)
@@ -50,36 +55,39 @@ export const ResizeHandle: React.FC<ResizeHandleProps> = ({
startXref.current = e.clientX startXref.current = e.clientX
} }
// Common hit area that is always larger than the visible element for usability
const HitArea = () => (
<div className="absolute inset-y-0 -left-4 -right-4 z-20 cursor-col-resize touch-none" />
)
return ( return (
<div <div
className={`group relative z-20 flex h-full w-[2px] cursor-col-resize items-center justify-center bg-border transition-all hover:bg-transparent ${className}`} {...props}
data-slot="resize-handle"
className={`group/resize relative z-20 flex h-full w-[2px] cursor-col-resize items-center justify-center bg-border transition-all hover:bg-transparent ${className}`}
onMouseDown={handleMouseDown} onMouseDown={handleMouseDown}
> >
<HitArea /> <div
aria-hidden="true"
className={cn(
'absolute inset-y-0 -left-4 -right-4 z-20 cursor-col-resize touch-none',
hitAreaClassName,
)}
/>
{/* The glowing vertical line */} {/* The glowing vertical line */}
<div <div
className={`absolute inset-y-0 w-[2px] transition-all duration-300 ease-out className={`pointer-events-none absolute inset-y-0 w-[2px] transition-all duration-300 ease-out
${ ${
isDragging isDragging
? 'bg-blue-600 shadow-[0_0_15px_rgba(37,99,235,0.6)] opacity-100' ? 'bg-blue-600 shadow-[0_0_15px_rgba(37,99,235,0.6)] opacity-100'
: 'bg-blue-400 opacity-0 group-hover:opacity-100 group-hover:shadow-[0_0_8px_rgba(96,165,250,0.5)]' : 'bg-blue-400 opacity-0 group-hover/resize:opacity-100 group-hover/resize:shadow-[0_0_8px_rgba(96,165,250,0.5)]'
} }
`} `}
/> />
{/* The central drag handle (Pill) */} {/* The central drag handle (Pill) */}
<div <div
className={`absolute top-1/2 left-1/2 h-10 w-1.5 -translate-x-1/2 -translate-y-1/2 rounded-full bg-blue-600 transition-all duration-300 ease-out className={`pointer-events-none absolute top-1/2 left-1/2 h-10 w-1.5 -translate-x-1/2 -translate-y-1/2 rounded-full bg-blue-600 transition-all duration-300 ease-out
${ ${
isDragging isDragging
? 'opacity-100 scale-100 shadow-[0_0_10px_rgba(37,99,235,0.5)]' ? 'opacity-100 scale-100 shadow-[0_0_10px_rgba(37,99,235,0.5)]'
: 'opacity-0 scale-75 group-hover:opacity-100 group-hover:scale-100' : 'opacity-0 scale-75 group-hover/resize:opacity-100 group-hover/resize:scale-100'
}`} }`}
/> />
</div> </div>
+1
View File
@@ -1828,6 +1828,7 @@
"transcript_title": "Transcript", "transcript_title": "Transcript",
"transcript_view": "Show transcript", "transcript_view": "Show transcript",
"transcript_close": "Close transcript", "transcript_close": "Close transcript",
"transcript_resize": "Resize transcript",
"transcript_search": "Search transcript", "transcript_search": "Search transcript",
"transcript_search_count": "{current} / {total}", "transcript_search_count": "{current} / {total}",
"transcript_previous_match": "Previous match", "transcript_previous_match": "Previous match",
+1
View File
@@ -1758,6 +1758,7 @@
"transcript_title": "전사", "transcript_title": "전사",
"transcript_view": "전사 보기", "transcript_view": "전사 보기",
"transcript_close": "전사 닫기", "transcript_close": "전사 닫기",
"transcript_resize": "전사 패널 크기 조정",
"transcript_search": "전사 검색", "transcript_search": "전사 검색",
"transcript_search_count": "{current} / {total}", "transcript_search_count": "{current} / {total}",
"transcript_previous_match": "이전 검색 결과", "transcript_previous_match": "이전 검색 결과",
+1
View File
@@ -1828,6 +1828,7 @@
"transcript_title": "转录", "transcript_title": "转录",
"transcript_view": "显示转录", "transcript_view": "显示转录",
"transcript_close": "关闭转录", "transcript_close": "关闭转录",
"transcript_resize": "调整转录面板宽度",
"transcript_search": "搜索转录", "transcript_search": "搜索转录",
"transcript_search_count": "{current} / {total}", "transcript_search_count": "{current} / {total}",
"transcript_previous_match": "上一个结果", "transcript_previous_match": "上一个结果",
@@ -7,7 +7,7 @@ import { FileViewer } from '@/ui/components/file-viewer'
import { FileViewerLeftSidebar } from '@/ui/components/file-viewer-left-sidebar' import { FileViewerLeftSidebar } from '@/ui/components/file-viewer-left-sidebar'
import { FileViewerRightSidebar } from '@/ui/components/file-viewer-right-sidebar' import { FileViewerRightSidebar } from '@/ui/components/file-viewer-right-sidebar'
import { MobileFileDetail } from '@/ui/components/file-viewer/mobile-file-detail' import { MobileFileDetail } from '@/ui/components/file-viewer/mobile-file-detail'
import { TranscriptPanel } from '@/ui/components/file-viewer/transcript-panel' import { ResizableTranscriptPanel } from '@/ui/components/file-viewer/resizable-transcript-panel'
import { FileDetailSkeleton } from '@/ui/components/loading-skeletons' import { FileDetailSkeleton } from '@/ui/components/loading-skeletons'
import { ResizeHandle } from '@/ui/components/resize-handle' import { ResizeHandle } from '@/ui/components/resize-handle'
import { ShareLinkCreatedDialog } from '@/ui/components/share-link-created-dialog' import { ShareLinkCreatedDialog } from '@/ui/components/share-link-created-dialog'
@@ -83,6 +83,7 @@ function FileViewPage() {
} = useShareLinkActions({ projectId, enabled: canEdit }) } = useShareLinkActions({ projectId, enabled: canEdit })
const { teamId, ensureTeamIdForProject } = useTeamContextStore() const { teamId, ensureTeamIdForProject } = useTeamContextStore()
const [rightSidebarWidth, setRightSidebarWidth] = useState(360) const [rightSidebarWidth, setRightSidebarWidth] = useState(360)
const [transcriptWidthPercent, setTranscriptWidthPercent] = useState(30)
const [annotations, setAnnotations] = useState<Annotation[]>([]) const [annotations, setAnnotations] = useState<Annotation[]>([])
const { fileViewRightSidebarCollapsed } = useUiStore() const { fileViewRightSidebarCollapsed } = useUiStore()
const { isChatbotOpen } = useChatbotStore() const { isChatbotOpen } = useChatbotStore()
@@ -822,7 +823,7 @@ function FileViewPage() {
return ( return (
<div className="h-full flex flex-1 flex-col bg-background"> <div className="h-full flex flex-1 flex-col bg-background">
<div className="h-full flex flex-1 overflow-hidden"> <div className="h-full flex flex-1 overflow-hidden">
<div className="flex-1 relative"> <div className="relative min-w-0 flex-1">
{isFetching && !isCompareMode && ( {isFetching && !isCompareMode && (
<div className="absolute inset-0 z-10 flex items-center justify-center bg-background/50"> <div className="absolute inset-0 z-10 flex items-center justify-center bg-background/50">
<Loader2 className="h-8 w-8 animate-spin text-foreground" /> <Loader2 className="h-8 w-8 animate-spin text-foreground" />
@@ -859,11 +860,12 @@ function FileViewPage() {
transcriptToggle={transcript?.toggle} transcriptToggle={transcript?.toggle}
> >
{transcript?.panel && ( {transcript?.panel && (
<TranscriptPanel <ResizableTranscriptPanel
key={transcript.panel.assetId} key={transcript.panel.assetId}
{...transcript.panel} {...transcript.panel}
mediaControllerRef={mediaControllerRef} mediaControllerRef={mediaControllerRef}
className="w-[30vw] max-w-[48%] border-r border-border" widthPercent={transcriptWidthPercent}
setWidthPercent={setTranscriptWidthPercent}
/> />
)} )}
<div className={transcript?.panel ? 'hidden' : 'contents'}> <div className={transcript?.panel ? 'hidden' : 'contents'}>