definition changes
This commit is contained in:
@@ -1,40 +1,87 @@
|
|||||||
import { calculators } from './calculators';
|
import { calculators } from './calculators';
|
||||||
|
|
||||||
const domainDescriptions: Record<string, string> = {
|
const domainDefinitions: Record<string, { summary: string; context: string }> = {
|
||||||
length: 'linear or spatial distance measurement',
|
length: {
|
||||||
weight: 'mass or force quantity',
|
summary: 'describes the linear or spatial distance between two points.',
|
||||||
temperature: 'thermal energy level',
|
context: 'Use it when explaining how far apart objects are, how long surfaces run, or how tall structures rise.',
|
||||||
volume: 'three-dimensional capacity',
|
},
|
||||||
area: 'two-dimensional surface measurement',
|
weight: {
|
||||||
speed: 'rate of change of position',
|
summary: 'quantifies mass or the gravitational force exerted on an object.',
|
||||||
pressure: 'force exerted per unit area',
|
context: 'Apply these units when comparing loads, weights on a scale, or quantities of matter.',
|
||||||
energy: 'capacity to do work',
|
},
|
||||||
power: 'rate of energy transfer',
|
temperature: {
|
||||||
data: 'digital information volume',
|
summary: 'captures thermal energy along a fixed scale such as Celsius, Fahrenheit, or Kelvin.',
|
||||||
time: 'temporal duration',
|
context: 'They help compare how warm or cold something is and how heat flows between systems.',
|
||||||
angle: 'angular measurement',
|
},
|
||||||
'number-systems': 'numeric representation systems',
|
volume: {
|
||||||
radiation: 'ionizing emission metrics',
|
summary: 'measures three-dimensional capacity inside containers or spaces.',
|
||||||
electrical: 'electricity-related magnitude',
|
context: 'Useful for describing liquids, gases, or any amount of space you can fill.',
|
||||||
force: 'force or torque measurement',
|
},
|
||||||
light: 'luminous intensity',
|
area: {
|
||||||
other: 'specialized measurement',
|
summary: 'tracks two-dimensional surface coverage.',
|
||||||
|
context: 'Helpful when sizing plots of land, floor space, or sheets of material.',
|
||||||
|
},
|
||||||
|
speed: {
|
||||||
|
summary: 'expresses how quickly an object changes position relative to time.',
|
||||||
|
context: 'Speed and velocity units tell you how fast you are moving across a distance or around a path.',
|
||||||
|
},
|
||||||
|
pressure: {
|
||||||
|
summary: 'quantifies the amount of force applied over a specific unit of area.',
|
||||||
|
context: 'Essential when working with gases, fluids, or loads pressing onto a surface.',
|
||||||
|
},
|
||||||
|
energy: {
|
||||||
|
summary: 'represents the capacity to do work or release heat.',
|
||||||
|
context: 'Energy units compare calories, joules, or BTUs when tracking work, heat, or stored energy.',
|
||||||
|
},
|
||||||
|
power: {
|
||||||
|
summary: 'measures the rate at which energy is transferred or converted.',
|
||||||
|
context: 'Use them to compare engines, appliances, or systems that deliver energy over time.',
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
summary: 'counts digital information in bytes, bits, or other storage grains.',
|
||||||
|
context: 'Data units help you compare file sizes, bandwidth, and storage capacity.',
|
||||||
|
},
|
||||||
|
time: {
|
||||||
|
summary: 'denotes duration, intervals, or counts of ticks such as seconds, minutes, and hours.',
|
||||||
|
context: 'These units frame anything that changes over time or requires scheduling.',
|
||||||
|
},
|
||||||
|
angle: {
|
||||||
|
summary: 'measures rotation between two rays or the sweep of a circle.',
|
||||||
|
context: 'Angle units are useful for describing turns, sweeps, bearings, and geometric layouts.',
|
||||||
|
},
|
||||||
|
'number-systems': {
|
||||||
|
summary: 'names positional numeral systems such as binary, decimal, or hexadecimal.',
|
||||||
|
context: 'They specify the base used to represent integers and guide how digits are interpreted.',
|
||||||
|
},
|
||||||
|
radiation: {
|
||||||
|
summary: 'records ionizing emissions or the absorbed dose from radioactive sources.',
|
||||||
|
context: 'Radiation units show how much exposure, decay, or energy deposition is happening.',
|
||||||
|
},
|
||||||
|
electrical: {
|
||||||
|
summary: 'covers electrical quantities like current, voltage, resistance, and capacitance.',
|
||||||
|
context: 'They keep circuit values aligned so you can balance loads, voltages, and energy transfer.',
|
||||||
|
},
|
||||||
|
force: {
|
||||||
|
summary: 'describes pushes, pulls, or torque applied to an object.',
|
||||||
|
context: 'Force units help you quantify mechanical effort, tension, or rotation in machines and systems.',
|
||||||
|
},
|
||||||
|
light: {
|
||||||
|
summary: 'relates to luminous intensity, illuminance, or optical flux.',
|
||||||
|
context: 'Use them to describe brightness, how much light reaches a surface, or the output of a lamp.',
|
||||||
|
},
|
||||||
|
other: {
|
||||||
|
summary: 'covers specialized metrics that do not neatly fit the standard categories.',
|
||||||
|
context: 'That includes frequencies, compound conversions, and other domain-specific scales such as RPM or wavelength.',
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const definitions: Record<string, string> = {};
|
const definitions: Record<string, string> = {};
|
||||||
|
|
||||||
const formatLabel = (label: string): string => {
|
|
||||||
if (!label) return '';
|
|
||||||
return label
|
|
||||||
.replace(/\b([A-Z])/g, ' $1')
|
|
||||||
.replace(/\s+/g, ' ')
|
|
||||||
.trim();
|
|
||||||
};
|
|
||||||
|
|
||||||
const buildDefinition = (label: string, categoryKey: string): string => {
|
const buildDefinition = (label: string, categoryKey: string): string => {
|
||||||
if (!label) return '';
|
if (!label) return '';
|
||||||
const desc = domainDescriptions[categoryKey] || 'measurement';
|
const domain = domainDefinitions[categoryKey] || domainDefinitions.other;
|
||||||
return `${label} is used to express ${desc}. Understanding ${label} keeps calculations aligned across the ${categoryKey} domain.`;
|
const description = [domain.summary, domain.context].filter(Boolean).join(' ');
|
||||||
|
return `${label} ${description}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
calculators.forEach(calc => {
|
calculators.forEach(calc => {
|
||||||
|
|||||||
Reference in New Issue
Block a user