From 08e9120db5016879737bdab590d606f44729879f Mon Sep 17 00:00:00 2001 From: Nick Mowen Date: Wed, 13 Dec 2023 11:09:32 -0700 Subject: [PATCH] Don't have horizontal scrolling --- web-new/src/components/card/HistoryCard.tsx | 3 +- .../player/PreviewThumbnailPlayer.tsx | 33 +++++++++++-- web-new/src/pages/History.tsx | 49 +++++++++---------- web-new/tailwind.config.js | 4 ++ 4 files changed, 58 insertions(+), 31 deletions(-) diff --git a/web-new/src/components/card/HistoryCard.tsx b/web-new/src/components/card/HistoryCard.tsx index 30ddd7caa..faad096b7 100644 --- a/web-new/src/components/card/HistoryCard.tsx +++ b/web-new/src/components/card/HistoryCard.tsx @@ -35,11 +35,12 @@ export default function HistoryCard({ } return ( - +
diff --git a/web-new/src/components/player/PreviewThumbnailPlayer.tsx b/web-new/src/components/player/PreviewThumbnailPlayer.tsx index 2e05f601e..6e86d6f71 100644 --- a/web-new/src/components/player/PreviewThumbnailPlayer.tsx +++ b/web-new/src/components/player/PreviewThumbnailPlayer.tsx @@ -10,6 +10,7 @@ type PreviewPlayerProps = { camera: string; relevantPreview?: Preview; startTs: number; + eventId: string; }; type Preview = { @@ -24,6 +25,7 @@ export default function PreviewThumbnailPlayer({ camera, relevantPreview, startTs, + eventId, }: PreviewPlayerProps) { const { data: config } = useSWR("config"); const playerRef = useRef(null); @@ -46,12 +48,29 @@ export default function PreviewThumbnailPlayer({ ); if (!relevantPreview) { + if (isCurrentHour(startTs)) { + return ( + + + + ); + } + return ( - + ); } @@ -63,7 +82,7 @@ export default function PreviewThumbnailPlayer({ onMouseEnter={() => onHover(true)} onMouseLeave={() => onHover(false)} > -
+
now.getTime() / 1000; +} + +function getPreviewWidth(camera: string, config: FrigateConfig) { const detect = config.cameras[camera].detect; if (detect.width / detect.height < 1.4) { - return "w-[200px]"; + return "w-[208px]"; } return "w-full"; diff --git a/web-new/src/pages/History.tsx b/web-new/src/pages/History.tsx index c238df4ee..4427446df 100644 --- a/web-new/src/pages/History.tsx +++ b/web-new/src/pages/History.tsx @@ -197,32 +197,29 @@ function History() { strftime_fmt: "%I:00", })} - -
- {Object.entries(timelineHour).map( - ([key, timeline]) => { - const startTs = Object.values( - timeline.entries - )[0].timestamp; - return ( - - preview.camera == timeline.camera && - preview.start < startTs && - preview.end > startTs - )} - /> - ); - } - )} -
- -
+ +
+ {Object.entries(timelineHour).map( + ([key, timeline]) => { + const startTs = Object.values(timeline.entries)[0] + .timestamp; + return ( + + preview.camera == timeline.camera && + preview.start < startTs && + preview.end > startTs + )} + /> + ); + } + )} +
{lastRow && }
); diff --git a/web-new/tailwind.config.js b/web-new/tailwind.config.js index 0377ea1de..e6180eacd 100644 --- a/web-new/tailwind.config.js +++ b/web-new/tailwind.config.js @@ -70,6 +70,10 @@ module.exports = { "accordion-down": "accordion-down 0.2s ease-out", "accordion-up": "accordion-up 0.2s ease-out", }, + screens: { + "xs": "480px", + "2xl": "1400px", + }, }, }, plugins: [require("tailwindcss-animate")],