From bb7a66b0d650f6efbb24af02556452a2bab7e477 Mon Sep 17 00:00:00 2001 From: lrnselfreliance <33263708+lrnselfreliance@users.noreply.github.com> Date: Wed, 18 Nov 2026 15:49:32 -0700 Subject: [PATCH] The calculators have no Temperature calculator (#987) The Celsius/Fahrenheit/Kelvin converter is removed from the Calculators page and from the search suggestions. Co-authored-by: Claude Fable 5.2 --- app/src/components/Calculators.js | 2 - app/src/components/Search.js | 5 -- .../calculators/TemperatureCalculator.js | 81 ------------------- 3 files changed, 88 deletions(-) delete mode 100644 app/src/components/calculators/TemperatureCalculator.js diff --git a/app/src/components/Calculators.js b/app/src/components/Calculators.js index da82243f..8f4fb95e 100644 --- a/app/src/components/Calculators.js +++ b/app/src/components/Calculators.js @@ -2,7 +2,6 @@ import React from "react"; import {Breadcrumbs, useTitle} from "./Common"; import {Button, Header, Icon} from "./ui"; import {useCalcQuery} from "../hooks/customHooks"; -import {TemperatureCalculator} from "./calculators/TemperatureCalculator"; import {ElectricalCalculators} from "./calculators/ElectricalCalculators"; import {DipoleAntennaCalculator} from "./calculators/HamCalculators"; import {Link} from "react-router"; @@ -40,7 +39,6 @@ export const useCalculators = () => { {key: 'water', icon: 'tint', button: 'Water Storage', group: 'Preparedness & Storage', contents: }, {key: 'ration', icon: 'food', button: 'Food Storage', group: 'Preparedness & Storage', contents: }, {key: 'antenna', icon: 'signal', button: 'Antenna', group: 'Radio & Communications', contents: }, - {key: 'temperature', icon: 'thermometer', button: 'Temperature', group: 'Tools & Reference', contents: }, {key: 'qrCode', icon: 'qrcode', button: 'QR Code', group: 'Tools & Reference', contents: }, {key: 'otp', icon: 'lock', button: 'One Time Pad', title: 'One Time Pad', group: 'Radio & Communications', contents: }, {key: 'vin', icon: 'car', button: 'VIN Decoder', title: 'VIN Decoder', group: 'Tools & Reference', contents: }, diff --git a/app/src/components/Search.js b/app/src/components/Search.js index a50d3c76..40de77f6 100644 --- a/app/src/components/Search.js +++ b/app/src/components/Search.js @@ -49,11 +49,6 @@ const SUGGESTED_APPS = [ {location: '/videos/channel', title: 'Channels', description: 'View the Channels of your Videos'}, {location: '/zim', title: 'Zim', description: 'View your Zims'}, {location: '/zim/manage', title: 'Manage Zim', description: 'Manage your Zims'}, - { - location: '/more/calculators?calc=temperature', - title: 'Temperature Calculator', - description: 'Convert Celsius, Fahrenheit, Kelvin' - }, { location: '/more/calculators?calc=electrical', title: 'Electrical Calculator', diff --git a/app/src/components/calculators/TemperatureCalculator.js b/app/src/components/calculators/TemperatureCalculator.js deleted file mode 100644 index 503bf1d6..00000000 --- a/app/src/components/calculators/TemperatureCalculator.js +++ /dev/null @@ -1,81 +0,0 @@ -import React from "react"; -import {roundDigits} from "../Common"; -import {Grid, NumberInput} from "../ui"; - -export function TemperatureCalculator() { - const [state, setState] = React.useState({ - celsius: '', - fahrenheit: '', - kelvin: '', - }) - - const handleInputChange = (name, value) => { - if (value === '' || value === undefined || value === null) { - // User has cleared the input; - setState({celsius: '', fahrenheit: '', kelvin: ''}); - return - } - - const stringValue = `${value}`; - const numValue = parseFloat(stringValue.endsWith('.') ? `${stringValue}0` : stringValue); - console.debug(`Calculating ${value} ${name}`); - let newCelsius; - let newKelvin; - let newFahrenheit; - if (name === 'fahrenheit') { - newFahrenheit = value; - newCelsius = roundDigits((numValue - 32) / 1.8); - newKelvin = roundDigits(newCelsius + 273.15); - } else if (name === 'celsius') { - newCelsius = value; - newFahrenheit = roundDigits((numValue * 1.8) + 32); - newKelvin = roundDigits(numValue + 273.15); - } else if (name === 'kelvin') { - newKelvin = value; - newCelsius = roundDigits(numValue - 273.15); - newFahrenheit = roundDigits((newCelsius * 1.8) + 32); - } - if (newFahrenheit < -459.67) { - console.warn('Temperature was below absolute zero!'); - newCelsius = -273.3; - newFahrenheit = -459.67; - newKelvin = 0; - } - setState({ - celsius: newCelsius, - fahrenheit: newFahrenheit, - kelvin: newKelvin - }); - } - - const handleClick = (e) => { - e.target.select(); - } - - return - - handleInputChange('celsius', value)} - onClick={handleClick} - /> - - - handleInputChange('fahrenheit', value)} - onClick={handleClick} - /> - - - handleInputChange('kelvin', value)} - onClick={handleClick} - /> - - -}