From 013b1d48a34516c848942f6b558d8a129f22d7d8 Mon Sep 17 00:00:00 2001 From: eric Date: Tue, 11 Aug 2026 04:17:54 -0500 Subject: [PATCH] Shorts: JS ResizeObserver syncs right panel height to left panel Co-authored-by: Cursor --- frontend/src/app/shorts/page.tsx | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/frontend/src/app/shorts/page.tsx b/frontend/src/app/shorts/page.tsx index 6a17ef2..2b7c6e4 100644 --- a/frontend/src/app/shorts/page.tsx +++ b/frontend/src/app/shorts/page.tsx @@ -1,6 +1,6 @@ "use client"; -import { useCallback, useEffect, useMemo, useState } from "react"; +import { useCallback, useEffect, useMemo, useRef, useState } from "react"; import Link from "next/link"; import { Clock3, @@ -110,6 +110,8 @@ export default function ShortsPage() { const toast = useToast(); const [pageTab, setPageTab] = useState<"ops" | "live">("ops"); const [status, setStatus] = useState | null>(null); + const leftPanelRef = useRef(null); + const rightPanelRef = useRef(null); const [channels, setChannels] = useState([]); const [jobs, setJobs] = useState([]); const [jobTotal, setJobTotal] = useState(0); @@ -203,6 +205,21 @@ export default function ShortsPage() { return () => clearInterval(t); }, [load, pageTab]); + // Sync right panel height to left panel + useEffect(() => { + const left = leftPanelRef.current; + const right = rightPanelRef.current; + if (!left || !right) return; + const sync = () => { + const h = left.getBoundingClientRect().height; + right.style.maxHeight = `${h}px`; + }; + sync(); + const ro = new ResizeObserver(sync); + ro.observe(left); + return () => ro.disconnect(); + }); + useEffect(() => { if (pageTab !== "live") return; void loadLiveAnalytics(); @@ -889,8 +906,8 @@ export default function ShortsPage() { {!loading || status ? ( <> -
-
+
+

频道配额({channels.length})

@@ -1007,7 +1024,7 @@ export default function ShortsPage() {
-
+