redesigned camera settings page, left the minimum height at 100%, open to change

This commit is contained in:
2025-09-26 13:38:47 +01:00
parent 1edeba9b13
commit 6773b82349
7 changed files with 28 additions and 31 deletions

View File

@@ -16,9 +16,14 @@ export const SnapshotContainer = ({
if (isPending) return <>Loading...</>; if (isPending) return <>Loading...</>;
return ( return (
<div className="relative w-full aspect-video"> <div className="flex flex-col md:flex-row">
<NavigationArrow side={side} settingsPage={settingsPage} /> <NavigationArrow side={side} settingsPage={settingsPage} />
<canvas ref={canvasRef} className="w-full h-full object-contain block" /> <div className="w-full">
<canvas
ref={canvasRef}
className="absolute inset-0 object-contain min-h-[100%] z-20"
/>
</div>
</div> </div>
); );
}; };

View File

@@ -53,7 +53,7 @@ const CameraSettingFields = ({
enableReinitialize enableReinitialize
> >
{({ errors, touched }) => ( {({ errors, touched }) => (
<Form className="flex flex-col space-y-4 p-2"> <Form className="flex flex-col space-y-6 p-2">
<div className="flex flex-col space-y-2 relative"> <div className="flex flex-col space-y-2 relative">
<label htmlFor="friendlyName">Name</label> <label htmlFor="friendlyName">Name</label>
{touched.friendlyName && errors.friendlyName && ( {touched.friendlyName && errors.friendlyName && (

View File

@@ -15,10 +15,10 @@ const CameraSettings = ({ title, side }: { title: string; side: string }) => {
console.log(updateCameraConfigError); console.log(updateCameraConfigError);
return ( return (
<Card className="px-4 py-4"> <Card className="overflow-hidden min-h-[40vh] md:min-h-[60vh] max-h-[80vh] lg:w-[40%] p-4">
{isPending && <>Loading camera config</>} {isPending && <>Loading camera config</>}
{isError && <>Error fetching camera config</>} {isError && <>Error fetching camera config</>}
<div className="relative flex flex-col space-y-3 h-full"> <div className="relative flex flex-col space-y-3">
<CardHeader title={title} icon={faWrench} /> <CardHeader title={title} icon={faWrench} />
<CameraSettingFields <CameraSettingFields
initialData={data} initialData={data}

View File

@@ -10,7 +10,6 @@ const FrontCameraOverviewCard = () => {
const navigate = useNavigate(); const navigate = useNavigate();
const handlers = useSwipeable({ const handlers = useSwipeable({
onSwipedRight: () => navigate("/front-camera-settings"), onSwipedRight: () => navigate("/front-camera-settings"),
trackMouse: true, trackMouse: true,
}); });
@@ -20,7 +19,7 @@ const FrontCameraOverviewCard = () => {
"relative min-h-[40vh] md:min-h-[60vh] max-h-[80vh] lg:w-[70%] overflow-y-hidden" "relative min-h-[40vh] md:min-h-[60vh] max-h-[80vh] lg:w-[70%] overflow-y-hidden"
)} )}
> >
<div className="lg:overflow-hidden" {...handlers}> <div className="w-full" {...handlers}>
<SightingOverview /> <SightingOverview />
</div> </div>
</Card> </Card>

View File

@@ -1,11 +1,10 @@
import clsx from "clsx"; import clsx from "clsx";
import { SnapshotContainer } from "../CameraOverview/SnapshotContainer"; import { SnapshotContainer } from "../CameraOverview/SnapshotContainer";
import { faCamera } from "@fortawesome/free-regular-svg-icons";
import Card from "../UI/Card"; import Card from "../UI/Card";
import CardHeader from "../UI/CardHeader"; import { useNavigate } from "react-router";
import { useSwipeable } from "react-swipeable";
const OverviewVideoContainer = ({ const OverviewVideoContainer = ({
title,
side, side,
settingsPage, settingsPage,
}: { }: {
@@ -13,14 +12,18 @@ const OverviewVideoContainer = ({
side: string; side: string;
settingsPage?: boolean; settingsPage?: boolean;
}) => { }) => {
const navigate = useNavigate();
const handlers = useSwipeable({
onSwipedLeft: () => navigate("/"),
trackMouse: true,
});
return ( return (
<Card <Card
className={clsx( className={clsx(
"min-h-[40vh] md:min-h-[60vh] max-h-[80vh] h-auto overflow-y-hidden" "relative min-h-[40vh] md:min-h-[60vh] max-h-[80vh] lg:w-[70%] overflow-y-hidden"
)} )}
> >
<div className="relative flex flex-col space-y-3 h-full"> <div className="w-full" {...handlers}>
<CardHeader title={title} icon={faCamera} />
<SnapshotContainer side={side} settingsPage={settingsPage} /> <SnapshotContainer side={side} settingsPage={settingsPage} />
</div> </div>
</Card> </Card>

View File

@@ -1,8 +1,8 @@
import { useMutation, useQuery } from "@tanstack/react-query"; import { useMutation, useQuery } from "@tanstack/react-query";
import { toast } from "sonner"; import { toast } from "sonner";
import { CAM_BASE } from "../utils/config"; import { OUTSIDE_CAM_BASE } from "../utils/config";
const base_url = `${CAM_BASE}/api`; const base_url = `${OUTSIDE_CAM_BASE}/api`;
console.log(base_url); console.log(base_url);
const fetchCameraSideConfig = async ({ queryKey }: { queryKey: string[] }) => { const fetchCameraSideConfig = async ({ queryKey }: { queryKey: string[] }) => {

View File

@@ -1,25 +1,15 @@
import CameraSettings from "../components/CameraSettings/CameraSettings"; import CameraSettings from "../components/CameraSettings/CameraSettings";
import OverviewVideoContainer from "../components/FrontCameraSettings/OverviewVideoContainer"; import OverviewVideoContainer from "../components/FrontCameraSettings/OverviewVideoContainer";
import { Toaster } from "sonner"; import { Toaster } from "sonner";
import { useNavigate } from "react-router";
import { useSwipeable } from "react-swipeable";
const FrontCamera = () => { const FrontCamera = () => {
const navigate = useNavigate();
const handlers = useSwipeable({
onSwipedLeft: () => navigate("/"),
trackMouse: true,
});
return ( return (
<div className="mx-auto grid grid-cols-1 sm:grid-cols-1 lg:grid-cols-2 gap-4 px-2 sm:px-4 lg:px-0 w-full"> <div className="mx-auto flex flex-col lg:flex-row gap-2 px-1 sm:px-2 lg:px-0 w-full min-h-screen">
<div {...handlers}>
<OverviewVideoContainer <OverviewVideoContainer
title={"Front Camera"} title={"Front Camera"}
side="CameraFront" side="CameraRear"
settingsPage={true} settingsPage={true}
/> />
</div>
<CameraSettings title="Front Camera Settings" side="CameraFront" /> <CameraSettings title="Front Camera Settings" side="CameraFront" />
<Toaster /> <Toaster />
</div> </div>