From 9b6e802fd7afcdf1d0fdb1fc927492351b71a570 Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Mon, 4 Mar 2024 10:40:26 -0600 Subject: [PATCH] adapt for mobile --- web/src/components/timeline/MotionSegment.tsx | 31 +++++++++++-------- web/src/pages/UIPlayground.tsx | 2 +- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/web/src/components/timeline/MotionSegment.tsx b/web/src/components/timeline/MotionSegment.tsx index 466c04e0b..b898611ca 100644 --- a/web/src/components/timeline/MotionSegment.tsx +++ b/web/src/components/timeline/MotionSegment.tsx @@ -12,6 +12,7 @@ import scrollIntoView from "scroll-into-view-if-needed"; import { MinimapBounds, Tick, Timestamp } from "./segment-metadata"; import { MockMotionData } from "@/pages/UIPlayground"; import { useMotionSegmentUtils } from "@/hooks/use-motion-segment-utils"; +import { isMobile } from "react-device-detect"; type MotionSegmentProps = { events: ReviewSegment[]; @@ -85,6 +86,10 @@ export function MotionSegment({ const timestamp = useMemo(() => new Date(segmentTime * 1000), [segmentTime]); const segmentKey = useMemo(() => segmentTime, [segmentTime]); + const maxSegmentWidth = useMemo(() => { + return isMobile ? 15 : 25; + }, []); + const alignedMinimapStartTime = useMemo( () => alignStartDateToTimeline(minimapStartTime ?? 0), [minimapStartTime, alignStartDateToTimeline], @@ -204,27 +209,27 @@ export function MotionSegment({ segmentKey={segmentKey} /> -
-
-
+
+
+
-
+
-
-
+
+
-
+
diff --git a/web/src/pages/UIPlayground.tsx b/web/src/pages/UIPlayground.tsx index 65b37c490..10306e07e 100644 --- a/web/src/pages/UIPlayground.tsx +++ b/web/src/pages/UIPlayground.tsx @@ -284,7 +284,7 @@ function UIPlayground() {
-
+
{!isEventsReviewTimeline && (