Skip to content

Commit

Permalink
Implement Conops MVP
Browse files Browse the repository at this point in the history
  • Loading branch information
AlyNat75 authored and ZachGarcia42 committed Jan 19, 2025
1 parent cfb3463 commit 45b040f
Show file tree
Hide file tree
Showing 13 changed files with 1,118 additions and 84 deletions.
63 changes: 63 additions & 0 deletions ground-server/src/app/conops/page1/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import { auth } from "@/app/auth";
import { LiveValueBox } from "@/components/live-value-box";
import { Button } from "@/components/ui/button";
import {
AlertDialog,
AlertDialogTrigger,
AlertDialogContent,
AlertDialogHeader,
AlertDialogFooter,
AlertDialogTitle,
AlertDialogDescription,
AlertDialogCancel,
AlertDialogAction,
} from "@/components/ui/alert-dialog";
import Link from "next/link";

export default async function Conops() {
const session = await auth();

if (!session) {
return <div>Not authenticated</div>;
}

return (
<div className="flex flex-col items-center p-6 min-h-screen bg-white dark:bg-black relative">
<h1 className="text-3xl font-bold mb-6 text-center">Page 1: Sensor Checks</h1>
<div className="grid grid-cols-3 gap-8 w-full max-w-6xl">
<LiveValueBox label="Pressure Transducer 1 (PT1)" dbField="pt1" />
<LiveValueBox label="Pressure Transducer 2 (PT2)" dbField="pt2" />
<LiveValueBox label="Load Cell 1 (LC1)" dbField="lc1" />
<LiveValueBox label="RTD Temperature (RTD)" dbField="rtdTemp" />
<LiveValueBox label="Pressure Transducer 3 (PT3)" dbField="pt3" />
<LiveValueBox label="Pressure Transducer 4 (PT4)" dbField="pt4" />
</div>
<AlertDialog>
<AlertDialogTrigger asChild>
<Button
variant="default"
className="fixed bottom-6 right-6 px-6 py-6 text-lg rounded-lg shadow-lg"
>
{"Next Page"}
</Button>
</AlertDialogTrigger>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>Move to Next Page</AlertDialogTitle>
<AlertDialogDescription>
Are you sure all sensors are displaying correct values?
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>No</AlertDialogCancel>
<Link href="/conops/page2" passHref>
<AlertDialogAction asChild>
<button>Yes</button>
</AlertDialogAction>
</Link>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
</div>
);
}
119 changes: 119 additions & 0 deletions ground-server/src/app/conops/page2/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
import { auth } from "@/app/auth";
import ActuationBox from "@/components/actuation-box";
import {
AlertDialog,
AlertDialogTrigger,
AlertDialogContent,
AlertDialogHeader,
AlertDialogFooter,
AlertDialogTitle,
AlertDialogDescription,
AlertDialogCancel,
AlertDialogAction,
} from "@/components/ui/alert-dialog";
import Link from "next/link";
import { Button } from "@/components/ui/button";

export default async function Page2() {
const session = await auth();

if (!session) {
return <div>Not authenticated</div>;
}

return (
<div className="flex flex-col items-center p-6 min-h-screen bg-white dark:bg-black relative text-gray-900 dark:text-gray-200">
{/* Page Title */}
<h1 className="text-3xl font-bold mb-6 text-center">Page 2: Actuation Checks</h1>

{/* Actuation Boxes */}
<div className="grid grid-cols-1 lg:grid-cols-2 xl:grid-cols-3 gap-5 p-5">
<ActuationBox
title="MAV"
buttons={[
{ label: "Open", stateLabel: "Opened", command: { mavOpen: true }, isOn: true },
{ label: "Close", stateLabel: "Closed", command: { mavOpen: false }, isOn: false },
]}
initialStateLabel="No Data"
useSwitch={false}
/>
<ActuationBox
title="Solenoid Valve 1 (SV1)"
buttons={[
{ label: "Open", stateLabel: "Opened", command: { sv1Open: true }, isOn: true },
{ label: "Close", stateLabel: "Closed", command: { sv1Open: false }, isOn: false },
]}
initialStateLabel="No Data"
useSwitch={false}
/>
<ActuationBox
title="Quick Disconnect Motor (QD)"
buttons={[
{ label: "Retract", stateLabel: "Retracted", command: { qdRetract: true }, isOn: true },
]}
initialStateLabel="No Data"
useSwitch={false}
/>
<ActuationBox
title="Ball Valve"
buttons={[
{
label: "Open",
stateLabel: "Opening",
command: { bv1Open: true },
isOn: true,
},
{
label: "Close",
stateLabel: "Closing",
command: { bv1Open: false },
isOn: false,
},
]}
initialStateLabel="No Data"
useSwitch={true}
switchLabel="Ball Valve On/Off"
switchOnCommand={{ bv1Off: false }}
switchOffCommand={{ bv1Off: true }}
/>
<ActuationBox
title="Solenoid Valve 2 (SV2)"
buttons={[
{ label: "Open", stateLabel: "Opened", command: { sv2Close: false }, isOn: true },
{ label: "Close", stateLabel: "Closed", command: { sv2Close: true }, isOn: false },
]}
initialStateLabel="No Data"
useSwitch={false}
/>
</div>

{/* Alert Dialog Button */}
<AlertDialog>
<AlertDialogTrigger asChild>
<Button
variant="default"
className="fixed bottom-6 right-6 px-6 py-6 text-lg rounded-lg shadow-lg"
>
{"Next Page"}
</Button>
</AlertDialogTrigger>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>Move to Next Page</AlertDialogTitle>
<AlertDialogDescription>
Are you sure all actuators are functioning correctly?
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>No</AlertDialogCancel>
<Link href="/conops/page3" passHref>
<AlertDialogAction asChild>
<button>Yes</button>
</AlertDialogAction>
</Link>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
</div>
);
}
148 changes: 148 additions & 0 deletions ground-server/src/app/conops/page3/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
import { auth } from "@/app/auth";
import ActuationBox from "@/components/actuation-box";
import { LiveValueBox } from "@/components/live-value-box";
import {
AlertDialog,
AlertDialogTrigger,
AlertDialogContent,
AlertDialogHeader,
AlertDialogFooter,
AlertDialogTitle,
AlertDialogDescription,
AlertDialogCancel,
AlertDialogAction,
} from "@/components/ui/alert-dialog";
import Link from "next/link";
import { Button } from "@/components/ui/button";

