Skip to content

Remove temp toggle, frontend now always celsius - #690

Merged
haralde merged 5 commits into
mainfrom
remove-temp-toggle-v2
May 20, 2026
Merged

Remove temp toggle, frontend now always celsius#690
haralde merged 5 commits into
mainfrom
remove-temp-toggle-v2

Conversation

@haralde

@haralde haralde commented May 11, 2026

Copy link
Copy Markdown
Collaborator

Temperature is now always C in frontend. Fixes #635

Adapters that require K needs to handle this internally in adapter before posting a model run

@haralde
haralde force-pushed the remove-temp-toggle-v2 branch from 708a048 to 3eac08d Compare May 11, 2026 13:49
@haralde
haralde marked this pull request as ready for review May 12, 2026 06:14
@haralde
haralde requested review from Copilot and fmell May 12, 2026 06:36

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Removes the Kelvin/Celsius unit toggle and standardizes temperature handling to always use Celsius across the frontend and core API model, with backend adapters converting to Kelvin internally where required (per #635).

Changes:

  • Removed the frontend temperature-unit settings context/toggle and the ConvertibleTextField abstraction.
  • Switched frontend temperature values and defaults to Celsius (no longer adding/subtracting 273 on the client side).
  • Updated backend Conditions default temperature to 25°C and adjusted model adapters/tests to match the new Celsius contract.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
frontend/tests/functions/Formatting.test.tsx Updates expected tabulated temperatures to Celsius values.
frontend/tests/components/ConvertibleTextField.test.tsx Removes tests for deleted ConvertibleTextField.
frontend/src/hooks/useSimulationQueriesResult.ts Stops converting experiment temperature to Kelvin before starting simulations.
frontend/src/hooks/useConditionsStore.ts Changes default temperature from 300 to 25 (Celsius).
frontend/src/functions/Formatting.tsx Stops converting experiment temperatures to Kelvin when tabulating results.
frontend/src/contexts/SettingsContext.ts Removes temperature unit context and toggle logic.
frontend/src/components/TopBar.tsx Removes temperature toggle UI and related icon/import usage.
frontend/src/components/Simulation/ModelInputs.tsx Replaces ConvertibleTextField with TextField for parameters; updates temperature unit label to °C.
frontend/src/components/ConvertibleTextField.tsx Removes the unit-converting numeric input component.
frontend/src/App.tsx Removes SettingsProvider from the provider composition.
backend/tests/test_models_endpoints.py Updates expected default condition temperature to 25°C.
backend/src/acidwatch_api/models/solubilityccs.py Converts Celsius to Kelvin internally before calling solubilityccs.
backend/src/acidwatch_api/models/phpitz.py Removes Kelvin→Celsius conversion; now passes Celsius through.
backend/src/acidwatch_api/models/gibbs_minimization_model.py Converts Celsius to Kelvin internally for neqsim.
backend/src/acidwatch_api/models/datamodel.py Documents Celsius contract and changes default temperature to 25°C.
backend/src/acidwatch_api/models/arcs.py Converts Celsius to Kelvin internally before calling ARCS.
backend/src/acidwatch_api/models/arcs_exp.py Converts Celsius to Kelvin internally before calling ARCS experimental.
Comments suppressed due to low confidence (1)

frontend/src/components/Simulation/ModelInputs.tsx:213

  • The Temperature condition field now uses unit "°C", but the onChange handler only updates state when valueAsNumber is finite. This makes it effectively impossible to type negative Celsius temperatures normally (first keystroke - yields NaN, so the controlled input reverts). To support negative temperatures and normal numeric editing, handle intermediate string states (e.g. empty string / "-" / trailing decimal) and commit the parsed number on blur, or manage the value as a string internally.
                    <TextField
                        type="number"
                        id="temperature"
                        label="Temperature"
                        unit="°C"
                        step="any"
                        value={conditions.temperature}
                        onChange={(e: ChangeEvent<HTMLInputElement>) => {
                            if (Number.isFinite(e.target.valueAsNumber)) {
                                setCondition("temperature", e.target.valueAsNumber);
                            }
                        }}

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread frontend/src/components/Simulation/ModelInputs.tsx Outdated
@haralde
haralde force-pushed the remove-temp-toggle-v2 branch from 4ef27d6 to 3f5fcd0 Compare May 13, 2026 12:23
@haralde
haralde merged commit 3d85e84 into main May 20, 2026
7 checks passed
@haralde
haralde deleted the remove-temp-toggle-v2 branch May 20, 2026 06:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove the option of changing between units (kelvin and celcius)

2 participants