diff --git a/src/component/ComponentForm.tsx b/src/component/ComponentForm.tsx
index 08d6117..99568da 100644
--- a/src/component/ComponentForm.tsx
+++ b/src/component/ComponentForm.tsx
@@ -699,6 +699,86 @@ export default function ComponentForm(props: Props) {
);
};
+ const componentMode = () => {
+ const { component, coefficient, offset } = form;
+ return (
+
+
+
+
+ }
+ label="Mode"
+ labelPlacement="top"
+ className={classes.switchControl}
+ disabled={!canEdit}
+ />
+
+
+
+ {compMode.mode.entryA && (
+
+ {compMode.mode.entryA === "select" &&
+ compMode.mode.dictionaryA.map((elem: any) => {
+ if (!elem.restricted || (elem.restricted && user.hasAdmin())) {
+ return (
+
+ );
+ }
+ return undefined; //TODO-CS: Time permitting re-think the structure of this function so that I don't have to return undefined
+ })}
+
+ )}
+
+
+ {compMode.mode.entryB && (
+
+ {compMode.mode.entryB === "select" &&
+ compMode.mode.dictionaryB.map((elem: any) => (
+
+ ))}
+
+ )}
+
+
+ )
+ }
+
const describeSource = (measurementType: quack.MeasurementType): MeasurementDescriber => {
const { component } = form;
return describeMeasurement(measurementType, component.type(), component.subType());
@@ -1046,87 +1126,17 @@ export default function ComponentForm(props: Props) {
}
- {!compMode ? (
- device.featureSupported("individualCalibrations") ? (
- individualCalibration()
- ) : (
- blanketCalibration()
- )
- ) : (
+ {device.featureSupported("individualCalibrations") ? (
-
-
-
- }
- label="Mode"
- labelPlacement="top"
- className={classes.switchControl}
- disabled={!canEdit}
- />
-
-
-
- {compMode.mode.entryA && (
-
- {compMode.mode.entryA === "select" &&
- compMode.mode.dictionaryA.map((elem: any) => {
- if (!elem.restricted || (elem.restricted && user.hasAdmin())) {
- return (
-
- );
- }
- return undefined; //TODO-CS: Time permitting re-think the structure of this function so that I don't have to return undefined
- })}
-
- )}
-
-
- {compMode.mode.entryB && (
-
- {compMode.mode.entryB === "select" &&
- compMode.mode.dictionaryB.map((elem: any) => (
-
- ))}
-
- )}
-
+ {compMode && componentMode()}
+ {individualCalibration()}
+ ) : (
+ !compMode ? (
+ blanketCalibration()
+ ):(
+ componentMode()
+ )
)}