export default async function Page3() {
const session = await auth();

if (!session) {
return <div>Not authenticated</div>;
}

return (
<div className="flex flex-col items-center p-6 min-h-screen bg-white dark:bg-black relative text-gray-900 dark:text-gray-200">
{/* Page Title */}
<h1 className="text-3xl font-bold mb-6 text-center">Page 3: Pre-Fill</h1>

{/* Actuation Boxes */}
<div className="grid grid-cols-7 gap-4 w-full max-w-7xl">
<ActuationBox
title="Solenoid Valve 1"
buttons={[
{ label: "Close", stateLabel: "Closed", command: { sv1Open: false }, isOn: false },
]}
initialStateLabel="Closed"
small={true}
useSwitch={false}
/>
<ActuationBox
title="Ball Valve 1 (BV1)"
buttons={[
{ label: "Close", stateLabel: "Closed", command: { bv1Open: false }, isOn: false },
]}
initialStateLabel="Closed"
small={true}
useSwitch={false}
/>
{/* Using mavOpen as a command place holder until i figure out what MV1 and MV2 is */}
<ActuationBox
title="MV1?"
buttons={[
{ label: "Close", stateLabel: "Closed", command: { mavOpen: false }, isOn: false },
]}
initialStateLabel="Closed"
small={true}
useSwitch={false}
/>
<ActuationBox
title="MV2?"
buttons={[
{ label: "Close", stateLabel: "Closed", command: { mavOpen: false }, isOn: false },
]}
initialStateLabel="Closed"
small={true}
useSwitch={false}
/>
<ActuationBox
title="MAV"
buttons={[
{ label: "Close", stateLabel: "Closed", command: { mavOpen: false }, isOn: false },
]}
initialStateLabel="Closed"
small={true}
useSwitch={false}
/>
<ActuationBox
title="Solenoid Valve 2"
buttons={[
{ label: "Open", stateLabel: "Opened", command: { sv2Close: false }, isOn: true },
]}
initialStateLabel="Open"
small={true}
useSwitch={false}
/>
<ActuationBox
title="Quick Disconnect"
buttons={[
{ label: "Connect", stateLabel: "Connected", command: { qdRetract: false }, isOn: true },
]}
initialStateLabel="Connected"
small={true}
useSwitch={false}
/>
</div>

{/* Full-Size MAV Actuation Box and PT1 Live Value */}
<div className="flex items-center justify-between w-full max-w-7xl mt-8">
{/* MAV Actuation Box */}
<div className="flex-grow max-w-[600px]">
<ActuationBox
title="MAV Control"
buttons={[
{ label: "Open", stateLabel: "Opened", command: { mavOpen: true }, isOn: true },
{ label: "Close", stateLabel: "Closed", command: { mavOpen: false }, isOn: false },
]}
initialStateLabel="Closed"
useSwitch={false}
/>
</div>

{/* PT1 Live Value Box */}
<div className="flex-grow max-w-[300px]">
<LiveValueBox label="PT1 Pressure" dbField="pt1" />
</div>
</div>

{/* Alert Dialog Button */}
<AlertDialog>
<AlertDialogTrigger asChild>
<Button
variant="default"
className="fixed bottom-6 right-6 px-6 py-6 text-lg rounded-lg shadow-lg"
>
{"Next Page"}
</Button>
</AlertDialogTrigger>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>Move to Next Page</AlertDialogTitle>
<AlertDialogDescription>
Are you sure the pre-fill process is complete?
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>No</AlertDialogCancel>
<Link href="/conops/page4" passHref>
<AlertDialogAction asChild>
<button>Yes</button>
</AlertDialogAction>
</Link>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
</div>
);
}
Loading

0 comments on commit 45b040f

Please sign in to comment.