Skip to content

Commit 0e51525

Browse files
skearnesclaude
andcommitted
Use YIELD enum reference and hide zero-default precision in setpoints
Replaces the hardcoded 3 in ReactionCard with reaction_pb.ProductMeasurement.ProductMeasurementType.YIELD so a schema renumber would fail at compile time. Skips the "± 0" suffix in tempSetPoint and pressureSetPoint when precision is the proto3 zero-default. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent bfa9dc1 commit 0e51525

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

app/src/components/ReactionCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ interface ReactionCardProps {
3232
onSelectionChange?: (reactionId: string, isSelected: boolean) => void;
3333
}
3434

35-
const YIELD_MEASUREMENT_TYPE = 3; // ord-schema ProductMeasurementType.YIELD
35+
const YIELD_MEASUREMENT_TYPE = reaction_pb.ProductMeasurement.ProductMeasurementType.YIELD;
3636

3737
const ReactionCard: React.FC<ReactionCardProps> = ({
3838
reaction,

app/src/utils/conditions.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ export const tempType = (type: number | undefined): string =>
3333
export const tempSetPoint = (setpoint: Temperature.AsObject | undefined): string => {
3434
if (!setpoint) return 'None';
3535
const unit = enumName(reaction_pb.Temperature.TemperatureUnit, setpoint.units);
36-
return `${setpoint.value}${setpoint.precision}) °${unit ? unit.charAt(0) : ''}`;
36+
const precision = setpoint.precision ? ` (± ${setpoint.precision})` : '';
37+
return `${setpoint.value}${precision} °${unit ? unit.charAt(0) : ''}`;
3738
};
3839

3940
export const pressureType = (type: number | undefined): string =>
@@ -42,7 +43,8 @@ export const pressureType = (type: number | undefined): string =>
4243
export const pressureSetPoint = (setpoint: Pressure.AsObject | undefined): string => {
4344
if (!setpoint) return 'None';
4445
const unit = enumName(reaction_pb.Pressure.PressureUnit, setpoint.units);
45-
return `${setpoint.value}${setpoint.precision}) ${unit ? unit.toLowerCase() : ''}`;
46+
const precision = setpoint.precision ? ` (± ${setpoint.precision})` : '';
47+
return `${setpoint.value}${precision} ${unit ? unit.toLowerCase() : ''}`;
4648
};
4749

4850
export const pressureAtmo = (atmo: PressureConditions.Atmosphere.AsObject | undefined): string => {

0 commit comments

Comments
 (0)