mirror of
https://github.com/iib0011/omni-tools.git
synced 2025-09-25 08:59:31 +02:00
Merge branch 'main' into tools-filtering
This commit is contained in:
@@ -7,6 +7,7 @@ import { generateArithmeticSequence } from './service';
|
||||
import * as Yup from 'yup';
|
||||
import { CardExampleType } from '@components/examples/ToolExamples';
|
||||
import { ToolComponentProps } from '@tools/defineTool';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
type InitialValuesType = {
|
||||
firstTerm: string;
|
||||
@@ -70,6 +71,7 @@ const exampleCards: CardExampleType<InitialValuesType>[] = [
|
||||
];
|
||||
|
||||
export default function ArithmeticSequence({ title }: ToolComponentProps) {
|
||||
const { t } = useTranslation('number');
|
||||
const [result, setResult] = useState<string>('');
|
||||
|
||||
return (
|
||||
@@ -77,35 +79,39 @@ export default function ArithmeticSequence({ title }: ToolComponentProps) {
|
||||
title={title}
|
||||
inputComponent={null}
|
||||
resultComponent={
|
||||
<ToolTextResult title="Generated Sequence" value={result} />
|
||||
<ToolTextResult
|
||||
title={t('arithmeticSequence.resultTitle')}
|
||||
value={result}
|
||||
/>
|
||||
}
|
||||
initialValues={initialValues}
|
||||
validationSchema={validationSchema}
|
||||
exampleCards={exampleCards}
|
||||
toolInfo={{
|
||||
title: 'What is an Arithmetic Sequence?',
|
||||
description:
|
||||
'An arithmetic sequence is a sequence of numbers where the difference between each consecutive term is constant. This constant difference is called the common difference. Given the first term (a₁) and the common difference (d), each term can be found by adding the common difference to the previous term.'
|
||||
title: t('arithmeticSequence.toolInfo.title'),
|
||||
description: t('arithmeticSequence.toolInfo.description')
|
||||
}}
|
||||
getGroups={({ values, updateField }) => [
|
||||
{
|
||||
title: 'Sequence Parameters',
|
||||
title: t('arithmeticSequence.sequenceParameters'),
|
||||
component: (
|
||||
<Box>
|
||||
<TextFieldWithDesc
|
||||
description="First term of the sequence (a₁)"
|
||||
description={t('arithmeticSequence.firstTermDescription')}
|
||||
value={values.firstTerm}
|
||||
onOwnChange={(val) => updateField('firstTerm', val)}
|
||||
type="number"
|
||||
/>
|
||||
<TextFieldWithDesc
|
||||
description="Common difference between terms (d)"
|
||||
description={t(
|
||||
'arithmeticSequence.commonDifferenceDescription'
|
||||
)}
|
||||
value={values.commonDifference}
|
||||
onOwnChange={(val) => updateField('commonDifference', val)}
|
||||
type="number"
|
||||
/>
|
||||
<TextFieldWithDesc
|
||||
description="Number of terms to generate (n)"
|
||||
description={t('arithmeticSequence.numberOfTermsDescription')}
|
||||
value={values.numberOfTerms}
|
||||
onOwnChange={(val) => updateField('numberOfTerms', val)}
|
||||
type="number"
|
||||
@@ -114,10 +120,10 @@ export default function ArithmeticSequence({ title }: ToolComponentProps) {
|
||||
)
|
||||
},
|
||||
{
|
||||
title: 'Output Format',
|
||||
title: t('arithmeticSequence.outputFormat'),
|
||||
component: (
|
||||
<TextFieldWithDesc
|
||||
description="Separator between terms"
|
||||
description={t('arithmeticSequence.separatorDescription')}
|
||||
value={values.separator}
|
||||
onOwnChange={(val) => updateField('separator', val)}
|
||||
/>
|
||||
|
@@ -2,14 +2,15 @@ import { defineTool } from '@tools/defineTool';
|
||||
import { lazy } from 'react';
|
||||
|
||||
export const tool = defineTool('number', {
|
||||
name: 'Generate Arithmetic Sequence',
|
||||
path: 'arithmetic-sequence',
|
||||
icon: 'ic:sharp-plus',
|
||||
description:
|
||||
'Generate an arithmetic sequence by specifying the first term (a₁), common difference (d), and number of terms (n). The tool creates a sequence where each number differs from the previous by a constant difference.',
|
||||
shortDescription:
|
||||
'Generate a sequence where each term differs by a constant value.',
|
||||
keywords: ['arithmetic', 'sequence', 'generate'],
|
||||
userTypes: ['Students'],
|
||||
component: lazy(() => import('./index'))
|
||||
icon: 'material-symbols:functions',
|
||||
|
||||
keywords: ['arithmetic', 'sequence', 'math', 'progression'],
|
||||
component: lazy(() => import('./index')),
|
||||
i18n: {
|
||||
name: 'number:arithmeticSequence.title',
|
||||
description: 'number:arithmeticSequence.description',
|
||||
shortDescription: 'number:arithmeticSequence.shortDescription',
|
||||
userTypes: ['Students']
|
||||
}
|
||||
});
|
||||
|
@@ -5,6 +5,7 @@ import { listOfIntegers } from './service';
|
||||
import TextFieldWithDesc from '@components/options/TextFieldWithDesc';
|
||||
import ToolContent from '@components/ToolContent';
|
||||
import { ToolComponentProps } from '@tools/defineTool';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
const initialValues = {
|
||||
firstValue: '1',
|
||||
@@ -14,6 +15,7 @@ const initialValues = {
|
||||
};
|
||||
|
||||
export default function GenerateNumbers({ title }: ToolComponentProps) {
|
||||
const { t } = useTranslation('number');
|
||||
const [result, setResult] = useState<string>('');
|
||||
|
||||
const compute = (optionsValues: typeof initialValues) => {
|
||||
@@ -34,23 +36,23 @@ export default function GenerateNumbers({ title }: ToolComponentProps) {
|
||||
initialValues={initialValues}
|
||||
getGroups={({ values, updateField }) => [
|
||||
{
|
||||
title: 'Arithmetic sequence option',
|
||||
title: t('generate.arithmeticSequenceOption'),
|
||||
component: (
|
||||
<Box>
|
||||
<TextFieldWithDesc
|
||||
description={'Start sequence from this number.'}
|
||||
description={t('generate.startSequenceDescription')}
|
||||
value={values.firstValue}
|
||||
onOwnChange={(val) => updateField('firstValue', val)}
|
||||
type={'number'}
|
||||
/>
|
||||
<TextFieldWithDesc
|
||||
description={'Increase each element by this amount'}
|
||||
description={t('generate.stepDescription')}
|
||||
value={values.step}
|
||||
onOwnChange={(val) => updateField('step', val)}
|
||||
type={'number'}
|
||||
/>
|
||||
<TextFieldWithDesc
|
||||
description={'Number of elements in sequence.'}
|
||||
description={t('generate.numberOfElementsDescription')}
|
||||
value={values.numberOfNumbers}
|
||||
onOwnChange={(val) => updateField('numberOfNumbers', val)}
|
||||
type={'number'}
|
||||
@@ -59,12 +61,10 @@ export default function GenerateNumbers({ title }: ToolComponentProps) {
|
||||
)
|
||||
},
|
||||
{
|
||||
title: 'Separator',
|
||||
title: t('generate.separator'),
|
||||
component: (
|
||||
<TextFieldWithDesc
|
||||
description={
|
||||
'Separate elements in the arithmetic sequence by this character.'
|
||||
}
|
||||
description={t('generate.separatorDescription')}
|
||||
value={values.separator}
|
||||
onOwnChange={(val) => updateField('separator', val)}
|
||||
/>
|
||||
@@ -73,7 +73,7 @@ export default function GenerateNumbers({ title }: ToolComponentProps) {
|
||||
]}
|
||||
compute={compute}
|
||||
resultComponent={
|
||||
<ToolTextResult title={'Generated numbers'} value={result} />
|
||||
<ToolTextResult title={t('generate.resultTitle')} value={result} />
|
||||
}
|
||||
/>
|
||||
);
|
||||
|
@@ -3,12 +3,14 @@ import { lazy } from 'react';
|
||||
// import image from '@assets/text.png';
|
||||
|
||||
export const tool = defineTool('number', {
|
||||
name: 'Generate numbers',
|
||||
path: 'generate',
|
||||
shortDescription: 'Quickly calculate a list of integers in your browser',
|
||||
icon: 'lsicon:number-filled',
|
||||
description:
|
||||
'Quickly calculate a list of integers in your browser. To get your list, just specify the first integer, change value and total count in the options below, and this utility will generate that many integers',
|
||||
keywords: ['generate'],
|
||||
component: lazy(() => import('./index'))
|
||||
icon: 'material-symbols:add-circle',
|
||||
|
||||
keywords: ['generate', 'random', 'numbers'],
|
||||
component: lazy(() => import('./index')),
|
||||
i18n: {
|
||||
name: 'number:generate.title',
|
||||
description: 'number:generate.description',
|
||||
shortDescription: 'number:generate.shortDescription'
|
||||
}
|
||||
});
|
||||
|
@@ -13,14 +13,14 @@ const ohmsLawCalc: GenericCalcType = {
|
||||
'power',
|
||||
'V=IR'
|
||||
],
|
||||
shortDescription:
|
||||
"Calculate voltage, current, or resistance in electrical circuits using Ohm's Law",
|
||||
name: "Ohm's Law",
|
||||
path: 'ohms-law',
|
||||
description: 'Calculates voltage, current and resistance',
|
||||
longDescription:
|
||||
"This calculator applies Ohm's Law (V = I × R) to determine any of the three electrical parameters when the other two are known. Ohm's Law is a fundamental principle in electrical engineering that describes the relationship between voltage (V), current (I), and resistance (R). This tool is essential for electronics hobbyists, electrical engineers, and students working with circuits to quickly solve for unknown values in their electrical designs.",
|
||||
formula: 'V = I * R',
|
||||
i18n: {
|
||||
name: 'number:ohmsLaw.title',
|
||||
description: 'number:ohmsLaw.description',
|
||||
shortDescription: 'number:ohmsLaw.shortDescription',
|
||||
longDescription: 'number:ohmsLaw.longDescription'
|
||||
},
|
||||
presets: [],
|
||||
variables: [
|
||||
{
|
||||
|
@@ -11,14 +11,15 @@ const slackline: GenericCalcType = {
|
||||
'tension',
|
||||
'clothesline'
|
||||
],
|
||||
shortDescription:
|
||||
'Calculate the approximate tension of a slackline or clothesline. Do not rely on this for safety.',
|
||||
name: 'Slackline Tension',
|
||||
path: 'slackline-tension',
|
||||
description: 'Calculates tension in a slackline',
|
||||
longDescription: 'This calculator assumes a load in the center of the rope',
|
||||
formula: 'T = (W * sqrt((S**2) + ((L/2)**2)) )/ (2S)',
|
||||
presets: [],
|
||||
i18n: {
|
||||
name: 'number:slackline.title',
|
||||
description: 'number:slackline.description',
|
||||
shortDescription: 'number:slackline.shortDescription',
|
||||
longDescription: 'number:slackline.longDescription'
|
||||
},
|
||||
variables: [
|
||||
{
|
||||
name: 'L',
|
||||
|
@@ -13,15 +13,15 @@ const areaSphere: GenericCalcType = {
|
||||
'3D',
|
||||
'shape'
|
||||
],
|
||||
shortDescription:
|
||||
'Calculate the surface area of a sphere based on its radius',
|
||||
name: 'Area of a Sphere',
|
||||
path: 'area-sphere',
|
||||
description: 'Area of a Sphere',
|
||||
longDescription:
|
||||
'This calculator determines the surface area of a sphere using the formula A = 4πr². You can either input the radius to find the surface area or enter the surface area to calculate the required radius. This tool is useful for students studying geometry, engineers working with spherical objects, and anyone needing to perform calculations involving spherical surfaces.',
|
||||
formula: 'A = 4 * pi * r**2',
|
||||
presets: [],
|
||||
i18n: {
|
||||
name: 'number:sphereArea.title',
|
||||
description: 'number:sphereArea.description',
|
||||
shortDescription: 'number:sphereArea.shortDescription',
|
||||
longDescription: 'number:sphereArea.longDescription'
|
||||
},
|
||||
variables: [
|
||||
{
|
||||
name: 'A',
|
||||
|
@@ -14,12 +14,13 @@ const volumeSphere: GenericCalcType = {
|
||||
'shape',
|
||||
'capacity'
|
||||
],
|
||||
shortDescription: 'Calculate the volume of a sphere using radius or diameter',
|
||||
name: 'Volume of a Sphere',
|
||||
i18n: {
|
||||
name: 'number:sphereVolume.title',
|
||||
description: 'number:sphereVolume.description',
|
||||
shortDescription: 'number:sphereVolume.shortDescription',
|
||||
longDescription: 'number:sphereVolume.longDescription'
|
||||
},
|
||||
path: 'volume-sphere',
|
||||
description: 'Volume of a Sphere',
|
||||
longDescription:
|
||||
'This calculator computes the volume of a sphere using the formula V = (4/3)πr³. You can input either the radius or diameter to find the volume, or enter the volume to determine the required radius. The tool is valuable for students, engineers, and professionals working with spherical objects in fields such as physics, engineering, and manufacturing.',
|
||||
formula: 'v = (4/3) * pi * r**3',
|
||||
presets: [],
|
||||
variables: [
|
||||
|
@@ -16,15 +16,14 @@ const voltageDropInWire: GenericCalcType = {
|
||||
'AWG',
|
||||
'gauge'
|
||||
],
|
||||
shortDescription:
|
||||
'Calculate voltage drop and power loss in electrical cables based on length, material, and current',
|
||||
name: 'Round trip voltage drop in cable',
|
||||
path: 'cable-voltage-drop',
|
||||
formula: 'x = (((p * L) / (A/10**6) ) *2) * I',
|
||||
description:
|
||||
'Calculates round trip voltage and power loss in a 2 conductor cable',
|
||||
longDescription:
|
||||
'This calculator helps determine the voltage drop and power loss in a two-conductor electrical cable. It takes into account the cable length, wire gauge (cross-sectional area), material resistivity, and current flow. The tool calculates the round-trip voltage drop, total resistance of the cable, and the power dissipated as heat. This is particularly useful for electrical engineers, electricians, and hobbyists when designing electrical systems to ensure voltage levels remain within acceptable limits at the load.',
|
||||
i18n: {
|
||||
name: 'number:voltageDropInWire.title',
|
||||
description: 'number:voltageDropInWire.description',
|
||||
shortDescription: 'number:voltageDropInWire.shortDescription',
|
||||
longDescription: 'number:voltageDropInWire.longDescription'
|
||||
},
|
||||
presets: [
|
||||
{
|
||||
title: 'Material',
|
||||
|
@@ -26,6 +26,8 @@ import { CustomSnackBarContext } from 'contexts/CustomSnackBarContext';
|
||||
import Typography from '@mui/material/Typography';
|
||||
import Grid from '@mui/material/Grid';
|
||||
import useMediaQuery from '@mui/material/useMediaQuery';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { validNamespaces } from '../../../../i18n';
|
||||
|
||||
function numericSolveEquationFor(
|
||||
equation: string,
|
||||
@@ -61,6 +63,7 @@ export default async function makeTool(
|
||||
|
||||
return function GenericCalc({ title }: ToolComponentProps) {
|
||||
const { showSnackBar } = useContext(CustomSnackBarContext);
|
||||
const { t } = useTranslation(validNamespaces);
|
||||
const theme = useTheme();
|
||||
const lessThanSmall = useMediaQuery(theme.breakpoints.down('sm'));
|
||||
|
||||
@@ -236,8 +239,10 @@ export default async function makeTool(
|
||||
inputComponent={null}
|
||||
initialValues={initialValues}
|
||||
toolInfo={{
|
||||
title: calcData.name,
|
||||
description: calcData.longDescription
|
||||
title: t(calcData.i18n.name),
|
||||
description: calcData.i18n.longDescription
|
||||
? t(calcData.i18n.longDescription)
|
||||
: undefined
|
||||
}}
|
||||
verticalGroups
|
||||
// @ts-ignore
|
||||
|
@@ -9,6 +9,7 @@ import CheckboxWithDesc from '@components/options/CheckboxWithDesc';
|
||||
import { CardExampleType } from '@components/examples/ToolExamples';
|
||||
import { ToolComponentProps } from '@tools/defineTool';
|
||||
import ToolContent from '@components/ToolContent';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
const initialValues = {
|
||||
extractionType: 'smart' as NumberExtractionType,
|
||||
@@ -118,6 +119,7 @@ const exampleCards: CardExampleType<InitialValuesType>[] = [
|
||||
];
|
||||
|
||||
export default function SumNumbers({ title }: ToolComponentProps) {
|
||||
const { t } = useTranslation('number');
|
||||
const [input, setInput] = useState<string>('');
|
||||
const [result, setResult] = useState<string>('');
|
||||
|
||||
@@ -126,16 +128,16 @@ export default function SumNumbers({ title }: ToolComponentProps) {
|
||||
updateField
|
||||
}) => [
|
||||
{
|
||||
title: 'Number extraction',
|
||||
title: t('sum.numberExtraction'),
|
||||
component: extractionTypes.map(
|
||||
({ title, description, type, withTextField, textValueAccessor }) =>
|
||||
withTextField ? (
|
||||
<RadioWithTextField
|
||||
key={type}
|
||||
checked={type === values.extractionType}
|
||||
title={title}
|
||||
title={t(`sum.extractionTypes.${type}.title`)}
|
||||
fieldName={'extractionType'}
|
||||
description={description}
|
||||
description={t(`sum.extractionTypes.${type}.description`)}
|
||||
value={
|
||||
textValueAccessor ? values[textValueAccessor].toString() : ''
|
||||
}
|
||||
@@ -149,18 +151,18 @@ export default function SumNumbers({ title }: ToolComponentProps) {
|
||||
key={title}
|
||||
onClick={() => updateField('extractionType', type)}
|
||||
checked={values.extractionType === type}
|
||||
description={description}
|
||||
title={title}
|
||||
description={t(`sum.extractionTypes.${type}.description`)}
|
||||
title={t(`sum.extractionTypes.${type}.title`)}
|
||||
/>
|
||||
)
|
||||
)
|
||||
},
|
||||
{
|
||||
title: 'Running Sum',
|
||||
title: t('sum.runningSum'),
|
||||
component: (
|
||||
<CheckboxWithDesc
|
||||
title={'Print Running Sum'}
|
||||
description={"Display the sum as it's calculated step by step."}
|
||||
title={t('sum.printRunningSum')}
|
||||
description={t('sum.printRunningSumDescription')}
|
||||
checked={values.printRunningSum}
|
||||
onChange={(value) => updateField('printRunningSum', value)}
|
||||
/>
|
||||
@@ -171,8 +173,16 @@ export default function SumNumbers({ title }: ToolComponentProps) {
|
||||
<ToolContent
|
||||
title={title}
|
||||
input={input}
|
||||
inputComponent={<ToolTextInput value={input} onChange={setInput} />}
|
||||
resultComponent={<ToolTextResult title={'Total'} value={result} />}
|
||||
inputComponent={
|
||||
<ToolTextInput
|
||||
title={t('sum.inputTitle')}
|
||||
value={input}
|
||||
onChange={setInput}
|
||||
/>
|
||||
}
|
||||
resultComponent={
|
||||
<ToolTextResult title={t('sum.resultTitle')} value={result} />
|
||||
}
|
||||
initialValues={initialValues}
|
||||
getGroups={getGroups}
|
||||
compute={(optionsValues, input) => {
|
||||
@@ -181,9 +191,8 @@ export default function SumNumbers({ title }: ToolComponentProps) {
|
||||
}}
|
||||
setInput={setInput}
|
||||
toolInfo={{
|
||||
title: 'What Is a Number Sum Calculator?',
|
||||
description:
|
||||
'This is an online browser-based utility for calculating the sum of a bunch of numbers. You can enter the numbers separated by a comma, space, or any other character, including the line break. You can also simply paste a fragment of textual data that contains numerical values that you want to sum up and the utility will extract them and find their sum.'
|
||||
title: t('sum.toolInfo.title'),
|
||||
description: t('sum.toolInfo.description')
|
||||
}}
|
||||
exampleCards={exampleCards}
|
||||
/>
|
||||
|
@@ -3,13 +3,15 @@ import { lazy } from 'react';
|
||||
// import image from '@assets/text.png';
|
||||
|
||||
export const tool = defineTool('number', {
|
||||
name: 'Number Sum Calculator',
|
||||
path: 'sum',
|
||||
icon: 'fluent:autosum-20-regular',
|
||||
description:
|
||||
'Quickly calculate the sum of numbers in your browser. To get your sum, just enter your list of numbers in the input field, adjust the separator between the numbers in the options below, and this utility will add up all these numbers.',
|
||||
shortDescription: 'Quickly sum numbers',
|
||||
keywords: ['sum'],
|
||||
userTypes: ['General Users', 'Students'],
|
||||
component: lazy(() => import('./index'))
|
||||
icon: 'material-symbols:add',
|
||||
|
||||
keywords: ['sum', 'add', 'calculate', 'total'],
|
||||
component: lazy(() => import('./index')),
|
||||
i18n: {
|
||||
name: 'number:sum.title',
|
||||
description: 'number:sum.description',
|
||||
shortDescription: 'number:sum.shortDescription',
|
||||
userTypes: ['General Users', 'Students']
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user