MCPcopy
hub / github.com/TanShilongMario/PromptFill / VideoLayout

Function VideoLayout

src/video/components/layout/VideoLayout.jsx:11–124  ·  view source on GitHub ↗
({ isDarkMode })

Source from the content-addressed store, hash-verified

9const STORAGE_KEY = 'app_video_right_panel_width_v1';
10
11export const VideoLayout = ({ isDarkMode }) => {
12 const [rightPanelWidth, setRightPanelWidth] = useStickyState(RIGHT_PANEL_DEFAULT, STORAGE_KEY);
13 const [isResizing, setIsResizing] = useState(false);
14
15 useEffect(() => {
16 const handleMouseMove = (e) => {
17 if (!isResizing) return;
18 const w = window.innerWidth - e.clientX;
19 const clamped = Math.max(RIGHT_PANEL_MIN, Math.min(RIGHT_PANEL_MAX, w));
20 setRightPanelWidth(clamped);
21 };
22 const handleMouseUp = () => {
23 setIsResizing(false);
24 document.body.style.cursor = '';
25 document.body.style.userSelect = '';
26 };
27 if (isResizing) {
28 document.addEventListener('mousemove', handleMouseMove);
29 document.addEventListener('mouseup', handleMouseUp);
30 document.body.style.cursor = 'col-resize';
31 document.body.style.userSelect = 'none';
32 }
33 return () => {
34 document.removeEventListener('mousemove', handleMouseMove);
35 document.removeEventListener('mouseup', handleMouseUp);
36 };
37 }, [isResizing, setRightPanelWidth]);
38
39 const getContainerStyle = (width, flex = 'none') => {
40 const baseStyle = {
41 height: '100%',
42 borderRadius: '24px',
43 border: '1px solid transparent',
44 backgroundOrigin: 'border-box',
45 backgroundClip: 'padding-box, border-box',
46 width: typeof width === 'number' ? `${width}px` : width,
47 flex,
48 display: 'flex',
49 flexDirection: 'column',
50 position: 'relative',
51 overflow: 'hidden',
52 };
53 return isDarkMode
54 ? {
55 ...baseStyle,
56 backgroundImage:
57 'linear-gradient(180deg, #3B3B3B 0%, #242120 100%), linear-gradient(180deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0) 100%)',
58 }
59 : {
60 ...baseStyle,
61 backgroundImage:
62 'linear-gradient(180deg, #FAF5F1 0%, #F6EBE6 100%), linear-gradient(180deg, #FFFFFF 0%, rgba(255, 255, 255, 0) 100%)',
63 };
64 };
65
66 return (
67 <div className="flex-1 flex gap-0 h-full min-h-0 overflow-hidden">
68 {/* 1. 左侧导航树容器 */}

Callers

nothing calls this directly

Calls 2

useStickyStateFunction · 0.90
getContainerStyleFunction · 0.85

Tested by

no test coverage detected