diff --git a/src/features/output/components/BearerTypeCard.tsx b/src/features/output/components/BearerTypeCard.tsx index 23f9b51..f7144e2 100644 --- a/src/features/output/components/BearerTypeCard.tsx +++ b/src/features/output/components/BearerTypeCard.tsx @@ -4,7 +4,7 @@ import BearerTypeFields from "./BearerTypeFields"; const BearerTypeCard = () => { return ( - + diff --git a/src/features/output/components/BearerTypeFields.tsx b/src/features/output/components/BearerTypeFields.tsx index a4d0a31..dccbd26 100644 --- a/src/features/output/components/BearerTypeFields.tsx +++ b/src/features/output/components/BearerTypeFields.tsx @@ -2,8 +2,10 @@ import { Field } from "formik"; const BearerTypeFields = () => { return ( - <> - +
+ { FTP - +
); }; diff --git a/src/features/output/components/ChannelCard.tsx b/src/features/output/components/ChannelCard.tsx index 1468c4d..1378161 100644 --- a/src/features/output/components/ChannelCard.tsx +++ b/src/features/output/components/ChannelCard.tsx @@ -2,14 +2,21 @@ import { useFormikContext } from "formik"; import Card from "../../../ui/Card"; import CardHeader from "../../../ui/CardHeader"; import ChannelFields from "./ChannelFields"; +import type { FormTypes } from "../../../types/types"; const ChannelCard = () => { - const { values } = useFormikContext(); - console.log(values); + const { values, errors, touched } = useFormikContext(); + return ( - + - + + ); }; diff --git a/src/features/output/components/ChannelFields.tsx b/src/features/output/components/ChannelFields.tsx index 88e9adc..231a9c6 100644 --- a/src/features/output/components/ChannelFields.tsx +++ b/src/features/output/components/ChannelFields.tsx @@ -1,10 +1,16 @@ import { Field } from "formik"; +import type { FormTypes, InitialValuesFormErrors } from "../../../types/types"; type ChannelFieldsProps = { - format: string; + values: FormTypes; + errors: InitialValuesFormErrors; + touched: { + connectTimeoutSeconds?: boolean | undefined; + readTimeoutSeconds?: boolean | undefined; + }; }; -const ChannelFields = ({ format }: ChannelFieldsProps) => { +const ChannelFields = ({ errors, touched, values }: ChannelFieldsProps) => { return (
@@ -60,6 +66,163 @@ const ChannelFields = ({ format }: ChannelFieldsProps) => { className={`p-1.5 border border-gray-400 rounded-lg w-full md:w-60`} />
+
+ + + + + + +
+
+ + + + + + + +
+ {values.format.toLowerCase() === "utmc" && ( + <> +
+

{values.format} Constants

+
+ +
+ + +
+
+ + + + + +
+
+ + + + + +
+ + )} + {values.format?.toLowerCase() === "bof2" && ( + <> +
+
+

{values.format} Constants

+
+
+ + +
+
+ + +
+
+ + + + + +
+
+ + + + + +
+
+
+
+

{values.format} Lane ID Config

+
+
+ + +
+
+ + +
+
+ + )}
); }; diff --git a/src/features/output/components/Output.tsx b/src/features/output/components/Output.tsx index ece7d10..5c6854b 100644 --- a/src/features/output/components/Output.tsx +++ b/src/features/output/components/Output.tsx @@ -1,13 +1,14 @@ import { Formik, Form } from "formik"; import BearerTypeCard from "./BearerTypeCard"; import ChannelCard from "./ChannelCard"; +import type { FormTypes } from "../../../types/types"; const Output = () => { - const handleSubmit = (values) => { + const handleSubmit = (values: FormTypes) => { console.log(values); }; - const inititalValues = { + const inititalValues: FormTypes = { format: "JSON", enabled: true, backOfficeURL: "", @@ -17,11 +18,22 @@ const Output = () => { readTimeoutSeconds: Number(15), overviewQuality: "HIGH", cropSizeFactor: "3/4", + + // Bof2 -optional constants + FFID: "", + SCID: "", + timestampSource: "UTC", + GPSFormat: "Minutes", + + //BOF2 - optional Lane IDs + laneId: "", + LID1: "", + LID2: "", }; return ( -
+ diff --git a/src/types/types.ts b/src/types/types.ts index b130f22..a768370 100644 --- a/src/types/types.ts +++ b/src/types/types.ts @@ -21,3 +21,39 @@ export type SystemHealthStatus = { id: string; tags: string[]; }; + +export type BearerTypeFields = { + format: string; + enabled: boolean; + backOfficeURL: string; + username: string; + password: string; + connectTimeoutSeconds: number; + readTimeoutSeconds: number; + overviewQuality: string; + cropSizeFactor: string; +}; + +export type OptionalConstants = { + FFID?: string; + SCID?: string; + timestampSource?: string; + GPSFormat?: string; +}; + +export type OptionalLaneIDs = { + laneId?: string; + LID1?: string; + LID2?: string; + LID3?: string; +}; + +export type InitialValuesFormErrors = { + backOfficeURL?: string; + username?: string; + password?: string; + connectTimeoutSeconds?: string; + readTimeoutSeconds?: string; +}; + +export type FormTypes = BearerTypeFields & OptionalConstants & OptionalLaneIDs;