Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | 76x 76x 202x 2403x 2403x | import type { CostCurveDriverSpec } from "@/api/apiStore.gen";
import { RoleEnum, SourceOptionsEnum } from "@/api/apiStore.gen";
export const NO_SUBTYPE_VALUE = "__none__";
export const CUSTOM_EQUIPMENT_CATEGORY = "custom_equipment";
export function uniqueOptions(values: readonly (string | null | undefined)[]) {
return [
...new Set(
values
.map((value) => value?.trim())
.filter((value): value is string => Boolean(value)),
),
];
}
export function primaryFormulaSymbol(specs: readonly CostCurveDriverSpec[]) {
return (
specs.find(
(spec) =>
spec.role === RoleEnum.FormulaInput &&
spec.primary &&
spec.variable_symbol?.trim(),
)?.variable_symbol ?? "x"
);
}
export function createFormulaInputSpec(index: number): CostCurveDriverSpec {
const suffix = index <= 1 ? "" : String(index);
return {
key: "",
label: `Input ${index}`,
role: RoleEnum.FormulaInput,
variable_symbol: `x${suffix}`,
unit: "",
required: true,
primary: index === 1,
source_options: [SourceOptionsEnum.Property, SourceOptionsEnum.Manual],
};
}
|